Skip to content

Commit

Permalink
Discarded setConnected, let setOffline accept bool?
Browse files Browse the repository at this point in the history
  • Loading branch information
ciakov committed Aug 25, 2024
1 parent c8b0e67 commit a4fd37b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,8 @@ public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) {
result.success(null);
break;
case "setOffline":
boolean offline = methodCall.argument("offline");
ConnectivityReceiver.instance(context).setConnected(offline ? false : null);
result.success(null);
break;
case "setConnected":
boolean connected = methodCall.argument("connected");
ConnectivityReceiver.instance(context).setConnected(connected ? true : null);
Boolean offline = (Boolean) methodCall.argument("offline");
ConnectivityReceiver.instance(context).setConnected(offline!=null ? !(offline) : null);
result.success(null);
break;
case "mergeOfflineRegions":
Expand Down
9 changes: 1 addition & 8 deletions maplibre_gl/lib/src/global.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,13 @@ Future<void> installOfflineMapTiles(String tilesDb) async {

enum DragEventType { start, drag, end }

Future<dynamic> setOffline(bool offline) => _globalChannel.invokeMethod(
Future<dynamic> setOffline(bool? offline) => _globalChannel.invokeMethod(
'setOffline',
<String, dynamic>{
'offline': offline,
},
);

Future<dynamic> setConnected(bool connected) => _globalChannel.invokeMethod(
'setConnected',
<String, dynamic>{
'connected': connected,
},
);

Future<void> setHttpHeaders(Map<String, String> headers) {
return _globalChannel.invokeMethod(
'setHttpHeaders',
Expand Down

0 comments on commit a4fd37b

Please sign in to comment.