implemented a 1-minute in-memory cache for the EmergencyNoticeClient to prevent redundant network requests on app resume
This commit is contained in:
@@ -10,13 +10,9 @@ import '../../api/emergency/emergency_notice_client.dart';
|
||||
import '../../state/app/modules/settings/bloc/settings_cubit.dart';
|
||||
|
||||
/// Wraps the app and surfaces a backend-independent emergency notice on cold
|
||||
/// start and on resume. Transparent otherwise: renders [child] unchanged and
|
||||
/// only overlays a dialog when the foreign source has an active message.
|
||||
///
|
||||
/// Independent of MarianumConnect and of the login state by design — this is
|
||||
/// the disaster fallback for when the backend is gone. Any failure to load or
|
||||
/// parse is swallowed by [EmergencyNoticeClient], so a missing/broken source
|
||||
/// simply shows nothing.
|
||||
/// start and resume. Renders [child] unchanged and only overlays a dialog when
|
||||
/// the foreign source has an active message. Independent of MarianumConnect and
|
||||
/// the login state by design — the fallback for when the backend is gone.
|
||||
class EmergencyNoticeGate extends StatefulWidget {
|
||||
final Widget child;
|
||||
|
||||
@@ -28,7 +24,7 @@ class EmergencyNoticeGate extends StatefulWidget {
|
||||
|
||||
class _EmergencyNoticeGateState extends State<EmergencyNoticeGate>
|
||||
with WidgetsBindingObserver {
|
||||
final EmergencyNoticeClient _client = const EmergencyNoticeClient();
|
||||
final EmergencyNoticeClient _client = EmergencyNoticeClient();
|
||||
bool _showing = false;
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user