Skip to content

Commit

Permalink
move things around
Browse files Browse the repository at this point in the history
  • Loading branch information
josxha committed Nov 6, 2024
1 parent d44a4b4 commit 10700dc
Show file tree
Hide file tree
Showing 212 changed files with 58 additions and 133 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
strategy:
fail-fast: false
matrix:
sdk: [ '3.24.3', '' ]
sdk: [ '3.24.0', '' ]
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -174,7 +174,7 @@ jobs:
strategy:
fail-fast: false
matrix:
sdk: [ '3.24.3', '' ]
sdk: [ '3.24.0', '' ]
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:
# strategy:
# fail-fast: false
# matrix:
# sdk: [ '3.24.3', '' ]
# sdk: [ '3.24.0', '' ]
# steps:
# - uses: actions/checkout@v4
# - uses: subosito/flutter-action@v2
Expand Down Expand Up @@ -235,7 +235,7 @@ jobs:
strategy:
fail-fast: false
matrix:
sdk: [ '3.24.3', '' ]
sdk: [ '3.24.0', '' ]
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
Expand All @@ -255,7 +255,7 @@ jobs:
strategy:
fail-fast: false
matrix:
sdk: [ '3.24.3', '' ]
sdk: [ '3.24.0', '' ]
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
Expand Down
83 changes: 0 additions & 83 deletions lib/src/native/permission_manager_pigeon.g.dart

This file was deleted.

22 changes: 0 additions & 22 deletions lib/src/native/platform_impl.dart

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/rendering.dart';
import 'package:maplibre/maplibre.dart';
import 'package:maplibre/src/native/jni/jni.dart' as jni;
import 'package:maplibre/src/native/pigeon.g.dart' as pigeon;
import 'package:maplibre/src/platform/android/jni/jni.dart' as jni;
import 'package:maplibre/src/platform/pigeon.g.dart' as pigeon;

