-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1140 from matthiasn/inbox_v2
Inbox refactoring
- Loading branch information
Showing
24 changed files
with
654 additions
and
490 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:connectivity_plus/connectivity_plus.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:lotti/database/logging_db.dart'; | ||
import 'package:lotti/get_it.dart'; | ||
|
||
class ConnectivityService { | ||
ConnectivityService() { | ||
_broadcastStream = _controller.stream.asBroadcastStream(); | ||
|
||
Connectivity().onConnectivityChanged.listen( | ||
(ConnectivityResult result) { | ||
debugPrint('Connectivity onConnectivityChanged $result'); | ||
getIt<LoggingDb>().captureEvent( | ||
'onConnectivityChanged $result', | ||
domain: 'CONNECTIVITY', | ||
); | ||
_controller.add(result != ConnectivityResult.none); | ||
}, | ||
onError: (Object error, Object stacktrace) { | ||
getIt<LoggingDb>().captureException( | ||
error, | ||
stackTrace: stacktrace, | ||
domain: 'CONNECTIVITY', | ||
); | ||
}, | ||
); | ||
} | ||
|
||
final _controller = StreamController<bool>(); | ||
late final Stream<bool> _broadcastStream; | ||
|
||
Future<bool> isConnected() async { | ||
final status = await Connectivity().checkConnectivity(); | ||
return status != ConnectivityResult.none; | ||
} | ||
|
||
Stream<bool> get connectedStream { | ||
return _broadcastStream; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:flutter_fgbg/flutter_fgbg.dart'; | ||
import 'package:lotti/database/logging_db.dart'; | ||
import 'package:lotti/get_it.dart'; | ||
import 'package:lotti/utils/platform.dart'; | ||
|
||
class FgBgService { | ||
FgBgService() { | ||
_broadcastStream = _controller.stream.asBroadcastStream(); | ||
|
||
if (isMobile) { | ||
FGBGEvents.stream.listen( | ||
(result) { | ||
_controller.add(result != FGBGType.foreground); | ||
}, | ||
onError: (Object error, Object stacktrace) { | ||
getIt<LoggingDb>().captureException( | ||
error, | ||
stackTrace: stacktrace, | ||
domain: 'FG_BG', | ||
); | ||
}, | ||
); | ||
} | ||
} | ||
|
||
final _controller = StreamController<bool>(); | ||
late final Stream<bool> _broadcastStream; | ||
|
||
Stream<bool> get fgBgStream { | ||
return _broadcastStream; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.