Сохраняет ли Cloud Firestore прослушиватель, если приложение находится в фоновом режиме или закрыто? ⇐ IOS
-
Гость
Сохраняет ли Cloud Firestore прослушиватель, если приложение находится в фоновом режиме или закрыто?
I have a SwiftUI app where I attach a listener to a document when a user logs in (I'm using Firebase Auth and email/password sign in). I remove the listener when the user signs out. My users typically stay signed in unless certain events happen to explicitly trigger sign out. My question is what happens to the listener if the user just backgrounds the app or closes out of it completely? Is it automatically removed at some point or does it stay attached indefinitely? I can't seem to find a definitive answer to this in the documentation.
I'm asking this because I don't know if I should use scenePhase to determine when the app is backgrounded, so that I can manually remove the listener and then reattach it later. I'm not sure whether leaving it open or performing remove/reattach is better in terms of performance and resource usage. I know that I'll have to decide that myself based on my logic and application flow. However, I would like to know exactly how Cloud Firestore behaves. Does anyone know and/or have documentation that they can point me toward?
Источник: https://stackoverflow.com/questions/781 ... ed-or-clos
I have a SwiftUI app where I attach a listener to a document when a user logs in (I'm using Firebase Auth and email/password sign in). I remove the listener when the user signs out. My users typically stay signed in unless certain events happen to explicitly trigger sign out. My question is what happens to the listener if the user just backgrounds the app or closes out of it completely? Is it automatically removed at some point or does it stay attached indefinitely? I can't seem to find a definitive answer to this in the documentation.
I'm asking this because I don't know if I should use scenePhase to determine when the app is backgrounded, so that I can manually remove the listener and then reattach it later. I'm not sure whether leaving it open or performing remove/reattach is better in terms of performance and resource usage. I know that I'll have to decide that myself based on my logic and application flow. However, I would like to know exactly how Cloud Firestore behaves. Does anyone know and/or have documentation that they can point me toward?
Источник: https://stackoverflow.com/questions/781 ... ed-or-clos
Мобильная версия