Add a debug option to force re-register FCM
This commit is contained in:
parent
26f7a75628
commit
c6130e4d29
@ -93,6 +93,10 @@ public class PushSubscriptionManager{
|
|||||||
this.accountID=accountID;
|
this.accountID=accountID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void resetLocalPreferences(){
|
||||||
|
getPrefs().edit().clear().apply();
|
||||||
|
}
|
||||||
|
|
||||||
public static void tryRegisterFCM(){
|
public static void tryRegisterFCM(){
|
||||||
deviceToken=getPrefs().getString("deviceToken", null);
|
deviceToken=getPrefs().getString("deviceToken", null);
|
||||||
int tokenVersion=getPrefs().getInt("version", 0);
|
int tokenVersion=getPrefs().getInt("version", 0);
|
||||||
|
@ -6,6 +6,7 @@ import android.os.Bundle;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.joinmastodon.android.GlobalUserPreferences;
|
import org.joinmastodon.android.GlobalUserPreferences;
|
||||||
|
import org.joinmastodon.android.api.PushSubscriptionManager;
|
||||||
import org.joinmastodon.android.api.session.AccountActivationInfo;
|
import org.joinmastodon.android.api.session.AccountActivationInfo;
|
||||||
import org.joinmastodon.android.api.session.AccountSession;
|
import org.joinmastodon.android.api.session.AccountSession;
|
||||||
import org.joinmastodon.android.api.session.AccountSessionManager;
|
import org.joinmastodon.android.api.session.AccountSessionManager;
|
||||||
@ -29,6 +30,7 @@ public class SettingsDebugFragment extends BaseSettingsFragment<Void>{
|
|||||||
setTitle("Debug settings");
|
setTitle("Debug settings");
|
||||||
ListItem<Void> selfUpdateItem, resetUpdateItem;
|
ListItem<Void> selfUpdateItem, resetUpdateItem;
|
||||||
onDataLoaded(List.of(
|
onDataLoaded(List.of(
|
||||||
|
new ListItem<>("Re-register for FCM", null, this::onUpdatePushRegistrationClick),
|
||||||
new ListItem<>("Test email confirmation flow", null, this::onTestEmailConfirmClick),
|
new ListItem<>("Test email confirmation flow", null, this::onTestEmailConfirmClick),
|
||||||
selfUpdateItem=new ListItem<>("Force self-update", null, this::onForceSelfUpdateClick),
|
selfUpdateItem=new ListItem<>("Force self-update", null, this::onForceSelfUpdateClick),
|
||||||
resetUpdateItem=new ListItem<>("Reset self-updater", null, this::onResetUpdaterClick),
|
resetUpdateItem=new ListItem<>("Reset self-updater", null, this::onResetUpdaterClick),
|
||||||
@ -52,6 +54,11 @@ public class SettingsDebugFragment extends BaseSettingsFragment<Void>{
|
|||||||
getPrefs().edit().putBoolean("donationsStaging", donationsStagingItem.checked).apply();
|
getPrefs().edit().putBoolean("donationsStaging", donationsStagingItem.checked).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onUpdatePushRegistrationClick(ListItem<?> item){
|
||||||
|
PushSubscriptionManager.resetLocalPreferences();
|
||||||
|
PushSubscriptionManager.tryRegisterFCM();
|
||||||
|
}
|
||||||
|
|
||||||
private void onTestEmailConfirmClick(ListItem<?> item){
|
private void onTestEmailConfirmClick(ListItem<?> item){
|
||||||
AccountSession sess=AccountSessionManager.getInstance().getAccount(accountID);
|
AccountSession sess=AccountSessionManager.getInstance().getAccount(accountID);
|
||||||
sess.activated=false;
|
sess.activated=false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user