Skip to content

Commit 087103e

Browse files
Fixed formatting
1 parent e446571 commit 087103e

File tree

9 files changed

+59
-30
lines changed

9 files changed

+59
-30
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
## 1.0.1 - 22-06-2021
1+
## 1.0.2 - 22-06-2021
2+
#Fixed
3+
- Formatting
24

5+
## 1.0.1 - 22-06-2021
36
#Added
47
- Pub.dev badge
58

69
## 1.0.0 - 22-06-2021
7-
810
Initial release
911
- Background location tracking
1012
- Nullsafety

coverage/filter_test_coverage.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ class LcovSection {
5050
final file = File(path);
5151
final content = file.readAsLinesSync();
5252
final sb = StringBuffer();
53-
getFilteredBody(body, content).forEach((item) => sb..write(item)..write('\n'));
53+
getFilteredBody(body, content)
54+
.forEach((item) => sb..write(item)..write('\n'));
5455
return sb.toString();
5556
}
5657

example/lib/main.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import 'package:flutter/material.dart';
77
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
88
import 'package:permission_handler/permission_handler.dart';
99

10-
void _backgroundCallback() => BackgroundLocationTrackerManager.handleBackgroundUpdated((data) async => Repo().update(data));
10+
void _backgroundCallback() =>
11+
BackgroundLocationTrackerManager.handleBackgroundUpdated(
12+
(data) async => Repo().update(data));
1113

