mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-24 03:47:37 +00:00
Minor changes
This commit is contained in:
parent
775d095b3c
commit
5c333dec33
@ -2,7 +2,6 @@ package com.topjohnwu.magisk.arch
|
||||
|
||||
import android.Manifest
|
||||
import androidx.annotation.CallSuper
|
||||
import androidx.core.graphics.Insets
|
||||
import androidx.databinding.Bindable
|
||||
import androidx.databinding.Observable
|
||||
import androidx.databinding.PropertyChangeRegistry
|
||||
@ -14,8 +13,10 @@ import androidx.navigation.NavDirections
|
||||
import com.topjohnwu.magisk.BR
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.core.Info
|
||||
import com.topjohnwu.magisk.core.base.BaseActivity
|
||||
import com.topjohnwu.magisk.events.*
|
||||
import com.topjohnwu.magisk.events.BackPressEvent
|
||||
import com.topjohnwu.magisk.events.NavigationEvent
|
||||
import com.topjohnwu.magisk.events.PermissionEvent
|
||||
import com.topjohnwu.magisk.events.SnackbarEvent
|
||||
import com.topjohnwu.magisk.utils.ObservableHost
|
||||
import com.topjohnwu.magisk.utils.set
|
||||
import kotlinx.coroutines.Job
|
||||
@ -40,10 +41,6 @@ abstract class BaseViewModel(
|
||||
val isConnected get() = Info.isConnected
|
||||
val viewEvents: LiveData<ViewEvent> get() = _viewEvents
|
||||
|
||||
@get:Bindable
|
||||
var insets = Insets.NONE
|
||||
set(value) = set(value, field, { field = it }, BR.insets)
|
||||
|
||||
var state= initialState
|
||||
set(value) = set(value, field, { field = it }, BR.loading, BR.loaded, BR.loadFailed)
|
||||
|
||||
@ -76,10 +73,6 @@ abstract class BaseViewModel(
|
||||
super.onCleared()
|
||||
}
|
||||
|
||||
fun withView(action: BaseActivity.() -> Unit) {
|
||||
ViewActionEvent(action).publish()
|
||||
}
|
||||
|
||||
fun withPermission(permission: String, callback: (Boolean) -> Unit) {
|
||||
PermissionEvent(permission, callback).publish()
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.topjohnwu.magisk.di
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
@ -25,6 +26,7 @@ import com.topjohnwu.magisk.ui.surequest.SuRequestViewModel
|
||||
|
||||
val AppContext: Context inline get() = ServiceLocator.context
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object ServiceLocator {
|
||||
|
||||
lateinit var context: Context
|
||||
|
@ -137,7 +137,7 @@ class CheckSafetyNetEvent(
|
||||
}
|
||||
|
||||
private fun String.decode(): ByteArray {
|
||||
return if (contains("\\+|/".toRegex()))
|
||||
return if (contains("[+/]".toRegex()))
|
||||
Base64.decode(this, Base64.DEFAULT)
|
||||
else
|
||||
Base64.decode(this, Base64.URL_SAFE)
|
||||
|
@ -79,13 +79,13 @@ class SafetynetViewModel : BaseViewModel() {
|
||||
if (success) R.string.safetynet_attest_success
|
||||
else R.string.safetynet_attest_failure
|
||||
}
|
||||
} ?: {
|
||||
} ?: run {
|
||||
isSuccess = false
|
||||
ctsState = false
|
||||
basicIntegrityState = false
|
||||
evalType = "N/A"
|
||||
safetyNetTitle = R.string.safetynet_api_error
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
Loading…
x
Reference in New Issue
Block a user