Upgraded Core to 9.0.0.
Added DB Migrations. Removed unnecessary HumanVerification/MissingScope handling.
This commit is contained in:
parent
226813fb1d
commit
9fb9f43c70
|
@ -312,6 +312,7 @@ dependencies {
|
|||
`Proton-key`,
|
||||
`Proton-human-verification`,
|
||||
`Proton-payment`,
|
||||
// `Proton-payment-iap`,
|
||||
`Proton-plan`,
|
||||
`Proton-contact`,
|
||||
`Proton-country`,
|
||||
|
@ -424,6 +425,7 @@ dependencies {
|
|||
`uiautomator`,
|
||||
`android-activation`,
|
||||
`Proton-android-instrumented-test`,
|
||||
`Proton-payment-iap`,
|
||||
`junit-ext`,
|
||||
`mock-web-server`,
|
||||
`okhttp-tls`
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -95,8 +95,6 @@ public abstract class BaseActivity extends AppCompatActivity implements INetwork
|
|||
@Inject
|
||||
protected AccountStateManager accountStateManager;
|
||||
@Inject
|
||||
protected HumanVerificationOrchestrator humanVerificationOrchestrator;
|
||||
@Inject
|
||||
protected JobManager mJobManager;
|
||||
@Inject
|
||||
protected QueueNetworkUtil mNetworkUtil;
|
||||
|
@ -183,16 +181,6 @@ public abstract class BaseActivity extends AppCompatActivity implements INetwork
|
|||
if (mToolbar != null) {
|
||||
setSupportActionBar(mToolbar);
|
||||
}
|
||||
|
||||
humanVerificationOrchestrator.register(this, false);
|
||||
accountStateManager.setHumanVerificationOrchestrator(humanVerificationOrchestrator);
|
||||
accountStateManager.observeHVStateWithExternalLifecycle(getLifecycle());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
humanVerificationOrchestrator.unregister(this);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -217,8 +205,6 @@ public abstract class BaseActivity extends AppCompatActivity implements INetwork
|
|||
|
||||
app.setAppInBackground(false);
|
||||
networkConfigurator.setNetworkConfiguratorCallback(this);
|
||||
|
||||
accountStateManager.setHumanVerificationOrchestrator(humanVerificationOrchestrator);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -140,7 +140,7 @@ internal abstract class AppDatabase :
|
|||
|
||||
companion object {
|
||||
|
||||
const val version = 7
|
||||
const val version = 8
|
||||
private const val name = "proton-mail.db"
|
||||
|
||||
private fun getDbCreationCallback(context: Context): Callback = object : Callback() {
|
||||
|
@ -165,7 +165,8 @@ internal abstract class AppDatabase :
|
|||
AppDatabaseMigrations.MIGRATION_3_4,
|
||||
AppDatabaseMigrations.MIGRATION_4_5,
|
||||
AppDatabaseMigrations.MIGRATION_5_6,
|
||||
AppDatabaseMigrations.MIGRATION_6_7
|
||||
AppDatabaseMigrations.MIGRATION_6_7,
|
||||
AppDatabaseMigrations.MIGRATION_7_8
|
||||
)
|
||||
Timber.v("Db migrations list size ${migrations.size}")
|
||||
return migrations
|
||||
|
|
|
@ -31,6 +31,7 @@ import me.proton.core.account.data.entity.SessionEntity
|
|||
import me.proton.core.challenge.data.db.ChallengeDatabase
|
||||
import me.proton.core.contact.data.local.db.ContactDatabase
|
||||
import me.proton.core.featureflag.data.db.FeatureFlagDatabase
|
||||
import me.proton.core.humanverification.data.db.HumanVerificationDatabase
|
||||
import me.proton.core.humanverification.data.entity.HumanVerificationEntity
|
||||
import me.proton.core.key.data.db.PublicAddressDatabase
|
||||
import me.proton.core.key.data.entity.KeySaltEntity
|
||||
|
@ -148,4 +149,13 @@ object AppDatabaseMigrations {
|
|||
UserSettingsDatabase.MIGRATION_1.migrate(database)
|
||||
}
|
||||
}
|
||||
|
||||
val MIGRATION_7_8 = object : Migration(7, 8) {
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
FeatureFlagDatabase.MIGRATION_2.migrate(database)
|
||||
FeatureFlagDatabase.MIGRATION_3.migrate(database)
|
||||
HumanVerificationDatabase.MIGRATION_1.migrate(database)
|
||||
HumanVerificationDatabase.MIGRATION_2.migrate(database)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import dagger.Provides
|
|||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import me.proton.core.account.domain.entity.AccountType
|
||||
import me.proton.core.domain.entity.AppStore
|
||||
import me.proton.core.domain.entity.Product
|
||||
import javax.inject.Singleton
|
||||
|
||||
|
@ -37,6 +38,10 @@ object CoreAppModule {
|
|||
@Singleton
|
||||
fun provideProduct(): Product = Product.Mail
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideAppStore() = AppStore.GooglePlay
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideRequiredAccountType(): AccountType = AccountType.Internal
|
||||
|
|
|
@ -33,7 +33,7 @@ object HumanVerificationModule {
|
|||
|
||||
@Provides
|
||||
// Can be either HumanVerificationVersion.HV2 or HV3.
|
||||
fun provideHumanVerificationVersion() = HumanVerificationVersion.HV2
|
||||
fun provideHumanVerificationVersion() = HumanVerificationVersion.HV3
|
||||
|
||||
@Provides
|
||||
@CaptchaApiHost
|
||||
|
|
|
@ -27,9 +27,7 @@ import dagger.hilt.InstallIn
|
|||
import dagger.hilt.components.SingletonComponent
|
||||
import me.proton.core.auth.domain.ClientSecret
|
||||
import me.proton.core.network.data.client.ExtraHeaderProviderImpl
|
||||
import me.proton.core.network.data.di.AlternativeApiPins
|
||||
import me.proton.core.network.data.di.BaseProtonApiUrl
|
||||
import me.proton.core.network.data.di.CertificatePins
|
||||
import me.proton.core.network.data.di.Constants
|
||||
import me.proton.core.network.data.di.DohProviderUrls
|
||||
import me.proton.core.network.domain.ApiClient
|
||||
|
|
|
@ -71,11 +71,6 @@ import me.proton.core.auth.presentation.AuthOrchestrator
|
|||
import me.proton.core.auth.presentation.onAddAccountResult
|
||||
import me.proton.core.domain.entity.Product
|
||||
import me.proton.core.domain.entity.UserId
|
||||
import me.proton.core.humanverification.domain.HumanVerificationManager
|
||||
import me.proton.core.humanverification.presentation.HumanVerificationManagerObserver
|
||||
import me.proton.core.humanverification.presentation.HumanVerificationOrchestrator
|
||||
import me.proton.core.humanverification.presentation.observe
|
||||
import me.proton.core.humanverification.presentation.onHumanVerificationNeeded
|
||||
import me.proton.core.user.domain.UserManager
|
||||
import me.proton.core.util.android.sharedpreferences.clearAll
|
||||
import me.proton.core.util.kotlin.DispatcherProvider
|
||||
|
@ -92,7 +87,6 @@ internal class AccountStateManager @Inject constructor(
|
|||
private val eventManager: EventManager,
|
||||
private val jobManager: JobManager,
|
||||
private val authOrchestrator: AuthOrchestrator,
|
||||
private val humanVerificationManager: HumanVerificationManager,
|
||||
private val oldUserManager: ch.protonmail.android.core.UserManager,
|
||||
private val launchInitialDataFetch: LaunchInitialDataFetch,
|
||||
private val clearUserData: ClearUserData,
|
||||
|
@ -106,8 +100,6 @@ internal class AccountStateManager @Inject constructor(
|
|||
private val scope = lifecycleOwner.lifecycleScope
|
||||
private val lifecycle = lifecycleOwner.lifecycle
|
||||
|
||||
private lateinit var currentHumanVerificationOrchestrator: HumanVerificationOrchestrator
|
||||
|
||||
private val mutableStateFlow = MutableStateFlow(State.Processing)
|
||||
|
||||
enum class State { Processing, AccountNeeded, PrimaryExist }
|
||||
|
@ -138,9 +130,6 @@ internal class AccountStateManager @Inject constructor(
|
|||
private fun observeAccountManager(lifecycle: Lifecycle): AccountManagerObserver =
|
||||
accountManager.observe(lifecycle, Lifecycle.State.CREATED)
|
||||
|
||||
private fun observeHumanVerificationManager(lifecycle: Lifecycle): HumanVerificationManagerObserver =
|
||||
humanVerificationManager.observe(lifecycle, Lifecycle.State.STARTED)
|
||||
|
||||
/**
|
||||
* Observe all accounts states that can be solved without any workflow ([AuthOrchestrator]).
|
||||
*/
|
||||
|
@ -172,18 +161,6 @@ internal class AccountStateManager @Inject constructor(
|
|||
.onAccountCreateAddressNeeded { authOrchestrator.startChooseAddressWorkflow(it) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Observe all human verification states that can be solved with [HumanVerificationOrchestrator].
|
||||
*/
|
||||
fun observeHVStateWithExternalLifecycle(lifecycle: Lifecycle) {
|
||||
observeHumanVerificationManager(lifecycle)
|
||||
.onHumanVerificationNeeded { currentHumanVerificationOrchestrator.startHumanVerificationWorkflow(it) }
|
||||
}
|
||||
|
||||
fun setHumanVerificationOrchestrator(humanVerificationOrchestrator: HumanVerificationOrchestrator) {
|
||||
currentHumanVerificationOrchestrator = humanVerificationOrchestrator
|
||||
}
|
||||
|
||||
fun register(context: ComponentActivity) {
|
||||
authOrchestrator.register(context)
|
||||
observeAccountStateWithExternalLifecycle(context.lifecycle)
|
||||
|
|
|
@ -48,6 +48,7 @@ val DependencyHandler.`Proton-mail-settings` get() = proton("mail
|
|||
val DependencyHandler.`Proton-metrics` get() = proton("metrics") version `Proton-core version`
|
||||
val DependencyHandler.`Proton-network` get() = proton("network") version `Proton-core version`
|
||||
val DependencyHandler.`Proton-payment` get() = proton("payment") version `Proton-core version`
|
||||
val DependencyHandler.`Proton-payment-iap` get() = proton("payment-iap") version `Proton-core version`
|
||||
val DependencyHandler.`Proton-plan` get() = proton("plan") version `Proton-core version`
|
||||
val DependencyHandler.`Proton-presentation` get() = proton("presentation") version `Proton-core version`
|
||||
val DependencyHandler.`Proton-report` get() = proton("report") version `Proton-core version`
|
||||
|
|
|
@ -27,5 +27,4 @@ val repos: RepositoryHandler.() -> Unit get() = {
|
|||
google()
|
||||
gradlePluginPortal()
|
||||
maven("https://plugins.gradle.org/m2/")
|
||||
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ fun initVersions() {
|
|||
}
|
||||
|
||||
// Proton Core
|
||||
const val `Proton-core version` = "8.5.0"
|
||||
const val `Proton-core version` = "9.0.0"
|
||||
|
||||
// Test
|
||||
const val `aerogear version` = "1.0.0" // Released: Mar 23, 2013
|
||||
|
|
|
@ -50,4 +50,4 @@ org.aspectj.weaver.Dump.exception=false
|
|||
android.jetifier.ignorelist=bcprov-jdk15on
|
||||
|
||||
# By default use core libs from Git Submodule.
|
||||
useCoreGitSubmodule=false
|
||||
useCoreGitSubmodule=true
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit fd106af39383e2619728809c6801d377a927c6d6
|
||||
Subproject commit 2a21b3ae9b085a27699278f58597feaea1fb9995
|
Loading…
Reference in New Issue