react-native-nitro-geolocation 1.2.5 → 1.3.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/README.md +55 -278
- package/android/build.gradle +1 -0
- package/android/src/main/AndroidManifest.xml +39 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidFusedLocationProvider.kt +310 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidFusedRequestFactory.kt +31 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidGeolocationConversions.kt +71 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidGeolocationErrors.kt +85 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidGeolocationOptions.kt +92 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidLocationSettings.kt +3 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/AndroidProviderRoute.kt +74 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/NitroBackgroundLocation.kt +132 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/NitroGeolocation.kt +219 -476
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/AndroidBackgroundHttpSync.kt +134 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/AndroidBackgroundPermissions.kt +196 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/AndroidBackgroundSerialization.kt +266 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroActivityRecognitionReceiver.kt +13 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroBackgroundEventHub.kt +65 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroBackgroundHeadlessTaskService.kt +58 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroBackgroundLocationController.kt +710 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroBackgroundLocationService.kt +48 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroBackgroundNotificationFactory.kt +37 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroBackgroundStore.kt +655 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroBootReceiver.kt +26 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroGeofenceReceiver.kt +14 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/background/NitroLocationUpdateReceiver.kt +37 -0
- package/android/src/test/java/com/margelo/nitro/nitrogeolocation/AndroidFusedLocationProviderTest.kt +64 -0
- package/android/src/test/java/com/margelo/nitro/nitrogeolocation/AndroidProviderRouteTest.kt +116 -0
- package/ios/IOSBackgroundHttpSync.swift +126 -0
- package/ios/IOSBackgroundLocationDelegate.swift +36 -0
- package/ios/IOSBackgroundMotion.swift +55 -0
- package/ios/IOSBackgroundSerialization.swift +539 -0
- package/ios/IOSGeolocationConversions.swift +131 -0
- package/ios/IOSGeolocationDelegate.swift +31 -0
- package/ios/IOSGeolocationErrors.swift +39 -0
- package/ios/IOSGeolocationOptions.swift +135 -0
- package/ios/NitroBackgroundLocation.swift +849 -0
- package/ios/NitroGeolocation.swift +14 -347
- package/nitrogen/generated/android/c++/JActivityRecognitionOptions.hpp +69 -0
- package/nitrogen/generated/android/c++/JAndroidBackgroundLocationOptions.hpp +74 -0
- package/nitrogen/generated/android/c++/JAndroidBackgroundLocationStatus.hpp +67 -0
- package/nitrogen/generated/android/c++/JAndroidBackgroundProvider.hpp +61 -0
- package/nitrogen/generated/android/c++/JAndroidForegroundServiceOptions.hpp +90 -0
- package/nitrogen/generated/android/c++/JBackgroundEventEnvelope.hpp +129 -0
- package/nitrogen/generated/android/c++/JBackgroundEventType.hpp +70 -0
- package/nitrogen/generated/android/c++/JBackgroundHttpMethod.hpp +61 -0
- package/nitrogen/generated/android/c++/JBackgroundHttpSyncOptions.hpp +131 -0
- package/nitrogen/generated/android/c++/JBackgroundHttpSyncResult.hpp +111 -0
- package/nitrogen/generated/android/c++/JBackgroundLocation.hpp +110 -0
- package/nitrogen/generated/android/c++/JBackgroundLocationOptions.hpp +162 -0
- package/nitrogen/generated/android/c++/JBackgroundLocationSource.hpp +73 -0
- package/nitrogen/generated/android/c++/JBackgroundLocationState.hpp +70 -0
- package/nitrogen/generated/android/c++/JBackgroundLocationStatus.hpp +126 -0
- package/nitrogen/generated/android/c++/JBackgroundPermissionResult.hpp +79 -0
- package/nitrogen/generated/android/c++/JBackgroundPermissionStatus.hpp +64 -0
- package/nitrogen/generated/android/c++/JBackgroundTrackingMode.hpp +61 -0
- package/nitrogen/generated/android/c++/JBatterySnapshot.hpp +61 -0
- package/nitrogen/generated/android/c++/JDetectedActivity.hpp +66 -0
- package/nitrogen/generated/android/c++/JDetectedActivityType.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_BackgroundEventEnvelope.hpp +114 -0
- package/nitrogen/generated/android/c++/JFunc_void_BackgroundLocation.hpp +95 -0
- package/nitrogen/generated/android/c++/JGeofenceEvent.hpp +94 -0
- package/nitrogen/generated/android/c++/JGeofenceRegion.hpp +112 -0
- package/nitrogen/generated/android/c++/JGeofenceTransition.hpp +61 -0
- package/nitrogen/generated/android/c++/JGeofencingOptions.hpp +82 -0
- package/nitrogen/generated/android/c++/JGetStoredBackgroundEventsOptions.hpp +90 -0
- package/nitrogen/generated/android/c++/JGetStoredBackgroundLocationsOptions.hpp +69 -0
- package/nitrogen/generated/android/c++/JHybridNitroBackgroundLocationSpec.cpp +662 -0
- package/nitrogen/generated/android/c++/JHybridNitroBackgroundLocationSpec.hpp +89 -0
- package/nitrogen/generated/android/c++/JIOSBackgroundActivityType.hpp +67 -0
- package/nitrogen/generated/android/c++/JIOSBackgroundLocationOptions.hpp +79 -0
- package/nitrogen/generated/android/c++/JIOSBackgroundLocationStatus.hpp +61 -0
- package/nitrogen/generated/android/c++/JLocationProviderStatus.hpp +5 -1
- package/nitrogen/generated/android/c++/JStoredBackgroundEventEnvelope.hpp +115 -0
- package/nitrogen/generated/android/c++/JStoredBackgroundLocation.hpp +122 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_Boolean_String_Double.cpp +34 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_Boolean_String_Double.hpp +100 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/ActivityRecognitionOptions.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AndroidBackgroundLocationOptions.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AndroidBackgroundLocationStatus.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AndroidBackgroundProvider.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AndroidForegroundServiceOptions.kt +91 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundEventEnvelope.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundEventType.kt +27 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundHttpMethod.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundHttpSyncOptions.kt +101 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundHttpSyncResult.kt +71 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundLocation.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundLocationOptions.kt +136 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundLocationSource.kt +28 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundLocationState.kt +27 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundLocationStatus.kt +116 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundPermissionResult.kt +71 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundPermissionStatus.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BackgroundTrackingMode.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/BatterySnapshot.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/DetectedActivity.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/DetectedActivityType.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_BackgroundEventEnvelope.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_BackgroundLocation.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeofenceEvent.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeofenceRegion.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeofenceTransition.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeofencingOptions.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GetStoredBackgroundEventsOptions.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GetStoredBackgroundLocationsOptions.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/HybridNitroBackgroundLocationSpec.kt +174 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/IOSBackgroundActivityType.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/IOSBackgroundLocationOptions.kt +76 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/IOSBackgroundLocationStatus.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationProviderStatus.kt +7 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/StoredBackgroundEventEnvelope.kt +76 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/StoredBackgroundLocation.kt +111 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Variant_NullType_Boolean_String_Double.kt +88 -0
- package/nitrogen/generated/android/nitrogeolocation+autolinking.cmake +3 -0
- package/nitrogen/generated/android/nitrogeolocationOnLoad.cpp +20 -0
- package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Bridge.cpp +104 -15
- package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Bridge.hpp +1107 -50
- package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Umbrella.hpp +102 -0
- package/nitrogen/generated/ios/NitroGeolocationAutolinking.mm +8 -0
- package/nitrogen/generated/ios/NitroGeolocationAutolinking.swift +15 -3
- package/nitrogen/generated/ios/c++/HybridNitroBackgroundLocationSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroBackgroundLocationSpecSwift.hpp +416 -0
- package/nitrogen/generated/ios/swift/ActivityRecognitionOptions.swift +96 -0
- package/nitrogen/generated/ios/swift/AndroidBackgroundLocationOptions.swift +76 -0
- package/nitrogen/generated/ios/swift/AndroidBackgroundLocationStatus.swift +58 -0
- package/nitrogen/generated/ios/swift/AndroidBackgroundProvider.swift +44 -0
- package/nitrogen/generated/ios/swift/AndroidForegroundServiceOptions.swift +160 -0
- package/nitrogen/generated/ios/swift/BackgroundEventEnvelope.swift +110 -0
- package/nitrogen/generated/ios/swift/BackgroundEventType.swift +56 -0
- package/nitrogen/generated/ios/swift/BackgroundHttpMethod.swift +44 -0
- package/nitrogen/generated/ios/swift/BackgroundHttpSyncOptions.swift +259 -0
- package/nitrogen/generated/ios/swift/BackgroundHttpSyncResult.swift +87 -0
- package/nitrogen/generated/ios/swift/BackgroundLocation.swift +118 -0
- package/nitrogen/generated/ios/swift/BackgroundLocationOptions.swift +292 -0
- package/nitrogen/generated/ios/swift/BackgroundLocationSource.swift +60 -0
- package/nitrogen/generated/ios/swift/BackgroundLocationState.swift +56 -0
- package/nitrogen/generated/ios/swift/BackgroundLocationStatus.swift +124 -0
- package/nitrogen/generated/ios/swift/BackgroundPermissionResult.swift +81 -0
- package/nitrogen/generated/ios/swift/BackgroundPermissionStatus.swift +48 -0
- package/nitrogen/generated/ios/swift/BackgroundTrackingMode.swift +44 -0
- package/nitrogen/generated/ios/swift/BatterySnapshot.swift +60 -0
- package/nitrogen/generated/ios/swift/DetectedActivity.swift +39 -0
- package/nitrogen/generated/ios/swift/DetectedActivityType.swift +64 -0
- package/nitrogen/generated/ios/swift/Func_void_BackgroundEventEnvelope.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_BackgroundHttpSyncResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_BackgroundLocation.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_BackgroundLocationStatus.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_BackgroundPermissionResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_BackgroundLocationOptions_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_GeofenceRegion_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_StoredBackgroundEventEnvelope_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_StoredBackgroundLocation_.swift +46 -0
- package/nitrogen/generated/ios/swift/GeofenceEvent.swift +50 -0
- package/nitrogen/generated/ios/swift/GeofenceRegion.swift +195 -0
- package/nitrogen/generated/ios/swift/GeofenceTransition.swift +44 -0
- package/nitrogen/generated/ios/swift/GeofencingOptions.swift +66 -0
- package/nitrogen/generated/ios/swift/GetStoredBackgroundEventsOptions.swift +102 -0
- package/nitrogen/generated/ios/swift/GetStoredBackgroundLocationsOptions.swift +96 -0
- package/nitrogen/generated/ios/swift/HybridNitroBackgroundLocationSpec.swift +81 -0
- package/nitrogen/generated/ios/swift/HybridNitroBackgroundLocationSpec_cxx.swift +654 -0
- package/nitrogen/generated/ios/swift/IOSBackgroundActivityType.swift +52 -0
- package/nitrogen/generated/ios/swift/IOSBackgroundLocationOptions.swift +125 -0
- package/nitrogen/generated/ios/swift/IOSBackgroundLocationStatus.swift +34 -0
- package/nitrogen/generated/ios/swift/LocationProviderStatus.swift +19 -1
- package/nitrogen/generated/ios/swift/StoredBackgroundEventEnvelope.swift +54 -0
- package/nitrogen/generated/ios/swift/StoredBackgroundLocation.swift +120 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_Bool_String_Double.swift +34 -0
- package/nitrogen/generated/shared/c++/ActivityRecognitionOptions.hpp +95 -0
- package/nitrogen/generated/shared/c++/AndroidBackgroundLocationOptions.hpp +100 -0
- package/nitrogen/generated/shared/c++/AndroidBackgroundLocationStatus.hpp +93 -0
- package/nitrogen/generated/shared/c++/AndroidBackgroundProvider.hpp +80 -0
- package/nitrogen/generated/shared/c++/AndroidForegroundServiceOptions.hpp +116 -0
- package/nitrogen/generated/shared/c++/BackgroundEventEnvelope.hpp +140 -0
- package/nitrogen/generated/shared/c++/BackgroundEventType.hpp +92 -0
- package/nitrogen/generated/shared/c++/BackgroundHttpMethod.hpp +80 -0
- package/nitrogen/generated/shared/c++/BackgroundHttpSyncOptions.hpp +129 -0
- package/nitrogen/generated/shared/c++/BackgroundHttpSyncResult.hpp +101 -0
- package/nitrogen/generated/shared/c++/BackgroundLocation.hpp +134 -0
- package/nitrogen/generated/shared/c++/BackgroundLocationOptions.hpp +174 -0
- package/nitrogen/generated/shared/c++/BackgroundLocationSource.hpp +96 -0
- package/nitrogen/generated/shared/c++/BackgroundLocationState.hpp +92 -0
- package/nitrogen/generated/shared/c++/BackgroundLocationStatus.hpp +158 -0
- package/nitrogen/generated/shared/c++/BackgroundPermissionResult.hpp +107 -0
- package/nitrogen/generated/shared/c++/BackgroundPermissionStatus.hpp +84 -0
- package/nitrogen/generated/shared/c++/BackgroundTrackingMode.hpp +80 -0
- package/nitrogen/generated/shared/c++/BatterySnapshot.hpp +87 -0
- package/nitrogen/generated/shared/c++/DetectedActivity.hpp +92 -0
- package/nitrogen/generated/shared/c++/DetectedActivityType.hpp +100 -0
- package/nitrogen/generated/shared/c++/GeofenceEvent.hpp +103 -0
- package/nitrogen/generated/shared/c++/GeofenceRegion.hpp +123 -0
- package/nitrogen/generated/shared/c++/GeofenceTransition.hpp +80 -0
- package/nitrogen/generated/shared/c++/GeofencingOptions.hpp +90 -0
- package/nitrogen/generated/shared/c++/GetStoredBackgroundEventsOptions.hpp +98 -0
- package/nitrogen/generated/shared/c++/GetStoredBackgroundLocationsOptions.hpp +95 -0
- package/nitrogen/generated/shared/c++/HybridNitroBackgroundLocationSpec.cpp +47 -0
- package/nitrogen/generated/shared/c++/HybridNitroBackgroundLocationSpec.hpp +133 -0
- package/nitrogen/generated/shared/c++/IOSBackgroundActivityType.hpp +88 -0
- package/nitrogen/generated/shared/c++/IOSBackgroundLocationOptions.hpp +105 -0
- package/nitrogen/generated/shared/c++/IOSBackgroundLocationStatus.hpp +87 -0
- package/nitrogen/generated/shared/c++/LocationProviderStatus.hpp +5 -1
- package/nitrogen/generated/shared/c++/StoredBackgroundEventEnvelope.hpp +108 -0
- package/nitrogen/generated/shared/c++/StoredBackgroundLocation.hpp +146 -0
- package/package.json +17 -6
- package/src/NitroGeolocation.nitro.ts +4 -4
- package/src/api/getCurrentPosition.ts +1 -1
- package/src/api/requestLocationSettings.ts +3 -2
- package/src/background/NitroBackgroundLocation.nitro.ts +83 -0
- package/src/background/index.ts +200 -0
- package/src/background/index.web.ts +120 -0
- package/src/background/task.ts +13 -0
- package/src/background/types.ts +328 -0
- package/src/compat/index.web.ts +141 -0
- package/src/index.tsx +3 -0
- package/src/index.web.tsx +41 -0
- package/src/publicTypes.ts +6 -5
- package/src/types.ts +3 -0
- package/src/web/browser.ts +171 -0
- package/src/web/index.ts +167 -0
- package/src/web/useWatchPosition.ts +76 -0
- package/src/web/watch.ts +81 -0
- package/src/devtools/index.test.ts +0 -54
- package/src/utils/errors.test.ts +0 -65
- package/src/utils/provider.test.ts +0 -303
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AndroidBackgroundLocationStatus.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `PermissionStatus` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::nitrogeolocation { enum class PermissionStatus; }
|
|
33
|
+
|
|
34
|
+
#include <optional>
|
|
35
|
+
#include "PermissionStatus.hpp"
|
|
36
|
+
|
|
37
|
+
namespace margelo::nitro::nitrogeolocation {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A struct which can be represented as a JavaScript object (AndroidBackgroundLocationStatus).
|
|
41
|
+
*/
|
|
42
|
+
struct AndroidBackgroundLocationStatus final {
|
|
43
|
+
public:
|
|
44
|
+
bool isForegroundServiceRunning SWIFT_PRIVATE;
|
|
45
|
+
std::optional<bool> isIgnoringBatteryOptimizations SWIFT_PRIVATE;
|
|
46
|
+
std::optional<PermissionStatus> notificationPermission SWIFT_PRIVATE;
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
AndroidBackgroundLocationStatus() = default;
|
|
50
|
+
explicit AndroidBackgroundLocationStatus(bool isForegroundServiceRunning, std::optional<bool> isIgnoringBatteryOptimizations, std::optional<PermissionStatus> notificationPermission): isForegroundServiceRunning(isForegroundServiceRunning), isIgnoringBatteryOptimizations(isIgnoringBatteryOptimizations), notificationPermission(notificationPermission) {}
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
friend bool operator==(const AndroidBackgroundLocationStatus& lhs, const AndroidBackgroundLocationStatus& rhs) = default;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
57
|
+
|
|
58
|
+
namespace margelo::nitro {
|
|
59
|
+
|
|
60
|
+
// C++ AndroidBackgroundLocationStatus <> JS AndroidBackgroundLocationStatus (object)
|
|
61
|
+
template <>
|
|
62
|
+
struct JSIConverter<margelo::nitro::nitrogeolocation::AndroidBackgroundLocationStatus> final {
|
|
63
|
+
static inline margelo::nitro::nitrogeolocation::AndroidBackgroundLocationStatus fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
64
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
65
|
+
return margelo::nitro::nitrogeolocation::AndroidBackgroundLocationStatus(
|
|
66
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isForegroundServiceRunning"))),
|
|
67
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isIgnoringBatteryOptimizations"))),
|
|
68
|
+
JSIConverter<std::optional<margelo::nitro::nitrogeolocation::PermissionStatus>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationPermission")))
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::AndroidBackgroundLocationStatus& arg) {
|
|
72
|
+
jsi::Object obj(runtime);
|
|
73
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "isForegroundServiceRunning"), JSIConverter<bool>::toJSI(runtime, arg.isForegroundServiceRunning));
|
|
74
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "isIgnoringBatteryOptimizations"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.isIgnoringBatteryOptimizations));
|
|
75
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "notificationPermission"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::PermissionStatus>>::toJSI(runtime, arg.notificationPermission));
|
|
76
|
+
return obj;
|
|
77
|
+
}
|
|
78
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
79
|
+
if (!value.isObject()) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
jsi::Object obj = value.getObject(runtime);
|
|
83
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isForegroundServiceRunning")))) return false;
|
|
87
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isIgnoringBatteryOptimizations")))) return false;
|
|
88
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::PermissionStatus>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationPermission")))) return false;
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AndroidBackgroundProvider.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::nitrogeolocation {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (AndroidBackgroundProvider).
|
|
30
|
+
*/
|
|
31
|
+
enum class AndroidBackgroundProvider {
|
|
32
|
+
AUTO SWIFT_NAME(auto) = 0,
|
|
33
|
+
PLAYSERVICES SWIFT_NAME(playservices) = 1,
|
|
34
|
+
ANDROID_PLATFORM SWIFT_NAME(androidPlatform) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ AndroidBackgroundProvider <> JS AndroidBackgroundProvider (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::nitrogeolocation::AndroidBackgroundProvider> final {
|
|
44
|
+
static inline margelo::nitro::nitrogeolocation::AndroidBackgroundProvider fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("auto"): return margelo::nitro::nitrogeolocation::AndroidBackgroundProvider::AUTO;
|
|
48
|
+
case hashString("playServices"): return margelo::nitro::nitrogeolocation::AndroidBackgroundProvider::PLAYSERVICES;
|
|
49
|
+
case hashString("android_platform"): return margelo::nitro::nitrogeolocation::AndroidBackgroundProvider::ANDROID_PLATFORM;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum AndroidBackgroundProvider - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitrogeolocation::AndroidBackgroundProvider arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::nitrogeolocation::AndroidBackgroundProvider::AUTO: return JSIConverter<std::string>::toJSI(runtime, "auto");
|
|
57
|
+
case margelo::nitro::nitrogeolocation::AndroidBackgroundProvider::PLAYSERVICES: return JSIConverter<std::string>::toJSI(runtime, "playServices");
|
|
58
|
+
case margelo::nitro::nitrogeolocation::AndroidBackgroundProvider::ANDROID_PLATFORM: return JSIConverter<std::string>::toJSI(runtime, "android_platform");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert AndroidBackgroundProvider to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("auto"):
|
|
71
|
+
case hashString("playServices"):
|
|
72
|
+
case hashString("android_platform"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AndroidForegroundServiceOptions.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <optional>
|
|
34
|
+
#include <string>
|
|
35
|
+
|
|
36
|
+
namespace margelo::nitro::nitrogeolocation {
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A struct which can be represented as a JavaScript object (AndroidForegroundServiceOptions).
|
|
40
|
+
*/
|
|
41
|
+
struct AndroidForegroundServiceOptions final {
|
|
42
|
+
public:
|
|
43
|
+
std::optional<double> notificationId SWIFT_PRIVATE;
|
|
44
|
+
std::string notificationTitle SWIFT_PRIVATE;
|
|
45
|
+
std::string notificationText SWIFT_PRIVATE;
|
|
46
|
+
std::optional<std::string> notificationChannelId SWIFT_PRIVATE;
|
|
47
|
+
std::optional<std::string> notificationChannelName SWIFT_PRIVATE;
|
|
48
|
+
std::optional<std::string> notificationChannelDescription SWIFT_PRIVATE;
|
|
49
|
+
std::optional<std::string> notificationIcon SWIFT_PRIVATE;
|
|
50
|
+
std::optional<std::string> notificationColor SWIFT_PRIVATE;
|
|
51
|
+
std::optional<std::string> stopActionTitle SWIFT_PRIVATE;
|
|
52
|
+
|
|
53
|
+
public:
|
|
54
|
+
AndroidForegroundServiceOptions() = default;
|
|
55
|
+
explicit AndroidForegroundServiceOptions(std::optional<double> notificationId, std::string notificationTitle, std::string notificationText, std::optional<std::string> notificationChannelId, std::optional<std::string> notificationChannelName, std::optional<std::string> notificationChannelDescription, std::optional<std::string> notificationIcon, std::optional<std::string> notificationColor, std::optional<std::string> stopActionTitle): notificationId(notificationId), notificationTitle(notificationTitle), notificationText(notificationText), notificationChannelId(notificationChannelId), notificationChannelName(notificationChannelName), notificationChannelDescription(notificationChannelDescription), notificationIcon(notificationIcon), notificationColor(notificationColor), stopActionTitle(stopActionTitle) {}
|
|
56
|
+
|
|
57
|
+
public:
|
|
58
|
+
friend bool operator==(const AndroidForegroundServiceOptions& lhs, const AndroidForegroundServiceOptions& rhs) = default;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
62
|
+
|
|
63
|
+
namespace margelo::nitro {
|
|
64
|
+
|
|
65
|
+
// C++ AndroidForegroundServiceOptions <> JS AndroidForegroundServiceOptions (object)
|
|
66
|
+
template <>
|
|
67
|
+
struct JSIConverter<margelo::nitro::nitrogeolocation::AndroidForegroundServiceOptions> final {
|
|
68
|
+
static inline margelo::nitro::nitrogeolocation::AndroidForegroundServiceOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
69
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
70
|
+
return margelo::nitro::nitrogeolocation::AndroidForegroundServiceOptions(
|
|
71
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationId"))),
|
|
72
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationTitle"))),
|
|
73
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationText"))),
|
|
74
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationChannelId"))),
|
|
75
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationChannelName"))),
|
|
76
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationChannelDescription"))),
|
|
77
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationIcon"))),
|
|
78
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationColor"))),
|
|
79
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stopActionTitle")))
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::AndroidForegroundServiceOptions& arg) {
|
|
83
|
+
jsi::Object obj(runtime);
|
|
84
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "notificationId"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.notificationId));
|
|
85
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "notificationTitle"), JSIConverter<std::string>::toJSI(runtime, arg.notificationTitle));
|
|
86
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "notificationText"), JSIConverter<std::string>::toJSI(runtime, arg.notificationText));
|
|
87
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "notificationChannelId"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.notificationChannelId));
|
|
88
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "notificationChannelName"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.notificationChannelName));
|
|
89
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "notificationChannelDescription"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.notificationChannelDescription));
|
|
90
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "notificationIcon"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.notificationIcon));
|
|
91
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "notificationColor"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.notificationColor));
|
|
92
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "stopActionTitle"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.stopActionTitle));
|
|
93
|
+
return obj;
|
|
94
|
+
}
|
|
95
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
96
|
+
if (!value.isObject()) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
jsi::Object obj = value.getObject(runtime);
|
|
100
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationId")))) return false;
|
|
104
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationTitle")))) return false;
|
|
105
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationText")))) return false;
|
|
106
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationChannelId")))) return false;
|
|
107
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationChannelName")))) return false;
|
|
108
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationChannelDescription")))) return false;
|
|
109
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationIcon")))) return false;
|
|
110
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationColor")))) return false;
|
|
111
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stopActionTitle")))) return false;
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// BackgroundEventEnvelope.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `BackgroundLocation` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::nitrogeolocation { struct BackgroundLocation; }
|
|
33
|
+
// Forward declaration of `GeofenceEvent` to properly resolve imports.
|
|
34
|
+
namespace margelo::nitro::nitrogeolocation { struct GeofenceEvent; }
|
|
35
|
+
// Forward declaration of `DetectedActivity` to properly resolve imports.
|
|
36
|
+
namespace margelo::nitro::nitrogeolocation { struct DetectedActivity; }
|
|
37
|
+
// Forward declaration of `LocationProviderStatus` to properly resolve imports.
|
|
38
|
+
namespace margelo::nitro::nitrogeolocation { struct LocationProviderStatus; }
|
|
39
|
+
// Forward declaration of `BackgroundHttpSyncResult` to properly resolve imports.
|
|
40
|
+
namespace margelo::nitro::nitrogeolocation { struct BackgroundHttpSyncResult; }
|
|
41
|
+
// Forward declaration of `LocationError` to properly resolve imports.
|
|
42
|
+
namespace margelo::nitro::nitrogeolocation { struct LocationError; }
|
|
43
|
+
// Forward declaration of `BackgroundEventType` to properly resolve imports.
|
|
44
|
+
namespace margelo::nitro::nitrogeolocation { enum class BackgroundEventType; }
|
|
45
|
+
|
|
46
|
+
#include "BackgroundLocation.hpp"
|
|
47
|
+
#include <optional>
|
|
48
|
+
#include "GeofenceEvent.hpp"
|
|
49
|
+
#include "DetectedActivity.hpp"
|
|
50
|
+
#include "LocationProviderStatus.hpp"
|
|
51
|
+
#include "BackgroundHttpSyncResult.hpp"
|
|
52
|
+
#include "LocationError.hpp"
|
|
53
|
+
#include <string>
|
|
54
|
+
#include "BackgroundEventType.hpp"
|
|
55
|
+
|
|
56
|
+
namespace margelo::nitro::nitrogeolocation {
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A struct which can be represented as a JavaScript object (BackgroundEventEnvelope).
|
|
60
|
+
*/
|
|
61
|
+
struct BackgroundEventEnvelope final {
|
|
62
|
+
public:
|
|
63
|
+
std::optional<BackgroundLocation> location SWIFT_PRIVATE;
|
|
64
|
+
std::optional<GeofenceEvent> geofence SWIFT_PRIVATE;
|
|
65
|
+
std::optional<DetectedActivity> activity SWIFT_PRIVATE;
|
|
66
|
+
std::optional<LocationProviderStatus> providerStatus SWIFT_PRIVATE;
|
|
67
|
+
std::optional<BackgroundHttpSyncResult> result SWIFT_PRIVATE;
|
|
68
|
+
std::optional<LocationError> error SWIFT_PRIVATE;
|
|
69
|
+
std::string id SWIFT_PRIVATE;
|
|
70
|
+
BackgroundEventType type SWIFT_PRIVATE;
|
|
71
|
+
double timestamp SWIFT_PRIVATE;
|
|
72
|
+
bool deliveredToJS SWIFT_PRIVATE;
|
|
73
|
+
|
|
74
|
+
public:
|
|
75
|
+
BackgroundEventEnvelope() = default;
|
|
76
|
+
explicit BackgroundEventEnvelope(std::optional<BackgroundLocation> location, std::optional<GeofenceEvent> geofence, std::optional<DetectedActivity> activity, std::optional<LocationProviderStatus> providerStatus, std::optional<BackgroundHttpSyncResult> result, std::optional<LocationError> error, std::string id, BackgroundEventType type, double timestamp, bool deliveredToJS): location(location), geofence(geofence), activity(activity), providerStatus(providerStatus), result(result), error(error), id(id), type(type), timestamp(timestamp), deliveredToJS(deliveredToJS) {}
|
|
77
|
+
|
|
78
|
+
public:
|
|
79
|
+
friend bool operator==(const BackgroundEventEnvelope& lhs, const BackgroundEventEnvelope& rhs) = default;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
83
|
+
|
|
84
|
+
namespace margelo::nitro {
|
|
85
|
+
|
|
86
|
+
// C++ BackgroundEventEnvelope <> JS BackgroundEventEnvelope (object)
|
|
87
|
+
template <>
|
|
88
|
+
struct JSIConverter<margelo::nitro::nitrogeolocation::BackgroundEventEnvelope> final {
|
|
89
|
+
static inline margelo::nitro::nitrogeolocation::BackgroundEventEnvelope fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
90
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
91
|
+
return margelo::nitro::nitrogeolocation::BackgroundEventEnvelope(
|
|
92
|
+
JSIConverter<std::optional<margelo::nitro::nitrogeolocation::BackgroundLocation>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "location"))),
|
|
93
|
+
JSIConverter<std::optional<margelo::nitro::nitrogeolocation::GeofenceEvent>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "geofence"))),
|
|
94
|
+
JSIConverter<std::optional<margelo::nitro::nitrogeolocation::DetectedActivity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "activity"))),
|
|
95
|
+
JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationProviderStatus>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "providerStatus"))),
|
|
96
|
+
JSIConverter<std::optional<margelo::nitro::nitrogeolocation::BackgroundHttpSyncResult>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "result"))),
|
|
97
|
+
JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationError>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "error"))),
|
|
98
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id"))),
|
|
99
|
+
JSIConverter<margelo::nitro::nitrogeolocation::BackgroundEventType>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
|
|
100
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp"))),
|
|
101
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deliveredToJS")))
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogeolocation::BackgroundEventEnvelope& arg) {
|
|
105
|
+
jsi::Object obj(runtime);
|
|
106
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "location"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::BackgroundLocation>>::toJSI(runtime, arg.location));
|
|
107
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "geofence"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::GeofenceEvent>>::toJSI(runtime, arg.geofence));
|
|
108
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "activity"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::DetectedActivity>>::toJSI(runtime, arg.activity));
|
|
109
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "providerStatus"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationProviderStatus>>::toJSI(runtime, arg.providerStatus));
|
|
110
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "result"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::BackgroundHttpSyncResult>>::toJSI(runtime, arg.result));
|
|
111
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "error"), JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationError>>::toJSI(runtime, arg.error));
|
|
112
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "id"), JSIConverter<std::string>::toJSI(runtime, arg.id));
|
|
113
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<margelo::nitro::nitrogeolocation::BackgroundEventType>::toJSI(runtime, arg.type));
|
|
114
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestamp"), JSIConverter<double>::toJSI(runtime, arg.timestamp));
|
|
115
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "deliveredToJS"), JSIConverter<bool>::toJSI(runtime, arg.deliveredToJS));
|
|
116
|
+
return obj;
|
|
117
|
+
}
|
|
118
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
119
|
+
if (!value.isObject()) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
jsi::Object obj = value.getObject(runtime);
|
|
123
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::BackgroundLocation>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "location")))) return false;
|
|
127
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::GeofenceEvent>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "geofence")))) return false;
|
|
128
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::DetectedActivity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "activity")))) return false;
|
|
129
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationProviderStatus>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "providerStatus")))) return false;
|
|
130
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::BackgroundHttpSyncResult>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "result")))) return false;
|
|
131
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitrogeolocation::LocationError>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "error")))) return false;
|
|
132
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id")))) return false;
|
|
133
|
+
if (!JSIConverter<margelo::nitro::nitrogeolocation::BackgroundEventType>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
|
|
134
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp")))) return false;
|
|
135
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deliveredToJS")))) return false;
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// BackgroundEventType.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::nitrogeolocation {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (BackgroundEventType).
|
|
30
|
+
*/
|
|
31
|
+
enum class BackgroundEventType {
|
|
32
|
+
ERROR SWIFT_NAME(error) = 0,
|
|
33
|
+
GEOFENCE SWIFT_NAME(geofence) = 1,
|
|
34
|
+
LOCATION SWIFT_NAME(location) = 2,
|
|
35
|
+
ACTIVITY SWIFT_NAME(activity) = 3,
|
|
36
|
+
PROVIDERCHANGE SWIFT_NAME(providerchange) = 4,
|
|
37
|
+
HTTPSYNC SWIFT_NAME(httpsync) = 5,
|
|
38
|
+
} CLOSED_ENUM;
|
|
39
|
+
|
|
40
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
41
|
+
|
|
42
|
+
namespace margelo::nitro {
|
|
43
|
+
|
|
44
|
+
// C++ BackgroundEventType <> JS BackgroundEventType (union)
|
|
45
|
+
template <>
|
|
46
|
+
struct JSIConverter<margelo::nitro::nitrogeolocation::BackgroundEventType> final {
|
|
47
|
+
static inline margelo::nitro::nitrogeolocation::BackgroundEventType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
48
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
49
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
50
|
+
case hashString("error"): return margelo::nitro::nitrogeolocation::BackgroundEventType::ERROR;
|
|
51
|
+
case hashString("geofence"): return margelo::nitro::nitrogeolocation::BackgroundEventType::GEOFENCE;
|
|
52
|
+
case hashString("location"): return margelo::nitro::nitrogeolocation::BackgroundEventType::LOCATION;
|
|
53
|
+
case hashString("activity"): return margelo::nitro::nitrogeolocation::BackgroundEventType::ACTIVITY;
|
|
54
|
+
case hashString("providerChange"): return margelo::nitro::nitrogeolocation::BackgroundEventType::PROVIDERCHANGE;
|
|
55
|
+
case hashString("httpSync"): return margelo::nitro::nitrogeolocation::BackgroundEventType::HTTPSYNC;
|
|
56
|
+
default: [[unlikely]]
|
|
57
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum BackgroundEventType - invalid value!");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitrogeolocation::BackgroundEventType arg) {
|
|
61
|
+
switch (arg) {
|
|
62
|
+
case margelo::nitro::nitrogeolocation::BackgroundEventType::ERROR: return JSIConverter<std::string>::toJSI(runtime, "error");
|
|
63
|
+
case margelo::nitro::nitrogeolocation::BackgroundEventType::GEOFENCE: return JSIConverter<std::string>::toJSI(runtime, "geofence");
|
|
64
|
+
case margelo::nitro::nitrogeolocation::BackgroundEventType::LOCATION: return JSIConverter<std::string>::toJSI(runtime, "location");
|
|
65
|
+
case margelo::nitro::nitrogeolocation::BackgroundEventType::ACTIVITY: return JSIConverter<std::string>::toJSI(runtime, "activity");
|
|
66
|
+
case margelo::nitro::nitrogeolocation::BackgroundEventType::PROVIDERCHANGE: return JSIConverter<std::string>::toJSI(runtime, "providerChange");
|
|
67
|
+
case margelo::nitro::nitrogeolocation::BackgroundEventType::HTTPSYNC: return JSIConverter<std::string>::toJSI(runtime, "httpSync");
|
|
68
|
+
default: [[unlikely]]
|
|
69
|
+
throw std::invalid_argument("Cannot convert BackgroundEventType to JS - invalid value: "
|
|
70
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
74
|
+
if (!value.isString()) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
78
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
79
|
+
case hashString("error"):
|
|
80
|
+
case hashString("geofence"):
|
|
81
|
+
case hashString("location"):
|
|
82
|
+
case hashString("activity"):
|
|
83
|
+
case hashString("providerChange"):
|
|
84
|
+
case hashString("httpSync"):
|
|
85
|
+
return true;
|
|
86
|
+
default:
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// BackgroundHttpMethod.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::nitrogeolocation {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (BackgroundHttpMethod).
|
|
30
|
+
*/
|
|
31
|
+
enum class BackgroundHttpMethod {
|
|
32
|
+
POST SWIFT_NAME(post) = 0,
|
|
33
|
+
PUT SWIFT_NAME(put) = 1,
|
|
34
|
+
PATCH SWIFT_NAME(patch) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::nitrogeolocation
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ BackgroundHttpMethod <> JS BackgroundHttpMethod (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::nitrogeolocation::BackgroundHttpMethod> final {
|
|
44
|
+
static inline margelo::nitro::nitrogeolocation::BackgroundHttpMethod fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("POST"): return margelo::nitro::nitrogeolocation::BackgroundHttpMethod::POST;
|
|
48
|
+
case hashString("PUT"): return margelo::nitro::nitrogeolocation::BackgroundHttpMethod::PUT;
|
|
49
|
+
case hashString("PATCH"): return margelo::nitro::nitrogeolocation::BackgroundHttpMethod::PATCH;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum BackgroundHttpMethod - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitrogeolocation::BackgroundHttpMethod arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::nitrogeolocation::BackgroundHttpMethod::POST: return JSIConverter<std::string>::toJSI(runtime, "POST");
|
|
57
|
+
case margelo::nitro::nitrogeolocation::BackgroundHttpMethod::PUT: return JSIConverter<std::string>::toJSI(runtime, "PUT");
|
|
58
|
+
case margelo::nitro::nitrogeolocation::BackgroundHttpMethod::PATCH: return JSIConverter<std::string>::toJSI(runtime, "PATCH");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert BackgroundHttpMethod to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("POST"):
|
|
71
|
+
case hashString("PUT"):
|
|
72
|
+
case hashString("PATCH"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|