react-native-daro 1.0.5 → 1.0.7
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.
|
@@ -38,11 +38,12 @@ extension DaroMModule {
|
|
|
38
38
|
reject("LIGHTPOPUP_NOT_LOADED", "LightPopup ad not loaded", nil)
|
|
39
39
|
return
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
executeOnMainThread { [weak self] in
|
|
42
42
|
guard let viewController = UIApplication.shared.windows.first?.rootViewController else {
|
|
43
43
|
reject("VIEW_CONTROLLER_NOT_FOUND", "Root view controller not found", nil)
|
|
44
44
|
return
|
|
45
45
|
}
|
|
46
|
+
self?.applyStoredConfiguration(to: loadedAd, for: adUnitId)
|
|
46
47
|
loadedAd.show(viewController: viewController)
|
|
47
48
|
resolve(Void())
|
|
48
49
|
}
|
|
@@ -60,32 +61,38 @@ extension DaroMModule {
|
|
|
60
61
|
resolve(Void())
|
|
61
62
|
return
|
|
62
63
|
}
|
|
63
|
-
executeOnMainThread {
|
|
64
|
-
|
|
64
|
+
executeOnMainThread { [weak self] in
|
|
65
|
+
self?.applyStoredConfiguration(to: loadedAd, for: adUnitId)
|
|
66
|
+
}
|
|
67
|
+
resolve(Void())
|
|
68
|
+
}
|
|
65
69
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
}
|
|
70
|
+
func applyStoredConfiguration(to ad: DaroLightPopupAd, for unitId: String) {
|
|
71
|
+
if let configuration = lightPopupConfigurations[unitId] {
|
|
72
|
+
let lightPopupConfig = DaroLightPopupConfiguration()
|
|
71
73
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
setColorIfValid("titleTextColor") { lightPopupConfig.titleTextColor = $0 }
|
|
78
|
-
setColorIfValid("bodyTextColor") { lightPopupConfig.bodyTextColor = $0 }
|
|
79
|
-
setColorIfValid("ctaButtonTextColor") { lightPopupConfig.ctaButtonTextColor = $0 }
|
|
80
|
-
setColorIfValid("ctaButtonBackgroundColor") { lightPopupConfig.ctaButtonBackgroundColor = $0 }
|
|
81
|
-
|
|
82
|
-
if let closeButtonText = configuration["closeButtonText"] as? String {
|
|
83
|
-
lightPopupConfig.closeButtonText = closeButtonText
|
|
84
|
-
}
|
|
74
|
+
func setColorIfValid(_ key: String, setter: (UIColor) -> Void) {
|
|
75
|
+
if let colorString = configuration[key] as? String {
|
|
76
|
+
setter(UIColor(hex: colorString))
|
|
77
|
+
}
|
|
78
|
+
}
|
|
85
79
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
80
|
+
setColorIfValid("backgroundColor") { lightPopupConfig.backgroundColor = $0 }
|
|
81
|
+
setColorIfValid("cardViewBackgroundColor") { lightPopupConfig.cardViewBackgroundColor = $0 }
|
|
82
|
+
setColorIfValid("adMarkLabelTextColor") { lightPopupConfig.adMarkLabelTextColor = $0 }
|
|
83
|
+
setColorIfValid("adMarkLabelBackgroundColor") { lightPopupConfig.adMarkLabelBackgroundColor = $0 }
|
|
84
|
+
setColorIfValid("closeButtonTextColor") { lightPopupConfig.closeButtonTextColor = $0 }
|
|
85
|
+
setColorIfValid("titleTextColor") { lightPopupConfig.titleTextColor = $0 }
|
|
86
|
+
setColorIfValid("bodyTextColor") { lightPopupConfig.bodyTextColor = $0 }
|
|
87
|
+
setColorIfValid("ctaButtonTextColor") { lightPopupConfig.ctaButtonTextColor = $0 }
|
|
88
|
+
setColorIfValid("ctaButtonBackgroundColor") { lightPopupConfig.ctaButtonBackgroundColor = $0 }
|
|
89
|
+
|
|
90
|
+
if let closeButtonText = configuration["closeButtonText"] as? String {
|
|
91
|
+
lightPopupConfig.closeButtonText = closeButtonText
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
ad.configuration = lightPopupConfig
|
|
95
|
+
}
|
|
89
96
|
}
|
|
90
97
|
|
|
91
98
|
func retrieveLightPopupLoader(for unitId: String) -> DaroLightPopupAdLoader {
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
18
|
|
|
19
|
-
s.dependency "DaroAds", "1.
|
|
19
|
+
s.dependency "DaroAds", "1.1.37-beta"
|
|
20
20
|
|
|
21
21
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
22
22
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|