@@ -15,42 +15,9 @@ import '../api/model/narrow.dart';
15
15
import '../api/route/messages.dart' ;
16
16
import '../generated/l10n/zulip_localizations.dart' ;
17
17
import '../model/narrow.dart' ;
18
- import '../model/store.dart' ;
19
- import '../notifications/receive.dart' ;
20
18
import 'dialog.dart' ;
21
19
import 'store.dart' ;
22
20
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
-
54
21
Future <void > markNarrowAsRead (BuildContext context, Narrow narrow) async {
55
22
final store = PerAccountStoreWidget .of (context);
56
23
final connection = store.connection;
0 commit comments