Commit 7705108
authored
fix: Notifications are ignored if the app was killed before. (#2136)
If a message arrives when the app is killed or in the background, it is first handled by `FCMHandlerService`. The service needs to access `GlobalModule` and `AccountsService` before it can call `PushService` in order to sync the app. (We don't use the received message directly as it might be out of sync - we perform a sync instead). But if the app is killed there is no `GlobalModule` (nor `AccountService`) present and the service silently stops without calling `PushService`.
In this PR the service first ensures that the app is initialized properly. If the app simply works in the background, no initialization is needed and the code will work as before. If the app is killed, we will look for the stored global config and initialize the app according to it. Only if the config is missing, we will not initialize the app and the service won't work. To avoid this, the first launch of the app after installing it should be done through `LaunchActivity`: there we choose the backend and we save our decision in the stored backend config. After that, even if the app is killed, we will have the information about the chosen backend and the service will be able to initialize the app. (It didn't work before because if we had our Prod backend as default, it was not saved in the
stored backend config, and the service didn't know that Prod was our backend).1 parent 74b6959 commit 7705108
File tree
3 files changed
+27
-25
lines changed- app/src/main/scala/com/waz
- services/fcm
- zclient
3 files changed
+27
-25
lines changedLines changed: 15 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
61 | | - | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
70 | | - | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | | - | |
| 75 | + | |
74 | 76 | | |
75 | | - | |
76 | | - | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | | - | |
80 | | - | |
81 | | - | |
| 79 | + | |
82 | 80 | | |
83 | 81 | | |
84 | 82 | | |
85 | 83 | | |
86 | 84 | | |
87 | | - | |
88 | 85 | | |
89 | 86 | | |
90 | 87 | | |
91 | | - | |
92 | 88 | | |
93 | 89 | | |
94 | | - | |
95 | 90 | | |
96 | 91 | | |
97 | 92 | | |
| |||
123 | 118 | | |
124 | 119 | | |
125 | 120 | | |
126 | | - | |
127 | 121 | | |
128 | 122 | | |
129 | 123 | | |
| |||
134 | 128 | | |
135 | 129 | | |
136 | 130 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
143 | 137 | | |
144 | 138 | | |
145 | 139 | | |
| |||
150 | 144 | | |
151 | 145 | | |
152 | 146 | | |
153 | | - | |
| 147 | + | |
| 148 | + | |
154 | 149 | | |
155 | 150 | | |
156 | 151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
49 | 54 | | |
50 | 55 | | |
51 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
371 | | - | |
372 | | - | |
| 370 | + | |
373 | 371 | | |
374 | 372 | | |
375 | | - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
376 | 376 | | |
| 377 | + | |
377 | 378 | | |
378 | 379 | | |
379 | 380 | | |
| |||
419 | 420 | | |
420 | 421 | | |
421 | 422 | | |
| 423 | + | |
0 commit comments