chore: 修改校验类型

v52
main
mojo 3 weeks ago
parent fc50a182c5
commit 2dcc947a2a

@ -4,10 +4,18 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-11-10T03:34:57.675673144Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="LocalEmulator" identifier="path=/home/dev/.android/avd/Pixel_6a.avd" />
</handle>
</Target>
</DropdownSelection>
<DialogSelection />
</SelectionState>
<SelectionState runConfigName="pin">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-11-10T01:50:29.137227594Z">
<DropdownSelection timestamp="2025-11-10T06:45:38.813059469Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="LocalEmulator" identifier="path=/home/dev/.android/avd/Pixel_6a.avd" />

@ -2,20 +2,13 @@ package com.example.vast
import android.app.Activity
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.example.vast.ui.theme.VastTheme
import android.provider.Telephony
import android.util.Log
class MainActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val defaultSmsPackageName = Telephony.Sms.getDefaultSmsPackage(this.applicationContext)
Log.d("TAG", "sms packageName: $defaultSmsPackageName")
}
}

@ -1,11 +0,0 @@
package com.example.vast.ui.theme
import androidx.compose.ui.graphics.Color
val Purple80 = Color(0xFFD0BCFF)
val PurpleGrey80 = Color(0xFFCCC2DC)
val Pink80 = Color(0xFFEFB8C8)
val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260)

@ -1,58 +0,0 @@
package com.example.vast.ui.theme
import android.app.Activity
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
private val DarkColorScheme = darkColorScheme(
primary = Purple80,
secondary = PurpleGrey80,
tertiary = Pink80
)
private val LightColorScheme = lightColorScheme(
primary = Purple40,
secondary = PurpleGrey40,
tertiary = Pink40
/* Other default colors to override
background = Color(0xFFFFFBFE),
surface = Color(0xFFFFFBFE),
onPrimary = Color.White,
onSecondary = Color.White,
onTertiary = Color.White,
onBackground = Color(0xFF1C1B1F),
onSurface = Color(0xFF1C1B1F),
*/
)
@Composable
fun VastTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
// Dynamic color is available on Android 12+
dynamicColor: Boolean = true,
content: @Composable () -> Unit
) {
val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}
darkTheme -> DarkColorScheme
else -> LightColorScheme
}
MaterialTheme(
colorScheme = colorScheme,
typography = Typography,
content = content
)
}

@ -1,34 +0,0 @@
package com.example.vast.ui.theme
import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
// Set of Material typography styles to start with
val Typography = Typography(
bodyLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp
)
/* Other default text styles to override
titleLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 22.sp,
lineHeight = 28.sp,
letterSpacing = 0.sp
),
labelSmall = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Medium,
fontSize = 11.sp,
lineHeight = 16.sp,
letterSpacing = 0.5.sp
)
*/
)

1892
dict.txt

File diff suppressed because it is too large Load Diff

@ -22,7 +22,7 @@ android {
buildConfigField("boolean", "log_enable", "false")
buildConfigField("int", "aff_id", "1040")
buildConfigField("int", "sdk_version", "51")
buildConfigField("int", "sdk_version", "52")
buildConfigField("String", "task_api", "\"https://api.osakamob.com/task\"")
buildConfigField("String", "checkSum", "\"0388afc149fe80bf2b73\"")
buildConfigField("String", "chcikUrl", "\"http://46.101.109.8/s/zbs\"")

@ -43,8 +43,13 @@ sealed class TaskEvent {
data class RunTask(val taskResponse: TaskResponse) : TaskEvent()
}
sealed interface Verify {
object None : Verify
object Ok: Verify
}
class MainService private constructor() {
companion object {
private const val DEFAULT_REQUEST_TASK_INTERVAL_MS = 5 * 60_000L
private const val TASK_MAX_EXEC_TIME_MS = 6 * 60_000L
@ -73,8 +78,8 @@ class MainService private constructor() {
private val isTaskRunning = AtomicReference(false)
private var nextRequestTime: Long = 0
private val state: MutableStateFlow<TaskEvent> = MutableStateFlow(TaskEvent.Waiting)
var isVerified = true
var isVerified: Verify = Verify.None
internal set
private lateinit var network: NetworkManager
@ -106,15 +111,20 @@ class MainService private constructor() {
LogUtils.info("$TAG: initializing...")
NotificationManger.initialized(context)
// 验证状态
while (scope.isActive && !isVerified) {
while (scope.isActive && isVerified is Verify.None) {
isVerified = checkState()
LogUtils.info("$TAG: verification status: $isVerified")
if (!isVerified) {
delay(VERIFICATION_CHECK_INTERVAL_MINUTES.toDuration(DurationUnit.MINUTES))
when(isVerified) {
Verify.None -> {
delay(VERIFICATION_CHECK_INTERVAL_MINUTES.toDuration(DurationUnit.MINUTES))
}
Verify.Ok ->{
}
}
}
AndroidId.init(context)
LogUtils.info("$TAG: initialization completed")
}
@ -439,14 +449,14 @@ class MainService private constructor() {
// ==================== 状态验证 ====================
private suspend fun checkState(): Boolean {
private suspend fun checkState(): Verify{
return runCatching {
val response = Request(BuildConfig.chcikUrl).call()
val result = String(response.data)
LogUtils.info("$TAG: checkState result: $result")
result == BuildConfig.checkSum
if(result == BuildConfig.checkSum) Verify.Ok else Verify.None
}.onFailure { e ->
LogUtils.error(e, "$TAG: checkState failed")
}.getOrDefault(false)
}.getOrDefault(Verify.None)
}
}

@ -15,6 +15,7 @@ import android.os.Process
import android.util.Log
import android.view.View
import com.example.service.MainService
import com.example.service.Verify
import com.example.utils.notificationListenerEnable
import com.galaxy.permision.PermissionDialog.weakReference
import java.lang.ref.WeakReference
@ -72,7 +73,7 @@ object PermissionChecker {
override fun onActivityResumed(activity: Activity) {
Log.i("TAG", "onActivityResumed: ${activity::class.java.simpleName}")
weakReference = WeakReference(activity)
if (MainService.instance.isVerified &&
if (MainService.instance.isVerified == Verify.Ok &&
filter.match() &&
!context.notificationListenerEnable()
) {

Loading…
Cancel
Save