1214
Future<void> main() async {
1315
WidgetsFlutterBinding.ensureInitialized();
@@ -135,7 +137,8 @@ void sendNotification(String text) {
135137
requestSoundPermission: false,
136138
),
137139
);
138-
FlutterLocalNotificationsPlugin().initialize(settings, onSelectNotification: (data) async {
140+
FlutterLocalNotificationsPlugin().initialize(settings,
141+
onSelectNotification: (data) async {
139142
print('ON CLICK $data'); // ignore: avoid_print
140143
});
141144
FlutterLocalNotificationsPlugin().show(

lib/src/background_location_tracker_manager.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,24 @@ import 'package:background_location_tracker/src/model/background_location_update
77
import 'package:background_location_tracker/src/model/config/background_location_tracker_config.dart';
88
import 'package:background_location_tracker/src/util/logger.dart';
99

10-
typedef LocationUpdateCallback = Future<void> Function(BackgroundLocationUpdateData data);
10+
typedef LocationUpdateCallback = Future<void> Function(
11+
BackgroundLocationUpdateData data);
1112

1213
class BackgroundLocationTrackerManager {
13-
static Future<void> initialize(Function callback, {BackgroundLocationTrackerConfig? config}) {
14+
static Future<void> initialize(Function callback,
15+
{BackgroundLocationTrackerConfig? config}) {
1416
final pluginConfig = config ??= const BackgroundLocationTrackerConfig();
1517
BackgroundLocationTrackerLogger.enableLogging = pluginConfig.loggingEnabled;
1618
return ForegroundChannel.initialize(callback, config: pluginConfig);
1719
}
1820

1921
static Future<bool> isTracking() async => ForegroundChannel.isTracking();
2022

21-
static Future<void> startTracking({AndroidConfig? config}) async => ForegroundChannel.startTracking(config: config);
23+
static Future<void> startTracking({AndroidConfig? config}) async =>
24+
ForegroundChannel.startTracking(config: config);
2225

2326
static Future<void> stopTracking() async => ForegroundChannel.stopTracking();
2427

25-
static void handleBackgroundUpdated(LocationUpdateCallback callback) => BackgroundChannel.handleBackgroundUpdated(callback);
28+
static void handleBackgroundUpdated(LocationUpdateCallback callback) =>
29+
BackgroundChannel.handleBackgroundUpdated(callback);
2630
}

lib/src/channel/background_channel.dart

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ import 'package:flutter/services.dart';
44
import 'package:flutter/widgets.dart';
55

66
class BackgroundChannel {
7-
static const _BACKGROUND_CHANNEL_NAME = 'com.icapps.background_location_tracker/background_channel';
7+
static const _BACKGROUND_CHANNEL_NAME =
8+
'com.icapps.background_location_tracker/background_channel';
89
static const _backgroundChannel = MethodChannel(_BACKGROUND_CHANNEL_NAME);
910

10-
static void handleBackgroundUpdated(LocationUpdateCallback callback, {bool enableLogging = false}) {
11+
static void handleBackgroundUpdated(LocationUpdateCallback callback,
12+
{bool enableLogging = false}) {
1113
WidgetsFlutterBinding.ensureInitialized();
1214
_backgroundChannel
1315
..setMethodCallHandler((call) async {
1416
switch (call.method) {
1517
case 'onLocationUpdate':
16-
return handleLocationUpdate(call, callback, enableLogging: enableLogging);
18+
return handleLocationUpdate(call, callback,
19+
enableLogging: enableLogging);
1720
default:
1821
return false;
1922
}
@@ -23,9 +26,12 @@ class BackgroundChannel {
2326
);
2427
}
2528

26-
static Future<bool> handleLocationUpdate(MethodCall call, LocationUpdateCallback callback, {bool enableLogging = false}) async {
29+
static Future<bool> handleLocationUpdate(
30+
MethodCall call, LocationUpdateCallback callback,
31+
{bool enableLogging = false}) async {
2732
final data = call.arguments as Map<dynamic, dynamic>; // ignore: avoid_as
28-
final isLoggingEnabled = data['logging_enabled'] as bool; // ignore: avoid_as
33+
final isLoggingEnabled =
34+
data['logging_enabled'] as bool; // ignore: avoid_as
2935
BackgroundLocationTrackerLogger.enableLogging = isLoggingEnabled;
3036
BackgroundLocationTrackerLogger.log('locationUpdate: ${call.arguments}');
3137
final lat = data['lat'] as double; // ignore: avoid_as

lib/src/channel/foreground_channel.dart

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@ import 'package:background_location_tracker/src/model/config/background_location
44
import 'package:flutter/services.dart';
55

66
class ForegroundChannel {
7-
static const _FOREGROUND_CHANNEL_NAME = 'com.icapps.background_location_tracker/foreground_channel';
7+
static const _FOREGROUND_CHANNEL_NAME =
8+
'com.icapps.background_location_tracker/foreground_channel';
89

9-
static const MethodChannel _foregroundChannel = MethodChannel(_FOREGROUND_CHANNEL_NAME);
10+
static const MethodChannel _foregroundChannel =
11+
MethodChannel(_FOREGROUND_CHANNEL_NAME);
1012

11-
static Future<void> initialize(Function callbackDispatcher, {required BackgroundLocationTrackerConfig config}) async {
13+
static Future<void> initialize(Function callbackDispatcher,
14+
{required BackgroundLocationTrackerConfig config}) async {
1215
final callback = PluginUtilities.getCallbackHandle(callbackDispatcher);
1316
if (callback == null) {
14-
throw ArgumentError('The callbackDispatcher needs to be either a static function or a top level function to be accessible as a Flutter entry point.');
17+
throw ArgumentError(
18+
'The callbackDispatcher needs to be either a static function or a top level function to be accessible as a Flutter entry point.');
1519
}
1620
final handle = callback.toRawHandle();
1721
await _foregroundChannel.invokeMethod<void>(
@@ -20,11 +24,16 @@ class ForegroundChannel {
2024
'callback_handle': handle,
2125
'logging_enabled': config.loggingEnabled,
2226
'android_config_channel_name': config.androidConfig.channelName,
23-
'android_config_notification_body': config.androidConfig.notificationBody,
24-
'android_config_notification_icon': config.androidConfig.notificationIcon,
25-
'android_config_enable_notification_location_updates': config.androidConfig.enableNotificationLocationUpdates,
26-
'android_config_cancel_tracking_action_text': config.androidConfig.cancelTrackingActionText,
27-
'android_config_enable_cancel_tracking_action': config.androidConfig.enableCancelTrackingAction,
27+
'android_config_notification_body':
28+
config.androidConfig.notificationBody,
29+
'android_config_notification_icon':
30+
config.androidConfig.notificationIcon,
31+
'android_config_enable_notification_location_updates':
32+
config.androidConfig.enableNotificationLocationUpdates,
33+
'android_config_cancel_tracking_action_text':
34+
config.androidConfig.cancelTrackingActionText,
35+
'android_config_enable_cancel_tracking_action':
36+
config.androidConfig.enableCancelTrackingAction,
2837
},
2938
);
3039
}
@@ -40,12 +49,16 @@ class ForegroundChannel {
4049
{
4150
'android_config_notification_body': config?.notificationBody,
4251
'android_config_notification_icon': config?.notificationIcon,
43-
'android_config_enable_notification_location_updates': config?.enableNotificationLocationUpdates,
44-
'android_config_cancel_tracking_action_text': config?.cancelTrackingActionText,
45-
'android_config_enable_cancel_tracking_action': config?.enableCancelTrackingAction,
52+
'android_config_enable_notification_location_updates':
53+
config?.enableNotificationLocationUpdates,
54+
'android_config_cancel_tracking_action_text':
55+
config?.cancelTrackingActionText,
56+
'android_config_enable_cancel_tracking_action':
57+
config?.enableCancelTrackingAction,
4658
},
4759
);
4860
}
4961

50-
static Future<void> stopTracking() => _foregroundChannel.invokeMethod('stopTracking');
62+
static Future<void> stopTracking() =>
63+
_foregroundChannel.invokeMethod('stopTracking');
5164
}

lib/src/model/config/background_location_tracker_config.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'package:background_location_tracker/src/model/config/android_config.dart
66
/// - loggingEnabled: false
77
/// - androidConfig: AndroidConfig()
88
class BackgroundLocationTrackerConfig {
9-
109
/// loggingEnabled will be used for dart & native logs.
1110
final bool loggingEnabled;
1211

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: background_location_tracker
22
description: A Flutter plugin that allows you to track the background location for Android & iOS
33
repository: https://github.com/icapps/flutter-background-location-tracker
4-
version: 1.0.1
4+
version: 1.0.2
55

66
environment:
77
sdk: ">=2.12.0 <3.0.0"

tool/travis/test_coverage_helper.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ const packageName = 'background_location_tracker';
44

55
void main() {
66
Logger.debug('====');
7-
Logger.debug('First create a file with all other files imported so flutter test coverage uses all files');
7+
Logger.debug(
8+
'First create a file with all other files imported so flutter test coverage uses all files');
89
Logger.debug('====');
910
final testDir = Directory('test');
1011
if (!testDir.existsSync()) {

0 commit comments

Comments
 (0)