/// Extension methods for the [Position] class. Not exported publicly.
extension PositionExt on Position {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import 'dart:ui';

import 'package:jni/jni.dart';
import 'package:maplibre/maplibre.dart';
import 'package:maplibre/src/native/extensions.dart';
import 'package:maplibre/src/native/jni/jni.dart' as jni;
import 'package:maplibre/src/platform/android/extensions.dart';
import 'package:maplibre/src/platform/android/jni/jni.dart' as jni;

/// MapLibre Android specific implementation of the [OfflineManager].
class OfflineManagerNative implements OfflineManager {
const OfflineManagerNative._(this._jManager);
class OfflineManagerAndroid implements OfflineManager {
const OfflineManagerAndroid._(this._jManager);

final jni.OfflineManager _jManager;

Expand All @@ -20,7 +20,7 @@ class OfflineManagerNative implements OfflineManager {
jni.MapLibre.getInstance(jContext);
});
final jManager = jni.OfflineManager.getInstance(jContext);
return OfflineManagerNative._(jManager);
return OfflineManagerAndroid._(jManager);
}

@override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import 'package:jni/jni.dart';
import 'package:maplibre/maplibre.dart';
import 'package:maplibre/src/native/jni/jni.dart' as jni;
import 'package:maplibre/src/native/permission_manager_pigeon.g.dart';
import 'package:maplibre/src/platform/android/jni/jni.dart' as jni;
import 'package:maplibre/src/platform/pigeon.g.dart';

/// MapLibre Android specific implementation of the [PermissionManager].
///
/// https://maplibre.org/maplibre-native/android/api/-map-libre%20-native%20-android/org.maplibre.android.location.permissions/-permissions-manager/index.html
class PermissionManagerNative implements PermissionManager {
/// Create a new [PermissionManagerNative] instance.
PermissionManagerNative();
class PermissionManagerAndroid implements PermissionManager {
/// Create a new [PermissionManagerAndroid] instance.
PermissionManagerAndroid();

final _api = PermissionManagerHostApi();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import 'package:jni/jni.dart';
import 'package:maplibre/maplibre.dart';
import 'package:maplibre/src/annotation/annotation_manager.dart';
import 'package:maplibre/src/map_state.dart';
import 'package:maplibre/src/native/extensions.dart';
import 'package:maplibre/src/native/jni/jni.dart' as jni;
import 'package:maplibre/src/native/pigeon.g.dart' as pigeon;
import 'package:maplibre/src/platform/android/extensions.dart';
import 'package:maplibre/src/platform/android/jni/jni.dart' as jni;
import 'package:maplibre/src/platform/pigeon.g.dart' as pigeon;

/// The implementation that gets used for state of the [MapLibreMap] widget on
/// android using JNI and Pigeon as a fallback.
final class MapLibreMapStateJni extends MapLibreMapState
final class MapLibreMapStateAndroid extends MapLibreMapState
implements pigeon.MapLibreFlutterApi {
late final pigeon.MapLibreHostApi _hostApi;
late final int _viewId;
Expand Down
File renamed without changes.
30 changes: 30 additions & 0 deletions lib/src/platform/platform_native.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import 'dart:io';

import 'package:maplibre/src/map_state.dart';
import 'package:maplibre/src/offline/offline_manager.dart';
import 'package:maplibre/src/permission_manager.dart';
import 'package:maplibre/src/platform/android/offline_manager.dart';
import 'package:maplibre/src/platform/android/permission_manager.dart';
import 'package:maplibre/src/platform/android/widget_state.dart';
import 'package:maplibre/src/platform_interface.dart';

/// An implementation of [PlatformInterface] that uses method channels and ffi.
final class PlatformImpl extends PlatformInterface {
@override
MapLibreMapState createWidgetState() {
if (Platform.isAndroid) return MapLibreMapStateAndroid();
throw UnimplementedError('Unsupported platform');
}

@override
Future<OfflineManager> createOfflineManager() async {
if (Platform.isAndroid) return OfflineManagerAndroid.createInstance();
throw UnimplementedError('Unsupported platform');
}

@override
PermissionManager createPermissionManager() {
if (Platform.isAndroid) return PermissionManagerAndroid();
throw UnimplementedError('Unsupported platform');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import 'package:flutter_web_plugins/flutter_web_plugins.dart';
import 'package:maplibre/src/map_state.dart';
import 'package:maplibre/src/offline/offline_manager.dart';
import 'package:maplibre/src/permission_manager.dart';
import 'package:maplibre/src/platform/web/widget_state.dart';
import 'package:maplibre/src/platform_interface.dart';
import 'package:maplibre/src/web/widget_state.dart';

/// A web implementation of the MapLibrePlatform of the MapLibre plugin.
final class PlatformImpl extends PlatformInterface {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/widgets.dart';
import 'package:maplibre/maplibre.dart';
import 'package:maplibre/src/web/interop/interop.dart' as interop;
import 'package:maplibre/src/platform/web/interop/interop.dart' as interop;

/// Extension methods for the [Position] class. Not exported publicly.
extension PositionExt on Position {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import 'package:flutter/widgets.dart';
import 'package:maplibre/maplibre.dart';
import 'package:maplibre/src/annotation/annotation_manager.dart';
import 'package:maplibre/src/map_state.dart';
import 'package:maplibre/src/web/extensions.dart';
import 'package:maplibre/src/web/interop/interop.dart' as interop;
import 'package:maplibre/src/web/interop/json.dart';
import 'package:maplibre/src/platform/web/extensions.dart';
import 'package:maplibre/src/platform/web/interop/interop.dart' as interop;
import 'package:maplibre/src/platform/web/interop/json.dart';
import 'package:web/web.dart';

/// The web specific implementation of the [MapLibreMap] widget.
Expand Down
4 changes: 2 additions & 2 deletions lib/src/platform_interface.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:maplibre/maplibre.dart';
import 'package:maplibre/src/map_state.dart';
import 'package:maplibre/src/web/platform_impl.dart'
if (dart.library.io) 'package:maplibre/src/native/platform_impl.dart';
import 'package:maplibre/src/platform/platform_web.dart'
if (dart.library.io) 'package:maplibre/src/platform/platform_native.dart';

/// https://pub.dev/packages/plugin_platform_interface#a-note-about-base
abstract base class PlatformInterface {
Expand Down

0 comments on commit 10700dc

Please sign in to comment.