@josuelmm/capacitor-background-geolocation 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/JosuelmmCapacitorBackgroundGeolocation.podspec +34 -0
- package/LICENSE +17 -0
- package/NOTICE.md +32 -0
- package/Package.swift +45 -0
- package/README.md +402 -0
- package/android/build.gradle +79 -0
- package/android/proguard-rules.pro +1 -0
- package/android/src/main/AndroidManifest.xml +83 -0
- package/android/src/main/java/com/evgenii/jsevaluator/HandlerWrapper.java +18 -0
- package/android/src/main/java/com/evgenii/jsevaluator/JavaScriptInterface.java +22 -0
- package/android/src/main/java/com/evgenii/jsevaluator/JsEvaluator.java +133 -0
- package/android/src/main/java/com/evgenii/jsevaluator/JsFunctionCallFormatter.java +37 -0
- package/android/src/main/java/com/evgenii/jsevaluator/WebViewWrapper.java +71 -0
- package/android/src/main/java/com/evgenii/jsevaluator/interfaces/CallJavaResultInterface.java +8 -0
- package/android/src/main/java/com/evgenii/jsevaluator/interfaces/HandlerWrapperInterface.java +5 -0
- package/android/src/main/java/com/evgenii/jsevaluator/interfaces/JsCallback.java +10 -0
- package/android/src/main/java/com/evgenii/jsevaluator/interfaces/JsEvaluatorInterface.java +18 -0
- package/android/src/main/java/com/evgenii/jsevaluator/interfaces/WebViewWrapperInterface.java +14 -0
- package/android/src/main/java/com/josuelmm/capacitor/backgroundgeolocation/BackgroundGeolocationPlugin.java +898 -0
- package/android/src/main/java/com/josuelmm/capacitor/backgroundgeolocation/ConfigMapper.java +303 -0
- package/android/src/main/java/com/josuelmm/capacitor/backgroundgeolocation/HeadlessTaskRegistry.java +34 -0
- package/android/src/main/java/com/josuelmm/capacitor/backgroundgeolocation/JsEvaluatorTaskRunner.java +63 -0
- package/android/src/main/java/com/marianhello/bgloc/BackgroundGeolocationFacade.java +699 -0
- package/android/src/main/java/com/marianhello/bgloc/BootCompletedReceiver.java +103 -0
- package/android/src/main/java/com/marianhello/bgloc/Config.java +1155 -0
- package/android/src/main/java/com/marianhello/bgloc/ConnectivityListener.java +5 -0
- package/android/src/main/java/com/marianhello/bgloc/HttpPostService.java +362 -0
- package/android/src/main/java/com/marianhello/bgloc/LocationManager.java +138 -0
- package/android/src/main/java/com/marianhello/bgloc/PluginDelegate.java +45 -0
- package/android/src/main/java/com/marianhello/bgloc/PluginException.java +38 -0
- package/android/src/main/java/com/marianhello/bgloc/PostLocationTask.java +238 -0
- package/android/src/main/java/com/marianhello/bgloc/ResourceResolver.java +55 -0
- package/android/src/main/java/com/marianhello/bgloc/data/AbstractLocationTemplate.java +69 -0
- package/android/src/main/java/com/marianhello/bgloc/data/ArrayListLocationTemplate.java +88 -0
- package/android/src/main/java/com/marianhello/bgloc/data/BackgroundActivity.java +108 -0
- package/android/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java +1088 -0
- package/android/src/main/java/com/marianhello/bgloc/data/ConfigJsonMapper.java +211 -0
- package/android/src/main/java/com/marianhello/bgloc/data/ConfigurationDAO.java +13 -0
- package/android/src/main/java/com/marianhello/bgloc/data/DAOFactory.java +17 -0
- package/android/src/main/java/com/marianhello/bgloc/data/HashMapLocationTemplate.java +82 -0
- package/android/src/main/java/com/marianhello/bgloc/data/LocationDAO.java +27 -0
- package/android/src/main/java/com/marianhello/bgloc/data/LocationTemplate.java +12 -0
- package/android/src/main/java/com/marianhello/bgloc/data/LocationTemplateFactory.java +71 -0
- package/android/src/main/java/com/marianhello/bgloc/data/LocationTransform.java +19 -0
- package/android/src/main/java/com/marianhello/bgloc/data/SessionLocationDAO.java +18 -0
- package/android/src/main/java/com/marianhello/bgloc/data/provider/ContentProviderLocationDAO.java +406 -0
- package/android/src/main/java/com/marianhello/bgloc/data/provider/LocationContentProvider.java +321 -0
- package/android/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteConfigurationContract.java +94 -0
- package/android/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteConfigurationDAO.java +227 -0
- package/android/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteLocationContract.java +122 -0
- package/android/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteLocationDAO.java +550 -0
- package/android/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteOpenHelper.java +189 -0
- package/android/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteSessionContract.java +74 -0
- package/android/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteSessionLocationDAO.java +169 -0
- package/android/src/main/java/com/marianhello/bgloc/driving/DrivingEventsDetector.java +265 -0
- package/android/src/main/java/com/marianhello/bgloc/headless/AbstractTaskRunner.java +15 -0
- package/android/src/main/java/com/marianhello/bgloc/headless/ActivityTask.java +48 -0
- package/android/src/main/java/com/marianhello/bgloc/headless/JsCallback.java +10 -0
- package/android/src/main/java/com/marianhello/bgloc/headless/LocationTask.java +60 -0
- package/android/src/main/java/com/marianhello/bgloc/headless/StationaryTask.java +25 -0
- package/android/src/main/java/com/marianhello/bgloc/headless/Task.java +8 -0
- package/android/src/main/java/com/marianhello/bgloc/headless/TaskRunner.java +5 -0
- package/android/src/main/java/com/marianhello/bgloc/headless/TaskRunnerFactory.java +8 -0
- package/android/src/main/java/com/marianhello/bgloc/http/UrlTemplateResolver.java +115 -0
- package/android/src/main/java/com/marianhello/bgloc/oem/BatteryOemHelper.java +214 -0
- package/android/src/main/java/com/marianhello/bgloc/provider/AbstractLocationProvider.java +218 -0
- package/android/src/main/java/com/marianhello/bgloc/provider/ActivityRecognitionLocationProvider.java +385 -0
- package/android/src/main/java/com/marianhello/bgloc/provider/DistanceFilterLocationProvider.java +685 -0
- package/android/src/main/java/com/marianhello/bgloc/provider/LocationProvider.java +32 -0
- package/android/src/main/java/com/marianhello/bgloc/provider/LocationProviderFactory.java +47 -0
- package/android/src/main/java/com/marianhello/bgloc/provider/ProviderDelegate.java +12 -0
- package/android/src/main/java/com/marianhello/bgloc/provider/RawLocationProvider.java +175 -0
- package/android/src/main/java/com/marianhello/bgloc/sensor/SensorFusionDetector.java +199 -0
- package/android/src/main/java/com/marianhello/bgloc/service/LocationService.java +16 -0
- package/android/src/main/java/com/marianhello/bgloc/service/LocationServiceImpl.java +1531 -0
- package/android/src/main/java/com/marianhello/bgloc/service/LocationServiceInfo.java +6 -0
- package/android/src/main/java/com/marianhello/bgloc/service/LocationServiceInfoImpl.java +41 -0
- package/android/src/main/java/com/marianhello/bgloc/service/LocationServiceIntentBuilder.java +203 -0
- package/android/src/main/java/com/marianhello/bgloc/service/LocationServiceProxy.java +156 -0
- package/android/src/main/java/com/marianhello/bgloc/sync/AccountHelper.java +39 -0
- package/android/src/main/java/com/marianhello/bgloc/sync/Authenticator.java +68 -0
- package/android/src/main/java/com/marianhello/bgloc/sync/AuthenticatorService.java +28 -0
- package/android/src/main/java/com/marianhello/bgloc/sync/BatchManager.java +311 -0
- package/android/src/main/java/com/marianhello/bgloc/sync/NotificationHelper.java +148 -0
- package/android/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java +301 -0
- package/android/src/main/java/com/marianhello/bgloc/sync/SyncService.java +68 -0
- package/android/src/main/java/com/marianhello/logging/DBLogReader.java +208 -0
- package/android/src/main/java/com/marianhello/logging/LogEntry.java +99 -0
- package/android/src/main/java/com/marianhello/logging/LoggerManager.java +70 -0
- package/android/src/main/java/com/marianhello/logging/UncaughtExceptionLogger.java +36 -0
- package/android/src/main/java/com/marianhello/utils/CloneHelper.java +22 -0
- package/android/src/main/java/com/marianhello/utils/Convert.java +56 -0
- package/android/src/main/java/com/marianhello/utils/TextUtils.java +72 -0
- package/android/src/main/java/com/marianhello/utils/ToneGenerator.java +68 -0
- package/android/src/main/java/org/apache/commons/io/Charsets.java +153 -0
- package/android/src/main/java/org/apache/commons/io/input/ReversedLinesFileReader.java +344 -0
- package/android/src/main/java/org/chromium/content/browser/ThreadUtils.java +134 -0
- package/android/src/main/java/ru/andremoniy/sqlbuilder/SqlExpression.java +398 -0
- package/android/src/main/java/ru/andremoniy/sqlbuilder/SqlSelectStatement.java +671 -0
- package/android/src/main/java/ru/andremoniy/sqlbuilder/SqlStatement.java +29 -0
- package/android/src/main/java/ru/andremoniy/utils/TextUtils.java +61 -0
- package/android/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/android/src/main/res/values/strings.xml +15 -0
- package/android/src/main/res/xml/authenticator.xml +7 -0
- package/android/src/main/res/xml/syncadapter.xml +9 -0
- package/dist/esm/definitions.d.ts +1052 -0
- package/dist/esm/definitions.js +142 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/index.js +23 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +92 -0
- package/dist/esm/web.js +242 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +415 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +418 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Sources/BackgroundGeolocationPlugin/BackgroundGeolocationPlugin-Bridging-Header.h +18 -0
- package/ios/Sources/BackgroundGeolocationPlugin/BackgroundGeolocationPlugin.m +52 -0
- package/ios/Sources/BackgroundGeolocationPlugin/BackgroundGeolocationPlugin.swift +750 -0
- package/ios/Tests/BackgroundGeolocationPluginTests/BackgroundGeolocationPluginTests.swift +12 -0
- package/ios/common/BackgroundGeolocation/CocoaLumberjack.h +1945 -0
- package/ios/common/BackgroundGeolocation/CocoaLumberjack.m +5255 -0
- package/ios/common/BackgroundGeolocation/FMDB.h +2357 -0
- package/ios/common/BackgroundGeolocation/FMDB.m +2672 -0
- package/ios/common/BackgroundGeolocation/FMDBLogger.h +42 -0
- package/ios/common/BackgroundGeolocation/FMDBLogger.m +264 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTUHeadingRequest.h +41 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTUHeadingRequest.m +68 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationManager+Internal.h +33 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationManager.h +178 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationManager.m +1025 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationRequest.h +103 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationRequest.m +238 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTULocationRequestDefines.h +163 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTURequestIDGenerator.h +39 -0
- package/ios/common/BackgroundGeolocation/INTULocationManager/INTURequestIDGenerator.m +37 -0
- package/ios/common/BackgroundGeolocation/MAURAbstractLocationProvider.h +51 -0
- package/ios/common/BackgroundGeolocation/MAURAbstractLocationProvider.m +53 -0
- package/ios/common/BackgroundGeolocation/MAURActivity.h +23 -0
- package/ios/common/BackgroundGeolocation/MAURActivity.m +52 -0
- package/ios/common/BackgroundGeolocation/MAURActivityLocationProvider.h +18 -0
- package/ios/common/BackgroundGeolocation/MAURActivityLocationProvider.m +340 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundGeolocationFacade.h +88 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundGeolocationFacade.m +1193 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundSync.h +46 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundSync.m +283 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundTaskManager.h +25 -0
- package/ios/common/BackgroundGeolocation/MAURBackgroundTaskManager.m +105 -0
- package/ios/common/BackgroundGeolocation/MAURConfig.h +99 -0
- package/ios/common/BackgroundGeolocation/MAURConfig.m +636 -0
- package/ios/common/BackgroundGeolocation/MAURConfigurationContract.h +53 -0
- package/ios/common/BackgroundGeolocation/MAURConfigurationContract.m +54 -0
- package/ios/common/BackgroundGeolocation/MAURDistanceFilterLocationProvider.h +20 -0
- package/ios/common/BackgroundGeolocation/MAURDistanceFilterLocationProvider.m +550 -0
- package/ios/common/BackgroundGeolocation/MAURGeolocationOpenHelper.h +17 -0
- package/ios/common/BackgroundGeolocation/MAURGeolocationOpenHelper.m +124 -0
- package/ios/common/BackgroundGeolocation/MAURLocation.h +73 -0
- package/ios/common/BackgroundGeolocation/MAURLocation.m +392 -0
- package/ios/common/BackgroundGeolocation/MAURLocationContract.h +38 -0
- package/ios/common/BackgroundGeolocation/MAURLocationContract.m +39 -0
- package/ios/common/BackgroundGeolocation/MAURLocationManager.h +53 -0
- package/ios/common/BackgroundGeolocation/MAURLocationManager.m +305 -0
- package/ios/common/BackgroundGeolocation/MAURLogReader.h +26 -0
- package/ios/common/BackgroundGeolocation/MAURLogReader.m +122 -0
- package/ios/common/BackgroundGeolocation/MAURLogging.h +19 -0
- package/ios/common/BackgroundGeolocation/MAURPostLocationTask.h +53 -0
- package/ios/common/BackgroundGeolocation/MAURPostLocationTask.m +367 -0
- package/ios/common/BackgroundGeolocation/MAURProviderDelegate.h +52 -0
- package/ios/common/BackgroundGeolocation/MAURRawLocationProvider.h +18 -0
- package/ios/common/BackgroundGeolocation/MAURRawLocationProvider.m +138 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteConfigurationDAO.h +26 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteConfigurationDAO.m +335 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteHelper.h +57 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteHelper.m +93 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteLocationDAO.h +52 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteLocationDAO.m +520 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteOpenHelper.h +32 -0
- package/ios/common/BackgroundGeolocation/MAURSQLiteOpenHelper.m +276 -0
- package/ios/common/BackgroundGeolocation/MAURSensorFusionDetector.h +41 -0
- package/ios/common/BackgroundGeolocation/MAURSensorFusionDetector.m +137 -0
- package/ios/common/BackgroundGeolocation/MAURSessionLocationContract.h +29 -0
- package/ios/common/BackgroundGeolocation/MAURSessionLocationContract.m +31 -0
- package/ios/common/BackgroundGeolocation/MAURSessionLocationDAO.h +25 -0
- package/ios/common/BackgroundGeolocation/MAURSessionLocationDAO.m +153 -0
- package/ios/common/BackgroundGeolocation/MAURUncaughtExceptionLogger.h +20 -0
- package/ios/common/BackgroundGeolocation/MAURUncaughtExceptionLogger.m +62 -0
- package/ios/common/BackgroundGeolocation/MAURUrlTemplateResolver.h +31 -0
- package/ios/common/BackgroundGeolocation/MAURUrlTemplateResolver.m +107 -0
- package/ios/common/BackgroundGeolocation/Reachability.h +102 -0
- package/ios/common/BackgroundGeolocation/Reachability.m +475 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/README.md +170 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/ext/NSString+ZIMString.h +55 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/ext/NSString+ZIMString.m +47 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlDataManipulationCommand.h +27 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlExpression.h +250 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlExpression.m +259 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlSelectStatement.h +360 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlSelectStatement.m +427 -0
- package/ios/common/BackgroundGeolocation/SQLQueryBuilder/sql/ZIMSqlStatement.h +37 -0
- package/ios/common/BackgroundGeolocation/module.modulemap +16 -0
- package/package.json +82 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MAURLocationManager.h
|
|
3
|
+
//
|
|
4
|
+
// Created by Jinru on 12/19/09.
|
|
5
|
+
// Copyright 2009 Arizona State University. All rights reserved.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <UIKit/UIKit.h>
|
|
9
|
+
#import <CoreLocation/CoreLocation.h>
|
|
10
|
+
#import "MAURProviderDelegate.h"
|
|
11
|
+
|
|
12
|
+
// protocol for sending location updates to another view controller
|
|
13
|
+
@protocol MAURLocationManagerDelegate
|
|
14
|
+
@required
|
|
15
|
+
- (void) onAuthorizationChanged:(MAURLocationAuthorizationStatus)authStatus;
|
|
16
|
+
- (void) onLocationsChanged:(NSArray*)locations;
|
|
17
|
+
- (void) onError:(NSError*)error;
|
|
18
|
+
- (void) onLocationPause:(CLLocationManager*)manager;
|
|
19
|
+
- (void) onLocationResume:(CLLocationManager*)manager;
|
|
20
|
+
- (void) onRegionExit:(CLRegion*)region;
|
|
21
|
+
@end
|
|
22
|
+
|
|
23
|
+
@interface MAURLocationManager : NSObject <CLLocationManagerDelegate> {
|
|
24
|
+
|
|
25
|
+
CLLocationManager* locationManager;
|
|
26
|
+
__weak id delegate;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@property (nonatomic, strong) CLLocationManager* locationManager;
|
|
30
|
+
@property (nonatomic, weak) id delegate;
|
|
31
|
+
|
|
32
|
+
- (BOOL) start:(NSError * __autoreleasing *)outError;
|
|
33
|
+
- (BOOL) stop:(NSError * __autoreleasing *)outError;
|
|
34
|
+
- (BOOL) startMonitoringSignificantLocationChanges;
|
|
35
|
+
- (BOOL) stopMonitoringSignificantLocationChanges;
|
|
36
|
+
- (void) startMonitoringForRegion:(CLRegion*)region;
|
|
37
|
+
- (void) stopMonitoringForRegion:(CLRegion*)region;
|
|
38
|
+
- (void) stopMonitoringForRegionIdentifier:(NSString*)identifier;
|
|
39
|
+
- (void) stopMonitoringAllRegions;
|
|
40
|
+
- (NSSet<__kindof CLRegion *>*) monitoredRegions;
|
|
41
|
+
- (void) setShowsBackgroundLocationIndicator:(BOOL)shows;
|
|
42
|
+
- (void) setPausesLocationUpdatesAutomatically:(BOOL)newPausesLocationsUpdatesAutomatically;
|
|
43
|
+
- (BOOL) pausesLocationUpdatesAutomatically;
|
|
44
|
+
- (void) setDistanceFilter:(CLLocationDistance)newDistanceFiler;
|
|
45
|
+
- (CLLocationDistance) distanceFilter;
|
|
46
|
+
- (void) setActivityType:(CLActivityType)newActivityType;
|
|
47
|
+
- (CLActivityType) activityType;
|
|
48
|
+
- (void) setDesiredAccuracy:(CLLocationAccuracy)newDesiredAccuracy;
|
|
49
|
+
- (CLLocationAccuracy) desiredAccuracy;
|
|
50
|
+
|
|
51
|
+
+ (MAURLocationManager*)sharedInstance; // Singleton method
|
|
52
|
+
|
|
53
|
+
@end
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MAURLocationManager.m
|
|
3
|
+
//
|
|
4
|
+
// Created by Jinru on 12/19/09.
|
|
5
|
+
// Copyright 2009 Arizona State University. All rights reserved.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import "MAURLocation.h"
|
|
9
|
+
#import "MAURLocationManager.h"
|
|
10
|
+
|
|
11
|
+
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
|
|
12
|
+
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
|
|
13
|
+
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
|
|
14
|
+
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
|
|
15
|
+
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
|
|
16
|
+
|
|
17
|
+
#define LOCATION_DENIED "User denied use of location services."
|
|
18
|
+
#define LOCATION_RESTRICTED "Application's use of location services is restricted."
|
|
19
|
+
#define LOCATION_NOT_DETERMINED "User undecided on application's use of location services."
|
|
20
|
+
|
|
21
|
+
static MAURLocationManager* sharedCLDelegate = nil;
|
|
22
|
+
static NSString *const TAG = @"MAURLocationManager";
|
|
23
|
+
static NSString *const Domain = @"com.marianhello";
|
|
24
|
+
|
|
25
|
+
@implementation MAURLocationManager
|
|
26
|
+
@synthesize locationManager, delegate;
|
|
27
|
+
|
|
28
|
+
- (id)init
|
|
29
|
+
{
|
|
30
|
+
self = [super init];
|
|
31
|
+
if (self != nil) {
|
|
32
|
+
locationManager = [[CLLocationManager alloc] init];
|
|
33
|
+
|
|
34
|
+
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"9.0")) {
|
|
35
|
+
locationManager.allowsBackgroundLocationUpdates = YES;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
locationManager.delegate = self;
|
|
39
|
+
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
|
|
40
|
+
}
|
|
41
|
+
return self;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
- (BOOL) start:(NSError * __autoreleasing *)outError
|
|
45
|
+
{
|
|
46
|
+
NSAssert([NSThread isMainThread], @"%@ %@", TAG, @"should only be called from the main thread.");
|
|
47
|
+
|
|
48
|
+
NSUInteger authStatus;
|
|
49
|
+
|
|
50
|
+
if ([CLLocationManager respondsToSelector:@selector(authorizationStatus)]) { // iOS 4.2+
|
|
51
|
+
authStatus = [CLLocationManager authorizationStatus];
|
|
52
|
+
|
|
53
|
+
if (authStatus == kCLAuthorizationStatusDenied) {
|
|
54
|
+
if (outError != NULL) {
|
|
55
|
+
NSDictionary *errorDictionary = @{
|
|
56
|
+
NSLocalizedDescriptionKey: NSLocalizedString(@LOCATION_DENIED, nil)
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
*outError = [NSError errorWithDomain:Domain code:MAURBGPermissionDenied userInfo:errorDictionary];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return NO;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (authStatus == kCLAuthorizationStatusRestricted) {
|
|
66
|
+
if (outError != NULL) {
|
|
67
|
+
NSDictionary *errorDictionary = @{
|
|
68
|
+
NSLocalizedDescriptionKey: NSLocalizedString(@LOCATION_RESTRICTED, nil)
|
|
69
|
+
};
|
|
70
|
+
*outError = [NSError errorWithDomain:Domain code:MAURBGPermissionDenied userInfo:errorDictionary];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return NO;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
#ifdef __IPHONE_8_0
|
|
77
|
+
// we do startUpdatingLocation even though we might not get permissions granted
|
|
78
|
+
// we can stop later on when recieved callback on user denial
|
|
79
|
+
// it's neccessary to start call startUpdatingLocation in iOS < 8.0 to show user prompt!
|
|
80
|
+
|
|
81
|
+
if (authStatus == kCLAuthorizationStatusNotDetermined) {
|
|
82
|
+
if ([locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) { //iOS 8.0+
|
|
83
|
+
[locationManager requestAlwaysAuthorization];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
#endif
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
[locationManager startUpdatingLocation];
|
|
90
|
+
return YES;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
- (BOOL) stop:(NSError * __autoreleasing *)outError
|
|
94
|
+
{
|
|
95
|
+
NSAssert([NSThread isMainThread], @"%@ %@", TAG, @"should only be called from the main thread.");
|
|
96
|
+
[locationManager stopUpdatingLocation];
|
|
97
|
+
return YES;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
- (BOOL) startMonitoringSignificantLocationChanges
|
|
101
|
+
{
|
|
102
|
+
NSAssert([NSThread isMainThread], @"%@ %@", TAG, @"should only be called from the main thread.");
|
|
103
|
+
[locationManager startMonitoringSignificantLocationChanges];
|
|
104
|
+
return YES;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
- (BOOL) stopMonitoringSignificantLocationChanges
|
|
108
|
+
{
|
|
109
|
+
NSAssert([NSThread isMainThread], @"%@ %@", TAG, @"should only be called from the main thread.");
|
|
110
|
+
[locationManager stopMonitoringSignificantLocationChanges];
|
|
111
|
+
return YES;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
- (void) startMonitoringForRegion:(CLRegion*)region
|
|
115
|
+
{
|
|
116
|
+
NSAssert([NSThread isMainThread], @"%@ %@", TAG, @"should only be called from the main thread.");
|
|
117
|
+
[locationManager startMonitoringForRegion:region];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
- (void) stopMonitoringForRegion:(CLRegion*)region
|
|
121
|
+
{
|
|
122
|
+
NSAssert([NSThread isMainThread], @"%@ %@", TAG, @"should only be called from the main thread.");
|
|
123
|
+
[locationManager stopMonitoringForRegion:region];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
- (void) stopMonitoringForRegionIdentifier:(NSString*)identifier
|
|
127
|
+
{
|
|
128
|
+
NSAssert([NSThread isMainThread], @"%@ %@", TAG, @"should only be called from the main thread.");
|
|
129
|
+
for (CLRegion *region in [locationManager monitoredRegions]){
|
|
130
|
+
if([region.identifier isEqualToString:identifier]){
|
|
131
|
+
[locationManager stopMonitoringForRegion:region];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
- (void) stopMonitoringAllRegions
|
|
137
|
+
{
|
|
138
|
+
NSAssert([NSThread isMainThread], @"%@ %@", TAG, @"should only be called from the main thread.");
|
|
139
|
+
for (CLRegion *region in [locationManager monitoredRegions]) {
|
|
140
|
+
[locationManager stopMonitoringForRegion:region];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
- (NSSet<__kindof CLRegion *>*) monitoredRegions
|
|
145
|
+
{
|
|
146
|
+
return locationManager.monitoredRegions;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
- (void) setShowsBackgroundLocationIndicator:(BOOL)shows
|
|
150
|
+
{
|
|
151
|
+
if (@available(iOS 11, *)) {
|
|
152
|
+
locationManager.showsBackgroundLocationIndicator = shows;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
- (void) setPausesLocationUpdatesAutomatically:(BOOL)newPausesLocationsUpdatesAutomatically
|
|
157
|
+
{
|
|
158
|
+
locationManager.pausesLocationUpdatesAutomatically = newPausesLocationsUpdatesAutomatically;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
- (BOOL) pausesLocationUpdatesAutomatically
|
|
162
|
+
{
|
|
163
|
+
return locationManager.pausesLocationUpdatesAutomatically;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
- (void) setDistanceFilter:(CLLocationDistance)newDistanceFiler
|
|
167
|
+
{
|
|
168
|
+
locationManager.distanceFilter = newDistanceFiler;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
- (CLLocationDistance) distanceFilter
|
|
172
|
+
{
|
|
173
|
+
return locationManager.distanceFilter;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
- (void) setActivityType:(CLActivityType)newActivityType
|
|
177
|
+
{
|
|
178
|
+
locationManager.activityType = newActivityType;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
- (CLActivityType) activityType
|
|
182
|
+
{
|
|
183
|
+
return locationManager.activityType;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
- (void) setDesiredAccuracy:(CLLocationAccuracy)newDesiredAccuracy
|
|
187
|
+
{
|
|
188
|
+
locationManager.desiredAccuracy = newDesiredAccuracy;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
- (CLLocationAccuracy) desiredAccuracy
|
|
192
|
+
{
|
|
193
|
+
return locationManager.desiredAccuracy;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
#pragma mark -
|
|
198
|
+
#pragma mark CLLocationManagerDelegate Methods
|
|
199
|
+
- (void) locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
|
|
200
|
+
{
|
|
201
|
+
[self.delegate onLocationsChanged:locations];
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
- (void) locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
|
|
205
|
+
{
|
|
206
|
+
if (self.delegate && [self.delegate respondsToSelector:@selector(onError:)]) {
|
|
207
|
+
NSDictionary *errorDictionary = @{
|
|
208
|
+
NSUnderlyingErrorKey : error
|
|
209
|
+
};
|
|
210
|
+
NSError *outError = [NSError errorWithDomain:Domain code:MAURBGServiceError userInfo:errorDictionary];
|
|
211
|
+
|
|
212
|
+
[self.delegate onError:outError];
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// v4.5.2: iOS 14+ delegate callback. The legacy
|
|
217
|
+
// `locationManager:didChangeAuthorizationStatus:` is deprecated in iOS 14 but
|
|
218
|
+
// still delivered alongside this one, so we ignore the legacy variant when
|
|
219
|
+
// running on iOS 14+ to avoid double-notifying delegates (RAW + ACTIVITY
|
|
220
|
+
// providers go through this MAURLocationManager singleton).
|
|
221
|
+
- (void) locationManagerDidChangeAuthorization:(CLLocationManager *)manager API_AVAILABLE(ios(14.0))
|
|
222
|
+
{
|
|
223
|
+
[self maurDispatchAuthorizationStatus:manager.authorizationStatus];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
- (void) locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
|
|
227
|
+
{
|
|
228
|
+
if (@available(iOS 14.0, *)) {
|
|
229
|
+
return; // delivered by locationManagerDidChangeAuthorization: above
|
|
230
|
+
}
|
|
231
|
+
[self maurDispatchAuthorizationStatus:status];
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
- (void) maurDispatchAuthorizationStatus:(CLAuthorizationStatus)status
|
|
235
|
+
{
|
|
236
|
+
MAURLocationAuthorizationStatus authStatus;
|
|
237
|
+
|
|
238
|
+
switch(status) {
|
|
239
|
+
case kCLAuthorizationStatusRestricted:
|
|
240
|
+
case kCLAuthorizationStatusDenied:
|
|
241
|
+
authStatus = MAURLocationAuthorizationDenied;
|
|
242
|
+
break;
|
|
243
|
+
case kCLAuthorizationStatusAuthorizedAlways:
|
|
244
|
+
authStatus = MAURLocationAuthorizationAlways;
|
|
245
|
+
break;
|
|
246
|
+
case kCLAuthorizationStatusAuthorizedWhenInUse:
|
|
247
|
+
authStatus = MAURLocationAuthorizationForeground;
|
|
248
|
+
break;
|
|
249
|
+
default:
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (self.delegate && [self.delegate respondsToSelector:@selector(onAuthorizationChanged:)]) {
|
|
254
|
+
[self.delegate onAuthorizationChanged:authStatus];
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
- (void) locationManagerDidPauseLocationUpdates:(CLLocationManager *)manager
|
|
259
|
+
{
|
|
260
|
+
if (self.delegate && [self.delegate respondsToSelector:@selector(onLocationPause:)]) {
|
|
261
|
+
[self.delegate onLocationPause:manager];
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
- (void) locationManagerDidResumeLocationUpdates:(CLLocationManager *)manager
|
|
266
|
+
{
|
|
267
|
+
if (self.delegate && [self.delegate respondsToSelector:@selector(onLocationResume:)]) {
|
|
268
|
+
[self.delegate onLocationResume:manager];
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
- (void) locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region
|
|
273
|
+
{
|
|
274
|
+
if (self.delegate && [self.delegate respondsToSelector:@selector(onRegionExit:)]) {
|
|
275
|
+
[self.delegate onRegionExit:region];
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
#pragma mark - Singleton implementation in ARC
|
|
280
|
+
+ (MAURLocationManager *)sharedInstance
|
|
281
|
+
{
|
|
282
|
+
static MAURLocationManager *sharedLocationControllerInstance = nil;
|
|
283
|
+
static dispatch_once_t predicate;
|
|
284
|
+
dispatch_once(&predicate, ^{
|
|
285
|
+
sharedLocationControllerInstance = [[self alloc] init];
|
|
286
|
+
});
|
|
287
|
+
return sharedLocationControllerInstance;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
+ (id)allocWithZone:(NSZone *)zone {
|
|
291
|
+
@synchronized(self) {
|
|
292
|
+
if (sharedCLDelegate == nil) {
|
|
293
|
+
sharedCLDelegate = [super allocWithZone:zone];
|
|
294
|
+
return sharedCLDelegate; // assignment and return on first allocation
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return nil; // on subsequent allocation attempts return nil
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
- (id)copyWithZone:(NSZone *)zone
|
|
301
|
+
{
|
|
302
|
+
return self;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
@end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MAURLogReader.h
|
|
3
|
+
// BackgroundGeolocation
|
|
4
|
+
//
|
|
5
|
+
// Created by Marian Hello on 02/07/16.
|
|
6
|
+
// Copyright © 2016 mauron85. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef MAURLogReader_h
|
|
10
|
+
#define MAURLogReader_h
|
|
11
|
+
|
|
12
|
+
#import "MAURLogging.h"
|
|
13
|
+
|
|
14
|
+
@interface MAURLogReader : NSObject {
|
|
15
|
+
@private
|
|
16
|
+
NSString *logDirectory;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
- (id)initWithLogDirectory:(NSString *)aLogDirectory;
|
|
20
|
+
- (NSString*) prepareSQL:(NSInteger)limit fromLogEntryId:(NSInteger)entryId minLogLevel:(NSInteger)minLogLevel;
|
|
21
|
+
- (NSArray*) getEntries:(NSInteger)limit fromLogEntryId:(NSInteger)entryId minLogLevel:(DDLogFlag)minLogLevel;
|
|
22
|
+
- (NSArray*) getLogEntries:(NSInteger)limit fromLogEntryId:(NSInteger)offset minLogLevelAsString:(NSString *)minLogLevel;
|
|
23
|
+
|
|
24
|
+
@end
|
|
25
|
+
|
|
26
|
+
#endif /* MAURLogReader_h */
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MAURLogReader.m
|
|
3
|
+
// BackgroundGeolocation
|
|
4
|
+
//
|
|
5
|
+
// Created by Marian Hello on 02/07/16.
|
|
6
|
+
// Copyright © 2016 mauron85. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
#import <sqlite3.h>
|
|
11
|
+
#import "FMDB.h"
|
|
12
|
+
#import "ZIMSqlSelectStatement.h"
|
|
13
|
+
#import "MAURLogReader.h"
|
|
14
|
+
|
|
15
|
+
// Convert DDLogFlag to string
|
|
16
|
+
static NSString* logFlag_toString(DDLogFlag logFlag)
|
|
17
|
+
{
|
|
18
|
+
switch (logFlag) {
|
|
19
|
+
case DDLogFlagVerbose:
|
|
20
|
+
return @"TRACE";
|
|
21
|
+
case DDLogFlagDebug:
|
|
22
|
+
return @"DEBUG";
|
|
23
|
+
case DDLogFlagInfo:
|
|
24
|
+
return @"INFO";
|
|
25
|
+
case DDLogFlagWarning:
|
|
26
|
+
return @"WARN";
|
|
27
|
+
case DDLogFlagError:
|
|
28
|
+
return @"ERROR";
|
|
29
|
+
}
|
|
30
|
+
return @"N/A";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static DDLogFlag string_toLogFlag(NSString *logFlag)
|
|
34
|
+
{
|
|
35
|
+
if ([@"TRACE" isEqualToString:logFlag]) {
|
|
36
|
+
return DDLogFlagVerbose;
|
|
37
|
+
}
|
|
38
|
+
if ([@"DEBUG" isEqualToString:logFlag]) {
|
|
39
|
+
return DDLogFlagDebug;
|
|
40
|
+
}
|
|
41
|
+
if ([@"INFO" isEqualToString:logFlag]) {
|
|
42
|
+
return DDLogFlagInfo;
|
|
43
|
+
}
|
|
44
|
+
if ([@"WARN" isEqualToString:logFlag]) {
|
|
45
|
+
return DDLogFlagWarning;
|
|
46
|
+
}
|
|
47
|
+
if ([@"ERROR" isEqualToString:logFlag]) {
|
|
48
|
+
return DDLogFlagError;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return DDLogFlagVerbose; // maybe we should throw exception instead
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@implementation MAURLogReader : NSObject
|
|
55
|
+
|
|
56
|
+
- (id)initWithLogDirectory:(NSString *)aLogDirectory
|
|
57
|
+
{
|
|
58
|
+
if ((self = [super init]))
|
|
59
|
+
{
|
|
60
|
+
logDirectory = [aLogDirectory copy];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return self;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
- (NSString*) prepareSQL:(NSInteger)limit fromLogEntryId:(NSInteger)entryId minLogLevel:(NSInteger)minLogLevel
|
|
67
|
+
{
|
|
68
|
+
ZIMSqlSelectStatement *sql = [[ZIMSqlSelectStatement alloc] init];
|
|
69
|
+
[sql column: @"rowid"];
|
|
70
|
+
[sql column: @"context"];
|
|
71
|
+
[sql column: @"level"];
|
|
72
|
+
[sql column: @"message"];
|
|
73
|
+
[sql column: @"timestamp"];
|
|
74
|
+
[sql from: @"logs"];
|
|
75
|
+
[sql where: @"level" operator: ZIMSqlOperatorLessThanOrEqualTo value: [NSNumber numberWithInteger:minLogLevel]];
|
|
76
|
+
if (entryId > 0) {
|
|
77
|
+
if (limit >= 0) {
|
|
78
|
+
[sql where: @"rowid" operator: ZIMSqlOperatorLessThan value: [NSNumber numberWithInteger:entryId]];
|
|
79
|
+
} else {
|
|
80
|
+
[sql where: @"rowid" operator: ZIMSqlOperatorGreaterThan value: [NSNumber numberWithInteger:entryId]];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
[sql orderBy: @"timestamp" descending:limit >= 0];
|
|
84
|
+
[sql orderBy: @"rowid" descending:limit >= 0];
|
|
85
|
+
[sql limit: ABS(limit)];
|
|
86
|
+
|
|
87
|
+
return [sql statement];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
- (NSArray*) getLogEntries:(NSInteger)limit fromLogEntryId:(NSInteger)entryId minLogLevelAsString:(NSString *)minLogLevel;
|
|
91
|
+
{
|
|
92
|
+
return [self getEntries:limit fromLogEntryId:entryId minLogLevel:string_toLogFlag(minLogLevel)];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
- (NSArray*) getEntries:(NSInteger)limit fromLogEntryId:(NSInteger)entryId minLogLevel:(DDLogFlag)minLogLevel;
|
|
96
|
+
{
|
|
97
|
+
NSMutableArray *logs = [[NSMutableArray alloc] init];
|
|
98
|
+
NSString *dbPath = [logDirectory stringByAppendingPathComponent:@"log.sqlite"];
|
|
99
|
+
FMDatabase *database = [[FMDatabase alloc] initWithPath:dbPath];
|
|
100
|
+
if (![database openWithFlags:SQLITE_OPEN_READONLY]) {
|
|
101
|
+
NSLog(@"%@: Failed opening database!", [self class]);
|
|
102
|
+
database = nil;
|
|
103
|
+
return nil;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
FMResultSet *rs = [database executeQuery:[self prepareSQL:limit fromLogEntryId:entryId minLogLevel:minLogLevel]];
|
|
107
|
+
while([rs next]) {
|
|
108
|
+
NSMutableDictionary *entry = [NSMutableDictionary dictionaryWithCapacity:4];
|
|
109
|
+
[entry setObject:[NSNumber numberWithInt:[rs intForColumnIndex:0]] forKey:@"id"];
|
|
110
|
+
[entry setObject:[NSNumber numberWithInt:[rs intForColumnIndex:1]] forKey:@"context"];
|
|
111
|
+
[entry setObject:logFlag_toString([rs intForColumnIndex:2]) forKey:@"level"];
|
|
112
|
+
[entry setObject:[rs stringForColumnIndex:3] forKey:@"message"];
|
|
113
|
+
[entry setObject:[NSNumber numberWithDouble:[rs doubleForColumnIndex:4] * 1000] forKey:@"timestamp"];
|
|
114
|
+
[logs addObject:entry];
|
|
115
|
+
}
|
|
116
|
+
[rs close];
|
|
117
|
+
[database close];
|
|
118
|
+
|
|
119
|
+
return logs;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MAURLogging.h
|
|
3
|
+
// BackgroundGeolocation
|
|
4
|
+
//
|
|
5
|
+
// Created by Marian Hello on 10/11/2017.
|
|
6
|
+
// Copyright © 2017 mauron85. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef MAURLogging_h
|
|
10
|
+
#define MAURLogging_h
|
|
11
|
+
|
|
12
|
+
#define LOG_LEVEL_DEF ddLogLevel
|
|
13
|
+
#import "CocoaLumberjack.h"
|
|
14
|
+
|
|
15
|
+
// we will override this global level later
|
|
16
|
+
// https://github.com/CocoaLumberjack/CocoaLumberjack/issues/469
|
|
17
|
+
static const DDLogLevel ddLogLevel = DDLogLevelAll;
|
|
18
|
+
|
|
19
|
+
#endif /* MAURLogging_h */
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MAURPostLocationTask.h
|
|
3
|
+
// BackgroundGeolocation
|
|
4
|
+
//
|
|
5
|
+
// Created by Marian Hello on 27/04/2018.
|
|
6
|
+
// Copyright © 2018 mauron85. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef MAURPostLocationTask_h
|
|
10
|
+
#define MAURPostLocationTask_h
|
|
11
|
+
|
|
12
|
+
#import "MAURConfig.h"
|
|
13
|
+
#import "MAURLocation.h"
|
|
14
|
+
|
|
15
|
+
@class MAURPostLocationTask;
|
|
16
|
+
|
|
17
|
+
@protocol MAURPostLocationTaskDelegate <NSObject>
|
|
18
|
+
|
|
19
|
+
@optional
|
|
20
|
+
- (void)postLocationTaskRequestedAbortUpdates:(MAURPostLocationTask * _Nonnull)task;
|
|
21
|
+
- (void)postLocationTaskHttpAuthorizationUpdates:(MAURPostLocationTask * _Nonnull)task;
|
|
22
|
+
// v3.5 Phase 4
|
|
23
|
+
- (void)postLocationTaskSyncStarted:(MAURPostLocationTask * _Nonnull)task;
|
|
24
|
+
- (void)postLocationTaskSyncSucceeded:(MAURPostLocationTask * _Nonnull)task locationsSent:(NSInteger)locationsSent;
|
|
25
|
+
- (void)postLocationTaskSyncFailed:(MAURPostLocationTask * _Nonnull)task httpStatus:(NSInteger)httpStatus message:(NSString * _Nullable)message;
|
|
26
|
+
|
|
27
|
+
@end
|
|
28
|
+
|
|
29
|
+
@interface MAURPostLocationTask : NSObject
|
|
30
|
+
|
|
31
|
+
@property (nonatomic, weak) MAURConfig * _Nullable config;
|
|
32
|
+
@property (nonatomic, weak) id<MAURPostLocationTaskDelegate> _Nullable delegate;
|
|
33
|
+
/** v4.5.1 — pending driving events buffer owned by the facade; the task drains it onto the
|
|
34
|
+
* post-transform location so events fired without a simultaneous fix (provider change,
|
|
35
|
+
* sensor crash, phone usage) survive even if `locationTransform` returns a new instance.
|
|
36
|
+
* Weak ref: if the facade is gone, no flush — by design. */
|
|
37
|
+
@property (nonatomic, weak) NSMutableArray * _Nullable pendingDrivingEventsBuffer;
|
|
38
|
+
/** v4.5.1 — same idea for the battery snapshot block. The facade installs a block that the
|
|
39
|
+
* task invokes AFTER a successful transform, so even when `locationTransform` returns a
|
|
40
|
+
* fresh instance, battery/charging fields land on what actually gets POSTed. */
|
|
41
|
+
@property (nonatomic, copy) void (^ _Nullable attachBatterySnapshot)(MAURLocation * _Nonnull);
|
|
42
|
+
|
|
43
|
+
- (void) add:(MAURLocation * _Nonnull)location;
|
|
44
|
+
- (void) start;
|
|
45
|
+
- (void) stop;
|
|
46
|
+
- (void) sync;
|
|
47
|
+
|
|
48
|
+
+ (void) setLocationTransform:(MAURLocationTransform _Nullable)transform;
|
|
49
|
+
+ (MAURLocationTransform _Nullable) locationTransform;
|
|
50
|
+
|
|
51
|
+
@end
|
|
52
|
+
|
|
53
|
+
#endif /* MAURPostLocationTask_h */
|