vibes-react-native 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +280 -0
  3. package/android/build.gradle +61 -0
  4. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  5. package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  6. package/android/gradlew +185 -0
  7. package/android/gradlew.bat +89 -0
  8. package/android/src/main/AndroidManifest.xml +28 -0
  9. package/android/src/main/java/com/vibes/push/rn/plugin/PushEvtEmitter.java +65 -0
  10. package/android/src/main/java/com/vibes/push/rn/plugin/VibesAppHelper.java +100 -0
  11. package/android/src/main/java/com/vibes/push/rn/plugin/VibesModule.java +327 -0
  12. package/android/src/main/java/com/vibes/push/rn/plugin/VibesPackage.java +28 -0
  13. package/android/src/main/java/com/vibes/push/rn/plugin/notifications/Fms.java +116 -0
  14. package/android/src/main/java/com/vibes/push/rn/plugin/notifications/PayloadWrapper.java +23 -0
  15. package/android/src/main/java/com/vibes/push/rn/plugin/notifications/VibesPushReceiver.java +60 -0
  16. package/ios/Configuration.swift +68 -0
  17. package/ios/Notifications.swift +72 -0
  18. package/ios/Vibes-Bridging-Header.h +2 -0
  19. package/ios/Vibes.m +31 -0
  20. package/ios/Vibes.swift +236 -0
  21. package/ios/Vibes.xcodeproj/project.pbxproj +293 -0
  22. package/ios/VibesClient.swift +35 -0
  23. package/ios/VibesPluginLogger.swift +160 -0
  24. package/lib/commonjs/index.js +53 -0
  25. package/lib/commonjs/index.js.map +1 -0
  26. package/lib/module/index.js +31 -0
  27. package/lib/module/index.js.map +1 -0
  28. package/lib/typescript/index.d.ts +8 -0
  29. package/package.json +149 -0
  30. package/src/index.tsx +48 -0
  31. package/vibes-react-native.podspec +20 -0
