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