@transistorsoft/capacitor-background-geolocation 7.2.0 → 7.2.1
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/Package.swift +45 -0
- package/android/Package.swift +2 -0
- package/ios/Frameworks/TSLocationManager.xcframework/Info.plist +61 -0
- package/ios/Frameworks/TSLocationManager.xcframework/_CodeSignature/CodeDirectory +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/_CodeSignature/CodeRequirements +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/_CodeSignature/CodeRequirements-1 +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/_CodeSignature/CodeResources +2033 -0
- package/ios/Frameworks/TSLocationManager.xcframework/_CodeSignature/CodeSignature +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/AtomicBoolean.h +18 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/ConfigModule.h +21 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/HttpRequest.h +21 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/HttpResponse.h +29 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/LocationManager.h +55 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/LogQuery.h +13 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/SOMotionDetector.h +141 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/SQLQuery.h +34 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSActivityChangeEvent.h +16 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSAuthorization.h +38 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSAuthorizationEvent.h +18 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSCallback.h +18 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSConfig.h +310 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSConnectivityChangeEvent.h +17 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSCurrentPositionRequest.h +43 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSDeviceInfo.h +24 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSEnabledChangeEvent.h +15 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSGeofence.h +54 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSGeofenceEvent.h +64 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSGeofenceManager.h +54 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSGeofencesChangeEvent.h +17 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSHeartbeatEvent.h +18 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSHttpEvent.h +19 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSHttpService.h +58 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSLocation.h +105 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSLocationManager.h +315 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSPowerSaveChangeEvent.h +14 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSProviderChangeEvent.h +20 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSReachability.h +106 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSSchedule.h +40 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSScheduleEvent.h +18 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TSWatchPositionRequest.h +41 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Headers/TransistorAuthorizationToken.h +31 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Info.plist +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Miniball/Miniball.hpp +525 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/Modules/module.modulemap +6 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/PrivacyInfo.xcprivacy +36 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/TSLocationManager +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/_CodeSignature/CodeRequirements +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/_CodeSignature/CodeRequirements-1 +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/_CodeSignature/CodeResources +642 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64/TSLocationManager.framework/_CodeSignature/CodeSignature +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/AtomicBoolean.h +18 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/ConfigModule.h +21 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/HttpRequest.h +21 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/HttpResponse.h +29 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/LocationManager.h +55 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/LogQuery.h +13 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/SOMotionDetector.h +141 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/SQLQuery.h +34 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSActivityChangeEvent.h +16 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSAuthorization.h +38 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSAuthorizationEvent.h +18 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSCallback.h +18 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSConfig.h +310 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSConnectivityChangeEvent.h +17 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSCurrentPositionRequest.h +43 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSDeviceInfo.h +24 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSEnabledChangeEvent.h +15 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSGeofence.h +54 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSGeofenceEvent.h +64 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSGeofenceManager.h +54 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSGeofencesChangeEvent.h +17 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSHeartbeatEvent.h +18 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSHttpEvent.h +19 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSHttpService.h +58 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSLocation.h +105 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSLocationManager.h +315 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSPowerSaveChangeEvent.h +14 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSProviderChangeEvent.h +20 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSReachability.h +106 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSSchedule.h +40 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSScheduleEvent.h +18 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TSWatchPositionRequest.h +41 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Headers/TransistorAuthorizationToken.h +31 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Modules/module.modulemap +6 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Resources/Info.plist +50 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Resources/Miniball/Miniball.hpp +525 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Resources/PrivacyInfo.xcprivacy +36 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/TSLocationManager +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/_CodeSignature/CodeRequirements +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/_CodeSignature/CodeRequirements-1 +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/_CodeSignature/CodeResources +536 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/_CodeSignature/CodeSignature +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/AtomicBoolean.h +18 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/ConfigModule.h +21 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/HttpRequest.h +21 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/HttpResponse.h +29 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/LocationManager.h +55 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/LogQuery.h +13 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/SOMotionDetector.h +141 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/SQLQuery.h +34 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSActivityChangeEvent.h +16 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSAuthorization.h +38 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSAuthorizationEvent.h +18 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSCallback.h +18 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSConfig.h +310 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSConnectivityChangeEvent.h +17 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSCurrentPositionRequest.h +43 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSDeviceInfo.h +24 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSEnabledChangeEvent.h +15 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSGeofence.h +54 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSGeofenceEvent.h +64 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSGeofenceManager.h +54 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSGeofencesChangeEvent.h +17 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSHeartbeatEvent.h +18 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSHttpEvent.h +19 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSHttpService.h +58 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSLocation.h +105 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSLocationManager.h +315 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSPowerSaveChangeEvent.h +14 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSProviderChangeEvent.h +20 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSReachability.h +106 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSSchedule.h +40 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSScheduleEvent.h +18 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TSWatchPositionRequest.h +41 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Headers/TransistorAuthorizationToken.h +31 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Info.plist +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Miniball/Miniball.hpp +525 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/Modules/module.modulemap +6 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/PrivacyInfo.xcprivacy +36 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/TSLocationManager +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/_CodeSignature/CodeRequirements +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/_CodeSignature/CodeRequirements-1 +0 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/_CodeSignature/CodeResources +642 -0
- package/ios/Frameworks/TSLocationManager.xcframework/ios-arm64_x86_64-simulator/TSLocationManager.framework/_CodeSignature/CodeSignature +0 -0
- package/ios/Sources/BackgroundGeolocationPlugin/BackgroundGeolocationPlugin.swift +880 -0
- package/ios/Sources/BackgroundGeolocationPlugin/PrivacyInfo.xcprivacy +35 -0
- package/package.json +5 -5
- package/ios/Plugin/BackgroundGeolocationModule.h +0 -14
- package/ios/Plugin/BackgroundGeolocationModule.m +0 -694
- package/ios/Plugin/BackgroundGeolocationPlugin.h +0 -10
- package/ios/Plugin/BackgroundGeolocationPlugin.m +0 -66
- package/ios/Plugin/Info.plist +0 -24
|
@@ -1,694 +0,0 @@
|
|
|
1
|
-
#import "BackgroundGeolocationModule.h"
|
|
2
|
-
#import <Foundation/Foundation.h>
|
|
3
|
-
#import <CoreLocation/CoreLocation.h>
|
|
4
|
-
#import <UIKit/UIKit.h>
|
|
5
|
-
|
|
6
|
-
#import <Capacitor/Capacitor.h>
|
|
7
|
-
#import <Capacitor/Capacitor-Swift.h>
|
|
8
|
-
#import <Capacitor/CAPBridgedPlugin.h>
|
|
9
|
-
#import <Capacitor/CAPBridgedJSTypes.h>
|
|
10
|
-
|
|
11
|
-
static NSString *const EVENT_LOCATION = @"location";
|
|
12
|
-
static NSString *const EVENT_WATCHPOSITION = @"watchposition";
|
|
13
|
-
static NSString *const EVENT_PROVIDERCHANGE = @"providerchange";
|
|
14
|
-
static NSString *const EVENT_MOTIONCHANGE = @"motionchange";
|
|
15
|
-
static NSString *const EVENT_ACTIVITYCHANGE = @"activitychange";
|
|
16
|
-
static NSString *const EVENT_GEOFENCESCHANGE = @"geofenceschange";
|
|
17
|
-
static NSString *const EVENT_HTTP = @"http";
|
|
18
|
-
static NSString *const EVENT_SCHEDULE = @"schedule";
|
|
19
|
-
static NSString *const EVENT_GEOFENCE = @"geofence";
|
|
20
|
-
static NSString *const EVENT_HEARTBEAT = @"heartbeat";
|
|
21
|
-
static NSString *const EVENT_POWERSAVECHANGE = @"powersavechange";
|
|
22
|
-
static NSString *const EVENT_CONNECTIVITYCHANGE = @"connectivitychange";
|
|
23
|
-
static NSString *const EVENT_ENABLEDCHANGE = @"enabledchange";
|
|
24
|
-
static NSString *const EVENT_NOTIFICATIONACTION = @"notificationaction";
|
|
25
|
-
static NSString *const EVENT_AUTHORIZATION = @"authorization";
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
@implementation BackgroundGeolocationModule {
|
|
29
|
-
NSMutableDictionary *listeners;
|
|
30
|
-
BOOL ready;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
- (void)load {
|
|
34
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
35
|
-
UIViewController *root = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
|
|
36
|
-
locationManager.viewController = root;
|
|
37
|
-
|
|
38
|
-
ready = NO;
|
|
39
|
-
|
|
40
|
-
[self registerEventListeners];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
- (void) registerEventListeners {
|
|
44
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
45
|
-
|
|
46
|
-
__typeof(self) __weak me = self;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
[locationManager onLocation:^(TSLocation* location) {
|
|
50
|
-
if (![me hasListeners:EVENT_LOCATION]) return;
|
|
51
|
-
[me notifyListeners:EVENT_LOCATION data:[location toDictionary]];
|
|
52
|
-
} failure:^(NSError *error) {
|
|
53
|
-
if (![me hasListeners:EVENT_LOCATION]) return;
|
|
54
|
-
[me notifyListeners:EVENT_LOCATION data: @{@"error":@(error.code)}];
|
|
55
|
-
}];
|
|
56
|
-
|
|
57
|
-
[locationManager onMotionChange:^(TSLocation *tsLocation) {
|
|
58
|
-
if (![me hasListeners:EVENT_MOTIONCHANGE]) return;
|
|
59
|
-
NSDictionary *params = @{
|
|
60
|
-
@"isMoving": @(tsLocation.isMoving),
|
|
61
|
-
@"location": [tsLocation toDictionary]
|
|
62
|
-
};
|
|
63
|
-
[me notifyListeners:EVENT_MOTIONCHANGE data:params];
|
|
64
|
-
}];
|
|
65
|
-
|
|
66
|
-
[locationManager onActivityChange:^(TSActivityChangeEvent *event) {
|
|
67
|
-
if (![me hasListeners:EVENT_ACTIVITYCHANGE]) return;
|
|
68
|
-
NSDictionary *params = @{@"activity": event.activity, @"confidence": @(event.confidence)};
|
|
69
|
-
[me notifyListeners:EVENT_ACTIVITYCHANGE data:params];
|
|
70
|
-
}];
|
|
71
|
-
|
|
72
|
-
[locationManager onHeartbeat:^(TSHeartbeatEvent *event) {
|
|
73
|
-
if (![me hasListeners:EVENT_HEARTBEAT]) return;
|
|
74
|
-
NSDictionary *params = @{
|
|
75
|
-
@"location": [event.location toDictionary],
|
|
76
|
-
};
|
|
77
|
-
[me notifyListeners:EVENT_HEARTBEAT data:params];
|
|
78
|
-
}];
|
|
79
|
-
|
|
80
|
-
[locationManager onGeofence:^(TSGeofenceEvent *event) {
|
|
81
|
-
if (![me hasListeners:EVENT_GEOFENCE]) return;
|
|
82
|
-
NSMutableDictionary *params = [[event toDictionary] mutableCopy];
|
|
83
|
-
[params setObject:[event.location toDictionary] forKey:@"location"];
|
|
84
|
-
[me notifyListeners:EVENT_GEOFENCE data:params];
|
|
85
|
-
}];
|
|
86
|
-
|
|
87
|
-
[locationManager onGeofencesChange:^(TSGeofencesChangeEvent *event) {
|
|
88
|
-
if (![me hasListeners:EVENT_GEOFENCESCHANGE]) return;
|
|
89
|
-
[me notifyListeners:EVENT_GEOFENCESCHANGE data:[event toDictionary]];
|
|
90
|
-
}];
|
|
91
|
-
|
|
92
|
-
[locationManager onHttp:^(TSHttpEvent *event) {
|
|
93
|
-
if (![me hasListeners:EVENT_HTTP]) return;
|
|
94
|
-
[me notifyListeners:EVENT_HTTP data:[event toDictionary]];
|
|
95
|
-
}];
|
|
96
|
-
|
|
97
|
-
[locationManager onProviderChange:^(TSProviderChangeEvent *event) {
|
|
98
|
-
if (![me hasListeners:EVENT_PROVIDERCHANGE]) return;
|
|
99
|
-
[me notifyListeners:EVENT_PROVIDERCHANGE data:[event toDictionary]];
|
|
100
|
-
}];
|
|
101
|
-
|
|
102
|
-
[locationManager onSchedule:^(TSScheduleEvent *event) {
|
|
103
|
-
if (![me hasListeners:EVENT_SCHEDULE]) return;
|
|
104
|
-
[me notifyListeners:EVENT_SCHEDULE data:event.state];
|
|
105
|
-
}];
|
|
106
|
-
|
|
107
|
-
[locationManager onPowerSaveChange:^(TSPowerSaveChangeEvent *event) {
|
|
108
|
-
if (![me hasListeners:EVENT_POWERSAVECHANGE]) return;
|
|
109
|
-
NSDictionary *params = @{@"value":@(event.isPowerSaveMode)};
|
|
110
|
-
[me notifyListeners:EVENT_POWERSAVECHANGE data:params];
|
|
111
|
-
}];
|
|
112
|
-
|
|
113
|
-
[locationManager onConnectivityChange:^(TSConnectivityChangeEvent *event) {
|
|
114
|
-
if (![me hasListeners:EVENT_CONNECTIVITYCHANGE]) return;
|
|
115
|
-
NSDictionary *params = @{@"connected":@(event.hasConnection)};
|
|
116
|
-
[me notifyListeners:EVENT_CONNECTIVITYCHANGE data:params];
|
|
117
|
-
}];
|
|
118
|
-
|
|
119
|
-
[locationManager onEnabledChange:^(TSEnabledChangeEvent *event) {
|
|
120
|
-
if (![me hasListeners:EVENT_ENABLEDCHANGE]) return;
|
|
121
|
-
[me notifyListeners:EVENT_ENABLEDCHANGE data:@{@"value":@(event.enabled)}];
|
|
122
|
-
}];
|
|
123
|
-
|
|
124
|
-
[locationManager onAuthorization:^(TSAuthorizationEvent *event) {
|
|
125
|
-
if (![me hasListeners:EVENT_AUTHORIZATION]) return;
|
|
126
|
-
[me notifyListeners:EVENT_AUTHORIZATION data:[event toDictionary]];
|
|
127
|
-
}];
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
- (void)registerPlugin:(CAPPluginCall *) call {
|
|
131
|
-
NSString *pluginId = [call getString:@"id" defaultValue:nil];
|
|
132
|
-
TSConfig *config = [TSConfig sharedInstance];
|
|
133
|
-
[config registerPlugin:pluginId];
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
- (void)ready:(CAPPluginCall *) call {
|
|
137
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
138
|
-
TSConfig *config = [TSConfig sharedInstance];
|
|
139
|
-
NSDictionary *params = [call getObject:@"options" defaultValue:@{}];
|
|
140
|
-
BOOL reset = (params[@"reset"]) ? [params[@"reset"] boolValue] : YES;
|
|
141
|
-
if (ready) {
|
|
142
|
-
if (reset) {
|
|
143
|
-
[locationManager log:@"warn" message:@"#ready already called. Redirecting to #setConfig"];
|
|
144
|
-
[config updateWithDictionary:params];
|
|
145
|
-
} else {
|
|
146
|
-
[locationManager log:@"warn" message:@"#ready already called. Ignored Config since reset: false"];
|
|
147
|
-
}
|
|
148
|
-
[call resolve:[config toDictionary]];
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
ready = YES;
|
|
152
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
153
|
-
TSConfig *config = [TSConfig sharedInstance];
|
|
154
|
-
if (config.isFirstBoot) {
|
|
155
|
-
[config updateWithDictionary:params];
|
|
156
|
-
} else {
|
|
157
|
-
if (reset) {
|
|
158
|
-
[config reset:YES];
|
|
159
|
-
[config updateWithDictionary:params];
|
|
160
|
-
} else if ([params objectForKey:@"authorization"]) {
|
|
161
|
-
[config updateWithBlock:^(TSConfigBuilder *builder) {
|
|
162
|
-
builder.authorization = [TSAuthorization createWithDictionary:[params objectForKey:@"authorization"]];
|
|
163
|
-
}];
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
167
|
-
[locationManager ready];
|
|
168
|
-
[call resolve:[config toDictionary]];
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
- (void) reset:(CAPPluginCall *) call {
|
|
173
|
-
NSDictionary *params = [call getObject:@"options" defaultValue:@{}];
|
|
174
|
-
TSConfig *config = [TSConfig sharedInstance];
|
|
175
|
-
if ([[params allKeys] count] > 0) {
|
|
176
|
-
[config reset:YES];
|
|
177
|
-
[config updateWithDictionary:params];
|
|
178
|
-
} else {
|
|
179
|
-
[config reset];
|
|
180
|
-
}
|
|
181
|
-
[call resolve:[config toDictionary]];
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
- (void) setConfig:(CAPPluginCall *) call {
|
|
185
|
-
NSDictionary *params = [call getObject:@"options" defaultValue:@{}];
|
|
186
|
-
TSConfig *config = [TSConfig sharedInstance];
|
|
187
|
-
[config updateWithDictionary:params];
|
|
188
|
-
[call resolve:[config toDictionary]];
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
- (void) getState:(CAPPluginCall *) call {
|
|
192
|
-
TSConfig *config = [TSConfig sharedInstance];
|
|
193
|
-
[call resolve:[config toDictionary]];
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
- (void) start:(CAPPluginCall *) call {
|
|
197
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
198
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
199
|
-
[locationManager start];
|
|
200
|
-
[call resolve:[locationManager getState]];
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
- (void) stop:(CAPPluginCall *) call {
|
|
205
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
206
|
-
[locationManager stop];
|
|
207
|
-
[call resolve:[locationManager getState]];
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
- (void) startSchedule:(CAPPluginCall *) call {
|
|
211
|
-
TSConfig *config = [TSConfig sharedInstance];
|
|
212
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
213
|
-
[locationManager startSchedule];
|
|
214
|
-
[call resolve:[config toDictionary]];
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
- (void) stopSchedule:(CAPPluginCall *) call {
|
|
218
|
-
TSConfig *config = [TSConfig sharedInstance];
|
|
219
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
220
|
-
[locationManager stopSchedule];
|
|
221
|
-
[call resolve:[config toDictionary]];
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
- (void) startGeofences:(CAPPluginCall *) call {
|
|
225
|
-
TSConfig *config = [TSConfig sharedInstance];
|
|
226
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
227
|
-
[locationManager startGeofences];
|
|
228
|
-
[call resolve:[config toDictionary]];
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
- (void) changePace:(CAPPluginCall *) call {
|
|
232
|
-
BOOL isMoving = [call getBool:@"isMoving" defaultValue:NO];
|
|
233
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
234
|
-
[locationManager changePace:isMoving];
|
|
235
|
-
[call resolve];
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
- (void) startBackgroundTask:(CAPPluginCall *) call {
|
|
239
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
240
|
-
UIBackgroundTaskIdentifier taskId = [locationManager createBackgroundTask];
|
|
241
|
-
[call resolve:@{@"taskId":@(taskId)}];
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
- (void) stopBackgroundTask:(CAPPluginCall *) call {
|
|
245
|
-
NSNumber *taskId = [call getNumber:@"taskId" defaultValue:@(-1)];
|
|
246
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
247
|
-
[locationManager stopBackgroundTask:[taskId longValue]];
|
|
248
|
-
[call resolve];
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
- (void) getCurrentPosition:(CAPPluginCall *) call {
|
|
252
|
-
NSDictionary *options = [call getObject:@"options" defaultValue:@{}];
|
|
253
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
254
|
-
|
|
255
|
-
TSCurrentPositionRequest *request = [[TSCurrentPositionRequest alloc] initWithSuccess:^(TSLocation *location) {
|
|
256
|
-
[call resolve:[location toDictionary]];
|
|
257
|
-
} failure:^(NSError *error) {
|
|
258
|
-
[call reject:[NSString stringWithFormat:@"%lu", error.code] :nil :nil :error.userInfo];
|
|
259
|
-
}];
|
|
260
|
-
|
|
261
|
-
if (options[@"timeout"]) {
|
|
262
|
-
request.timeout = [options[@"timeout"] doubleValue];
|
|
263
|
-
}
|
|
264
|
-
if (options[@"maximumAge"]) {
|
|
265
|
-
request.maximumAge = [options[@"maximumAge"] doubleValue];
|
|
266
|
-
}
|
|
267
|
-
if (options[@"persist"]) {
|
|
268
|
-
request.persist = [options[@"persist"] boolValue];
|
|
269
|
-
}
|
|
270
|
-
if (options[@"samples"]) {
|
|
271
|
-
request.samples = [options[@"samples"] intValue];
|
|
272
|
-
}
|
|
273
|
-
if (options[@"desiredAccuracy"]) {
|
|
274
|
-
request.desiredAccuracy = [options[@"desiredAccuracy"] doubleValue];
|
|
275
|
-
}
|
|
276
|
-
if (options[@"extras"]) {
|
|
277
|
-
request.extras = options[@"extras"];
|
|
278
|
-
}
|
|
279
|
-
[locationManager getCurrentPosition:request];
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
- (void) watchPosition:(CAPPluginCall *) call {
|
|
283
|
-
NSDictionary *options = [call getObject:@"options" defaultValue:@{}];
|
|
284
|
-
|
|
285
|
-
__typeof(self) __weak me = self;
|
|
286
|
-
TSWatchPositionRequest *request = [[TSWatchPositionRequest alloc] initWithSuccess:^(TSLocation *location) {
|
|
287
|
-
if (![me hasListeners:EVENT_WATCHPOSITION]) {
|
|
288
|
-
[[TSLocationManager sharedInstance] stopWatchPosition];
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
[me notifyListeners:EVENT_WATCHPOSITION data:[location toDictionary]];
|
|
292
|
-
} failure:^(NSError *error) {
|
|
293
|
-
if (![me hasListeners:EVENT_WATCHPOSITION]) {
|
|
294
|
-
[[TSLocationManager sharedInstance] stopWatchPosition];
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
NSDictionary *result = @{@"error": @{
|
|
298
|
-
@"code": @(error.code),
|
|
299
|
-
@"message":error.localizedDescription
|
|
300
|
-
}};
|
|
301
|
-
[me notifyListeners:EVENT_WATCHPOSITION data:result];
|
|
302
|
-
}];
|
|
303
|
-
|
|
304
|
-
if (options[@"interval"]) {
|
|
305
|
-
request.interval = [options[@"interval"] doubleValue];
|
|
306
|
-
}
|
|
307
|
-
if (options[@"desiredAccuracy"]) {
|
|
308
|
-
request.desiredAccuracy = [options[@"desiredAccuracy"] doubleValue];
|
|
309
|
-
}
|
|
310
|
-
if (options[@"persist"]) {
|
|
311
|
-
request.persist = [options[@"persist"] boolValue];
|
|
312
|
-
}
|
|
313
|
-
if (options[@"extras"]) {
|
|
314
|
-
request.extras = options[@"extras"];
|
|
315
|
-
}
|
|
316
|
-
if (options[@"timeout"]) {
|
|
317
|
-
request.timeout = [options[@"timeout"] doubleValue];
|
|
318
|
-
}
|
|
319
|
-
[[TSLocationManager sharedInstance] watchPosition:request];
|
|
320
|
-
|
|
321
|
-
[call resolve];
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
- (void) stopWatchPosition:(CAPPluginCall *) call {
|
|
325
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
326
|
-
[locationManager stopWatchPosition];
|
|
327
|
-
[call resolve];
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/// Locations Database
|
|
331
|
-
|
|
332
|
-
- (void) getLocations:(CAPPluginCall *) call {
|
|
333
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
334
|
-
[locationManager getLocations:^(NSArray* records) {
|
|
335
|
-
NSDictionary *params = @{@"locations":records};
|
|
336
|
-
[call resolve:params];
|
|
337
|
-
} failure:^(NSString* error) {
|
|
338
|
-
[call reject:error :nil :nil :@{}];
|
|
339
|
-
}];
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
- (void) sync:(CAPPluginCall *) call {
|
|
343
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
344
|
-
[locationManager sync:^(NSArray* records) {
|
|
345
|
-
NSDictionary *params = @{@"locations":records};
|
|
346
|
-
[call resolve:params];
|
|
347
|
-
} failure:^(NSError* error) {
|
|
348
|
-
[call reject:[NSString stringWithFormat:@"%lu", error.code] :nil :nil :error.userInfo];
|
|
349
|
-
}];
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
- (void) getGeofences:(CAPPluginCall *) call {
|
|
353
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
354
|
-
[locationManager getGeofences:^(NSArray* geofences) {
|
|
355
|
-
NSMutableArray *result = [NSMutableArray new];
|
|
356
|
-
for (TSGeofence *geofence in geofences) { [result addObject:[geofence toDictionary]]; }
|
|
357
|
-
[call resolve:@{@"geofences": result}];
|
|
358
|
-
} failure:^(NSString* error) {
|
|
359
|
-
[call reject:error :nil :nil :@{}];
|
|
360
|
-
}];
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
- (void) getGeofence:(CAPPluginCall *) call {
|
|
364
|
-
NSString *identifier = [call getString:@"identifier" defaultValue:nil];
|
|
365
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
366
|
-
[locationManager getGeofence:identifier success:^(TSGeofence *geofence) {
|
|
367
|
-
[call resolve:[geofence toDictionary]];
|
|
368
|
-
} failure:^(NSString* error) {
|
|
369
|
-
[call reject:error :nil :nil :@{}];
|
|
370
|
-
}];
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
- (void) geofenceExists:(CAPPluginCall *) call {
|
|
374
|
-
NSString *identifier = [call getString:@"identifier" defaultValue:nil];
|
|
375
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
376
|
-
[locationManager geofenceExists:identifier callback:^(BOOL exists) {
|
|
377
|
-
[call resolve:@{@"exists": @(exists)}];
|
|
378
|
-
}];
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
- (void) addGeofence:(CAPPluginCall *) call {
|
|
382
|
-
NSDictionary *params = [call getObject:@"options" defaultValue:@{}];
|
|
383
|
-
|
|
384
|
-
TSGeofence *geofence = [self buildGeofence:params];
|
|
385
|
-
|
|
386
|
-
if (!geofence) {
|
|
387
|
-
NSString *error = [NSString stringWithFormat:@"Invalid geofence data: %@", params];
|
|
388
|
-
[call reject:error :nil :nil :@{}];
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
393
|
-
|
|
394
|
-
[locationManager addGeofence:geofence success:^{
|
|
395
|
-
[call resolve];
|
|
396
|
-
} failure:^(NSString *error) {
|
|
397
|
-
[call reject:error :nil :nil :@{}];
|
|
398
|
-
}];
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
- (void) addGeofences:(CAPPluginCall *) call {
|
|
403
|
-
NSArray *data = [call.options mutableArrayValueForKey:@"options"];
|
|
404
|
-
NSMutableArray *geofences = [NSMutableArray new];
|
|
405
|
-
|
|
406
|
-
for (NSDictionary *params in data) {
|
|
407
|
-
TSGeofence *geofence = [self buildGeofence:params];
|
|
408
|
-
if (geofence != nil) {
|
|
409
|
-
[geofences addObject:geofence];
|
|
410
|
-
} else {
|
|
411
|
-
NSString *error = [NSString stringWithFormat:@"Invalid geofence data: %@", params];
|
|
412
|
-
[call reject:error :nil :nil :@{}];
|
|
413
|
-
return;
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
418
|
-
[locationManager addGeofences:geofences success:^{
|
|
419
|
-
[call resolve];
|
|
420
|
-
} failure:^(NSString *error) {
|
|
421
|
-
[call reject:error :nil :nil :@{}];
|
|
422
|
-
}];
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
- (void) removeGeofence:(CAPPluginCall *) call {
|
|
426
|
-
NSString *identifier = [call getString:@"identifier" defaultValue:nil];
|
|
427
|
-
|
|
428
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
429
|
-
[locationManager removeGeofence:identifier success:^{
|
|
430
|
-
[call resolve];
|
|
431
|
-
} failure:^(NSString* error) {
|
|
432
|
-
[call reject:error :nil :nil :@{}];
|
|
433
|
-
}];
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
- (void) removeGeofences:(CAPPluginCall *) call {
|
|
437
|
-
NSArray *identifiers = [call.options mutableArrayValueForKey:@"identifiers"];
|
|
438
|
-
|
|
439
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
440
|
-
[locationManager removeGeofences:identifiers success:^{
|
|
441
|
-
[call resolve];
|
|
442
|
-
} failure:^(NSString* error) {
|
|
443
|
-
[call reject:error :nil :nil :@{}];
|
|
444
|
-
}];
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
- (void) getOdometer:(CAPPluginCall *) call {
|
|
448
|
-
|
|
449
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
450
|
-
NSNumber *distance = @([locationManager getOdometer]);
|
|
451
|
-
[call resolve:@{@"odometer":distance}];
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
- (void) setOdometer:(CAPPluginCall *) call {
|
|
455
|
-
double value = [[call getNumber:@"odometer" defaultValue:0] doubleValue];
|
|
456
|
-
|
|
457
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
458
|
-
TSCurrentPositionRequest *request = [[TSCurrentPositionRequest alloc] initWithSuccess:^(TSLocation *location) {
|
|
459
|
-
[call resolve:[location toDictionary]];
|
|
460
|
-
} failure:^(NSError *error) {
|
|
461
|
-
[call reject:[NSString stringWithFormat:@"%lu", error.code] :nil :error :error.userInfo];
|
|
462
|
-
}];
|
|
463
|
-
[locationManager setOdometer:value request:request];
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
- (void) destroyLocations:(CAPPluginCall *) call {
|
|
467
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
468
|
-
BOOL result = [locationManager destroyLocations];
|
|
469
|
-
if (result) {
|
|
470
|
-
[call resolve];
|
|
471
|
-
} else {
|
|
472
|
-
[call reject:@"destroyLocations: Unknown error" :nil :nil :@{}];
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
- (void) destroyLocation:(CAPPluginCall *) call {
|
|
477
|
-
NSString *uuid = [call getString:@"uuid" defaultValue:nil];
|
|
478
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
479
|
-
[locationManager destroyLocation:uuid success:^{
|
|
480
|
-
[call resolve];
|
|
481
|
-
} failure:^(NSString *error) {
|
|
482
|
-
[call reject:error :nil :nil :@{}];
|
|
483
|
-
}];
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
- (void) getCount:(CAPPluginCall *) call {
|
|
487
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
488
|
-
int count = [locationManager getCount];
|
|
489
|
-
[call resolve:@{@"count": @(count)}];
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
- (void) insertLocation:(CAPPluginCall *) call {
|
|
493
|
-
NSDictionary *params = [call getObject:@"options" defaultValue:@{}];
|
|
494
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
495
|
-
[locationManager insertLocation: params success:^(NSString* uuid) {
|
|
496
|
-
[call resolve:@{@"uuid":uuid}];
|
|
497
|
-
} failure:^(NSString* error) {
|
|
498
|
-
[call reject:error :nil :nil :@{}];
|
|
499
|
-
}];
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
- (void) getLog:(CAPPluginCall *) call {
|
|
503
|
-
NSDictionary *params = [call getObject:@"options" defaultValue:@{}];
|
|
504
|
-
|
|
505
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
506
|
-
LogQuery *query = [[LogQuery alloc] initWithDictionary:params];
|
|
507
|
-
[locationManager getLog:query success:^(NSString* log) {
|
|
508
|
-
[call resolve:@{@"log":log}];
|
|
509
|
-
} failure:^(NSString* error) {
|
|
510
|
-
[call reject:error :nil :nil :@{}];
|
|
511
|
-
}];
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
- (void) destroyLog:(CAPPluginCall *) call {
|
|
515
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
516
|
-
BOOL result = [locationManager destroyLog];
|
|
517
|
-
if (result) {
|
|
518
|
-
[call resolve];
|
|
519
|
-
} else {
|
|
520
|
-
[call reject:@"destroyLog Unknown error" :nil :nil :@{}];
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
- (void) emailLog:(CAPPluginCall *) call {
|
|
525
|
-
NSDictionary *params = [call getObject:@"query" defaultValue:@{}];
|
|
526
|
-
NSString *email = [call getString:@"email" defaultValue:nil];
|
|
527
|
-
LogQuery *query = [[LogQuery alloc] initWithDictionary:params];
|
|
528
|
-
|
|
529
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
530
|
-
[locationManager emailLog:email query:query success:^{
|
|
531
|
-
[call resolve];
|
|
532
|
-
} failure:^(NSString* error) {
|
|
533
|
-
[call reject:error :nil :nil :@{}];
|
|
534
|
-
}];
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
- (void) uploadLog:(CAPPluginCall *) call {
|
|
538
|
-
NSDictionary *params = [call getObject:@"query" defaultValue:@{}];
|
|
539
|
-
NSString *url = [call getString:@"url" defaultValue:nil];
|
|
540
|
-
LogQuery *query = [[LogQuery alloc] initWithDictionary:params];
|
|
541
|
-
|
|
542
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
543
|
-
[locationManager uploadLog:url query:query success:^{
|
|
544
|
-
[call resolve];
|
|
545
|
-
} failure:^(NSString* error) {
|
|
546
|
-
[call reject:error :nil :nil :@{}];
|
|
547
|
-
}];
|
|
548
|
-
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
- (void) log:(CAPPluginCall *) call {
|
|
552
|
-
NSString *level = [call getString:@"level" defaultValue:@"debug"];
|
|
553
|
-
NSString *message = [call getString:@"message" defaultValue:@"no message"];
|
|
554
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
555
|
-
|
|
556
|
-
[locationManager log:level message:message];
|
|
557
|
-
[call resolve];
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
- (void) getSensors:(CAPPluginCall *) call {
|
|
561
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
562
|
-
NSDictionary *sensors = @{
|
|
563
|
-
@"platform": @"ios",
|
|
564
|
-
@"accelerometer": @([locationManager isAccelerometerAvailable]),
|
|
565
|
-
@"gyroscope": @([locationManager isGyroAvailable]),
|
|
566
|
-
@"magnetometer": @([locationManager isMagnetometerAvailable]),
|
|
567
|
-
@"motion_hardware": @([locationManager isMotionHardwareAvailable])
|
|
568
|
-
};
|
|
569
|
-
[call resolve:sensors];
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
- (void) getDeviceInfo:(CAPPluginCall *) call {
|
|
573
|
-
TSDeviceInfo *deviceInfo = [TSDeviceInfo sharedInstance];
|
|
574
|
-
[call resolve:[deviceInfo toDictionary:@"capacitor"]];
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
- (void) isPowerSaveMode:(CAPPluginCall *) call {
|
|
578
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
579
|
-
[call resolve:@{
|
|
580
|
-
@"isPowerSaveMode":@([locationManager isPowerSaveMode])
|
|
581
|
-
}];
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
- (void) isIgnoringBatteryOptimizations:(CAPPluginCall *) call {
|
|
585
|
-
[call resolve:@{
|
|
586
|
-
@"isIgnoringBatteryOptimizations":@(NO)
|
|
587
|
-
}];
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
- (void) requestSettings:(CAPPluginCall *) call {
|
|
591
|
-
[call reject:@"No iOS Implementation" :nil :nil :@{}];
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
- (void) showSettings:(CAPPluginCall *) call {
|
|
595
|
-
[call reject:@"No iOS Implementation" :nil :nil :@{}];
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
- (void) requestPermission:(CAPPluginCall *) call {
|
|
599
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
600
|
-
[locationManager requestPermission:^(NSNumber *status) {
|
|
601
|
-
[call resolve:@{@"success":@(YES), @"status":status}];
|
|
602
|
-
} failure:^(NSNumber *status) {
|
|
603
|
-
[call resolve:@{@"success":@(NO), @"status":status}];
|
|
604
|
-
}];
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
- (void) requestTemporaryFullAccuracy:(CAPPluginCall *) call {
|
|
608
|
-
NSString *purpose = [call getString:@"purpose" defaultValue:@""];
|
|
609
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
610
|
-
[locationManager requestTemporaryFullAccuracy:purpose success:^(NSInteger accuracyAuthorization) {
|
|
611
|
-
[call resolve:@{@"accuracyAuthorization": @(accuracyAuthorization)}];
|
|
612
|
-
} failure:^(NSError *error) {
|
|
613
|
-
[call reject:error.userInfo[@"NSDebugDescription"] :nil :error :error.userInfo];
|
|
614
|
-
}];
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
- (void) getProviderState:(CAPPluginCall *) call {
|
|
618
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
619
|
-
TSProviderChangeEvent *event = [locationManager getProviderState];
|
|
620
|
-
[call resolve:[event toDictionary]];
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
- (void) getTransistorToken:(CAPPluginCall *) call {
|
|
624
|
-
NSString *orgname = [call getString:@"org" defaultValue:nil];
|
|
625
|
-
NSString *username = [call getString:@"username" defaultValue:nil];
|
|
626
|
-
NSString *url = [call getString:@"url" defaultValue:nil];
|
|
627
|
-
|
|
628
|
-
[TransistorAuthorizationToken findOrCreateWithOrg:orgname
|
|
629
|
-
username:username
|
|
630
|
-
url:url
|
|
631
|
-
framework:@"capacitor"
|
|
632
|
-
success:^(TransistorAuthorizationToken *token) {
|
|
633
|
-
NSDictionary *result = @{
|
|
634
|
-
@"success":@(YES),
|
|
635
|
-
@"token": [token toDictionary]
|
|
636
|
-
};
|
|
637
|
-
[call resolve:result];
|
|
638
|
-
} failure:^(NSError *error) {
|
|
639
|
-
NSDictionary *result = @{
|
|
640
|
-
@"success":@(NO),
|
|
641
|
-
@"status": @(error.code),
|
|
642
|
-
@"message": error.localizedDescription
|
|
643
|
-
};
|
|
644
|
-
[call resolve:result];
|
|
645
|
-
}];
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
- (void) destroyTransistorToken:(CAPPluginCall *) call {
|
|
650
|
-
NSString *url = [call getString:@"url" defaultValue:nil];
|
|
651
|
-
[TransistorAuthorizationToken destroyWithUrl:url];
|
|
652
|
-
[call resolve];
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
- (void) playSound:(CAPPluginCall *) call {
|
|
656
|
-
int soundId = [[call getNumber:@"soundId" defaultValue:0] intValue];
|
|
657
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
658
|
-
[locationManager playSound:soundId];
|
|
659
|
-
[call resolve];
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
- (void) removeAllEventListeners:(CAPPluginCall *) call {
|
|
663
|
-
[self removeAllListeners:call];
|
|
664
|
-
NSLog(@"BackgroundGeolocation plugin removeAllListeners");
|
|
665
|
-
[call resolve];
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
-(TSGeofence*) buildGeofence:(NSDictionary*)params {
|
|
669
|
-
|
|
670
|
-
if (!params[@"identifier"] || (!params[@"vertices"] && (!params[@"radius"] || !params[@"latitude"] || !params[@"longitude"]))) {
|
|
671
|
-
return nil;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
return [[TSGeofence alloc] initWithIdentifier: params[@"identifier"]
|
|
675
|
-
radius: (params[@"radius"]) ? [params[@"radius"] doubleValue] : 0
|
|
676
|
-
latitude: (params[@"latitude"]) ? [params[@"latitude"] doubleValue] : 0
|
|
677
|
-
longitude: (params[@"longitude"]) ? [params[@"longitude"] doubleValue] : 0
|
|
678
|
-
notifyOnEntry: (params[@"notifyOnEntry"]) ? [params[@"notifyOnEntry"] boolValue] : NO
|
|
679
|
-
notifyOnExit: (params[@"notifyOnExit"]) ? [params[@"notifyOnExit"] boolValue] : NO
|
|
680
|
-
notifyOnDwell: (params[@"notifyOnDwell"]) ? [params[@"notifyOnDwell"] boolValue] : NO
|
|
681
|
-
loiteringDelay: (params[@"loiteringDelay"]) ? [params[@"loiteringDelay"] doubleValue] : 0
|
|
682
|
-
extras: params[@"extras"]
|
|
683
|
-
vertices: params[@"vertices"]];
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
- (void)dealloc
|
|
687
|
-
{
|
|
688
|
-
TSLocationManager *locationManager = [TSLocationManager sharedInstance];
|
|
689
|
-
[locationManager removeListeners];
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
@end
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#import <UIKit/UIKit.h>
|
|
2
|
-
|
|
3
|
-
//! Project version number for Plugin.
|
|
4
|
-
FOUNDATION_EXPORT double PluginVersionNumber;
|
|
5
|
-
|
|
6
|
-
//! Project version string for Plugin.
|
|
7
|
-
FOUNDATION_EXPORT const unsigned char PluginVersionString[];
|
|
8
|
-
|
|
9
|
-
// In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
|
|
10
|
-
|