diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 832585b49..710c2bc41 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -113,7 +113,7 @@ android {
flavorDimensions += "device"
productFlavors {
- create("vanilla"){
+ create("vanilla") {
dimension = "device"
}
@@ -121,6 +121,12 @@ android {
dimension = "device"
versionNameSuffix = "-hw"
}
+
+ // This flavor is only for preloaded devices / users who push the app to system
+ create("preload") {
+ dimension = "device"
+ versionNameSuffix = "-preload"
+ }
}
buildFeatures {
@@ -153,6 +159,15 @@ android {
}
}
+androidComponents {
+ beforeVariants(selector().all()) { variant ->
+ val flavour = variant.flavorName
+ if ((flavour == "huawei" || flavour == "preload") && variant.buildType == "nightly") {
+ variant.enable = false
+ }
+ }
+}
+
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
}
diff --git a/app/lint.xml b/app/lint.xml
index 171a4f24a..b4a690a2b 100644
--- a/app/lint.xml
+++ b/app/lint.xml
@@ -1,6 +1,7 @@
+
diff --git a/app/src/huawei/AndroidManifest.xml b/app/src/huawei/AndroidManifest.xml
new file mode 100644
index 000000000..ea1a0693d
--- /dev/null
+++ b/app/src/huawei/AndroidManifest.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/app/src/preload/AndroidManifest.xml b/app/src/preload/AndroidManifest.xml
new file mode 100644
index 000000000..ea1a0693d
--- /dev/null
+++ b/app/src/preload/AndroidManifest.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/app/src/preload/java/com/aurora/store/view/ui/onboarding/OnboardingFragment.kt b/app/src/preload/java/com/aurora/store/view/ui/onboarding/OnboardingFragment.kt
new file mode 100644
index 000000000..cadc94c05
--- /dev/null
+++ b/app/src/preload/java/com/aurora/store/view/ui/onboarding/OnboardingFragment.kt
@@ -0,0 +1,84 @@
+/*
+ * Aurora Store
+ * Copyright (C) 2021, Rahul Kumar Patel
+ *
+ * Aurora Store is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Aurora Store is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Aurora Store. If not, see .
+ *
+ */
+
+package com.aurora.store.view.ui.onboarding
+
+import androidx.fragment.app.Fragment
+import com.aurora.Constants
+import com.aurora.store.util.Preferences.PREFERENCE_AUTO_DELETE
+import com.aurora.store.util.Preferences.PREFERENCE_DEFAULT_SELECTED_TAB
+import com.aurora.store.util.Preferences.PREFERENCE_DISPENSER_URLS
+import com.aurora.store.util.Preferences.PREFERENCE_FILTER_AURORA_ONLY
+import com.aurora.store.util.Preferences.PREFERENCE_FILTER_FDROID
+import com.aurora.store.util.Preferences.PREFERENCE_FOR_YOU
+import com.aurora.store.util.Preferences.PREFERENCE_INSTALLER_ID
+import com.aurora.store.util.Preferences.PREFERENCE_SIMILAR
+import com.aurora.store.util.Preferences.PREFERENCE_THEME_STYLE
+import com.aurora.store.util.Preferences.PREFERENCE_UPDATES_CHECK_INTERVAL
+import com.aurora.store.util.Preferences.PREFERENCE_UPDATES_EXTENDED
+import com.aurora.store.util.Preferences.PREFERENCE_VENDING_VERSION
+import com.aurora.store.util.save
+import dagger.hilt.android.AndroidEntryPoint
+
+@AndroidEntryPoint
+class OnboardingFragment : BaseFlavouredOnboardingFragment() {
+
+ override fun loadDefaultPreferences() {
+ /*Filters*/
+ save(PREFERENCE_FILTER_AURORA_ONLY, false)
+ save(PREFERENCE_FILTER_FDROID, true)
+
+ /*Network*/
+ save(PREFERENCE_DISPENSER_URLS, setOf(Constants.URL_DISPENSER))
+ save(PREFERENCE_VENDING_VERSION, 0)
+
+ /*Customization*/
+ save(PREFERENCE_THEME_STYLE, 0)
+ save(PREFERENCE_DEFAULT_SELECTED_TAB, 0)
+ save(PREFERENCE_FOR_YOU, true)
+ save(PREFERENCE_SIMILAR, false)
+
+ /*Installer*/
+ save(PREFERENCE_AUTO_DELETE, true)
+ save(PREFERENCE_INSTALLER_ID, 0)
+
+ /*Updates*/
+ save(PREFERENCE_UPDATES_EXTENDED, false)
+ save(PREFERENCE_UPDATES_CHECK_INTERVAL, 3)
+ }
+
+ override fun onboardingPages(): List {
+ return listOf(
+ WelcomeFragment(),
+ PermissionsFragment.newInstance()
+ )
+ }
+
+ override fun setupAutoUpdates() {
+ super.setupAutoUpdates()
+
+ // Remove super & implement variant logic here
+ }
+
+ override fun finishOnboarding() {
+ super.finishOnboarding()
+
+ // Remove super & implement variant logic here
+ }
+}
diff --git a/app/src/preload/java/com/aurora/store/view/ui/splash/SplashFragment.kt b/app/src/preload/java/com/aurora/store/view/ui/splash/SplashFragment.kt
new file mode 100644
index 000000000..1ed8acc72
--- /dev/null
+++ b/app/src/preload/java/com/aurora/store/view/ui/splash/SplashFragment.kt
@@ -0,0 +1,75 @@
+/*
+ * Aurora Store
+ * Copyright (C) 2021, Rahul Kumar Patel
+ *
+ * Aurora Store is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Aurora Store is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Aurora Store. If not, see .
+ *
+ */
+
+package com.aurora.store.view.ui.splash
+
+import android.accounts.AccountManager
+import android.util.Log
+import androidx.navigation.fragment.findNavController
+import com.aurora.store.R
+import com.aurora.store.data.model.AuthState
+import com.aurora.store.util.CertUtil.GOOGLE_ACCOUNT_TYPE
+import dagger.hilt.android.AndroidEntryPoint
+
+@AndroidEntryPoint
+class SplashFragment : BaseFlavouredSplashFragment() {
+ private val TAG = SplashFragment::class.java.simpleName
+
+ override fun attachActions() {
+ binding.btnAnonymous.addOnClickListener {
+ if (viewModel.authState.value != AuthState.Fetching) {
+ binding.btnAnonymous.updateProgress(true)
+ viewModel.buildAnonymousAuthData()
+ }
+ }
+
+ binding.btnGoogle.addOnClickListener {
+ if (viewModel.authState.value != AuthState.Fetching) {
+ binding.btnGoogle.updateProgress(true)
+ if (canLoginWithMicroG) {
+ Log.i(TAG, "Found supported microG, trying to request credentials")
+ val accountIntent = AccountManager.newChooseAccountIntent(
+ null,
+ null,
+ arrayOf(GOOGLE_ACCOUNT_TYPE),
+ null,
+ null,
+ null,
+ null
+ )
+ startForAccount.launch(accountIntent)
+ } else {
+ findNavController().navigate(R.id.googleFragment)
+ }
+ }
+ }
+ }
+
+ override fun resetActions() {
+ binding.btnGoogle.apply {
+ updateProgress(false)
+ isEnabled = true
+ }
+
+ binding.btnAnonymous.apply {
+ updateProgress(false)
+ isEnabled = true
+ }
+ }
+}