Skip to content

Commit 01233e6

Browse files
authored
Federation (#800)
* Federate iOS and Android platforms * Fix geolocator_apple workflow * Fix geolocator_apple workflow
1 parent a92607c commit 01233e6

File tree

92 files changed

+48
-1045
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+48
-1045
lines changed

.github/workflows/geolocator_android.yaml

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -108,38 +108,3 @@ jobs:
108108
- name: Run Android build
109109
run: flutter build apk --release
110110
working-directory: ${{env.example-directory}}
111-
112-
tests:
113-
name: Unit-tests
114-
# The type of runner that the job will run on
115-
runs-on: ubuntu-latest
116-
117-
env:
118-
source-directory: ./geolocator_android
119-
120-
# Steps represent a sequence of tasks that will be executed as part of the job
121-
steps:
122-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
123-
- uses: actions/checkout@v2
124-
125-
# Make sure the stable version of Flutter is available
126-
- uses: subosito/flutter-action@v1
127-
with:
128-
channel: 'stable'
129-
130-
# Download all Flutter packages
131-
- name: Download dependencies
132-
run: flutter pub get
133-
working-directory: ${{env.source-directory}}
134-
135-
# Run all unit-tests with code coverage
136-
- name: Run unit tests
137-
run: flutter test --coverage
138-
working-directory: ${{env.source-directory}}
139-
140-
# Upload code coverage information
141-
- uses: codecov/codecov-action@v1
142-
with:
143-
file: ${{env.source-directory}}/coverage/lcov.info # optional
144-
name: Geolocator (App Facing Package) # optional
145-
fail_ci_if_error: true

.github/workflows/geolocator_ios.yaml renamed to .github/workflows/geolocator_apple.yaml

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# This is a basic workflow to help you get started with Actions
22

3-
name: geolocator_ios
3+
name: geolocator_apple
44

55
# Controls when the action will run. Triggers the workflow on push or pull request
66
# events but only for the develop branch
77
on:
88
push:
99
branches: [ master, next ]
1010
paths:
11-
- 'geolocator_ios/**'
11+
- 'geolocator_apple/**'
1212
pull_request:
1313
branches: [ master, next ]
1414
paths:
15-
- 'geolocator_ios/**'
15+
- 'geolocator_apple/**'
1616

1717
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1818
jobs:
@@ -23,7 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424

2525
env:
26-
source-directory: ./geolocator_ios
26+
source-directory: ./geolocator_apple
2727

2828
# Steps represent a sequence of tasks that will be executed as part of the job
2929
steps:
@@ -52,7 +52,7 @@ jobs:
5252
runs-on: ubuntu-latest
5353

5454
env:
55-
source-directory: ./geolocator_ios
55+
source-directory: ./geolocator_apple
5656

5757
# Steps represent a sequence of tasks that will be executed as part of the job
5858
steps:
@@ -81,8 +81,8 @@ jobs:
8181
runs-on: macos-latest
8282

8383
env:
84-
source-directory: ./geolocator_ios
85-
example-directory: ./geolocator_ios/example
84+
source-directory: ./geolocator_apple
85+
example-directory: ./geolocator_apple/example
8686

8787
# Steps represent a sequence of tasks that will be executed as part of the job
8888
steps:
@@ -103,38 +103,3 @@ jobs:
103103
- name: Run iOS build
104104
run: flutter build ios --release --no-codesign
105105
working-directory: ${{env.example-directory}}
106-
107-
tests:
108-
name: Unit-tests
109-
# The type of runner that the job will run on
110-
runs-on: ubuntu-latest
111-
112-
env:
113-
source-directory: ./geolocator_ios
114-
115-
# Steps represent a sequence of tasks that will be executed as part of the job
116-
steps:
117-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
118-
- uses: actions/checkout@v2
119-
120-
# Make sure the stable version of Flutter is available
121-
- uses: subosito/flutter-action@v1
122-
with:
123-
channel: 'stable'
124-
125-
# Download all Flutter packages
126-
- name: Download dependencies
127-
run: flutter pub get
128-
working-directory: ${{env.source-directory}}
129-
130-
# Run all unit-tests with code coverage
131-
- name: Run unit tests
132-
run: flutter test --coverage
133-
working-directory: ${{env.source-directory}}
134-
135-
# Upload code coverage information
136-
- uses: codecov/codecov-action@v1
137-
with:
138-
file: ${{env.source-directory}}/coverage/lcov.info # optional
139-
name: Geolocator (App Facing Package) # optional
140-
fail_ci_if_error: true

geolocator_android/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The official Android implementation of the [geolocator](https://pub.dev/packages
66

77
## Usage
88

9-
Since version 8.0.0 of the [geolocator](https://pub.dev/packages/geolocator) plugin this is the endorsed Android implementation. This means it will automatically be added to your dependencies when you depend on `geolocator: ^8.0.0` in your applications pubspec.yaml.
9+
Since version 7.4.0 of the [geolocator](https://pub.dev/packages/geolocator) plugin this is the endorsed Android implementation. This means it will automatically be added to your dependencies when you depend on `geolocator: ^7.4.0` in your applications pubspec.yaml.
1010

1111
More detailed instructions on using the API can be found in the [README.md](../geolocator/README.md) of the [geolocator](https://pub.dev/packages/geolocator) package.
1212

geolocator_android/example/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# geolocator_example
1+
# geolocator_android_example
22

3-
Demonstrates how to use the geolocator plugin.
3+
Demonstrates how to use the geolocator_android plugin.
44

55
## Getting Started
66

geolocator_android/example/lib/main.dart

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'dart:io' show Platform;
33

44
import 'package:baseflow_plugin_template/baseflow_plugin_template.dart';
55
import 'package:flutter/material.dart';
6-
import 'package:geolocator_android/geolocator.dart';
6+
import 'package:geolocator_platform_interface/geolocator_platform_interface.dart';
77

88
/// Defines the main theme color.
99
final MaterialColor themeMaterialColor =
@@ -37,7 +37,7 @@ class _GeolocatorWidgetState extends State<GeolocatorWidget> {
3737
'Permission denied forever.';
3838
static const String _kPermissionGrantedMessage = 'Permission granted.';
3939

40-
final GeolocatorPlatform _geolocatorPlatform = GeolocatorPlatform.instance;
40+
final GeolocatorPlatform geolocatorAndroid = GeolocatorPlatform.instance;
4141
final List<_PositionItem> _positionItems = <_PositionItem>[];
4242
StreamSubscription<Position>? _positionStreamSubscription;
4343
StreamSubscription<ServiceStatus>? _serviceStatusStreamSubscription;
@@ -186,7 +186,7 @@ class _GeolocatorWidgetState extends State<GeolocatorWidget> {
186186
return;
187187
}
188188

189-
final position = await _geolocatorPlatform.getCurrentPosition();
189+
final position = await geolocatorAndroid.getCurrentPosition();
190190
_updatePositionList(
191191
_PositionItemType.position,
192192
position.toString(),
@@ -198,7 +198,7 @@ class _GeolocatorWidgetState extends State<GeolocatorWidget> {
198198
LocationPermission permission;
199199

200200
// Test if location services are enabled.
201-
serviceEnabled = await _geolocatorPlatform.isLocationServiceEnabled();
201+
serviceEnabled = await geolocatorAndroid.isLocationServiceEnabled();
202202
if (!serviceEnabled) {
203203
// Location services are not enabled don't continue
204204
// accessing the position and request users of the
@@ -211,9 +211,9 @@ class _GeolocatorWidgetState extends State<GeolocatorWidget> {
211211
return false;
212212
}
213213

214-
permission = await _geolocatorPlatform.checkPermission();
214+
permission = await geolocatorAndroid.checkPermission();
215215
if (permission == LocationPermission.denied) {
216-
permission = await _geolocatorPlatform.requestPermission();
216+
permission = await geolocatorAndroid.requestPermission();
217217
if (permission == LocationPermission.denied) {
218218
// Permissions are denied, next time you could try
219219
// requesting permissions again (this is also where
@@ -262,7 +262,7 @@ class _GeolocatorWidgetState extends State<GeolocatorWidget> {
262262

263263
void _toggleServiceStatusStream() {
264264
if (_serviceStatusStreamSubscription == null) {
265-
final serviceStatusStream = _geolocatorPlatform.getServiceStatusStream();
265+
final serviceStatusStream = geolocatorAndroid.getServiceStatusStream();
266266
_serviceStatusStreamSubscription =
267267
serviceStatusStream.handleError((error) {
268268
_serviceStatusStreamSubscription?.cancel();
@@ -284,7 +284,7 @@ class _GeolocatorWidgetState extends State<GeolocatorWidget> {
284284

285285
void _toggleListening() {
286286
if (_positionStreamSubscription == null) {
287-
final positionStream = _geolocatorPlatform.getPositionStream();
287+
final positionStream = geolocatorAndroid.getPositionStream();
288288
_positionStreamSubscription = positionStream.handleError((error) {
289289
_positionStreamSubscription?.cancel();
290290
_positionStreamSubscription = null;
@@ -327,7 +327,7 @@ class _GeolocatorWidgetState extends State<GeolocatorWidget> {
327327
}
328328

329329
void _getLastKnownPosition() async {
330-
final position = await _geolocatorPlatform.getLastKnownPosition();
330+
final position = await geolocatorAndroid.getLastKnownPosition();
331331
if (position != null) {
332332
_updatePositionList(
333333
_PositionItemType.position,
@@ -342,12 +342,12 @@ class _GeolocatorWidgetState extends State<GeolocatorWidget> {
342342
}
343343

344344
void _getLocationAccuracy() async {
345-
final status = await _geolocatorPlatform.getLocationAccuracy();
345+
final status = await geolocatorAndroid.getLocationAccuracy();
346346
_handleLocationAccuracyStatus(status);
347347
}
348348

349349
void _requestTemporaryFullAccuracy() async {
350-
final status = await _geolocatorPlatform.requestTemporaryFullAccuracy(
350+
final status = await geolocatorAndroid.requestTemporaryFullAccuracy(
351351
purposeKey: "TemporaryPreciseAccuracy",
352352
);
353353
_handleLocationAccuracyStatus(status);
@@ -369,7 +369,7 @@ class _GeolocatorWidgetState extends State<GeolocatorWidget> {
369369
}
370370

371371
void _openAppSettings() async {
372-
final opened = await _geolocatorPlatform.openAppSettings();
372+
final opened = await geolocatorAndroid.openAppSettings();
373373
String displayValue;
374374

375375
if (opened) {
@@ -385,7 +385,7 @@ class _GeolocatorWidgetState extends State<GeolocatorWidget> {
385385
}
386386

387387
void _openLocationSettings() async {
388-
final opened = await _geolocatorPlatform.openLocationSettings();
388+
final opened = await geolocatorAndroid.openLocationSettings();
389389
String displayValue;
390390

391391
if (opened) {

0 commit comments

Comments
 (0)