Fix / register/unregister pusher

This commit is contained in:
Valere 2019-06-27 14:08:54 +02:00
parent 338de3ebf5
commit fb7ada72dd
2 changed files with 4 additions and 3 deletions

View File

@ -87,11 +87,13 @@ class VectorSettingsNotificationPreferenceFragment : VectorSettingsBaseFragment(
FcmHelper.getFcmToken(requireContext())?.let {
pushManager.unregisterPusher(it, object : MatrixCallback<Unit> {
override fun onSuccess(data: Unit) {
Matrix.getInstance().currentSession?.refreshPushers()
super.onSuccess(data)
}

override fun onFailure(failure: Throwable) {
super.onFailure(failure)
Matrix.getInstance().currentSession?.refreshPushers()
Toast.makeText(activity, R.string.unknown_error, Toast.LENGTH_SHORT).show()
}
})
}
@ -116,7 +118,7 @@ class VectorSettingsNotificationPreferenceFragment : VectorSettingsBaseFragment(
override fun onFailure(failure: Throwable) {
//revert the check box
switchPref.isChecked = !switchPref.isChecked
Toast.makeText(requireContext(), R.string.unknown_error, Toast.LENGTH_SHORT).show()
Toast.makeText(activity, R.string.unknown_error, Toast.LENGTH_SHORT).show()
}
})
}

View File

@ -33,7 +33,6 @@
app:fragment="im.vector.fragments.VectorSettingsNotificationsAdvancedFragment" />

<im.vector.riotredesign.core.preference.VectorPreference
android:dependency="SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY"
android:key="SETTINGS_NOTIFICATION_TROUBLESHOOT_PREFERENCE_KEY"
android:title="@string/settings_notification_troubleshoot"
app:fragment="im.vector.riotredesign.features.settings.VectorSettingsNotificationsTroubleshootFragment" />