Skip to content

Commit

Permalink
fix(intercom): AND-6763 intercom init (#4099)
Browse files Browse the repository at this point in the history
  • Loading branch information
dserrano-bc committed Nov 11, 2022
1 parent 577aac1 commit 2ba8df2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Expand Up @@ -952,11 +952,6 @@ class PinActivity :
}

private fun askToUseBiometrics() {
// This doesn't work
// val tempFragment = supportFragmentManager.findFragmentByTag("BIOMETRICS_BOTTOM_SHEET")
// if (tempFragment == null) {
// BiometricsEnrollmentBottomSheet.newInstance().show(supportFragmentManager, "BIOMETRICS_BOTTOM_SHEET")
// }
if (!isBiometricsVisible) {
BiometricsEnrollmentBottomSheet.newInstance().show(supportFragmentManager, "BIOMETRICS_BOTTOM_SHEET")
isBiometricsVisible = true
Expand Down
Expand Up @@ -125,9 +125,6 @@ class PinInteractor internal constructor(

@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
fun registerIntercomUser() {
// TODO(dserrano): Move this initialization back to BlockchainApplication when the flag is removed
Intercom.initialize(application, BuildConfig.INTERCOM_API_KEY, BuildConfig.INTERCOM_APP_ID)

val registration = Registration.create().withUserId(authPrefs.walletGuid)
Intercom.client().loginIdentifiedUser(
registration,
Expand All @@ -143,6 +140,11 @@ class PinInteractor internal constructor(
)
}

fun initialiseIntercom() {
// TODO(dserrano): Move this initialization back to BlockchainApplication when the flag is removed
Intercom.initialize(application, BuildConfig.INTERCOM_API_KEY, BuildConfig.INTERCOM_APP_ID)
}

private fun verifyCloudBackup(): Completable =
authDataManager.verifyCloudBackup()

Expand Down
Expand Up @@ -55,10 +55,14 @@ class PinModel(
is PinIntent.CheckIntercomStatus -> interactor.getIntercomStatus()
.subscribeBy(
onSuccess = { enabled ->
if (enabled) {
interactor.initialiseIntercom()
}
process(PinIntent.UpdateIntercomStatus(enabled))
}, onError = {
Timber.e("Error getting intercom status")
}
},
onError = {
Timber.e("Error getting intercom status")
}
)
is PinIntent.GetAction -> {
when {
Expand Down

0 comments on commit 2ba8df2

Please sign in to comment.