@capawesome/capacitor-singular 0.0.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/CapawesomeCapacitorSingular.podspec +19 -0
- package/LICENSE +21 -0
- package/Package.swift +26 -0
- package/README.md +1262 -0
- package/android/build.gradle +61 -0
- package/android/src/main/AndroidManifest.xml +5 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/Singular.java +443 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/SingularHelper.java +53 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/SingularPlugin.java +336 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/CustomException.java +20 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/CustomExceptions.java +34 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/events/DeviceAttributionInfoReceivedEvent.java +48 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/events/SdidReceivedEvent.java +23 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/events/SdidSetEvent.java +23 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/events/SingularLinkResolvedEvent.java +44 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/options/CreateReferrerShortLinkOptions.java +61 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/options/InitializeOptions.java +168 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/options/SetCustomUserIdOptions.java +24 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/options/SetDeviceTokenOptions.java +24 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/options/SetGlobalPropertyOptions.java +44 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/options/SetLimitAdvertisingIdentifiersOptions.java +22 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/options/SetLimitDataSharingOptions.java +22 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/options/TrackAdRevenueOptions.java +157 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/options/TrackEventOptions.java +35 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/options/TrackRevenueOptions.java +56 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/options/UnsetGlobalPropertyOptions.java +24 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/results/CreateReferrerShortLinkResult.java +23 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/results/GetGlobalPropertiesResult.java +31 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/results/GetLimitDataSharingResult.java +22 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/classes/results/IsAllTrackingStoppedResult.java +22 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/interfaces/Callback.java +5 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/interfaces/EmptyCallback.java +5 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/interfaces/NonEmptyResultCallback.java +7 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/singular/interfaces/Result.java +7 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +2014 -0
- package/dist/esm/definitions.d.ts +925 -0
- package/dist/esm/definitions.js +39 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +27 -0
- package/dist/esm/web.js +73 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +126 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +129 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/Classes/Events/DeviceAttributionInfoReceivedEvent.swift +43 -0
- package/ios/Plugin/Classes/Events/SdidReceivedEvent.swift +16 -0
- package/ios/Plugin/Classes/Events/SdidSetEvent.swift +16 -0
- package/ios/Plugin/Classes/Events/SingularLinkResolvedEvent.swift +28 -0
- package/ios/Plugin/Classes/Events/SkanConversionValueUpdatedEvent.swift +30 -0
- package/ios/Plugin/Classes/Options/CreateReferrerShortLinkOptions.swift +25 -0
- package/ios/Plugin/Classes/Options/InitializeOptions.swift +44 -0
- package/ios/Plugin/Classes/Options/SetCustomUserIdOptions.swift +13 -0
- package/ios/Plugin/Classes/Options/SetDeviceTokenOptions.swift +30 -0
- package/ios/Plugin/Classes/Options/SetGlobalPropertyOptions.swift +20 -0
- package/ios/Plugin/Classes/Options/SetLimitAdvertisingIdentifiersOptions.swift +13 -0
- package/ios/Plugin/Classes/Options/SetLimitDataSharingOptions.swift +13 -0
- package/ios/Plugin/Classes/Options/SkanUpdateConversionValueOptions.swift +27 -0
- package/ios/Plugin/Classes/Options/TrackAdRevenueOptions.swift +47 -0
- package/ios/Plugin/Classes/Options/TrackEventOptions.swift +15 -0
- package/ios/Plugin/Classes/Options/TrackRevenueOptions.swift +22 -0
- package/ios/Plugin/Classes/Options/UnsetGlobalPropertyOptions.swift +13 -0
- package/ios/Plugin/Classes/Results/CreateReferrerShortLinkResult.swift +16 -0
- package/ios/Plugin/Classes/Results/GetGlobalPropertiesResult.swift +16 -0
- package/ios/Plugin/Classes/Results/GetLimitDataSharingResult.swift +16 -0
- package/ios/Plugin/Classes/Results/IsAllTrackingStoppedResult.swift +16 -0
- package/ios/Plugin/Classes/Results/SkanGetConversionValueResult.swift +20 -0
- package/ios/Plugin/Enums/CustomError.swift +88 -0
- package/ios/Plugin/Enums/SkanCoarseConversionValue.swift +31 -0
- package/ios/Plugin/Info.plist +24 -0
- package/ios/Plugin/Protocols/Result.swift +6 -0
- package/ios/Plugin/Singular.swift +341 -0
- package/ios/Plugin/SingularHelper.swift +40 -0
- package/ios/Plugin/SingularPlugin.swift +340 -0
- package/package.json +102 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc(SingularPlugin)
|
|
5
|
+
public class SingularPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
6
|
+
public let identifier = "SingularPlugin"
|
|
7
|
+
public let jsName = "Singular"
|
|
8
|
+
public let pluginMethods: [CAPPluginMethod] = [
|
|
9
|
+
CAPPluginMethod(name: "clearGlobalProperties", returnType: CAPPluginReturnPromise),
|
|
10
|
+
CAPPluginMethod(name: "createReferrerShortLink", returnType: CAPPluginReturnPromise),
|
|
11
|
+
CAPPluginMethod(name: "getGlobalProperties", returnType: CAPPluginReturnPromise),
|
|
12
|
+
CAPPluginMethod(name: "getLimitDataSharing", returnType: CAPPluginReturnPromise),
|
|
13
|
+
CAPPluginMethod(name: "initialize", returnType: CAPPluginReturnPromise),
|
|
14
|
+
CAPPluginMethod(name: "isAllTrackingStopped", returnType: CAPPluginReturnPromise),
|
|
15
|
+
CAPPluginMethod(name: "resumeAllTracking", returnType: CAPPluginReturnPromise),
|
|
16
|
+
CAPPluginMethod(name: "setCustomUserId", returnType: CAPPluginReturnPromise),
|
|
17
|
+
CAPPluginMethod(name: "setDeviceToken", returnType: CAPPluginReturnPromise),
|
|
18
|
+
CAPPluginMethod(name: "setGlobalProperty", returnType: CAPPluginReturnPromise),
|
|
19
|
+
CAPPluginMethod(name: "setLimitAdvertisingIdentifiers", returnType: CAPPluginReturnPromise),
|
|
20
|
+
CAPPluginMethod(name: "setLimitDataSharing", returnType: CAPPluginReturnPromise),
|
|
21
|
+
CAPPluginMethod(name: "skanGetConversionValue", returnType: CAPPluginReturnPromise),
|
|
22
|
+
CAPPluginMethod(name: "skanRegisterAppForAdNetworkAttribution", returnType: CAPPluginReturnPromise),
|
|
23
|
+
CAPPluginMethod(name: "skanUpdateConversionValue", returnType: CAPPluginReturnPromise),
|
|
24
|
+
CAPPluginMethod(name: "stopAllTracking", returnType: CAPPluginReturnPromise),
|
|
25
|
+
CAPPluginMethod(name: "trackAdRevenue", returnType: CAPPluginReturnPromise),
|
|
26
|
+
CAPPluginMethod(name: "trackEvent", returnType: CAPPluginReturnPromise),
|
|
27
|
+
CAPPluginMethod(name: "trackRevenue", returnType: CAPPluginReturnPromise),
|
|
28
|
+
CAPPluginMethod(name: "trackingOptIn", returnType: CAPPluginReturnPromise),
|
|
29
|
+
CAPPluginMethod(name: "trackingUnder13", returnType: CAPPluginReturnPromise),
|
|
30
|
+
CAPPluginMethod(name: "unsetCustomUserId", returnType: CAPPluginReturnPromise),
|
|
31
|
+
CAPPluginMethod(name: "unsetGlobalProperty", returnType: CAPPluginReturnPromise)
|
|
32
|
+
]
|
|
33
|
+
public static let eventDeviceAttributionInfoReceived = "deviceAttributionInfoReceived"
|
|
34
|
+
public static let eventSdidReceived = "sdidReceived"
|
|
35
|
+
public static let eventSdidSet = "sdidSet"
|
|
36
|
+
public static let eventSingularLinkResolved = "singularLinkResolved"
|
|
37
|
+
public static let eventSkanConversionValueUpdated = "skanConversionValueUpdated"
|
|
38
|
+
public let tag = "Singular"
|
|
39
|
+
private var implementation: SingularImpl?
|
|
40
|
+
|
|
41
|
+
override public func load() {
|
|
42
|
+
super.load()
|
|
43
|
+
self.implementation = SingularImpl(plugin: self)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@objc func clearGlobalProperties(_ call: CAPPluginCall) {
|
|
47
|
+
do {
|
|
48
|
+
try implementation?.clearGlobalProperties(completion: { error in
|
|
49
|
+
self.handleCompletion(call, error)
|
|
50
|
+
})
|
|
51
|
+
} catch {
|
|
52
|
+
rejectCall(call, error)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@objc func createReferrerShortLink(_ call: CAPPluginCall) {
|
|
57
|
+
do {
|
|
58
|
+
let options = try CreateReferrerShortLinkOptions(call)
|
|
59
|
+
try implementation?.createReferrerShortLink(options, completion: { result, error in
|
|
60
|
+
self.handleCompletion(call, result, error)
|
|
61
|
+
})
|
|
62
|
+
} catch {
|
|
63
|
+
rejectCall(call, error)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@objc func getGlobalProperties(_ call: CAPPluginCall) {
|
|
68
|
+
do {
|
|
69
|
+
try implementation?.getGlobalProperties(completion: { result, error in
|
|
70
|
+
self.handleCompletion(call, result, error)
|
|
71
|
+
})
|
|
72
|
+
} catch {
|
|
73
|
+
rejectCall(call, error)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@objc func getLimitDataSharing(_ call: CAPPluginCall) {
|
|
78
|
+
do {
|
|
79
|
+
try implementation?.getLimitDataSharing(completion: { result, error in
|
|
80
|
+
self.handleCompletion(call, result, error)
|
|
81
|
+
})
|
|
82
|
+
} catch {
|
|
83
|
+
rejectCall(call, error)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@objc func initialize(_ call: CAPPluginCall) {
|
|
88
|
+
do {
|
|
89
|
+
let options = try InitializeOptions(call)
|
|
90
|
+
implementation?.initialize(options, completion: { error in
|
|
91
|
+
self.handleCompletion(call, error)
|
|
92
|
+
})
|
|
93
|
+
} catch {
|
|
94
|
+
rejectCall(call, error)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@objc func isAllTrackingStopped(_ call: CAPPluginCall) {
|
|
99
|
+
do {
|
|
100
|
+
try implementation?.isAllTrackingStopped(completion: { result, error in
|
|
101
|
+
self.handleCompletion(call, result, error)
|
|
102
|
+
})
|
|
103
|
+
} catch {
|
|
104
|
+
rejectCall(call, error)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public func notifyDeviceAttributionInfoReceivedListeners(_ event: DeviceAttributionInfoReceivedEvent) {
|
|
109
|
+
notifyListeners(Self.eventDeviceAttributionInfoReceived, data: event.toJSObject() as? [String: Any])
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
public func notifySdidReceivedListeners(_ event: SdidReceivedEvent) {
|
|
113
|
+
notifyListeners(Self.eventSdidReceived, data: event.toJSObject() as? [String: Any])
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
public func notifySdidSetListeners(_ event: SdidSetEvent) {
|
|
117
|
+
notifyListeners(Self.eventSdidSet, data: event.toJSObject() as? [String: Any])
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
public func notifySingularLinkResolvedListeners(_ event: SingularLinkResolvedEvent) {
|
|
121
|
+
notifyListeners(Self.eventSingularLinkResolved, data: event.toJSObject() as? [String: Any])
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
public func notifySkanConversionValueUpdatedListeners(_ event: SkanConversionValueUpdatedEvent) {
|
|
125
|
+
notifyListeners(Self.eventSkanConversionValueUpdated, data: event.toJSObject() as? [String: Any])
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@objc func resumeAllTracking(_ call: CAPPluginCall) {
|
|
129
|
+
do {
|
|
130
|
+
try implementation?.resumeAllTracking(completion: { error in
|
|
131
|
+
self.handleCompletion(call, error)
|
|
132
|
+
})
|
|
133
|
+
} catch {
|
|
134
|
+
rejectCall(call, error)
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@objc func setCustomUserId(_ call: CAPPluginCall) {
|
|
139
|
+
do {
|
|
140
|
+
let options = try SetCustomUserIdOptions(call)
|
|
141
|
+
try implementation?.setCustomUserId(options, completion: { error in
|
|
142
|
+
self.handleCompletion(call, error)
|
|
143
|
+
})
|
|
144
|
+
} catch {
|
|
145
|
+
rejectCall(call, error)
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@objc func setDeviceToken(_ call: CAPPluginCall) {
|
|
150
|
+
do {
|
|
151
|
+
let options = try SetDeviceTokenOptions(call)
|
|
152
|
+
try implementation?.setDeviceToken(options, completion: { error in
|
|
153
|
+
self.handleCompletion(call, error)
|
|
154
|
+
})
|
|
155
|
+
} catch {
|
|
156
|
+
rejectCall(call, error)
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
@objc func setGlobalProperty(_ call: CAPPluginCall) {
|
|
161
|
+
do {
|
|
162
|
+
let options = try SetGlobalPropertyOptions(call)
|
|
163
|
+
try implementation?.setGlobalProperty(options, completion: { error in
|
|
164
|
+
self.handleCompletion(call, error)
|
|
165
|
+
})
|
|
166
|
+
} catch {
|
|
167
|
+
rejectCall(call, error)
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
@objc func setLimitAdvertisingIdentifiers(_ call: CAPPluginCall) {
|
|
172
|
+
do {
|
|
173
|
+
let options = try SetLimitAdvertisingIdentifiersOptions(call)
|
|
174
|
+
try implementation?.setLimitAdvertisingIdentifiers(options, completion: { error in
|
|
175
|
+
self.handleCompletion(call, error)
|
|
176
|
+
})
|
|
177
|
+
} catch {
|
|
178
|
+
rejectCall(call, error)
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@objc func setLimitDataSharing(_ call: CAPPluginCall) {
|
|
183
|
+
do {
|
|
184
|
+
let options = try SetLimitDataSharingOptions(call)
|
|
185
|
+
try implementation?.setLimitDataSharing(options, completion: { error in
|
|
186
|
+
self.handleCompletion(call, error)
|
|
187
|
+
})
|
|
188
|
+
} catch {
|
|
189
|
+
rejectCall(call, error)
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
@objc func skanGetConversionValue(_ call: CAPPluginCall) {
|
|
194
|
+
do {
|
|
195
|
+
try implementation?.skanGetConversionValue(completion: { result, error in
|
|
196
|
+
self.handleCompletion(call, result, error)
|
|
197
|
+
})
|
|
198
|
+
} catch {
|
|
199
|
+
rejectCall(call, error)
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@objc func skanRegisterAppForAdNetworkAttribution(_ call: CAPPluginCall) {
|
|
204
|
+
do {
|
|
205
|
+
try implementation?.skanRegisterAppForAdNetworkAttribution(completion: { error in
|
|
206
|
+
self.handleCompletion(call, error)
|
|
207
|
+
})
|
|
208
|
+
} catch {
|
|
209
|
+
rejectCall(call, error)
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@objc func skanUpdateConversionValue(_ call: CAPPluginCall) {
|
|
214
|
+
do {
|
|
215
|
+
let options = try SkanUpdateConversionValueOptions(call)
|
|
216
|
+
try implementation?.skanUpdateConversionValue(options, completion: { error in
|
|
217
|
+
self.handleCompletion(call, error)
|
|
218
|
+
})
|
|
219
|
+
} catch {
|
|
220
|
+
rejectCall(call, error)
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@objc func stopAllTracking(_ call: CAPPluginCall) {
|
|
225
|
+
do {
|
|
226
|
+
try implementation?.stopAllTracking(completion: { error in
|
|
227
|
+
self.handleCompletion(call, error)
|
|
228
|
+
})
|
|
229
|
+
} catch {
|
|
230
|
+
rejectCall(call, error)
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@objc func trackAdRevenue(_ call: CAPPluginCall) {
|
|
235
|
+
do {
|
|
236
|
+
let options = try TrackAdRevenueOptions(call)
|
|
237
|
+
try implementation?.trackAdRevenue(options, completion: { error in
|
|
238
|
+
self.handleCompletion(call, error)
|
|
239
|
+
})
|
|
240
|
+
} catch {
|
|
241
|
+
rejectCall(call, error)
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
@objc func trackEvent(_ call: CAPPluginCall) {
|
|
246
|
+
do {
|
|
247
|
+
let options = try TrackEventOptions(call)
|
|
248
|
+
try implementation?.trackEvent(options, completion: { error in
|
|
249
|
+
self.handleCompletion(call, error)
|
|
250
|
+
})
|
|
251
|
+
} catch {
|
|
252
|
+
rejectCall(call, error)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
@objc func trackRevenue(_ call: CAPPluginCall) {
|
|
257
|
+
do {
|
|
258
|
+
let options = try TrackRevenueOptions(call)
|
|
259
|
+
try implementation?.trackRevenue(options, completion: { error in
|
|
260
|
+
self.handleCompletion(call, error)
|
|
261
|
+
})
|
|
262
|
+
} catch {
|
|
263
|
+
rejectCall(call, error)
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
@objc func trackingOptIn(_ call: CAPPluginCall) {
|
|
268
|
+
do {
|
|
269
|
+
try implementation?.trackingOptIn(completion: { error in
|
|
270
|
+
self.handleCompletion(call, error)
|
|
271
|
+
})
|
|
272
|
+
} catch {
|
|
273
|
+
rejectCall(call, error)
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
@objc func trackingUnder13(_ call: CAPPluginCall) {
|
|
278
|
+
do {
|
|
279
|
+
try implementation?.trackingUnder13(completion: { error in
|
|
280
|
+
self.handleCompletion(call, error)
|
|
281
|
+
})
|
|
282
|
+
} catch {
|
|
283
|
+
rejectCall(call, error)
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
@objc func unsetCustomUserId(_ call: CAPPluginCall) {
|
|
288
|
+
do {
|
|
289
|
+
try implementation?.unsetCustomUserId(completion: { error in
|
|
290
|
+
self.handleCompletion(call, error)
|
|
291
|
+
})
|
|
292
|
+
} catch {
|
|
293
|
+
rejectCall(call, error)
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
@objc func unsetGlobalProperty(_ call: CAPPluginCall) {
|
|
298
|
+
do {
|
|
299
|
+
let options = try UnsetGlobalPropertyOptions(call)
|
|
300
|
+
try implementation?.unsetGlobalProperty(options, completion: { error in
|
|
301
|
+
self.handleCompletion(call, error)
|
|
302
|
+
})
|
|
303
|
+
} catch {
|
|
304
|
+
rejectCall(call, error)
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
private func handleCompletion(_ call: CAPPluginCall, _ error: Error?) {
|
|
309
|
+
if let error = error {
|
|
310
|
+
rejectCall(call, error)
|
|
311
|
+
} else {
|
|
312
|
+
resolveCall(call)
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
private func handleCompletion(_ call: CAPPluginCall, _ result: Result?, _ error: Error?) {
|
|
317
|
+
if let error = error {
|
|
318
|
+
rejectCall(call, error)
|
|
319
|
+
} else {
|
|
320
|
+
resolveCall(call, result)
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
private func rejectCall(_ call: CAPPluginCall, _ error: Error) {
|
|
325
|
+
CAPLog.print("[", self.tag, "] ", error)
|
|
326
|
+
call.reject(error.localizedDescription, (error as? CustomError)?.code)
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
private func resolveCall(_ call: CAPPluginCall) {
|
|
330
|
+
call.resolve()
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
private func resolveCall(_ call: CAPPluginCall, _ result: Result?) {
|
|
334
|
+
if let result = result?.toJSObject() as? JSObject {
|
|
335
|
+
call.resolve(result)
|
|
336
|
+
} else {
|
|
337
|
+
call.resolve()
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@capawesome/capacitor-singular",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Unofficial Capacitor plugin for the Singular Mobile SDK on Android and iOS.",
|
|
5
|
+
"main": "dist/plugin.cjs.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/esm/index.d.ts",
|
|
8
|
+
"unpkg": "dist/plugin.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"android/src/main/",
|
|
11
|
+
"android/build.gradle",
|
|
12
|
+
"dist/",
|
|
13
|
+
"ios/Plugin/",
|
|
14
|
+
"CapawesomeCapacitorSingular.podspec",
|
|
15
|
+
"Package.swift"
|
|
16
|
+
],
|
|
17
|
+
"author": "Robin Genz <mail@robingenz.dev>",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"homepage": "https://capawesome.io/docs/sdks/capacitor/singular/",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/capawesome-team/capacitor-plugins.git"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/capawesome-team/capacitor-plugins/issues"
|
|
26
|
+
},
|
|
27
|
+
"funding": [
|
|
28
|
+
{
|
|
29
|
+
"type": "github",
|
|
30
|
+
"url": "https://github.com/sponsors/capawesome-team/"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"type": "opencollective",
|
|
34
|
+
"url": "https://opencollective.com/capawesome"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"keywords": [
|
|
38
|
+
"capacitor",
|
|
39
|
+
"plugin",
|
|
40
|
+
"native",
|
|
41
|
+
"capacitor-plugin",
|
|
42
|
+
"singular",
|
|
43
|
+
"singular-sdk",
|
|
44
|
+
"attribution",
|
|
45
|
+
"analytics",
|
|
46
|
+
"mobile-measurement",
|
|
47
|
+
"mmp",
|
|
48
|
+
"deep-links",
|
|
49
|
+
"skadnetwork",
|
|
50
|
+
"ads",
|
|
51
|
+
"marketing"
|
|
52
|
+
],
|
|
53
|
+
"scripts": {
|
|
54
|
+
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
55
|
+
"verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
|
|
56
|
+
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
57
|
+
"verify:web": "npm run build",
|
|
58
|
+
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
59
|
+
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
|
|
60
|
+
"eslint": "eslint . --ext ts",
|
|
61
|
+
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
62
|
+
"swiftlint": "node-swiftlint",
|
|
63
|
+
"docgen": "docgen --api SingularPlugin --output-readme README.md --output-json dist/docs.json",
|
|
64
|
+
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
65
|
+
"clean": "rimraf ./dist",
|
|
66
|
+
"watch": "tsc --watch",
|
|
67
|
+
"ios:pod:install": "cd ios && pod install --repo-update && cd ..",
|
|
68
|
+
"ios:spm:install": "cd ios && swift package resolve && cd ..",
|
|
69
|
+
"prepublishOnly": "npm run build"
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@capacitor/android": "8.0.0",
|
|
73
|
+
"@capacitor/cli": "8.4.2",
|
|
74
|
+
"@capacitor/core": "8.0.0",
|
|
75
|
+
"@capacitor/docgen": "0.3.1",
|
|
76
|
+
"@capacitor/ios": "8.0.0",
|
|
77
|
+
"@ionic/eslint-config": "0.4.0",
|
|
78
|
+
"eslint": "8.57.0",
|
|
79
|
+
"prettier-plugin-java": "2.9.7",
|
|
80
|
+
"rimraf": "6.1.2",
|
|
81
|
+
"rollup": "4.62.3",
|
|
82
|
+
"swiftlint": "2.0.0",
|
|
83
|
+
"typescript": "5.9.3"
|
|
84
|
+
},
|
|
85
|
+
"peerDependencies": {
|
|
86
|
+
"@capacitor/core": ">=8.0.0"
|
|
87
|
+
},
|
|
88
|
+
"eslintConfig": {
|
|
89
|
+
"extends": "@ionic/eslint-config/recommended"
|
|
90
|
+
},
|
|
91
|
+
"capacitor": {
|
|
92
|
+
"ios": {
|
|
93
|
+
"src": "ios"
|
|
94
|
+
},
|
|
95
|
+
"android": {
|
|
96
|
+
"src": "android"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"publishConfig": {
|
|
100
|
+
"access": "public"
|
|
101
|
+
}
|
|
102
|
+
}
|