mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-06 11:01:57 +00:00
Fix Huawei push notifications
This commit is contained in:
@@ -506,10 +506,10 @@ public class ApplicationContext extends Application implements DefaultLifecycleO
|
||||
firebaseInstanceIdJob.cancel(null);
|
||||
}
|
||||
String displayName = TextSecurePreferences.getProfileName(this);
|
||||
boolean isUsingFCM = TextSecurePreferences.isUsingFCM(this);
|
||||
boolean isUsingFCM = TextSecurePreferences.isPushEnabled(this);
|
||||
TextSecurePreferences.clearAll(this);
|
||||
if (isMigratingToV2KeyPair) {
|
||||
TextSecurePreferences.setIsUsingFCM(this, isUsingFCM);
|
||||
TextSecurePreferences.setPushEnabled(this, isUsingFCM);
|
||||
TextSecurePreferences.setProfileName(this, displayName);
|
||||
}
|
||||
getSharedPreferences(PREFERENCES_NAME, 0).edit().clear().commit();
|
||||
|
||||
@@ -12,7 +12,7 @@ class FcmTokenManager @Inject constructor(
|
||||
) {
|
||||
private val expiryManager = ExpiryManager(context)
|
||||
|
||||
val isUsingFCM get() = TextSecurePreferences.isUsingFCM(context)
|
||||
val isUsingFCM get() = TextSecurePreferences.isPushEnabled(context)
|
||||
|
||||
var fcmToken
|
||||
get() = TextSecurePreferences.getFCMToken(context)
|
||||
|
||||
@@ -33,7 +33,7 @@ class PushHandler @Inject constructor(@ApplicationContext val context: Context)
|
||||
onPush(dataMap?.asByteArray())
|
||||
}
|
||||
|
||||
private fun onPush(data: ByteArray?) {
|
||||
fun onPush(data: ByteArray?) {
|
||||
if (data == null) {
|
||||
onPush()
|
||||
return
|
||||
|
||||
@@ -165,7 +165,7 @@ class PNModeActivity : BaseActionBarActivity() {
|
||||
return
|
||||
}
|
||||
|
||||
TextSecurePreferences.setIsUsingFCM(this, (selectedOptionView == binding.fcmOptionView))
|
||||
TextSecurePreferences.setPushEnabled(this, (selectedOptionView == binding.fcmOptionView))
|
||||
val application = ApplicationContext.getInstance(this)
|
||||
application.startPollingIfNeeded()
|
||||
pushManager.refresh(true)
|
||||
|
||||
@@ -45,10 +45,10 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
||||
|
||||
// Set up FCM toggle
|
||||
String fcmKey = "pref_key_use_fcm";
|
||||
((SwitchPreferenceCompat)findPreference(fcmKey)).setChecked(TextSecurePreferences.isUsingFCM(getContext()));
|
||||
((SwitchPreferenceCompat)findPreference(fcmKey)).setChecked(TextSecurePreferences.isPushEnabled(getContext()));
|
||||
this.findPreference(fcmKey)
|
||||
.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
TextSecurePreferences.setIsUsingFCM(getContext(), (boolean) newValue);
|
||||
TextSecurePreferences.setPushEnabled(getContext(), (boolean) newValue);
|
||||
pushManager.refresh(true);
|
||||
return true;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user