@@ -15,42 +15,9 @@ import '../api/model/narrow.dart';
1515import '../api/route/messages.dart' ;
1616import '../generated/l10n/zulip_localizations.dart' ;
1717import '../model/narrow.dart' ;
18- import '../model/store.dart' ;
19- import '../notifications/receive.dart' ;
2018import 'dialog.dart' ;
2119import 'store.dart' ;
2220
23- Future <void > logOutAccount (GlobalStore globalStore, int accountId) async {
24- final account = globalStore.getAccount (accountId);
25- if (account == null ) return ; // TODO(log)
26-
27- // Unawaited, to not block removing the account on this request.
28- unawaited (unregisterToken (globalStore, accountId));
29-
30- await globalStore.removeAccount (accountId);
31- }
32-
33- Future <void > unregisterToken (GlobalStore globalStore, int accountId) async {
34- final account = globalStore.getAccount (accountId);
35- if (account == null ) return ; // TODO(log)
36-
37- // TODO(#322) use actual acked push token; until #322, this is just null.
38- final token = account.ackedPushToken
39- // Try the current token as a fallback; maybe the server has registered
40- // it and we just haven't recorded that fact in the client.
41- ?? NotificationService .instance.token.value;
42- if (token == null ) return ;
43-
44- final connection = globalStore.apiConnectionFromAccount (account);
45- try {
46- await NotificationService .unregisterToken (connection, token: token);
47- } catch (e) {
48- // TODO retry? handle failures?
49- } finally {
50- connection.close ();
51- }
52- }
53-
5421Future <void > markNarrowAsRead (BuildContext context, Narrow narrow) async {
5522 final store = PerAccountStoreWidget .of (context);
5623 final connection = store.connection;
0 commit comments