feat(android): add device activation flow and update dependencies

重构项目架构,引入启动页(SplashActivity)检查激活状态,未激活设备引导至激活页(ActivationActivity)完成provision+token流程。集成Retrofit+RxJava3网络层、Room数据库、Lifecycle组件、MMKV等依赖,升级OkHttp/Gson版本,并将构建配置从旧项目全面迁移至新项目结构。
This commit is contained in:
TongTongStudio
2026-08-03 00:25:51 +08:00
parent 61398ff4ff
commit ded6fe5ab7
105 changed files with 5363 additions and 1503 deletions

View File

@@ -1,6 +1,8 @@
plugins {
id 'com.android.application'
id 'com.google.protobuf'
id 'org.jetbrains.kotlin.android'
id 'org.jetbrains.kotlin.kapt'
}
def releaseTime() {
@@ -23,7 +25,9 @@ android {
versionName "1.0"
// 服务端地址(信令 wss 与 HTTP api 同源)。部署时通过 flavor / CI 注入真实值。
buildConfigField "String", "API_BASE", "\"https://www.ttstd.com\""
buildConfigField "String", "API_BASE", "\"http://192.168.5.224:8080\""
buildConfigField "String", "WS_URL", "\"ws://192.168.5.224:8080/ws/signal\""
}
compileOptions {
@@ -31,6 +35,10 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
dataBinding true
buildConfig true
@@ -107,15 +115,12 @@ android {
applicationVariants.all { variant ->
variant.outputs.each { output ->
def buildType = variant.buildType.name
def fileName = ""
if (buildType.contains("debug")) {
fileName = "${appName()}_V${defaultConfig.versionName}_${releaseTime()}.apk"
output.outputFileName = "${appName()}_V${defaultConfig.versionName}_${releaseTime()}.apk"
} else {
fileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${buildType}.apk"
output.outputFileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${buildType}.apk"
}
output.outputFileName = fileName
}
}
}
@@ -137,17 +142,56 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation "androidx.multidex:multidex:2.0.1"
implementation "androidx.recyclerview:recyclerview:1.1.0"
// Room依赖
implementation "androidx.room:room-runtime:2.8.4"
implementation "androidx.room:room-rxjava3:2.8.4"
kapt "androidx.room:room-compiler:2.8.4"
// ViewModel和LiveData
implementation "androidx.lifecycle:lifecycle-viewmodel:2.10.0"
implementation "androidx.lifecycle:lifecycle-livedata:2.10.0"
implementation "androidx.lifecycle:lifecycle-runtime:2.10.0"
kapt "androidx.lifecycle:lifecycle-compiler:2.10.0"
// LifecycleService 核心库
implementation "androidx.lifecycle:lifecycle-service:2.10.0"
// 安全存储:加密 SharedPreferences保存激活得到的 deviceSecret / deviceUid / accessToken
implementation 'androidx.security:security-crypto:1.1.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
//RxJava
implementation 'io.reactivex.rxjava3:rxjava:3.1.12'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.2'
implementation 'com.squareup.moshi:moshi:1.15.2'
implementation 'com.squareup.okhttp3:okhttp:5.3.2'
implementation 'com.squareup.okhttp3:logging-interceptor:5.3.2'
implementation 'com.squareup.retrofit2:retrofit:3.0.0'
implementation 'com.squareup.retrofit2:converter-gson:3.0.0'
// implementation 'com.squareup.retrofit2:adapter-rxjava2:3.0.0'
implementation "com.squareup.retrofit2:adapter-rxjava3:3.0.0"
// Gson for JSON信令消息仍使用 JSON
implementation 'com.google.code.gson:gson:2.14.0'
// ProtobufDataChannel 控制指令二进制)
implementation 'com.google.protobuf:protobuf-java:3.25.1'
// WebRTC
implementation 'io.github.webrtc-sdk:android:144.7559.09'
// implementation 'org.webrtc:google-webrtc:1.0.32006'
// OkHttp for WebSocket
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
//生命周期管理
implementation 'com.trello.rxlifecycle4:rxlifecycle:4.0.2'
implementation 'com.trello.rxlifecycle4:rxlifecycle-android:4.0.2'
implementation 'com.trello.rxlifecycle4:rxlifecycle-components:4.0.2'
implementation 'com.trello.rxlifecycle4:rxlifecycle-components-preference:4.0.2'
implementation 'com.trello.rxlifecycle4:rxlifecycle-android-lifecycle:4.0.2'
//glide
implementation 'com.github.bumptech.glide:glide:4.15.1'
kapt 'com.github.bumptech.glide:compiler:4.15.1'
// Gson for JSON信令消息仍使用 JSON
implementation 'com.google.code.gson:gson:2.10.1'
// ProtobufDataChannel 控制指令二进制)
implementation 'com.google.protobuf:protobuf-java:3.25.1'
// 安全存储:加密 SharedPreferences保存 accessToken / refreshToken
implementation 'androidx.security:security-crypto:1.1.0-alpha06'
implementation 'com.tencent:mmkv-static:2.4.0'
}