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 status = TestStatus.FAILED
} else { } else {
task.result?.token?.let { task.result?.token?.let {token ->
val tok = it.substring(0, Math.min(8, it.length)) + "********************" val tok = token.substring(0, Math.min(8, token.length)) + "********************"
description = stringProvider.getString(R.string.settings_troubleshoot_test_fcm_success, tok) description = stringProvider.getString(R.string.settings_troubleshoot_test_fcm_success, tok)
Timber.e("Retrieved FCM token success [$it].") Timber.e("Retrieved FCM token success [$tok].")
FcmHelper.storeFcmToken(context, tok) // Ensure it is well store in our local storage
FcmHelper.storeFcmToken(context, token)
} }
status = TestStatus.SUCCESS status = TestStatus.SUCCESS
} }

View File

@ -50,7 +50,8 @@ class TestTokenRegistration @Inject constructor(private val context: AppCompatAc
it.pushKey == fcmToken && it.state == PusherState.REGISTERED it.pushKey == fcmToken && it.state == PusherState.REGISTERED
} }
if (pusher.isEmpty()) { 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) { quickFix = object : TroubleshootQuickFix(R.string.settings_troubleshoot_test_token_registration_quick_fix) {
override fun doFix() { override fun doFix() {
val workId = pushersManager.registerPusherWithFcmKey(fcmToken) val workId = pushersManager.registerPusherWithFcmKey(fcmToken)