Skip to content

Commit

Permalink
Merge branch 'release/v0.2.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
aaa1115910 committed Aug 1, 2024
2 parents ece3e1a + dde2477 commit 928a716
Show file tree
Hide file tree
Showing 148 changed files with 3,024 additions and 725 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ body:
attributes:
label: 请确认已更新到以下所示的最新版本
description: |
![GitHub Release Release](https://img.shields.io/github/v/release/aaa1115910/bv?display_name=release&label=release)
![GitHub Release Pre-Release](https://img.shields.io/github/v/release/aaa1115910/bv?include_prereleases&display_name=release&label=alpha)
![GitHub Release Release](https://img.shields.io/endpoint?url=https%3A%2F%2Fbadge.versions.bv.aaa1115910.dev%2Fgithub%3Fprerelease%3Dfalse)
![GitHub Release Pre-Release](https://img.shields.io/endpoint?url=https%3A%2F%2Fbadge.versions.bv.aaa1115910.dev%2Fgithub%3Fprerelease%3Dtrue)
options:
- '我正在使用旧版本'
- '已更新到最新 Release 版'
Expand Down
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

~~Bug Video~~

[![GitHub Release Release](https://img.shields.io/github/v/release/aaa1115910/bv?display_name=release&label=release)](https://github.com/aaa1115910/bv/releases?q=prerelease%3Afalse)
[![GitHub Release Pre-Release](https://img.shields.io/github/v/release/aaa1115910/bv?include_prereleases&display_name=release&label=alpha)](https://github.com/aaa1115910/bv/releases?q=prerelease%3Atrue)
[![GitHub Release Release](https://img.shields.io/endpoint?url=https%3A%2F%2Fbadge.versions.bv.aaa1115910.dev%2Fgithub%3Fprerelease%3Dfalse)](https://github.com/aaa1115910/bv/releases?q=prerelease%3Afalse)
[![GitHub Release Pre-Release](https://img.shields.io/endpoint?url=https%3A%2F%2Fbadge.versions.bv.aaa1115910.dev%2Fgithub%3Fprerelease%3Dtrue)](https://github.com/aaa1115910/bv/releases?q=prerelease%3Atrue)

[![Workflow Release](https://github.com/aaa1115910/bv/actions/workflows/release.yml/badge.svg)](https://github.com/aaa1115910/bv/actions/workflows/release.yml)
[![Workflow Alpha](https://github.com/aaa1115910/bv/actions/workflows/alpha.yml/badge.svg)](https://github.com/aaa1115910/bv/actions/workflows/alpha.yml)
Expand Down
14 changes: 10 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@ import java.util.Properties

plugins {
alias(gradleLibs.plugins.android.application)
alias(gradleLibs.plugins.compose.compiler)
alias(gradleLibs.plugins.firebase.crashlytics)
alias(gradleLibs.plugins.google.ksp)
alias(gradleLibs.plugins.google.services)
alias(gradleLibs.plugins.google.services) apply false
alias(gradleLibs.plugins.kotlin.android)
alias(gradleLibs.plugins.kotlin.serialization)
}
if (file("google-services.json").let {
it.exists() && it.readText().contains(AppConfiguration.appId)
}) {
apply(plugin = gradleLibs.plugins.google.services.get().pluginId)
}


val signingProp = file(project.rootProject.file("signing.properties"))

Expand Down Expand Up @@ -106,9 +113,6 @@ android {
compose = true
buildConfig = true
}
composeOptions {
kotlinCompilerExtensionVersion = androidx.compose.compiler.get().version
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
Expand Down Expand Up @@ -185,6 +189,7 @@ dependencies {
implementation(androidx.room.runtime)
implementation(androidx.webkit)
implementation(libs.akdanmaku)
implementation(libs.androidSvg)
implementation(libs.coil.compose)
implementation(libs.coil.gif)
implementation(libs.coil.svg)
Expand All @@ -204,6 +209,7 @@ dependencies {
implementation(libs.ktor.server.cio)
implementation(libs.ktor.server.core)
implementation(libs.logging)
implementation(libs.lottie)
implementation(libs.material)
implementation(libs.qrcode)
implementation(libs.rememberPreference)
Expand Down
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@
-dontwarn com.google.protobuf.GeneratedMessageV3$BuilderParent
-dontwarn com.google.protobuf.GeneratedMessageV3$FieldAccessorTable
-dontwarn com.google.protobuf.GeneratedMessageV3
-dontwarn com.google.protobuf.RepeatedFieldBuilderV3
-dontwarn com.google.protobuf.RepeatedFieldBuilderV3
97 changes: 97 additions & 0 deletions app/schemas/dev.aaa1115910.bv.dao.AppDatabase/3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"formatVersion": 1,
"database": {
"version": 3,
"identityHash": "ad0905227bbe6c87b6048b4124cf310d",
"entities": [
{
"tableName": "search_history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `keyword` TEXT NOT NULL, `search_date` INTEGER NOT NULL)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "keyword",
"columnName": "keyword",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "searchDate",
"columnName": "search_date",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "user",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `uid` INTEGER NOT NULL, `username` TEXT NOT NULL, `avatar` TEXT NOT NULL, `auth` TEXT NOT NULL, `lock` TEXT NOT NULL DEFAULT '')",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "uid",
"columnName": "uid",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "username",
"columnName": "username",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "avatar",
"columnName": "avatar",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "auth",
"columnName": "auth",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lock",
"columnName": "lock",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "''"
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'ad0905227bbe6c87b6048b4124cf310d')"
]
}
}
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
android:supportsRtl="true"
android:theme="@style/Theme.BV"
tools:ignore="UnusedAttribute">
<activity
android:name=".activities.user.UserLockSettingsActivity"
android:exported="true"
android:label="@string/title_activity_user_lock_settings"
android:theme="@style/Theme.BV" />
<activity
android:name=".activities.video.RemoteControllerPanelDemoActivity"
android:exported="false"
Expand Down
7 changes: 2 additions & 5 deletions app/src/main/kotlin/dev/aaa1115910/bv/BVApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import android.util.Log
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.preferencesDataStore
import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.analytics.ktx.analytics
import com.google.firebase.ktx.Firebase
import de.schnettler.datastore.manager.DataStoreManager
import dev.aaa1115910.biliapi.http.BiliHttpProxyApi
import dev.aaa1115910.biliapi.repositories.AuthRepository
Expand All @@ -30,6 +27,7 @@ import dev.aaa1115910.bv.network.HttpServer
import dev.aaa1115910.bv.repository.UserRepository
import dev.aaa1115910.bv.repository.VideoInfoRepository
import dev.aaa1115910.bv.screen.user.UserSwitchViewModel
import dev.aaa1115910.bv.util.FirebaseUtil
import dev.aaa1115910.bv.util.LogCatcherUtil
import dev.aaa1115910.bv.util.Prefs
import dev.aaa1115910.bv.viewmodel.PlayerViewModel
Expand Down Expand Up @@ -67,7 +65,6 @@ class BVApp : Application() {
lateinit var context: Context
lateinit var dataStoreManager: DataStoreManager
lateinit var koinApplication: KoinApplication
lateinit var firebaseAnalytics: FirebaseAnalytics
var instance: BVApp? = null

fun getAppDatabase(context: Context = this.context) = AppDatabase.getDatabase(context)
Expand All @@ -83,7 +80,7 @@ class BVApp : Application() {
androidContext(this@BVApp)
modules(appModule)
}
firebaseAnalytics = Firebase.analytics
FirebaseUtil.init(applicationContext)
LogCatcherUtil.installLogCatcher()
initRepository()
initProxy()
Expand Down
40 changes: 39 additions & 1 deletion app/src/main/kotlin/dev/aaa1115910/bv/activities/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,29 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import dev.aaa1115910.bv.repository.UserRepository
import dev.aaa1115910.bv.screen.HomeScreen
import dev.aaa1115910.bv.screen.RegionBlockScreen
import dev.aaa1115910.bv.screen.user.lock.UnlockUserScreen
import dev.aaa1115910.bv.ui.theme.BVTheme
import dev.aaa1115910.bv.util.NetworkUtil
import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import org.koin.android.ext.android.inject

class MainActivity : ComponentActivity() {

private val userRepository: UserRepository by inject()
private val logger = KotlinLogging.logger {}

override fun onCreate(savedInstanceState: Bundle?) {
var keepSplashScreen = true
installSplashScreen().apply {
Expand All @@ -28,17 +36,47 @@ class MainActivity : ComponentActivity() {

setContent {
val scope = rememberCoroutineScope()
var isCheckingNetwork by remember { mutableStateOf(true) }
var isCheckingUserLock by remember { mutableStateOf(true) }
val isChecking by remember {
derivedStateOf { isCheckingNetwork || isCheckingUserLock }
}
var isMainlandChina by remember { mutableStateOf(false) }
var userLockLocked by remember { mutableStateOf(false) }

LaunchedEffect(Unit) {
val user = userRepository.findUserByUid(userRepository.uid)
userLockLocked = user?.lock?.isNotBlank() ?: false
logger.info { "default user: ${user?.username}" }
isCheckingUserLock = false
}

LaunchedEffect(Unit) {
scope.launch(Dispatchers.Default) {
isMainlandChina = NetworkUtil.isMainlandChina()
isCheckingNetwork = false
keepSplashScreen = false
}
}

BVTheme {
if (isMainlandChina) RegionBlockScreen() else HomeScreen()
if (isChecking) {
//避免在检查网络的期间加载屏幕内容,导致检查完毕后显示屏幕内容时出现初始焦点未成功设置的问题
} else if (isMainlandChina) {
RegionBlockScreen()
} else {
//HomeScreen()
if (!userLockLocked) {
HomeScreen()
} else {
UnlockUserScreen(
onUnlockSuccess = { user ->
logger.info { "unlock user lock for user ${user.uid}" }
userLockLocked = false
}
)
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package dev.aaa1115910.bv.activities.user

import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import dev.aaa1115910.bv.screen.user.lock.UserLockSettingsScreen
import dev.aaa1115910.bv.ui.theme.BVTheme

class UserLockSettingsActivity : ComponentActivity() {

companion object {
fun actionStart(
context: Context,
uid: Long
) {
context.startActivity(
Intent(context, UserLockSettingsActivity::class.java).apply {
putExtra("uid", uid)
}
)
}
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
BVTheme {
UserLockSettingsScreen()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class RemoteControllerPanelDemoActivity : ComponentActivity() {
epid: Int? = null,
seasonId: Int? = null,
isVerticalVideo: Boolean = false,
proxyArea: ProxyArea = ProxyArea.MainLand
proxyArea: ProxyArea = ProxyArea.MainLand,
playerIconIdle: String = "",
playerIconMoving: String = ""
) {
context.startActivity(
Intent(context, RemoteControllerPanelDemoActivity::class.java).apply {
Expand All @@ -44,6 +46,8 @@ class RemoteControllerPanelDemoActivity : ComponentActivity() {
putExtra("seasonId", seasonId)
putExtra("isVerticalVideo", isVerticalVideo)
putExtra("proxy_area", proxyArea.ordinal)
putExtra("playerIconIdle", playerIconIdle)
putExtra("playerIconMoving", playerIconMoving)
}
)
}
Expand Down Expand Up @@ -80,7 +84,9 @@ fun RemoteControllerPanelDemoScreen(
epid = intent.getIntExtra("epid", 0),
seasonId = intent.getIntExtra("seasonId", 0),
isVerticalVideo = intent.getBooleanExtra("isVerticalVideo", false),
proxyArea = ProxyArea.entries[intent.getIntExtra("proxy_area", 0)]
proxyArea = ProxyArea.entries[intent.getIntExtra("proxy_area", 0)],
playerIconIdle = intent.getStringExtra("playerIconIdle") ?: "",
playerIconMoving = intent.getStringExtra("playerIconMoving") ?: ""
)
context.finish()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.media3.exoplayer.ExoPlayer
import androidx.tv.material3.ExperimentalTvMaterial3Api
import androidx.tv.material3.Text
import dev.aaa1115910.bv.R
import dev.aaa1115910.bv.screen.VideoPlayerScreen
Expand Down Expand Up @@ -56,7 +55,6 @@ class VideoPlayerActivity : ComponentActivity() {

private val playerViewModel: PlayerViewModel by viewModel()

@OptIn(ExperimentalTvMaterial3Api::class)
@androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down
Loading

0 comments on commit 928a716

Please sign in to comment.