fixed stale state after logout and replayed or lost share intents
This commit is contained in:
@@ -107,6 +107,7 @@ class PushRegistration {
|
||||
/// fire-and-forget (and simply ignore the result).
|
||||
Future<bool> register() async {
|
||||
if (DemoMode.active) return false;
|
||||
final epoch = AccountData().sessionEpoch;
|
||||
final String? fcmToken;
|
||||
try {
|
||||
fcmToken = await FirebaseMessaging.instance.getToken();
|
||||
@@ -159,6 +160,7 @@ class PushRegistration {
|
||||
fcmToken: fcmToken,
|
||||
pems: pems,
|
||||
appVersion: appVersion,
|
||||
epoch: epoch,
|
||||
);
|
||||
allOk = allOk && ok;
|
||||
}
|
||||
@@ -170,6 +172,7 @@ class PushRegistration {
|
||||
required String fcmToken,
|
||||
required PushKeypairPems pems,
|
||||
required String? appVersion,
|
||||
required int epoch,
|
||||
}) async {
|
||||
try {
|
||||
final proxyServer = currentProxyServer;
|
||||
@@ -185,6 +188,11 @@ class PushRegistration {
|
||||
userAgent: isTalk ? _talkUserAgent : null,
|
||||
);
|
||||
|
||||
// Signed out while registering: persisting or announcing this
|
||||
// registration would keep delivering the previous account's pushes,
|
||||
// and logoutCleanup already ran so nothing would unregister it.
|
||||
if (!AccountData().isCurrentSession(epoch)) return false;
|
||||
|
||||
await _store.save(
|
||||
type: type,
|
||||
deviceIdentifier: registration.deviceIdentifier,
|
||||
|
||||
Reference in New Issue
Block a user