react-native-klarna-inapp-sdk 2.3.0 → 2.3.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.
|
@@ -37,7 +37,11 @@ NSString *const PROPERTY_NAME_ESTIMATED_PROGRESS = @"estimatedProgress";
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
-(void)dealloc {
|
|
40
|
-
|
|
40
|
+
@try {
|
|
41
|
+
[self.klarnaStandaloneWebView removeObserver:self forKeyPath:PROPERTY_NAME_ESTIMATED_PROGRESS context:nil];
|
|
42
|
+
} @catch(NSException *exception) {
|
|
43
|
+
RCTLog(@"Could not remove the progress observer: %@", exception);
|
|
44
|
+
}
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
|
|
@@ -80,6 +84,7 @@ NSString *const PROPERTY_NAME_ESTIMATED_PROGRESS = @"estimatedProgress";
|
|
|
80
84
|
self.klarnaStandaloneWebView.translatesAutoresizingMaskIntoConstraints = NO;
|
|
81
85
|
|
|
82
86
|
[self addSubview:self.klarnaStandaloneWebView];
|
|
87
|
+
[self setWebViewBackgroundToTransparent];
|
|
83
88
|
|
|
84
89
|
[NSLayoutConstraint activateConstraints:[[NSArray alloc] initWithObjects:
|
|
85
90
|
[self.klarnaStandaloneWebView.topAnchor constraintEqualToAnchor:self.topAnchor],
|
|
@@ -89,6 +94,17 @@ NSString *const PROPERTY_NAME_ESTIMATED_PROGRESS = @"estimatedProgress";
|
|
|
89
94
|
]];
|
|
90
95
|
}
|
|
91
96
|
|
|
97
|
+
- (void)setWebViewBackgroundToTransparent {
|
|
98
|
+
for (UIView *subview in self.klarnaStandaloneWebView.subviews) {
|
|
99
|
+
if ([subview isKindOfClass:[WKWebView class]]) {
|
|
100
|
+
WKWebView *webView = (WKWebView *) subview;
|
|
101
|
+
webView.backgroundColor = [UIColor clearColor];
|
|
102
|
+
webView.opaque = NO;
|
|
103
|
+
webView.scrollView.backgroundColor = [UIColor clearColor];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
92
108
|
- (void)layoutSubviews {
|
|
93
109
|
[super layoutSubviews];
|
|
94
110
|
self.klarnaStandaloneWebView.frame = self.bounds;
|
|
@@ -262,6 +278,11 @@ Class<RCTComponentViewProtocol>RNKlarnaStandaloneWebViewCls(void)
|
|
|
262
278
|
}
|
|
263
279
|
|
|
264
280
|
- (NSString *)serializeDictionaryToJsonString:(NSDictionary<NSString *, id<NSCoding>> *)dictionary {
|
|
281
|
+
if (!dictionary) {
|
|
282
|
+
RCTLog(@"Dictionary is nil");
|
|
283
|
+
return @"{}";
|
|
284
|
+
}
|
|
285
|
+
|
|
265
286
|
NSError *error;
|
|
266
287
|
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dictionary options:NSJSONWritingPrettyPrinted error:&error];
|
|
267
288
|
|
|
@@ -26,7 +26,11 @@ NSString * const PROPERTY_NAME_ESTIMATED_PROGRESS = @"estimatedProgress";
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
-(void)dealloc {
|
|
29
|
-
|
|
29
|
+
@try {
|
|
30
|
+
[self.klarnaStandaloneWebView removeObserver:self forKeyPath:PROPERTY_NAME_ESTIMATED_PROGRESS context:nil];
|
|
31
|
+
} @catch(NSException *exception) {
|
|
32
|
+
RCTLog(@"Could not remove the progress observer: %@", exception);
|
|
33
|
+
}
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
|
|
@@ -75,6 +79,7 @@ NSString * const PROPERTY_NAME_ESTIMATED_PROGRESS = @"estimatedProgress";
|
|
|
75
79
|
self.klarnaStandaloneWebView.translatesAutoresizingMaskIntoConstraints = NO;
|
|
76
80
|
|
|
77
81
|
[self addSubview:self.klarnaStandaloneWebView];
|
|
82
|
+
[self setWebViewBackgroundToTransparent];
|
|
78
83
|
|
|
79
84
|
[NSLayoutConstraint activateConstraints:[[NSArray alloc] initWithObjects:
|
|
80
85
|
[self.klarnaStandaloneWebView.topAnchor constraintEqualToAnchor:self.topAnchor],
|
|
@@ -84,6 +89,17 @@ NSString * const PROPERTY_NAME_ESTIMATED_PROGRESS = @"estimatedProgress";
|
|
|
84
89
|
]];
|
|
85
90
|
}
|
|
86
91
|
|
|
92
|
+
- (void)setWebViewBackgroundToTransparent {
|
|
93
|
+
for (UIView *subview in self.klarnaStandaloneWebView.subviews) {
|
|
94
|
+
if ([subview isKindOfClass:[WKWebView class]]) {
|
|
95
|
+
WKWebView *webView = (WKWebView *) subview;
|
|
96
|
+
webView.backgroundColor = [UIColor clearColor];
|
|
97
|
+
webView.opaque = NO;
|
|
98
|
+
webView.scrollView.backgroundColor = [UIColor clearColor];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
87
103
|
- (void)layoutSubviews {
|
|
88
104
|
[super layoutSubviews];
|
|
89
105
|
self.klarnaStandaloneWebView.frame = self.bounds;
|
|
@@ -182,6 +198,11 @@ NSString * const PROPERTY_NAME_ESTIMATED_PROGRESS = @"estimatedProgress";
|
|
|
182
198
|
#pragma mark - Events
|
|
183
199
|
|
|
184
200
|
- (NSString *)serializeDictionaryToJsonString:(NSDictionary<NSString *, id<NSCoding>> *)dictionary {
|
|
201
|
+
if (!dictionary) {
|
|
202
|
+
RCTLog(@"Dictionary is nil");
|
|
203
|
+
return @"{}";
|
|
204
|
+
}
|
|
205
|
+
|
|
185
206
|
NSError *error;
|
|
186
207
|
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dictionary options:NSJSONWritingPrettyPrinted error:&error];
|
|
187
208
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-klarna-inapp-sdk",
|
|
3
3
|
"title": "Klarna Mobile SDK React Native",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.1",
|
|
5
5
|
"description": "This library wraps Klarna Mobile SDK and exposes its functionality as React Native components.",
|
|
6
6
|
"main": "lib/commonjs/index",
|
|
7
7
|
"module": "lib/module/index",
|