@@ -0,0 +1,293 @@
1
+ // !$*UTF8*$!
2
+ {
3
+ archiveVersion = 1;
4
+ classes = {
5
+ };
6
+ objectVersion = 46;
7
+ objects = {
8
+
9
+ /* Begin PBXBuildFile section */
10
+ B37330EA281323F700662936 /* VibesClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = B37330E9281322A500662936 /* VibesClient.swift */; };
11
+ B37330EB281323FC00662936 /* Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = B37330E82813224100662936 /* Notifications.swift */; };
12
+ B37330EC2813240000662936 /* EventEmitterLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = B37330E7281321CF00662936 /* EventEmitterLogger.swift */; };
13
+ B37330ED2813240500662936 /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = B37330E62813215800662936 /* Configuration.swift */; };
14
+ /* End PBXBuildFile section */
15
+
16
+ /* Begin PBXCopyFilesBuildPhase section */
17
+ 58B511D91A9E6C8500147676 /* CopyFiles */ = {
18
+ isa = PBXCopyFilesBuildPhase;
19
+ buildActionMask = 2147483647;
20
+ dstPath = "include/$(PRODUCT_NAME)";
21
+ dstSubfolderSpec = 16;
22
+ files = (
23
+ );
24
+ runOnlyForDeploymentPostprocessing = 0;
25
+ };
26
+ /* End PBXCopyFilesBuildPhase section */
27
+
28
+ /* Begin PBXFileReference section */
29
+ 134814201AA4EA6300B7C361 /* libVibes.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libVibes.a; sourceTree = BUILT_PRODUCTS_DIR; };
30
+ 24E8E590281702690042822D /* Vibes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Vibes.swift; sourceTree = "<group>"; };
31
+ B37330E62813215800662936 /* Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Configuration.swift; sourceTree = "<group>"; };
32
+ B37330E7281321CF00662936 /* EventEmitterLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventEmitterLogger.swift; sourceTree = "<group>"; };
33
+ B37330E82813224100662936 /* Notifications.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Notifications.swift; sourceTree = "<group>"; };
34
+ B37330E9281322A500662936 /* VibesClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VibesClient.swift; sourceTree = "<group>"; };
35
+ B3E7B5891CC2AC0600A0062D /* Vibes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Vibes.m; sourceTree = "<group>"; };
36
+ F4FF95D5245B92E700C19C63 /* Vibes-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Vibes-Bridging-Header.h"; sourceTree = "<group>"; };
37
+ /* End PBXFileReference section */
38
+
39
+ /* Begin PBXFrameworksBuildPhase section */
40
+ 58B511D81A9E6C8500147676 /* Frameworks */ = {
41
+ isa = PBXFrameworksBuildPhase;
42
+ buildActionMask = 2147483647;
43
+ files = (
44
+ );
45
+ runOnlyForDeploymentPostprocessing = 0;
46
+ };
47
+ /* End PBXFrameworksBuildPhase section */
48
+
49
+ /* Begin PBXGroup section */
50
+ 134814211AA4EA7D00B7C361 /* Products */ = {
51
+ isa = PBXGroup;
52
+ children = (
53
+ 134814201AA4EA6300B7C361 /* libVibes.a */,
54
+ );
55
+ name = Products;
56
+ sourceTree = "<group>";
57
+ };
58
+ 58B511D21A9E6C8500147676 = {
59
+ isa = PBXGroup;
60
+ children = (
61
+ 24E8E590281702690042822D /* Vibes.swift */,
62
+ B37330E9281322A500662936 /* VibesClient.swift */,
63
+ B37330E82813224100662936 /* Notifications.swift */,
64
+ B37330E7281321CF00662936 /* EventEmitterLogger.swift */,
65
+ B37330E62813215800662936 /* Configuration.swift */,
66
+ B3E7B5891CC2AC0600A0062D /* Vibes.m */,
67
+ F4FF95D5245B92E700C19C63 /* Vibes-Bridging-Header.h */,
68
+ 134814211AA4EA7D00B7C361 /* Products */,
69
+ );
70
+ sourceTree = "<group>";
71
+ };
72
+ /* End PBXGroup section */
73
+
74
+ /* Begin PBXNativeTarget section */
75
+ 58B511DA1A9E6C8500147676 /* Vibes */ = {
76
+ isa = PBXNativeTarget;
77
+ buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Vibes" */;
78
+ buildPhases = (
79
+ 58B511D71A9E6C8500147676 /* Sources */,
80
+ 58B511D81A9E6C8500147676 /* Frameworks */,
81
+ 58B511D91A9E6C8500147676 /* CopyFiles */,
82
+ );
83
+ buildRules = (
84
+ );
85
+ dependencies = (
86
+ );
87
+ name = Vibes;
88
+ productName = RCTDataManager;
89
+ productReference = 134814201AA4EA6300B7C361 /* libVibes.a */;
90
+ productType = "com.apple.product-type.library.static";
91
+ };
92
+ /* End PBXNativeTarget section */
93
+
94
+ /* Begin PBXProject section */
95
+ 58B511D31A9E6C8500147676 /* Project object */ = {
96
+ isa = PBXProject;
97
+ attributes = {
98
+ LastUpgradeCheck = 0920;
99
+ ORGANIZATIONNAME = Facebook;
100
+ TargetAttributes = {
101
+ 58B511DA1A9E6C8500147676 = {
102
+ CreatedOnToolsVersion = 6.1.1;
103
+ };
104
+ };
105
+ };
106
+ buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Vibes" */;
107
+ compatibilityVersion = "Xcode 3.2";
108
+ developmentRegion = English;
109
+ hasScannedForEncodings = 0;
110
+ knownRegions = (
111
+ English,
112
+ en,
113
+ );
114
+ mainGroup = 58B511D21A9E6C8500147676;
115
+ productRefGroup = 58B511D21A9E6C8500147676;
116
+ projectDirPath = "";
117
+ projectRoot = "";
118
+ targets = (
119
+ 58B511DA1A9E6C8500147676 /* Vibes */,
120
+ );
121
+ };
122
+ /* End PBXProject section */
123
+
124
+ /* Begin PBXSourcesBuildPhase section */
125
+ 58B511D71A9E6C8500147676 /* Sources */ = {
126
+ isa = PBXSourcesBuildPhase;
127
+ buildActionMask = 2147483647;
128
+ files = (
129
+ B37330EB281323FC00662936 /* Notifications.swift in Sources */,
130
+ B37330ED2813240500662936 /* Configuration.swift in Sources */,
131
+ B37330EA281323F700662936 /* VibesClient.swift in Sources */,
132
+ B37330EC2813240000662936 /* EventEmitterLogger.swift in Sources */,
133
+ );
134
+ runOnlyForDeploymentPostprocessing = 0;
135
+ };
136
+ /* End PBXSourcesBuildPhase section */
137
+
138
+ /* Begin XCBuildConfiguration section */
139
+ 58B511ED1A9E6C8500147676 /* Debug */ = {
140
+ isa = XCBuildConfiguration;
141
+ buildSettings = {
142
+ ALWAYS_SEARCH_USER_PATHS = NO;
143
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
144
+ CLANG_CXX_LIBRARY = "libc++";
145
+ CLANG_ENABLE_MODULES = YES;
146
+ CLANG_ENABLE_OBJC_ARC = YES;
147
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
148
+ CLANG_WARN_BOOL_CONVERSION = YES;
149
+ CLANG_WARN_COMMA = YES;
150
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
151
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
152
+ CLANG_WARN_EMPTY_BODY = YES;
153
+ CLANG_WARN_ENUM_CONVERSION = YES;
154
+ CLANG_WARN_INFINITE_RECURSION = YES;
155
+ CLANG_WARN_INT_CONVERSION = YES;
156
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
157
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
158
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
159
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
160
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
161
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
162
+ CLANG_WARN_UNREACHABLE_CODE = YES;
163
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
164
+ COPY_PHASE_STRIP = NO;
165
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
166
+ ENABLE_TESTABILITY = YES;
167
+ GCC_C_LANGUAGE_STANDARD = gnu99;
168
+ GCC_DYNAMIC_NO_PIC = NO;
169
+ GCC_NO_COMMON_BLOCKS = YES;
170
+ GCC_OPTIMIZATION_LEVEL = 0;
171
+ GCC_PREPROCESSOR_DEFINITIONS = (
172
+ "DEBUG=1",
173
+ "$(inherited)",
174
+ );
175
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
176
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
177
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
178
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
179
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
180
+ GCC_WARN_UNUSED_FUNCTION = YES;
181
+ GCC_WARN_UNUSED_VARIABLE = YES;
182
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
183
+ MTL_ENABLE_DEBUG_INFO = YES;
184
+ ONLY_ACTIVE_ARCH = YES;
185
+ SDKROOT = iphoneos;
186
+ };
187
+ name = Debug;
188
+ };
189
+ 58B511EE1A9E6C8500147676 /* Release */ = {
190
+ isa = XCBuildConfiguration;
191
+ buildSettings = {
192
+ ALWAYS_SEARCH_USER_PATHS = NO;
193
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
194
+ CLANG_CXX_LIBRARY = "libc++";
195
+ CLANG_ENABLE_MODULES = YES;
196
+ CLANG_ENABLE_OBJC_ARC = YES;
197
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
198
+ CLANG_WARN_BOOL_CONVERSION = YES;
199
+ CLANG_WARN_COMMA = YES;
200
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
201
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
202
+ CLANG_WARN_EMPTY_BODY = YES;
203
+ CLANG_WARN_ENUM_CONVERSION = YES;
204
+ CLANG_WARN_INFINITE_RECURSION = YES;
205
+ CLANG_WARN_INT_CONVERSION = YES;
206
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
207
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
208
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
209
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
210
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
211
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
212
+ CLANG_WARN_UNREACHABLE_CODE = YES;
213
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
214
+ COPY_PHASE_STRIP = YES;
215
+ ENABLE_NS_ASSERTIONS = NO;
216
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
217
+ GCC_C_LANGUAGE_STANDARD = gnu99;
218
+ GCC_NO_COMMON_BLOCKS = YES;
219
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
220
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
221
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
222
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
223
+ GCC_WARN_UNUSED_FUNCTION = YES;
224
+ GCC_WARN_UNUSED_VARIABLE = YES;
225
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
226
+ MTL_ENABLE_DEBUG_INFO = NO;
227
+ SDKROOT = iphoneos;
228
+ VALIDATE_PRODUCT = YES;
229
+ };
230
+ name = Release;
231
+ };
232
+ 58B511F01A9E6C8500147676 /* Debug */ = {
233
+ isa = XCBuildConfiguration;
234
+ buildSettings = {
235
+ HEADER_SEARCH_PATHS = (
236
+ "$(inherited)",
237
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
238
+ "$(SRCROOT)/../../../React/**",
239
+ "$(SRCROOT)/../../react-native/React/**",
240
+ );
241
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
242
+ OTHER_LDFLAGS = "-ObjC";
243
+ PRODUCT_NAME = Vibes;
244
+ SKIP_INSTALL = YES;
245
+ SWIFT_OBJC_BRIDGING_HEADER = "Vibes-Bridging-Header.h";
246
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
247
+ SWIFT_VERSION = 5.0;
248
+ };
249
+ name = Debug;
250
+ };
251
+ 58B511F11A9E6C8500147676 /* Release */ = {
252
+ isa = XCBuildConfiguration;
253
+ buildSettings = {
254
+ HEADER_SEARCH_PATHS = (
255
+ "$(inherited)",
256
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
257
+ "$(SRCROOT)/../../../React/**",
258
+ "$(SRCROOT)/../../react-native/React/**",
259
+ );
260
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
261
+ OTHER_LDFLAGS = "-ObjC";
262
+ PRODUCT_NAME = Vibes;
263
+ SKIP_INSTALL = YES;
264
+ SWIFT_OBJC_BRIDGING_HEADER = "Vibes-Bridging-Header.h";
265
+ SWIFT_VERSION = 5.0;
266
+ };
267
+ name = Release;
268
+ };
269
+ /* End XCBuildConfiguration section */
270
+
271
+ /* Begin XCConfigurationList section */
272
+ 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Vibes" */ = {
273
+ isa = XCConfigurationList;
274
+ buildConfigurations = (
275
+ 58B511ED1A9E6C8500147676 /* Debug */,
276
+ 58B511EE1A9E6C8500147676 /* Release */,
277
+ );
278
+ defaultConfigurationIsVisible = 0;
279
+ defaultConfigurationName = Release;
280
+ };
281
+ 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Vibes" */ = {
282
+ isa = XCConfigurationList;
283
+ buildConfigurations = (
284
+ 58B511F01A9E6C8500147676 /* Debug */,
285
+ 58B511F11A9E6C8500147676 /* Release */,
286
+ );
287
+ defaultConfigurationIsVisible = 0;
288
+ defaultConfigurationName = Release;
289
+ };
290
+ /* End XCConfigurationList section */
291
+ };
292
+ rootObject = 58B511D31A9E6C8500147676 /* Project object */;
293
+ }
@@ -0,0 +1,35 @@
1
+ //
2
+ // VibesClient.swift
3
+ // Vibes
4
+ //
5
+ // Created by DHwty on 22/04/2022.
6
+ // Copyright © 2022 Facebook. All rights reserved.
7
+ //
8
+
9
+ import VibesPush
10
+
11
+ @objcMembers
12
+ class VibesClient: NSObject {
13
+ static let standard = VibesClient()
14
+
15
+ public let vibes: VibesPush.Vibes
16
+ public var logger: VibesLogger? = VibesPluginLogger.shared
17
+
18
+ override private init() {
19
+ // ensure we have Vibes app url set in current build config's Info.plist
20
+ guard let appUrl = Configuration.configValue(.vibesApiURL) else {
21
+ fatalError("`\(ConfigKey.vibesApiURL.value())` must be set in plist file of current build configuration")
22
+ }
23
+ // ensure we have Vibes app id set in current build config's Info.plist
24
+ guard let appId = Configuration.configValue(.vibesAppId) else {
25
+ fatalError("`\(ConfigKey.vibesAppId.value())` must be set in plist file of current build configuration")
26
+ }
27
+ let config = VibesConfiguration(advertisingId: nil,
28
+ apiUrl: appUrl,
29
+ logger: logger,
30
+ storageType: .USERDEFAULTS)
31
+
32
+ VibesPush.Vibes.configure(appId: appId, configuration: config)
33
+ vibes = VibesPush.Vibes.shared
34
+ }
35
+ }
@@ -0,0 +1,160 @@
1
+ //
2
+ // EventEmitterLogger.swift
3
+ // Vibes
4
+ //
5
+ // Created by DHwty on 22/04/2022.
6
+ // Copyright © 2022 Facebook. All rights reserved.
7
+ //
8
+
9
+ import UIKit
10
+ import VibesPush
11
+
12
+ @objcMembers
13
+ class VibesPluginLogger: NSObject {
14
+ static let Log = NSNotification.Name(rawValue: "Log")
15
+ static var data = [NSString]()
16
+ static let shared = VibesPluginLogger()
17
+ public typealias JsonObject = [String: Any]
18
+ let kBodyUrl = "url"
19
+ let kBodyMethod = "method"
20
+ let kBodyHeaders = "headers"
21
+ let kBody = "body"
22
+ let kBodyType = "type"
23
+ let kHTTPStatusCode = "http_status"
24
+
25
+ var deviceId: String! = "-"
26
+
27
+ // Can't init is singleton
28
+ override private init() { }
29
+
30
+ fileprivate func sendLog(uuid: String,
31
+ timestamp: String,
32
+ body: [AnyHashable: Any],
33
+ request_type: String) {
34
+ // get the saved device id from prefs, if not exist we will use "-"
35
+ if let devId = UserDefaults.standard.vibesDeviceId {
36
+ deviceId = devId
37
+ }
38
+ // get env from plist config file if set, else throw fatal error
39
+ guard let env = Configuration.configValue(.vibesAppEnv) else {
40
+ fatalError("`\(ConfigKey.vibesAppEnv.value())` must be set in plist file of current build configuration")
41
+ }
42
+ let jsonObj: [String: Any] = ["os_type": "iOS",
43
+ "device_id": deviceId ?? " - ",
44
+ "env": env,
45
+ "uuid": uuid,
46
+ "request type": request_type,
47
+ "data": body,
48
+ ]
49
+
50
+ // we comment out in case of debugging in xcode
51
+ // debugPrint(VibesPluginLogger.stringify(json: jsonObj, prettyPrinted: true))
52
+ }
53
+
54
+ static func stringify(json: Any, prettyPrinted: Bool = false) -> String {
55
+ var options: JSONSerialization.WritingOptions = []
56
+ if prettyPrinted {
57
+ options = JSONSerialization.WritingOptions.prettyPrinted
58
+ }
59
+
60
+ do {
61
+ let data = try JSONSerialization.data(withJSONObject: json, options: options)
62
+ if let string = String(data: data, encoding: String.Encoding.utf8) {
63
+ return string
64
+ }
65
+ } catch {
66
+ debugPrint(error)
67
+ }
68
+
69
+ return ""
70
+ }
71
+
72
+ fileprivate func dispatch(_ body: [AnyHashable: Any], requestType: String) {
73
+ do {
74
+ let pretty = try JSONSerialization.data(withJSONObject: body, options: .prettyPrinted)
75
+ let uuid = (UIDevice.current.identifierForVendor?.uuidString)!
76
+ let timestamp = Date().description
77
+ if let log = NSString(data: pretty, encoding: String.Encoding.utf8.rawValue) {
78
+ VibesPluginLogger.data.insert(NSString(string: "\(timestamp) \(log)"), at: 0)
79
+ }
80
+ sendLog(uuid: uuid, timestamp: timestamp, body: body, request_type: requestType)
81
+ } catch {
82
+ debugPrint("[LOG] Error during deserialization")
83
+ }
84
+ }
85
+
86
+ fileprivate func getLogMetaData() -> JsonObject {
87
+ var meta: JsonObject = [:]
88
+
89
+ if let buildNumber = Configuration.configValue(.appBuildNumber),
90
+ let versionNumber = Configuration.configValue(.appVersionNumber) {
91
+ meta["appBuildNumber"] = buildNumber
92
+ meta["appVersionNumber"] = versionNumber
93
+ }
94
+
95
+ let os = ProcessInfo.processInfo.operatingSystemVersion
96
+ meta["osRelease"] = "\(os.majorVersion).\(os.minorVersion).\(os.patchVersion)"
97
+ meta["vendorIdentifier"] = UIDevice.current.identifierForVendor!.uuidString
98
+ return meta
99
+ }
100
+ }
101
+
102
+ extension String {
103
+ func capitalizingFirstLetter() -> String {
104
+ return prefix(1).capitalized + dropFirst()
105
+ }
106
+
107
+ mutating func capitalizeFirstLetter() {
108
+ self = capitalizingFirstLetter()
109
+ }
110
+ }
111
+
112
+ extension VibesPluginLogger: VibesLogger {
113
+ func log(_ logObject: LogObject) {
114
+ let body = [
115
+ "type": "\(logObject.level.logPrefix.lowercased().capitalizingFirstLetter())",
116
+ "description": logObject.message,
117
+ ]
118
+ dispatch(body, requestType: "[\(logObject.level.logPrefix)]")
119
+ }
120
+
121
+ func log(request: URLRequest) {
122
+ let body = [
123
+ "type": "Request",
124
+ "method": request.methodDescription,
125
+ "url": request.urlDescription,
126
+ "headers": request.headerFieldsDescription,
127
+ "body": request.bodyDescription,
128
+ ]
129
+ dispatch(body, requestType: "[REQUEST]")
130
+ }
131
+
132
+ func log(response: URLResponse, data: Data?) {
133
+ var responseBody: NSString
134
+ if let url = response.url {
135
+ if let data = data {
136
+ responseBody = NSString(data: data, encoding: String.Encoding.utf8.rawValue)!
137
+ } else {
138
+ responseBody = "[]"
139
+ }
140
+
141
+ let body = [
142
+ kBodyType: "Response",
143
+ kBodyMethod: "-",
144
+ kBodyUrl: (response.url?.absoluteString)!,
145
+ kBodyHeaders: (response as? HTTPURLResponse)?.headersDescription as Any,
146
+ kBody: responseBody as String,
147
+ kHTTPStatusCode: (response as? HTTPURLResponse)?.statusCode as Any,
148
+ ] as [AnyHashable: Any]
149
+ dispatch(body, requestType: "[RESPONSE]")
150
+ }
151
+ }
152
+
153
+ func log(error: Error) {
154
+ let body = [
155
+ "type": "Error",
156
+ "description": error.localizedDescription,
157
+ ]
158
+ dispatch(body, requestType: "[ERROR]")
159
+ }
160
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.associatePerson = associatePerson;
7
+ exports.default = void 0;
8
+ exports.getVibesDeviceInfo = getVibesDeviceInfo;
9
+ exports.registerDevice = registerDevice;
10
+ exports.registerPush = registerPush;
11
+ exports.unregisterDevice = unregisterDevice;
12
+ exports.updateDevice = updateDevice;
13
+
14
+ var _reactNative = require("react-native");
15
+
16
+ const LINKING_ERROR = `The package 'vibes-react-native' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
17
+ ios: "- You have run 'pod install'\n",
18
+ default: ''
19
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
20
+ const Vibes = _reactNative.NativeModules.Vibes ? _reactNative.NativeModules.Vibes : new Proxy({}, {
21
+ get() {
22
+ throw new Error(LINKING_ERROR);
23
+ }
24
+
25
+ });
26
+
27
+ function registerDevice() {
28
+ return Vibes.registerDevice();
29
+ }
30
+
31
+ function unregisterDevice() {
32
+ return Vibes.unregisterDevice();
33
+ }
34
+
35
+ function registerPush() {
36
+ return Vibes.registerPush();
37
+ }
38
+
39
+ function getVibesDeviceInfo() {
40
+ return Vibes.getVibesDeviceInfo();
41
+ }
42
+
43
+ function updateDevice(updateCredential, latitude, longitude) {
44
+ return Vibes.updateDevice(updateCredential, latitude, longitude);
45
+ }
46
+
47
+ function associatePerson(externalPersonId) {
48
+ return Vibes.associatePerson(externalPersonId);
49
+ }
50
+
51
+ var _default = Vibes;
52
+ exports.default = _default;
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","Vibes","NativeModules","Proxy","get","Error","registerDevice","unregisterDevice","registerPush","getVibesDeviceInfo","updateDevice","updateCredential","latitude","longitude","associatePerson","externalPersonId"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'vibes-react-native' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst Vibes = NativeModules.Vibes\n ? NativeModules.Vibes\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport function registerDevice(): Promise<any> {\n return Vibes.registerDevice();\n}\n\nexport function unregisterDevice(): Promise<any> {\n return Vibes.unregisterDevice();\n}\n\nexport function registerPush(): Promise<any> {\n return Vibes.registerPush();\n}\n\nexport function getVibesDeviceInfo(): Promise<any> {\n return Vibes.getVibesDeviceInfo();\n}\n\nexport function updateDevice(\n updateCredential: boolean,\n latitude: number,\n longitude: number\n): Promise<any> {\n return Vibes.updateDevice(updateCredential, latitude, longitude);\n}\n\nexport function associatePerson(externalPersonId: string): Promise<any> {\n return Vibes.associatePerson(externalPersonId);\n}\n\nexport default Vibes;\n"],"mappings":";;;;;;;;;;;;;AAAA;;AAEA,MAAMA,aAAa,GAChB,6EAAD,GACAC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,KAAK,GAAGC,0BAAA,CAAcD,KAAd,GACVC,0BAAA,CAAcD,KADJ,GAEV,IAAIE,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUT,aAAV,CAAN;EACD;;AAHH,CAFF,CAFJ;;AAWO,SAASU,cAAT,GAAwC;EAC7C,OAAOL,KAAK,CAACK,cAAN,EAAP;AACD;;AAEM,SAASC,gBAAT,GAA0C;EAC/C,OAAON,KAAK,CAACM,gBAAN,EAAP;AACD;;AAEM,SAASC,YAAT,GAAsC;EAC3C,OAAOP,KAAK,CAACO,YAAN,EAAP;AACD;;AAEM,SAASC,kBAAT,GAA4C;EACjD,OAAOR,KAAK,CAACQ,kBAAN,EAAP;AACD;;AAEM,SAASC,YAAT,CACLC,gBADK,EAELC,QAFK,EAGLC,SAHK,EAIS;EACd,OAAOZ,KAAK,CAACS,YAAN,CAAmBC,gBAAnB,EAAqCC,QAArC,EAA+CC,SAA/C,CAAP;AACD;;AAEM,SAASC,eAAT,CAAyBC,gBAAzB,EAAiE;EACtE,OAAOd,KAAK,CAACa,eAAN,CAAsBC,gBAAtB,CAAP;AACD;;eAEcd,K"}
@@ -0,0 +1,31 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+ const LINKING_ERROR = `The package 'vibes-react-native' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
3
+ ios: "- You have run 'pod install'\n",
4
+ default: ''
5
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
6
+ const Vibes = NativeModules.Vibes ? NativeModules.Vibes : new Proxy({}, {
7
+ get() {
8
+ throw new Error(LINKING_ERROR);
9
+ }
10
+
11
+ });
12
+ export function registerDevice() {
13
+ return Vibes.registerDevice();
14
+ }
15
+ export function unregisterDevice() {
16
+ return Vibes.unregisterDevice();
17
+ }
18
+ export function registerPush() {
19
+ return Vibes.registerPush();
20
+ }
21
+ export function getVibesDeviceInfo() {
22
+ return Vibes.getVibesDeviceInfo();
23
+ }
24
+ export function updateDevice(updateCredential, latitude, longitude) {
25
+ return Vibes.updateDevice(updateCredential, latitude, longitude);
26
+ }
27
+ export function associatePerson(externalPersonId) {
28
+ return Vibes.associatePerson(externalPersonId);
29
+ }
30
+ export default Vibes;
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Vibes","Proxy","get","Error","registerDevice","unregisterDevice","registerPush","getVibesDeviceInfo","updateDevice","updateCredential","latitude","longitude","associatePerson","externalPersonId"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'vibes-react-native' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst Vibes = NativeModules.Vibes\n ? NativeModules.Vibes\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport function registerDevice(): Promise<any> {\n return Vibes.registerDevice();\n}\n\nexport function unregisterDevice(): Promise<any> {\n return Vibes.unregisterDevice();\n}\n\nexport function registerPush(): Promise<any> {\n return Vibes.registerPush();\n}\n\nexport function getVibesDeviceInfo(): Promise<any> {\n return Vibes.getVibesDeviceInfo();\n}\n\nexport function updateDevice(\n updateCredential: boolean,\n latitude: number,\n longitude: number\n): Promise<any> {\n return Vibes.updateDevice(updateCredential, latitude, longitude);\n}\n\nexport function associatePerson(externalPersonId: string): Promise<any> {\n return Vibes.associatePerson(externalPersonId);\n}\n\nexport default Vibes;\n"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAEA,MAAMC,aAAa,GAChB,6EAAD,GACAD,QAAQ,CAACE,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,KAAK,GAAGN,aAAa,CAACM,KAAd,GACVN,aAAa,CAACM,KADJ,GAEV,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUP,aAAV,CAAN;EACD;;AAHH,CAFF,CAFJ;AAWA,OAAO,SAASQ,cAAT,GAAwC;EAC7C,OAAOJ,KAAK,CAACI,cAAN,EAAP;AACD;AAED,OAAO,SAASC,gBAAT,GAA0C;EAC/C,OAAOL,KAAK,CAACK,gBAAN,EAAP;AACD;AAED,OAAO,SAASC,YAAT,GAAsC;EAC3C,OAAON,KAAK,CAACM,YAAN,EAAP;AACD;AAED,OAAO,SAASC,kBAAT,GAA4C;EACjD,OAAOP,KAAK,CAACO,kBAAN,EAAP;AACD;AAED,OAAO,SAASC,YAAT,CACLC,gBADK,EAELC,QAFK,EAGLC,SAHK,EAIS;EACd,OAAOX,KAAK,CAACQ,YAAN,CAAmBC,gBAAnB,EAAqCC,QAArC,EAA+CC,SAA/C,CAAP;AACD;AAED,OAAO,SAASC,eAAT,CAAyBC,gBAAzB,EAAiE;EACtE,OAAOb,KAAK,CAACY,eAAN,CAAsBC,gBAAtB,CAAP;AACD;AAED,eAAeb,KAAf"}
@@ -0,0 +1,8 @@
1
+ declare const Vibes: any;
2
+ export declare function registerDevice(): Promise<any>;
3
+ export declare function unregisterDevice(): Promise<any>;
4
+ export declare function registerPush(): Promise<any>;
5
+ export declare function getVibesDeviceInfo(): Promise<any>;
6
+ export declare function updateDevice(updateCredential: boolean, latitude: number, longitude: number): Promise<any>;
7
+ export declare function associatePerson(externalPersonId: string): Promise<any>;
8
+ export default Vibes;