nit picks
This commit is contained in:
@@ -5,7 +5,7 @@ import com.aurora.extensions.isHuawei
|
||||
|
||||
object FlavouredUtil : IFlavouredUtil {
|
||||
|
||||
override val defaultDispensers : Set<String> = emptySet()
|
||||
override val defaultDispensers: Set<String> = emptySet()
|
||||
|
||||
override fun promptMicroGInstall(context: Context): Boolean {
|
||||
return isHuawei &&
|
||||
|
||||
@@ -45,7 +45,7 @@ fun MicroG(
|
||||
modifier: Modifier = Modifier,
|
||||
uiState: MicroGUIState,
|
||||
onInstall: () -> Unit = {},
|
||||
onCheckedChange: (Boolean) -> Unit = {}
|
||||
onTOSChecked: (Boolean) -> Unit = {}
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
var isChecked by rememberSaveable { mutableStateOf(false) }
|
||||
@@ -109,13 +109,13 @@ fun MicroG(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(
|
||||
dimensionResource(R.dimen.padding_small)
|
||||
),
|
||||
)
|
||||
) {
|
||||
Checkbox(
|
||||
checked = isChecked,
|
||||
onCheckedChange = {
|
||||
isChecked = it
|
||||
onCheckedChange(it)
|
||||
onTOSChecked(it)
|
||||
},
|
||||
enabled = !uiState.isInstalled && !uiState.isDownloading
|
||||
)
|
||||
|
||||
@@ -32,13 +32,13 @@ import com.aurora.store.viewmodel.onboarding.MicroGViewModel
|
||||
|
||||
@Composable
|
||||
fun MicroGPage(
|
||||
onCheckedChange: (Boolean) -> Unit = {},
|
||||
onMicrogTOSChecked: (Boolean) -> Unit = {},
|
||||
viewModel: MicroGViewModel = hiltViewModel(),
|
||||
) {
|
||||
ScreenContent(
|
||||
uiState = viewModel.uiState,
|
||||
onInstall = { viewModel.downloadMicroG() },
|
||||
onMicrogTOCChange = onCheckedChange,
|
||||
onMicrogTOSChecked = onMicrogTOSChecked,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ fun MicroGPage(
|
||||
private fun ScreenContent(
|
||||
uiState: MicroGUIState,
|
||||
onInstall: () -> Unit = {},
|
||||
onMicrogTOCChange: (Boolean) -> Unit = {}
|
||||
onMicrogTOSChecked: (Boolean) -> Unit = {}
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
|
||||
@@ -81,13 +81,11 @@ private fun ScreenContent(
|
||||
onInstall()
|
||||
}
|
||||
|
||||
else -> context.toast(
|
||||
R.string.permissions_denied
|
||||
)
|
||||
else -> context.toast(R.string.permissions_denied)
|
||||
}
|
||||
},
|
||||
uiState = uiState,
|
||||
onCheckedChange = onMicrogTOCChange
|
||||
onTOSChecked = onMicrogTOSChecked
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ fun OnboardingScreen(viewModel: OnboardingViewModel = hiltViewModel()) {
|
||||
viewModel.finishOnboarding()
|
||||
},
|
||||
uiState = viewModel.uiState,
|
||||
onCheckedChange = viewModel::onMicroGCheckedChange
|
||||
onMicrogTOSChecked = viewModel::onMicrogTOSChecked
|
||||
)
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ private fun ScreenContent(
|
||||
pages: List<OnboardingPage> = emptyList(),
|
||||
onFinishOnboarding: () -> Unit = {},
|
||||
uiState: OnboardingUiState,
|
||||
onCheckedChange: (Boolean) -> Unit,
|
||||
onMicrogTOSChecked: (Boolean) -> Unit,
|
||||
windowAdaptiveInfo: WindowAdaptiveInfo = currentWindowAdaptiveInfo()
|
||||
) {
|
||||
val pagerState = rememberPagerState { pages.size }
|
||||
@@ -180,7 +180,7 @@ private fun ScreenContent(
|
||||
when (pages[page]) {
|
||||
OnboardingPage.WELCOME -> WelcomePage()
|
||||
OnboardingPage.PERMISSIONS -> PermissionsPage()
|
||||
OnboardingPage.MICRO_G -> MicroGPage(onCheckedChange = onCheckedChange)
|
||||
OnboardingPage.MICRO_G -> MicroGPage(onMicrogTOSChecked = onMicrogTOSChecked)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,7 +197,7 @@ private fun OnboardingScreenPreview() {
|
||||
ScreenContent(
|
||||
pages = listOf(OnboardingPage.WELCOME, OnboardingPage.PERMISSIONS),
|
||||
uiState = OnboardingUiState(),
|
||||
onCheckedChange = {}
|
||||
onMicrogTOSChecked = {}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,19 +65,19 @@ class OnboardingViewModel @Inject constructor(
|
||||
var uiState by mutableStateOf(OnboardingUiState())
|
||||
private set
|
||||
|
||||
fun onMicroGCheckedChange(value: Boolean) {
|
||||
uiState = uiState.copy(isMicroBundleChecked = value)
|
||||
}
|
||||
|
||||
init {
|
||||
AuroraApp.events.installerEvent.onEach {
|
||||
when (it) {
|
||||
is InstallerEvent.Installed -> confirmBundleInstall()
|
||||
else -> {}
|
||||
else -> {}
|
||||
}
|
||||
}.launchIn(AuroraApp.scope)
|
||||
}
|
||||
|
||||
fun onMicrogTOSChecked(value: Boolean) {
|
||||
uiState = uiState.copy(isMicroBundleChecked = value)
|
||||
}
|
||||
|
||||
fun finishOnboarding() {
|
||||
Log.i(TAG, "Finishing onboarding with defaults")
|
||||
context.saveDefaultPreferences()
|
||||
@@ -104,8 +104,8 @@ class OnboardingViewModel @Inject constructor(
|
||||
private fun setupAutoUpdates() {
|
||||
val updateMode = when {
|
||||
context.isIgnoringBatteryOptimizations() -> UpdateMode.CHECK_AND_INSTALL
|
||||
context.areNotificationsEnabled() -> UpdateMode.CHECK_AND_NOTIFY
|
||||
else -> UpdateMode.DISABLED
|
||||
context.areNotificationsEnabled() -> UpdateMode.CHECK_AND_NOTIFY
|
||||
else -> UpdateMode.DISABLED
|
||||
}
|
||||
|
||||
context.save(PREFERENCE_UPDATES_AUTO, updateMode.ordinal)
|
||||
|
||||
@@ -24,7 +24,9 @@ dependencyResolutionManagement {
|
||||
}
|
||||
// Only included in huawei variants
|
||||
maven("https://developer.huawei.com/repo/") {
|
||||
|
||||
content {
|
||||
includeModule("com.huawei.hms", "ag-coreservice")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user