Fix bad FCM token stored

This commit is contained in:
Benoit Marty 2019-06-28 16:54:53 +02:00
parent 419ef7b46f
commit 38ceb6f52a
2 changed files with 7 additions and 5 deletions

View File

@ -56,11 +56,12 @@ class TestFirebaseToken @Inject constructor(private val context: AppCompatActivi
}
status = TestStatus.FAILED
} else {
task.result?.token?.let {
val tok = it.substring(0, Math.min(8, it.length)) + "********************"
task.result?.token?.let {token ->
val tok = token.substring(0, Math.min(8, token.length)) + "********************"
description = stringProvider.getString(R.string.settings_troubleshoot_test_fcm_success, tok)
Timber.e("Retrieved FCM token success [$it].")
FcmHelper.storeFcmToken(context, tok)
Timber.e("Retrieved FCM token success [$tok].")
// Ensure it is well store in our local storage
FcmHelper.storeFcmToken(context, token)
}
status = TestStatus.SUCCESS
}

View File

@ -50,7 +50,8 @@ class TestTokenRegistration @Inject constructor(private val context: AppCompatAc
it.pushKey == fcmToken && it.state == PusherState.REGISTERED
}
if (pusher.isEmpty()) {
description = stringProvider.getString(R.string.settings_troubleshoot_test_token_registration_failed, null)
description = stringProvider.getString(R.string.settings_troubleshoot_test_token_registration_failed,
stringProvider.getString(R.string.sas_error_unknown))
quickFix = object : TroubleshootQuickFix(R.string.settings_troubleshoot_test_token_registration_quick_fix) {
override fun doFix() {
val workId = pushersManager.registerPusherWithFcmKey(fcmToken)