@customerglu/react-native-customerglu 2.1.2-1.0-beta → 3.0.0-beta-1.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/LICENSE +20 -15
- package/README.md +2 -2
- package/ReactNativeCustomerglu.podspec +42 -0
- package/android/build.gradle +78 -33
- package/android/generated/java/com/customerglu/reactnativecustomerglu/NativeReactNativeCustomergluSpec.java +144 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/RNReactNativeCustomergluSpec-generated.cpp +188 -0
- package/android/generated/jni/RNReactNativeCustomergluSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNReactNativeCustomergluSpec/RNReactNativeCustomergluSpecJSI-generated.cpp +237 -0
- package/android/generated/jni/react/renderer/components/RNReactNativeCustomergluSpec/RNReactNativeCustomergluSpecJSI.h +305 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +1 -6
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/customerglu/reactnativecustomerglu/BannerView.kt +76 -0
- package/android/src/main/java/com/customerglu/reactnativecustomerglu/BannerViewManager.kt +19 -0
- package/android/src/main/java/com/customerglu/reactnativecustomerglu/CGEmbededView.kt +102 -0
- package/android/src/main/java/com/customerglu/reactnativecustomerglu/CGEmbededViewManager.kt +18 -0
- package/android/src/main/java/com/customerglu/reactnativecustomerglu/RnCustomergluModule.kt +698 -0
- package/android/src/main/java/com/customerglu/reactnativecustomerglu/RnCustomergluPackage.kt +41 -0
- package/ios/Rncustomerglu.h +6 -0
- package/ios/Rncustomerglu.mm +18 -0
- package/ios/generated/RNReactNativeCustomergluSpec/RNReactNativeCustomergluSpec-generated.mm +221 -0
- package/ios/generated/RNReactNativeCustomergluSpec/RNReactNativeCustomergluSpec.h +106 -0
- package/ios/generated/RNReactNativeCustomergluSpecJSI-generated.cpp +237 -0
- package/ios/generated/RNReactNativeCustomergluSpecJSI.h +305 -0
- package/lib/commonjs/NativeReactNativeCustomerglu.js +9 -0
- package/lib/commonjs/NativeReactNativeCustomerglu.js.map +1 -0
- package/lib/commonjs/index.js +28 -191
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/NativeReactNativeCustomerglu.js +5 -0
- package/lib/module/NativeReactNativeCustomerglu.js.map +1 -0
- package/lib/module/index.js +30 -164
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeReactNativeCustomerglu.d.ts +33 -0
- package/lib/typescript/commonjs/src/NativeReactNativeCustomerglu.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +35 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeReactNativeCustomerglu.d.ts +33 -0
- package/lib/typescript/module/src/NativeReactNativeCustomerglu.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +35 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +91 -45
- package/react-native.config.js +12 -0
- package/src/NativeReactNativeCustomerglu.ts +36 -0
- package/src/index.tsx +73 -217
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
- package/android/gradlew +0 -185
- package/android/gradlew.bat +0 -89
- package/android/src/main/java/com/reactnativerncustomerglu/Bannerwidget/Bannerwidget/BannerWidgetViewGroupManager.java +0 -40
- package/android/src/main/java/com/reactnativerncustomerglu/Bannerwidget/Bannerwidget/bannerWidget.java +0 -43
- package/android/src/main/java/com/reactnativerncustomerglu/Bannerwidget/wrapperview/WrapperView.java +0 -61
- package/android/src/main/java/com/reactnativerncustomerglu/CGUtils.java +0 -13
- package/android/src/main/java/com/reactnativerncustomerglu/EmbedBannerwidget/EWrapperview/EWrapperView.java +0 -61
- package/android/src/main/java/com/reactnativerncustomerglu/EmbedBannerwidget/EmbedBannerwidget/EBannerWidget.java +0 -35
- package/android/src/main/java/com/reactnativerncustomerglu/EmbedBannerwidget/EmbedBannerwidget/EBannerWidgetVGManager.java +0 -40
- package/android/src/main/java/com/reactnativerncustomerglu/RncustomergluModule.java +0 -1033
- package/android/src/main/java/com/reactnativerncustomerglu/RncustomergluPackage.java +0 -35
- package/android/src/main/res/drawable/bottom_sheet_edges.xml +0 -7
- package/android/src/main/res/drawable/floating_close_layout.xml +0 -10
- package/android/src/main/res/drawable/ic_arrow_back.xml +0 -5
- package/android/src/main/res/drawable/ic_back.xml +0 -10
- package/android/src/main/res/drawable/ic_delete_bin.xml +0 -5
- package/android/src/main/res/drawable/ic_delete_bin_red.xml +0 -5
- package/android/src/main/res/drawable/ij.png +0 -0
- package/android/src/main/res/drawable/notification.png +0 -0
- package/android/src/main/res/drawable/progress_bg.xml +0 -33
- package/android/src/main/res/values/colors.xml +0 -13
- package/android/src/main/res/values/themes.xml +0 -15
- package/android/src/main/res/xml/provider_path.xml +0 -4
- package/ios/CustomPlayer.m +0 -30
- package/ios/Rncustomerglu-Bridging-Header.h +0 -4
- package/ios/Rncustomerglu.m +0 -83
- package/ios/Rncustomerglu.swift +0 -647
- package/ios/Rncustomerglu.xcodeproj/project.pbxproj +0 -293
- package/ios/Rncustomerglu.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
- package/ios/Rncustomerglu.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/lib/typescript/index.d.ts +0 -62
- package/react-native-customerglu.podspec +0 -23
package/ios/Rncustomerglu.swift
DELETED
|
@@ -1,647 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
import CustomerGlu
|
|
3
|
-
import UIKit
|
|
4
|
-
import React
|
|
5
|
-
|
|
6
|
-
let customerGlu = CustomerGlu.getInstance
|
|
7
|
-
extension Double {
|
|
8
|
-
func roundToDecimal(_ fractionDigits: Int) -> Double {
|
|
9
|
-
let multiplier = pow(10, Double(fractionDigits))
|
|
10
|
-
return Darwin.round(self * multiplier) / multiplier
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
extension Encodable {
|
|
14
|
-
/// Encode into JSON and return `Data`
|
|
15
|
-
func jsonData() throws -> Data {
|
|
16
|
-
let encoder = JSONEncoder()
|
|
17
|
-
encoder.outputFormatting = .prettyPrinted
|
|
18
|
-
encoder.dateEncodingStrategy = .iso8601
|
|
19
|
-
return try encoder.encode(self)
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
extension UIColor {
|
|
23
|
-
public convenience init?(hex: String) {
|
|
24
|
-
let r, g, b, a: CGFloat
|
|
25
|
-
|
|
26
|
-
if hex.hasPrefix("#") {
|
|
27
|
-
let start = hex.index(hex.startIndex, offsetBy: 1)
|
|
28
|
-
let hexColor = String(hex[start...])
|
|
29
|
-
|
|
30
|
-
if hexColor.count == 8 {
|
|
31
|
-
let scanner = Scanner(string: hexColor)
|
|
32
|
-
var hexNumber: UInt64 = 0
|
|
33
|
-
|
|
34
|
-
if scanner.scanHexInt64(&hexNumber) {
|
|
35
|
-
r = CGFloat((hexNumber & 0xff000000) >> 24) / 255
|
|
36
|
-
g = CGFloat((hexNumber & 0x00ff0000) >> 16) / 255
|
|
37
|
-
b = CGFloat((hexNumber & 0x0000ff00) >> 8) / 255
|
|
38
|
-
a = CGFloat(hexNumber & 0x000000ff) / 255
|
|
39
|
-
|
|
40
|
-
self.init(red: r, green: g, blue: b, alpha: a)
|
|
41
|
-
return
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
else{
|
|
45
|
-
let scanner = Scanner(string: hexColor)
|
|
46
|
-
var hexNumber: UInt32 = 0
|
|
47
|
-
if scanner.scanHexInt32(&hexNumber) {
|
|
48
|
-
let r = CGFloat((hexNumber & 0xff0000) >> 16) / 255.0
|
|
49
|
-
let g = CGFloat((hexNumber & 0xff00) >> 8) / 255.0
|
|
50
|
-
let b = CGFloat((hexNumber & 0xff) >> 0) / 255.0
|
|
51
|
-
|
|
52
|
-
self.init(red: r, green: g, blue: b, alpha: 1.0)
|
|
53
|
-
return
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
self.init(red:1, green: 1, blue: 1, alpha: 1.0)
|
|
59
|
-
return
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
@objc(Rncustomerglu)
|
|
63
|
-
class Rncustomerglu: RCTEventEmitter{
|
|
64
|
-
static var shared:Rncustomerglu?
|
|
65
|
-
|
|
66
|
-
private var supportedEventNames: Set<String> = ["CUSTOMERGLU_ANALYTICS_EVENT","CUSTOMERGLU_DEEPLINK_EVENT","CGBANNER_FINAL_HEIGHT","CUSTOMERGLU_BANNER_LOADED","CGEMBED_FINAL_HEIGHT","CG_INVALID_CAMPAIGN_ID","CG_UNI_DEEPLINK_EVENT"]
|
|
67
|
-
private var hasAttachedListener = true
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
override init() {
|
|
72
|
-
super.init()
|
|
73
|
-
// CustomerGlu.getInstance.initializeSdk()
|
|
74
|
-
Rncustomerglu.shared = self
|
|
75
|
-
|
|
76
|
-
NotificationCenter.default.addObserver(self, selector: #selector(self.catchAnalyticsNotification(notification:)), name: Notification.Name("CUSTOMERGLU_ANALYTICS_EVENT"), object: nil)
|
|
77
|
-
|
|
78
|
-
NotificationCenter.default.addObserver(self, selector: #selector(self.catchAnalyticsNotification(notification:)), name: Notification.Name("CUSTOMERGLU_DEEPLINK_EVENT"), object: nil)
|
|
79
|
-
|
|
80
|
-
NotificationCenter.default.addObserver(self, selector: #selector(self.catchAnalyticsNotification(notification:)), name: Notification.Name("CUSTOMERGLU_BANNER_LOADED"), object: nil)
|
|
81
|
-
|
|
82
|
-
NotificationCenter.default.addObserver(self, selector: #selector(self.catchAnalyticsNotification(notification:)), name: Notification.Name("CG_INVALID_CAMPAIGN_ID"), object: nil)
|
|
83
|
-
|
|
84
|
-
NotificationCenter.default.addObserver(self, selector: #selector(self.catchAnalyticsNotification(notification:)), name: Notification.Name("CGBANNER_FINAL_HEIGHT"), object: nil)
|
|
85
|
-
|
|
86
|
-
NotificationCenter.default.addObserver(self, selector: #selector(self.catchAnalyticsNotification(notification:)), name: Notification.Name("CGEMBED_FINAL_HEIGHT"), object: nil)
|
|
87
|
-
|
|
88
|
-
setPlatformAndSdkVersion()
|
|
89
|
-
}
|
|
90
|
-
func setPlatformAndSdkVersion(){
|
|
91
|
-
|
|
92
|
-
CustomerGlu.app_platform="REACT_NATIVE"
|
|
93
|
-
CustomerGlu.sdk_version="2.1.1"
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
override func startObserving() {
|
|
97
|
-
hasAttachedListener = true
|
|
98
|
-
}
|
|
99
|
-
override func stopObserving() {
|
|
100
|
-
hasAttachedListener = false
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// Must return an array of the supported events. Any unsupported events will throw errors
|
|
104
|
-
// if they are passed in to `sendEvent`
|
|
105
|
-
override func supportedEvents() -> [String] {
|
|
106
|
-
return Array(supportedEventNames)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
func emitEvent(withName name: String, body: Any!) {
|
|
111
|
-
if hasAttachedListener && supportedEventNames.contains(name) {
|
|
112
|
-
print("3rd notification call");
|
|
113
|
-
sendEvent(withName: name, body: body)
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
@objc func registerDevice(_ userdata:NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
119
|
-
customerGlu.registerDevice(userdata: userdata as! [String : AnyHashable]) { success in
|
|
120
|
-
if success {
|
|
121
|
-
resolve(true)
|
|
122
|
-
} else {
|
|
123
|
-
resolve(false)
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
@objc func isCampaignValid(_ campaign_id:String,dataFlag:String ,resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
128
|
-
let dataType = dataFlag == "CACHE" ? CAMPAIGNDATA.CACHE : CAMPAIGNDATA.API
|
|
129
|
-
CustomerGlu.getInstance.isCampaignValid(campaignId: campaign_id, dataType: dataType, completion: { success in
|
|
130
|
-
if success{
|
|
131
|
-
resolve(true)
|
|
132
|
-
}else {
|
|
133
|
-
resolve(false)
|
|
134
|
-
}
|
|
135
|
-
})
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
@objc func getCampaignStatus(_ campaign_id:String,dataFlag:String ,resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
139
|
-
let dataType = dataFlag == "CACHE" ? CAMPAIGNDATA.CACHE : CAMPAIGNDATA.API
|
|
140
|
-
CustomerGlu.getInstance.getCampaignStatus(campaignId: campaign_id, dataType: dataType, completion: { campaignStatus in
|
|
141
|
-
switch(campaignStatus){
|
|
142
|
-
case CAMPAIGN_STATE.PRISTINE:
|
|
143
|
-
resolve("pristine")
|
|
144
|
-
break;
|
|
145
|
-
|
|
146
|
-
case CAMPAIGN_STATE.IN_PROGRESS:
|
|
147
|
-
resolve("in_progress")
|
|
148
|
-
break;
|
|
149
|
-
|
|
150
|
-
case CAMPAIGN_STATE.COMPLETED:
|
|
151
|
-
resolve("completed")
|
|
152
|
-
break;
|
|
153
|
-
|
|
154
|
-
default:
|
|
155
|
-
resolve("not_eligible")
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
})
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
@objc public func setOpenWalletAsFallback(_ flag: Bool) {
|
|
163
|
-
customerGlu.setOpenWalletAsFallback(flag)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
@objc public func initCGSDK(_ flag: String) {
|
|
167
|
-
customerGlu.initializeSdk(myenv:flag)
|
|
168
|
-
}
|
|
169
|
-
@objc func OpenNudgeRN(_ id:String, nudgeconfigdata nudgeData:NSDictionary) -> Void {
|
|
170
|
-
|
|
171
|
-
let nudgeconfigData=CGNudgeConfiguration()
|
|
172
|
-
var nudgeconfig:NSDictionary;
|
|
173
|
-
|
|
174
|
-
if((nudgeData["nudgeConfiguration"]) != nil){
|
|
175
|
-
nudgeconfig=nudgeData["nudgeConfiguration"] as! NSDictionary
|
|
176
|
-
nudgeconfigData.layout=nudgeconfig["layout"] as? String ?? "full-default"
|
|
177
|
-
nudgeconfigData.opacity=nudgeconfig["opacity"] as? Double ?? Double(nudgeconfig["opacity"] as? String ?? "0.0")!
|
|
178
|
-
nudgeconfigData.closeOnDeepLink=nudgeconfig["closeOnDeepLink"] as? Bool ?? false
|
|
179
|
-
nudgeconfigData.relativeHeight=nudgeconfig["relativeHeight"] as? Double ?? Double(nudgeconfig["relativeHeight"] as? String ?? "0.0")!
|
|
180
|
-
nudgeconfigData.absoluteHeight=nudgeconfig["absoluteHeight"] as? Double ?? Double(nudgeconfig["absoluteHeight"] as? String ?? "0.0")!
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
customerGlu.openNudge(nudgeId: id,nudgeConfiguration:nudgeconfigData)
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
@objc(dataClear)
|
|
190
|
-
func dataClear() -> Void {
|
|
191
|
-
DispatchQueue.main.async {
|
|
192
|
-
customerGlu.clearGluData();
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
@objc
|
|
197
|
-
func sendData(_ property:NSDictionary) -> Void {
|
|
198
|
-
customerGlu.sendEventData(eventName: property["eventName"] as! String , eventProperties: property["eventProperties"] as? [String : Any])
|
|
199
|
-
}
|
|
200
|
-
@objc
|
|
201
|
-
func testIntegration() -> Void {
|
|
202
|
-
customerGlu.testIntegration();
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
@objc
|
|
206
|
-
func openWallet(_ walletData:NSDictionary) -> Void {
|
|
207
|
-
print("walletData--",walletData)
|
|
208
|
-
let nudgeconfigData=CGNudgeConfiguration()
|
|
209
|
-
var nudgeconfig:NSDictionary;
|
|
210
|
-
if((walletData["nudgeConfiguration"]) != nil){
|
|
211
|
-
|
|
212
|
-
nudgeconfig=walletData["nudgeConfiguration"] as! NSDictionary
|
|
213
|
-
nudgeconfigData.layout=nudgeconfig["layout"] as? String ?? "full-default"
|
|
214
|
-
nudgeconfigData.opacity=nudgeconfig["opacity"] as? Double ?? Double(nudgeconfig["opacity"] as? String ?? "0.8")!
|
|
215
|
-
nudgeconfigData.closeOnDeepLink=nudgeconfig["closeOnDeepLink"] as? Bool ?? false
|
|
216
|
-
nudgeconfigData.relativeHeight=nudgeconfig["relativeHeight"] as? Double ?? Double(nudgeconfig["relativeHeight"] as? String ?? "0.0")!
|
|
217
|
-
nudgeconfigData.absoluteHeight=nudgeconfig["absoluteHeight"] as? Double ?? Double(nudgeconfig["absoluteHeight"] as? String ?? "0.0")!
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
customerGlu.openWallet(nudgeConfiguration: nudgeconfigData)
|
|
223
|
-
// customerGlu.openWallet(auto_close_webview: bool)
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
@objc
|
|
228
|
-
func loadCampaignById(_ id:String, nudgeconfigdata nudgeData:NSDictionary) -> Void {
|
|
229
|
-
print("loadCampaignById--",id,nudgeData)
|
|
230
|
-
let nudgeconfigData=CGNudgeConfiguration()
|
|
231
|
-
var nudgeconfig:NSDictionary;
|
|
232
|
-
if((nudgeData["nudgeConfiguration"]) != nil){
|
|
233
|
-
|
|
234
|
-
nudgeconfig=nudgeData["nudgeConfiguration"] as! NSDictionary
|
|
235
|
-
nudgeconfigData.layout=nudgeconfig["layout"] as? String ?? "full-default"
|
|
236
|
-
nudgeconfigData.opacity=nudgeconfig["opacity"] as? Double ?? Double(nudgeconfig["opacity"] as? String ?? "0.0")!
|
|
237
|
-
nudgeconfigData.closeOnDeepLink=nudgeconfig["closeOnDeepLink"] as? Bool ?? false
|
|
238
|
-
nudgeconfigData.relativeHeight=nudgeconfig["relativeHeight"] as? Double ?? Double(nudgeconfig["relativeHeight"] as? String ?? "0.0")!
|
|
239
|
-
nudgeconfigData.absoluteHeight=nudgeconfig["absoluteHeight"] as? Double ?? Double(nudgeconfig["absoluteHeight"] as? String ?? "0.0")!
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
customerGlu.loadCampaignById(campaign_id:id, nudgeConfiguration: nudgeconfigData)
|
|
243
|
-
// customerGlu.loadCampaignById(campaign_id: id, auto_close_webview: bool)
|
|
244
|
-
}
|
|
245
|
-
@objc
|
|
246
|
-
func loadCampaignWithUrl(_ url:String, nudgeconfigdata nudgeData:NSDictionary) -> Void {
|
|
247
|
-
print("loadCampaignWithUrl--",url,nudgeData)
|
|
248
|
-
let nudgeconfigData=CGNudgeConfiguration()
|
|
249
|
-
var nudgeconfig:NSDictionary;
|
|
250
|
-
if((nudgeData["nudgeConfiguration"]) != nil){
|
|
251
|
-
nudgeconfig=nudgeData["nudgeConfiguration"] as! NSDictionary
|
|
252
|
-
nudgeconfigData.layout=nudgeconfig["layout"] as? String ?? "full-default"
|
|
253
|
-
nudgeconfigData.opacity=nudgeconfig["opacity"] as? Double ?? Double(nudgeconfig["opacity"] as? String ?? "0.0")!
|
|
254
|
-
nudgeconfigData.closeOnDeepLink=nudgeconfig["closeOnDeepLink"] as? Bool ?? false
|
|
255
|
-
nudgeconfigData.relativeHeight=nudgeconfig["relativeHeight"] as? Double ?? Double(nudgeconfig["relativeHeight"] as? String ?? "0.0")!
|
|
256
|
-
nudgeconfigData.absoluteHeight=nudgeconfig["absoluteHeight"] as? Double ?? Double(nudgeconfig["absoluteHeight"] as? String ?? "0.0")!
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
DispatchQueue.main.async {
|
|
260
|
-
customerGlu.openURLWithNudgeConfig(url: url, nudgeConfiguration: nudgeconfigData)
|
|
261
|
-
}
|
|
262
|
-
//customerGlu.openWalletWithURL(url: url)
|
|
263
|
-
// customerGlu.loadCampaignById(campaign_id: id, auto_close_webview: bool)
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
@objc
|
|
267
|
-
func enableAnalytic(_ bool:Bool) -> Void {
|
|
268
|
-
customerGlu.enableAnalyticsEvent(event: bool)
|
|
269
|
-
}
|
|
270
|
-
@objc func catchAnalyticsNotification(notification: NSNotification) {
|
|
271
|
-
if("CGBANNER_FINAL_HEIGHT" == notification.name.rawValue){
|
|
272
|
-
let height = CustomerGlu.bannersHeight
|
|
273
|
-
Rncustomerglu.shared?.emitEvent(withName: notification.name.rawValue, body: height)
|
|
274
|
-
}else if("CGEMBED_FINAL_HEIGHT" == notification.name.rawValue){
|
|
275
|
-
if let userInfo = notification.userInfo as? [String: Any]
|
|
276
|
-
{
|
|
277
|
-
print(userInfo)
|
|
278
|
-
let height = CustomerGlu.embedsHeight
|
|
279
|
-
Rncustomerglu.shared?.emitEvent(withName: notification.name.rawValue, body: userInfo)
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
}else{
|
|
283
|
-
Rncustomerglu.shared?.emitEvent(withName: notification.name.rawValue, body: notification.userInfo)
|
|
284
|
-
}
|
|
285
|
-
let userInfo = notification.userInfo as? [String: Any]
|
|
286
|
-
print("userinfo------",userInfo)
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
@objc func disableGluSdk(_ bool:Bool) -> Void {
|
|
290
|
-
customerGlu.disableGluSdk(disable: bool)
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
@objc
|
|
294
|
-
func configureLoaderColour(_ colr: String) -> Void {
|
|
295
|
-
let color = colorWithHexString(hexString: colr )
|
|
296
|
-
customerGlu.configureLoaderColour(color: [color])
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
@objc
|
|
300
|
-
func configureStatusBarColour(_ color: String) -> Void {
|
|
301
|
-
print("configureStatusBarColour------",color)
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
@objc
|
|
306
|
-
func configureLoadingScreenColor(_ color: String) -> Void {
|
|
307
|
-
let argbcolor = UIColor(hex: color )
|
|
308
|
-
print("configureLoadingScreenColor------",argbcolor)
|
|
309
|
-
customerGlu.configureLoadingScreenColor(color: argbcolor ?? UIColor.white)
|
|
310
|
-
}
|
|
311
|
-
//2jan2023
|
|
312
|
-
@objc
|
|
313
|
-
func configureDarkBackgroundColor(_ colr: String) -> Void {
|
|
314
|
-
let argbcolor = UIColor(hex: colr)
|
|
315
|
-
customerGlu.configureDarkBackgroundColor(color: argbcolor ?? UIColor.black)
|
|
316
|
-
}
|
|
317
|
-
@objc
|
|
318
|
-
func configureLightBackgroundColor(_ colr: String) -> Void {
|
|
319
|
-
let argbcolor = UIColor(hex: colr)
|
|
320
|
-
customerGlu.configureLightBackgroundColor(color: argbcolor ?? UIColor.white)
|
|
321
|
-
}
|
|
322
|
-
@objc
|
|
323
|
-
func listenToDarkMode(_ isdarkmode: Bool) -> Void {
|
|
324
|
-
customerGlu.listenToDarkMode(allowToListenDarkMode: isdarkmode)
|
|
325
|
-
}
|
|
326
|
-
@objc
|
|
327
|
-
func enableDarkMode(_ darkmode: Bool) -> Void {
|
|
328
|
-
customerGlu.enableDarkMode(isDarkModeEnabled: darkmode)
|
|
329
|
-
}
|
|
330
|
-
@objc private func connvertEnumToString(cgstatus:CGSTATE) -> (String){
|
|
331
|
-
switch cgstatus {
|
|
332
|
-
case CGSTATE.SUCCESS:
|
|
333
|
-
return "SUCCESS"
|
|
334
|
-
case CGSTATE.USER_NOT_SIGNED_IN:
|
|
335
|
-
return "USER_NOT_SIGNED_IN"
|
|
336
|
-
case CGSTATE.INVALID_URL:
|
|
337
|
-
return "INVALID_URL"
|
|
338
|
-
case CGSTATE.INVALID_CAMPAIGN:
|
|
339
|
-
return "INVALID_CAMPAIGN"
|
|
340
|
-
case CGSTATE.CAMPAIGN_UNAVAILABLE:
|
|
341
|
-
return "CAMPAIGN_UNAVAILABLE"
|
|
342
|
-
case CGSTATE.NETWORK_EXCEPTION:
|
|
343
|
-
return "NETWORK_EXCEPTION"
|
|
344
|
-
case CGSTATE.DEEPLINK_URL:
|
|
345
|
-
return "DEEPLINK_URL"
|
|
346
|
-
case CGSTATE.EXCEPTION:
|
|
347
|
-
return "EXCEPTION"
|
|
348
|
-
default:
|
|
349
|
-
return "EXCEPTION"
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
//end
|
|
353
|
-
//3jan2023
|
|
354
|
-
@objc
|
|
355
|
-
func handleDeepLinkUri(_ url: String) -> Void {
|
|
356
|
-
if(url.count > 0 && URL(string: url) != nil){
|
|
357
|
-
CustomerGlu.getInstance.openDeepLink(deepurl: URL(string: url)){ status, message, data in
|
|
358
|
-
if(((CGSTATE.DEEPLINK_URL == status) || (CGSTATE.SUCCESS == status)) && data != nil){
|
|
359
|
-
do{
|
|
360
|
-
let jsonData = try data.jsonData()
|
|
361
|
-
// To get dictionary from `Data`
|
|
362
|
-
let json = try JSONSerialization.jsonObject(with: jsonData, options: [])
|
|
363
|
-
guard let dictionary = json as? [String : Any] else {
|
|
364
|
-
let jsonObject = [
|
|
365
|
-
"status": self.connvertEnumToString(cgstatus: CGSTATE.EXCEPTION),
|
|
366
|
-
"data": [String : Any]()] as [String : Any]
|
|
367
|
-
let jsonData1 = try? JSONSerialization.data(withJSONObject: jsonObject, options: [])
|
|
368
|
-
let jsonString1 = String(data: jsonData1!, encoding: .utf8)
|
|
369
|
-
Rncustomerglu.shared?.emitEvent(withName:"CG_UNI_DEEPLINK_EVENT", body: jsonString1)
|
|
370
|
-
return
|
|
371
|
-
}
|
|
372
|
-
let jsonObject = [
|
|
373
|
-
"status": self.connvertEnumToString(cgstatus: status),
|
|
374
|
-
"data": dictionary] as [String : Any]
|
|
375
|
-
let jsonData1 = try? JSONSerialization.data(withJSONObject: jsonObject, options: [])
|
|
376
|
-
let jsonString1 = String(data: jsonData1!, encoding: .utf8)
|
|
377
|
-
Rncustomerglu.shared?.emitEvent(withName:"CG_UNI_DEEPLINK_EVENT", body: jsonString1)
|
|
378
|
-
}catch{
|
|
379
|
-
let jsonObject = [
|
|
380
|
-
"status": self.connvertEnumToString(cgstatus: CGSTATE.EXCEPTION),
|
|
381
|
-
"data": [String : Any]()] as [String : Any]
|
|
382
|
-
let jsonData1 = try? JSONSerialization.data(withJSONObject: jsonObject, options: [])
|
|
383
|
-
let jsonString1 = String(data: jsonData1!, encoding: .utf8)
|
|
384
|
-
Rncustomerglu.shared?.emitEvent(withName:"CG_UNI_DEEPLINK_EVENT", body: jsonString1)
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}else{
|
|
389
|
-
let jsonObject = [
|
|
390
|
-
"status": self.connvertEnumToString(cgstatus: CGSTATE.EXCEPTION),
|
|
391
|
-
"data": [String : Any]()] as [String : Any]
|
|
392
|
-
let jsonData1 = try? JSONSerialization.data(withJSONObject: jsonObject, options: [])
|
|
393
|
-
let jsonString1 = String(data: jsonData1!, encoding: .utf8)
|
|
394
|
-
Rncustomerglu.shared?.emitEvent(withName:"CG_UNI_DEEPLINK_EVENT", body: jsonString1)
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
//end
|
|
398
|
-
|
|
399
|
-
//16jan2023
|
|
400
|
-
@objc
|
|
401
|
-
func configureLightLoaderURL(_ url: String) -> Void {
|
|
402
|
-
// CustomerGlu.getInstance.configureLightLoaderURL(locallottieLoaderURL: url)
|
|
403
|
-
}
|
|
404
|
-
@objc
|
|
405
|
-
func configureDarkLoaderURL(_ url: String) -> Void {
|
|
406
|
-
// CustomerGlu.getInstance.configureDarkLoaderURL(locallottieLoaderURL: url)
|
|
407
|
-
}
|
|
408
|
-
@objc
|
|
409
|
-
func configureLightEmbedLoaderURL(_ url: String) -> Void {
|
|
410
|
-
// CustomerGlu.getInstance.configureLightEmbedLoaderURL(locallottieLoaderURL: url)
|
|
411
|
-
}
|
|
412
|
-
@objc
|
|
413
|
-
func configureDarkEmbedLoaderURL(_ url: String) -> Void {
|
|
414
|
-
// CustomerGlu.getInstance.configureDarkEmbedLoaderURL(locallottieLoaderURL: url)
|
|
415
|
-
}
|
|
416
|
-
//end
|
|
417
|
-
|
|
418
|
-
@objc
|
|
419
|
-
func enablePrecaching() -> Void {
|
|
420
|
-
|
|
421
|
-
}
|
|
422
|
-
@objc
|
|
423
|
-
func gluSDKDebuggingMode(_ bool:Bool) -> Void {
|
|
424
|
-
customerGlu.gluSDKDebuggingMode(enabled: bool)
|
|
425
|
-
print(bool);
|
|
426
|
-
}
|
|
427
|
-
@objc
|
|
428
|
-
func enableEntryPoints(_ bool:Bool) -> Void {
|
|
429
|
-
customerGlu.enableEntryPoints(enabled:bool)
|
|
430
|
-
print(bool);
|
|
431
|
-
}
|
|
432
|
-
@objc
|
|
433
|
-
func closeWebView(_ bool:Bool) -> Void {
|
|
434
|
-
customerGlu.closeWebviewOnDeeplinkEvent(close: bool);
|
|
435
|
-
}
|
|
436
|
-
@objc
|
|
437
|
-
func allowAnonymousRegistration(_ bool: Bool)-> Void{
|
|
438
|
-
customerGlu.allowAnonymousRegistration(enabled: bool);
|
|
439
|
-
}
|
|
440
|
-
@objc
|
|
441
|
-
func isFcmApn(_ fcm:String) -> Void {
|
|
442
|
-
customerGlu.isFcmApn(fcmApn:fcm)
|
|
443
|
-
}
|
|
444
|
-
@objc
|
|
445
|
-
func setApnFcmToken(_ apn:String, fcmToken fcm: String ) -> Void {
|
|
446
|
-
customerGlu.apnToken=apn
|
|
447
|
-
customerGlu.fcmToken=fcm
|
|
448
|
-
}
|
|
449
|
-
@objc
|
|
450
|
-
func configureSafeArea(_ safe:NSDictionary) -> Void {
|
|
451
|
-
let color1 = colorWithHexString(hexString: safe["topSafeAreaColor"] as! String )
|
|
452
|
-
let color2 = colorWithHexString(hexString: safe["bottomSafeAreaColor"] as! String )
|
|
453
|
-
customerGlu.configureSafeArea(topHeight: safe["topHeight"] as! Int, bottomHeight: safe["bottomHeight"] as! Int, topSafeAreaColor: color1, bottomSafeAreaColor: color2)
|
|
454
|
-
}
|
|
455
|
-
@objc
|
|
456
|
-
func SetDefaultBannerImage(_ url: String) -> Void {
|
|
457
|
-
DispatchQueue.main.async {
|
|
458
|
-
customerGlu.setDefaultBannerImage(bannerUrl: url)
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
@objc
|
|
462
|
-
func UpdateProfile(_ userdata:NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
463
|
-
customerGlu.updateProfile(userdata: userdata as! [String : AnyHashable])
|
|
464
|
-
}
|
|
465
|
-
@objc
|
|
466
|
-
func UpdateUserAttributes(_ userdata:NSDictionary) -> Void {
|
|
467
|
-
customerGlu.updateUserAttributes(customAttributes: userdata as! [String : AnyHashable])
|
|
468
|
-
}
|
|
469
|
-
@objc
|
|
470
|
-
func DisplayCustomerGluNotification() -> Void {
|
|
471
|
-
}
|
|
472
|
-
@objc
|
|
473
|
-
func CGApplication(_ userInfo:NSDictionary) -> Void {
|
|
474
|
-
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
|
|
475
|
-
// autoclosewebview - If True then it will dismiss the webview on Deeplink Event.
|
|
476
|
-
CustomerGlu.getInstance.cgapplication(application, didReceiveRemoteNotification: userInfo, backgroundAlpha: 0.5 ,auto_close_webview:false,fetchCompletionHandler: completionHandler) }
|
|
477
|
-
}
|
|
478
|
-
@objc func DisplayCGNotification(_ obj:NSDictionary, auto_close_webview bool:Bool) -> Void {
|
|
479
|
-
DispatchQueue.main.async {
|
|
480
|
-
customerGlu.displayBackgroundNotification(remoteMessage: obj as! [String : AnyHashable], auto_close_webview:bool)
|
|
481
|
-
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
@objc
|
|
485
|
-
func GetRefferalId(_ url:URL, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
486
|
-
let refferId = customerGlu.getReferralId(deepLink: url)
|
|
487
|
-
resolve(refferId)
|
|
488
|
-
}
|
|
489
|
-
@objc
|
|
490
|
-
func LoadAllCampagins() -> Void {
|
|
491
|
-
DispatchQueue.main.async {
|
|
492
|
-
customerGlu.loadAllCampaigns()
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
@objc
|
|
496
|
-
func LoadCampaginsByFilter(_ obj:NSDictionary) -> Void {
|
|
497
|
-
DispatchQueue.main.async {
|
|
498
|
-
customerGlu.loadCampaignByFilter(parameters: obj)
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
@objc
|
|
503
|
-
func SetCurrentClassName(_ clName:String) -> Void {
|
|
504
|
-
DispatchQueue.main.async {
|
|
505
|
-
customerGlu.setCurrentClassName(className: clName)
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
@objc
|
|
509
|
-
func SetCGCurrentClassName(_ clName:String,epochTimeStamp:String,resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
510
|
-
DispatchQueue.main.async {
|
|
511
|
-
customerGlu.setCGCurrentClassName(className: clName, timestamp: epochTimeStamp) { returnedTimestamp in
|
|
512
|
-
|
|
513
|
-
resolve(returnedTimestamp)
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
@objc
|
|
518
|
-
func configureWhiteListedDomains(_ domain:NSArray) -> Void {
|
|
519
|
-
customerGlu.configureWhiteListedDomains(domains: domain as! [String])
|
|
520
|
-
|
|
521
|
-
}
|
|
522
|
-
@objc
|
|
523
|
-
func configureDomainCodeMsg(_ codemsg: NSDictionary) -> Void {
|
|
524
|
-
customerGlu.configureDomainCodeMsg(code: codemsg["code"] as! Int, message: codemsg["msg"] as! String)
|
|
525
|
-
}
|
|
526
|
-
@objc
|
|
527
|
-
func getBannerHeight() {
|
|
528
|
-
// NotificationCenter.default.addObserver(self, selector: #selector(self.catchBannerHeightNotification(notification:)), name: Notification.Name("CGBANNER_FINAL_HEIGHT"), object: nil)
|
|
529
|
-
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
@objc
|
|
533
|
-
func addMarginsForPIP(_ horizontal: Int, vertical:Int, pipType: String){
|
|
534
|
-
customerGlu.addMarginForPIP(horizontal: horizontal, vertical: vertical)
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
@objc
|
|
538
|
-
func addDelayForPIP(_ delay: Int){
|
|
539
|
-
customerGlu.addDelayForPIP(delay: delay)
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
// @objc
|
|
544
|
-
// func catchBannerHeightNotification(notification: NSNotification) {
|
|
545
|
-
//
|
|
546
|
-
// }
|
|
547
|
-
override class func requiresMainQueueSetup() -> Bool {
|
|
548
|
-
return false
|
|
549
|
-
}
|
|
550
|
-
private func colorWithHexString(hexString: String) -> UIColor {
|
|
551
|
-
|
|
552
|
-
// Convert hex string to an integer
|
|
553
|
-
|
|
554
|
-
let hexint = Int(self.intFromHexString(hexStr: hexString))
|
|
555
|
-
|
|
556
|
-
let red = CGFloat((hexint & 0xff0000) >> 16) / 255.0
|
|
557
|
-
|
|
558
|
-
let green = CGFloat((hexint & 0xff00) >> 8) / 255.0
|
|
559
|
-
|
|
560
|
-
let blue = CGFloat((hexint & 0xff) >> 0) / 255.0
|
|
561
|
-
|
|
562
|
-
// Create color object, specifying alpha as well
|
|
563
|
-
|
|
564
|
-
let color = UIColor(red: red, green: green, blue: blue, alpha: 1.0)
|
|
565
|
-
|
|
566
|
-
return color
|
|
567
|
-
|
|
568
|
-
}
|
|
569
|
-
private func intFromHexString(hexStr: String) -> UInt32 {
|
|
570
|
-
|
|
571
|
-
var hexInt: UInt32 = 0
|
|
572
|
-
|
|
573
|
-
// Create scanner
|
|
574
|
-
|
|
575
|
-
let scanner: Scanner = Scanner(string: hexStr)
|
|
576
|
-
|
|
577
|
-
// Tell scanner to skip the # character
|
|
578
|
-
|
|
579
|
-
scanner.charactersToBeSkipped = CharacterSet(charactersIn: "#")
|
|
580
|
-
|
|
581
|
-
// Scan hex value
|
|
582
|
-
|
|
583
|
-
scanner.scanHexInt32(&hexInt)
|
|
584
|
-
|
|
585
|
-
return hexInt
|
|
586
|
-
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
}
|
|
590
|
-
@objc(BannerWidget)
|
|
591
|
-
class BannerWidget: RCTViewManager {
|
|
592
|
-
override func view() -> UIView! {
|
|
593
|
-
return MyNativeView()
|
|
594
|
-
}
|
|
595
|
-
override static func requiresMainQueueSetup() -> Bool {
|
|
596
|
-
return true
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
@objc(EmbedBannerWidget)
|
|
602
|
-
class EmbedBannerWidget: RCTViewManager {
|
|
603
|
-
override func view() -> UIView! {
|
|
604
|
-
return EmbedBannerView()
|
|
605
|
-
}
|
|
606
|
-
override static func requiresMainQueueSetup() -> Bool {
|
|
607
|
-
return true
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
// Custom View (Swift)
|
|
612
|
-
@objc
|
|
613
|
-
class MyNativeView: UIView {
|
|
614
|
-
@objc var bannerId = "" {
|
|
615
|
-
didSet {
|
|
616
|
-
DispatchQueue.main.asyncAfter(deadline: .now()) { [self] in
|
|
617
|
-
let bannerview = BannerView(frame: CGRect(x: 10, y: 0, width: UIScreen.main.bounds.width - 20 , height: 0), bannerId: bannerId)
|
|
618
|
-
self.addSubview(bannerview)
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
override init(frame: CGRect) {
|
|
623
|
-
super.init(frame: frame)
|
|
624
|
-
}
|
|
625
|
-
required init?(coder aDecoder: NSCoder) {
|
|
626
|
-
fatalError("init(coder:) has not been implemented")
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
@objc
|
|
631
|
-
class EmbedBannerView: UIView {
|
|
632
|
-
@objc var bannerId = "" {
|
|
633
|
-
didSet {
|
|
634
|
-
DispatchQueue.main.asyncAfter(deadline: .now()) { [self] in
|
|
635
|
-
let bannerview = CGEmbedView(frame: CGRect(x: 10, y: 0, width: UIScreen.main.bounds.width - 20 , height: 0), embedId: bannerId)
|
|
636
|
-
self.addSubview(bannerview)
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
override init(frame: CGRect) {
|
|
641
|
-
super.init(frame: frame)
|
|
642
|
-
}
|
|
643
|
-
required init?(coder aDecoder: NSCoder) {
|
|
644
|
-
fatalError("init(coder:) has not been implemented")
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
|