react-native-klarna-inapp-sdk 2.3.1 → 2.3.3
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/android/build.gradle +2 -7
- package/android/src/main/java/com/klarna/mobile/sdk/reactnative/KlarnaMobileSDKPackage.java +1 -1
- package/android/src/main/java/com/klarna/mobile/sdk/reactnative/standalonewebview/KlarnaStandaloneWebViewManager.java +42 -4
- package/android/src/oldarch/java/com/klarna/mobile/sdk/reactnative/spec/RNKlarnaStandaloneWebViewSpec.java +4 -0
- package/android/src/test/java/com/klarna/mobile/sdk/reactnative/common/event/ComponentEventSenderTest.java +14 -7
- package/android/src/test/java/com/klarna/mobile/sdk/reactnative/common/event/ComponentEventTest.java +11 -11
- package/android/src/test/java/com/klarna/mobile/sdk/reactnative/common/event/KlarnaEventHandlerEventsUtilTest.java +11 -6
- package/android/src/test/java/com/klarna/mobile/sdk/reactnative/payments/KlarnaPaymentEventTest.java +25 -33
- package/android/src/test/java/com/klarna/mobile/sdk/reactnative/payments/KlarnaPaymentViewManagerTest.java +7 -13
- package/ios/RNKlarnaMobileSDK.xcodeproj/project.pbxproj +9 -13
- package/ios/Sources/KlarnaCheckoutViewManager.mm +1 -5
- package/ios/Sources/KlarnaPaymentViewManager.mm +1 -5
- package/ios/Sources/KlarnaStandaloneWebViewManager.mm +2 -5
- package/ios/Sources/PrefixHeader.pch +4 -0
- package/ios/Sources/view/{oldarch/KlarnaCheckoutViewWrapper.h → KlarnaCheckoutViewWrapper.h} +14 -9
- package/ios/Sources/view/{oldarch/KlarnaStandaloneWebViewWrapper.h → KlarnaStandaloneWebViewWrapper.h} +10 -10
- package/ios/Sources/view/{oldarch/PaymentViewWrapper.h → PaymentViewWrapper.h} +12 -9
- package/ios/Sources/view/newarch/KlarnaCheckoutViewWrapper.mm +1 -1
- package/ios/Sources/view/newarch/KlarnaStandaloneWebViewWrapper.mm +17 -1
- package/ios/Sources/view/newarch/PaymentViewWrapper.mm +1 -1
- package/ios/Sources/view/oldarch/KlarnaCheckoutViewWrapper.mm +1 -1
- package/ios/Sources/view/oldarch/KlarnaStandaloneWebViewWrapper.mm +19 -1
- package/ios/Sources/view/oldarch/PaymentViewWrapper.mm +1 -1
- package/ios/Tests/PaymentViewWrapperTests.m +9 -5
- package/lib/commonjs/KlarnaCheckoutView.js +6 -7
- package/lib/commonjs/KlarnaCheckoutView.js.map +1 -1
- package/lib/commonjs/KlarnaPaymentView.js +34 -56
- package/lib/commonjs/KlarnaPaymentView.js.map +1 -1
- package/lib/commonjs/KlarnaStandaloneWebView.js +9 -8
- package/lib/commonjs/KlarnaStandaloneWebView.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/KlarnaCheckoutViewNativeComponent.js +4 -6
- package/lib/commonjs/specs/KlarnaCheckoutViewNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/KlarnaPaymentViewNativeComponent.js +4 -6
- package/lib/commonjs/specs/KlarnaPaymentViewNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/KlarnaStandaloneWebViewNativeComponent.js +4 -6
- package/lib/commonjs/specs/KlarnaStandaloneWebViewNativeComponent.js.map +1 -1
- package/lib/commonjs/types/common/KlarnaMobileSDKError.js.map +1 -1
- package/lib/commonjs/types/common/KlarnaProductEvent.js.map +1 -1
- package/lib/module/KlarnaCheckoutView.js +1 -1
- package/lib/module/KlarnaCheckoutView.js.map +1 -1
- package/lib/module/KlarnaPaymentView.js +31 -52
- package/lib/module/KlarnaPaymentView.js.map +1 -1
- package/lib/module/KlarnaStandaloneWebView.js +3 -1
- package/lib/module/KlarnaStandaloneWebView.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/KlarnaCheckoutViewNativeComponent.js +1 -1
- package/lib/module/specs/KlarnaCheckoutViewNativeComponent.js.map +1 -1
- package/lib/module/specs/KlarnaPaymentViewNativeComponent.js +1 -1
- package/lib/module/specs/KlarnaPaymentViewNativeComponent.js.map +1 -1
- package/lib/module/specs/KlarnaStandaloneWebViewNativeComponent.js +1 -1
- package/lib/module/specs/KlarnaStandaloneWebViewNativeComponent.js.map +1 -1
- package/lib/module/types/common/KlarnaMobileSDKError.js.map +1 -1
- package/lib/module/types/common/KlarnaProductEvent.js.map +1 -1
- package/lib/typescript/KlarnaStandaloneWebView.d.ts +2 -0
- package/lib/typescript/KlarnaStandaloneWebView.d.ts.map +1 -1
- package/lib/typescript/specs/KlarnaCheckoutViewNativeComponent.d.ts +1 -1
- package/lib/typescript/specs/KlarnaCheckoutViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/specs/KlarnaPaymentViewNativeComponent.d.ts +1 -1
- package/lib/typescript/specs/KlarnaPaymentViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/specs/KlarnaStandaloneWebViewNativeComponent.d.ts +3 -1
- package/lib/typescript/specs/KlarnaStandaloneWebViewNativeComponent.d.ts.map +1 -1
- package/package.json +2 -3
- package/react-native-klarna-inapp-sdk.podspec +3 -1
- package/src/KlarnaCheckoutView.tsx +1 -1
- package/src/KlarnaPaymentView.tsx +1 -1
- package/src/KlarnaStandaloneWebView.tsx +5 -1
- package/src/specs/KlarnaCheckoutViewNativeComponent.ts +1 -1
- package/src/specs/KlarnaPaymentViewNativeComponent.ts +1 -1
- package/src/specs/KlarnaStandaloneWebViewNativeComponent.ts +7 -1
- package/ios/Sources/view/newarch/KlarnaCheckoutViewWrapper.h +0 -26
- package/ios/Sources/view/newarch/KlarnaStandaloneWebViewWrapper.h +0 -29
- package/ios/Sources/view/newarch/PaymentViewWrapper.h +0 -33
package/android/build.gradle
CHANGED
|
@@ -113,13 +113,8 @@ dependencies {
|
|
|
113
113
|
testImplementation "junit:junit:4.13.2"
|
|
114
114
|
testImplementation 'androidx.test:core:1.5.0'
|
|
115
115
|
testImplementation "org.robolectric:robolectric:4.11.1"
|
|
116
|
-
testImplementation "org.mockito:mockito-core:
|
|
117
|
-
testImplementation "org.mockito:mockito-inline:
|
|
118
|
-
testImplementation "org.powermock:powermock-core:2.0.9"
|
|
119
|
-
testImplementation "org.powermock:powermock-api-mockito2:2.0.9"
|
|
120
|
-
testImplementation "org.powermock:powermock-module-junit4:2.0.9"
|
|
121
|
-
testImplementation "org.powermock:powermock-module-junit4-rule:2.0.9"
|
|
122
|
-
testImplementation "org.powermock:powermock-classloading-xstream:2.0.9"
|
|
116
|
+
testImplementation "org.mockito:mockito-core:3.12.4"
|
|
117
|
+
testImplementation "org.mockito:mockito-inline:3.12.4"
|
|
123
118
|
}
|
|
124
119
|
|
|
125
120
|
// removed from the docs but we can keep it
|
|
@@ -28,7 +28,7 @@ public class KlarnaMobileSDKPackage implements ReactPackage {
|
|
|
28
28
|
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
|
|
29
29
|
return List.of(
|
|
30
30
|
new KlarnaPaymentViewManager(reactContext),
|
|
31
|
-
new KlarnaStandaloneWebViewManager(reactContext
|
|
31
|
+
new KlarnaStandaloneWebViewManager(reactContext),
|
|
32
32
|
new KlarnaCheckoutViewManager(reactContext)
|
|
33
33
|
);
|
|
34
34
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
package com.klarna.mobile.sdk.reactnative.standalonewebview;
|
|
2
2
|
|
|
3
|
-
import android.app.Application;
|
|
4
3
|
import android.graphics.Bitmap;
|
|
5
4
|
import android.os.Build;
|
|
5
|
+
import android.view.View;
|
|
6
6
|
import android.webkit.RenderProcessGoneDetail;
|
|
7
7
|
import android.webkit.WebResourceError;
|
|
8
8
|
import android.webkit.WebResourceRequest;
|
|
9
|
+
import android.webkit.WebView;
|
|
9
10
|
|
|
10
11
|
import androidx.annotation.NonNull;
|
|
11
12
|
import androidx.annotation.Nullable;
|
|
@@ -33,17 +34,22 @@ import java.util.Objects;
|
|
|
33
34
|
|
|
34
35
|
public class KlarnaStandaloneWebViewManager extends RNKlarnaStandaloneWebViewSpec<KlarnaStandaloneWebView> {
|
|
35
36
|
|
|
37
|
+
private static final String REACT_CLASS = "RNKlarnaStandaloneWebView";
|
|
38
|
+
|
|
36
39
|
// Commands that can be triggered from React Native side
|
|
37
40
|
public static final String COMMAND_LOAD = "load";
|
|
38
41
|
public static final String COMMAND_GO_FORWARD = "goForward";
|
|
39
42
|
public static final String COMMAND_GO_BACK = "goBack";
|
|
40
43
|
public static final String COMMAND_RELOAD = "reload";
|
|
41
44
|
|
|
42
|
-
private static final String
|
|
45
|
+
private static final String OVER_SCROLL_MODE_ALWAYS = "always";
|
|
46
|
+
private static final String OVER_SCROLL_MODE_CONTENT = "content";
|
|
47
|
+
private static final String OVER_SCROLL_MODE_NEVER = "never";
|
|
43
48
|
|
|
44
49
|
// Store a list of views to event dispatchers so we send up events via the right views.
|
|
45
50
|
private final Map<WeakReference<KlarnaStandaloneWebView>, EventDispatcher> viewToDispatcher;
|
|
46
51
|
private final KlarnaStandaloneWebViewEventSender klarnaStandaloneWebViewEventSender;
|
|
52
|
+
private final ReactApplicationContext reactAppContext;
|
|
47
53
|
private final KlarnaEventHandler klarnaEventHandler = new KlarnaEventHandler() {
|
|
48
54
|
@Override
|
|
49
55
|
public void onEvent(@NonNull KlarnaComponent klarnaComponent, @NonNull KlarnaProductEvent klarnaProductEvent) {
|
|
@@ -95,8 +101,9 @@ public class KlarnaStandaloneWebViewManager extends RNKlarnaStandaloneWebViewSpe
|
|
|
95
101
|
}
|
|
96
102
|
};
|
|
97
103
|
|
|
98
|
-
public KlarnaStandaloneWebViewManager(ReactApplicationContext reactContext
|
|
104
|
+
public KlarnaStandaloneWebViewManager(ReactApplicationContext reactContext) {
|
|
99
105
|
super();
|
|
106
|
+
this.reactAppContext = reactContext;
|
|
100
107
|
viewToDispatcher = new HashMap<>();
|
|
101
108
|
klarnaStandaloneWebViewEventSender = new KlarnaStandaloneWebViewEventSender(viewToDispatcher);
|
|
102
109
|
}
|
|
@@ -109,6 +116,37 @@ public class KlarnaStandaloneWebViewManager extends RNKlarnaStandaloneWebViewSpe
|
|
|
109
116
|
}
|
|
110
117
|
}
|
|
111
118
|
|
|
119
|
+
@ReactProp(name = "overScrollMode")
|
|
120
|
+
@Override
|
|
121
|
+
public void setOverScrollMode(KlarnaStandaloneWebView view, String overScrollMode) {
|
|
122
|
+
for (int i = 0; i < view.getChildCount(); i++) {
|
|
123
|
+
View v = view.getChildAt(i);
|
|
124
|
+
if (v instanceof WebView) {
|
|
125
|
+
applyOverScrollMode(v, overScrollMode);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
private void applyOverScrollMode(View view, String overScrollMode) {
|
|
131
|
+
switch (overScrollMode) {
|
|
132
|
+
case OVER_SCROLL_MODE_NEVER:
|
|
133
|
+
view.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
|
134
|
+
break;
|
|
135
|
+
case OVER_SCROLL_MODE_CONTENT:
|
|
136
|
+
view.setOverScrollMode(View.OVER_SCROLL_IF_CONTENT_SCROLLS);
|
|
137
|
+
break;
|
|
138
|
+
case OVER_SCROLL_MODE_ALWAYS:
|
|
139
|
+
default:
|
|
140
|
+
view.setOverScrollMode(View.OVER_SCROLL_ALWAYS);
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@Override
|
|
146
|
+
public void setBounces(KlarnaStandaloneWebView view, boolean value) {
|
|
147
|
+
// No need to implement this as it is not supported in Android
|
|
148
|
+
}
|
|
149
|
+
|
|
112
150
|
@NonNull
|
|
113
151
|
@Override
|
|
114
152
|
public String getName() {
|
|
@@ -186,7 +224,7 @@ public class KlarnaStandaloneWebViewManager extends RNKlarnaStandaloneWebViewSpe
|
|
|
186
224
|
@Override
|
|
187
225
|
protected KlarnaStandaloneWebView createViewInstance(@NonNull ThemedReactContext themedReactContext) {
|
|
188
226
|
KlarnaStandaloneWebView klarnaStandaloneWebView = new KlarnaStandaloneWebView(
|
|
189
|
-
/* context */
|
|
227
|
+
/* context */ reactAppContext,
|
|
190
228
|
/* attrs */ null,
|
|
191
229
|
/* defStyleAttr */ 0,
|
|
192
230
|
/* webViewClient */ klarnaStandaloneWebViewClient,
|
|
@@ -9,6 +9,10 @@ import com.facebook.react.uimanager.SimpleViewManager;
|
|
|
9
9
|
public abstract class RNKlarnaStandaloneWebViewSpec<T extends View> extends SimpleViewManager<T> {
|
|
10
10
|
public abstract void setReturnUrl(T view, @Nullable String returnUrl);
|
|
11
11
|
|
|
12
|
+
public abstract void setOverScrollMode(T view, String overScrollMode);
|
|
13
|
+
|
|
14
|
+
public abstract void setBounces(T view, boolean bounces);
|
|
15
|
+
|
|
12
16
|
public abstract void load(T view, String url);
|
|
13
17
|
|
|
14
18
|
public abstract void goForward(T view);
|
|
@@ -7,14 +7,14 @@ import com.facebook.react.bridge.WritableMap;
|
|
|
7
7
|
import com.facebook.react.uimanager.UIManagerHelper;
|
|
8
8
|
import com.facebook.react.uimanager.events.EventDispatcher;
|
|
9
9
|
|
|
10
|
+
import org.junit.After;
|
|
10
11
|
import org.junit.Assert;
|
|
11
12
|
import org.junit.Before;
|
|
12
13
|
import org.junit.Test;
|
|
13
14
|
import org.junit.runner.RunWith;
|
|
15
|
+
import org.mockito.MockedStatic;
|
|
14
16
|
import org.mockito.Mockito;
|
|
15
|
-
import org.
|
|
16
|
-
import org.powermock.core.classloader.annotations.PrepareForTest;
|
|
17
|
-
import org.powermock.modules.junit4.PowerMockRunner;
|
|
17
|
+
import org.mockito.junit.MockitoJUnitRunner;
|
|
18
18
|
|
|
19
19
|
import java.lang.ref.WeakReference;
|
|
20
20
|
import java.util.Arrays;
|
|
@@ -22,10 +22,11 @@ import java.util.Collection;
|
|
|
22
22
|
import java.util.HashMap;
|
|
23
23
|
import java.util.Map;
|
|
24
24
|
|
|
25
|
-
@RunWith(
|
|
26
|
-
@PrepareForTest({UIManagerHelper.class, SystemClock.class})
|
|
25
|
+
@RunWith(MockitoJUnitRunner.class)
|
|
27
26
|
public class ComponentEventSenderTest {
|
|
28
27
|
|
|
28
|
+
private MockedStatic<UIManagerHelper> mockedStaticUiManagerHelper;
|
|
29
|
+
private MockedStatic<SystemClock> mockedStaticSystemClock;
|
|
29
30
|
private TestEventSender testEventSender;
|
|
30
31
|
private View view;
|
|
31
32
|
private EventDispatcher eventDispatcher;
|
|
@@ -40,9 +41,15 @@ public class ComponentEventSenderTest {
|
|
|
40
41
|
}};
|
|
41
42
|
testEventSender = new TestEventSender(viewToDispatcher);
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
mockedStaticUiManagerHelper = Mockito.mockStatic(UIManagerHelper.class);
|
|
44
45
|
Mockito.when(UIManagerHelper.getEventDispatcherForReactTag(Mockito.any(), Mockito.anyInt())).thenAnswer(invocation -> eventDispatcher);
|
|
45
|
-
|
|
46
|
+
mockedStaticSystemClock = Mockito.mockStatic(SystemClock.class);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@After
|
|
50
|
+
public void teardown() {
|
|
51
|
+
mockedStaticUiManagerHelper.close();
|
|
52
|
+
mockedStaticSystemClock.close();
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
@Test
|
package/android/src/test/java/com/klarna/mobile/sdk/reactnative/common/event/ComponentEventTest.java
CHANGED
|
@@ -11,32 +11,32 @@ import org.junit.After;
|
|
|
11
11
|
import org.junit.Assert;
|
|
12
12
|
import org.junit.Before;
|
|
13
13
|
import org.junit.Test;
|
|
14
|
-
import org.
|
|
15
|
-
import org.
|
|
16
|
-
import org.powermock.core.classloader.annotations.PrepareForTest;
|
|
17
|
-
import org.powermock.modules.junit4.PowerMockRunner;
|
|
14
|
+
import org.mockito.MockedStatic;
|
|
15
|
+
import org.mockito.Mockito;
|
|
18
16
|
|
|
19
|
-
@RunWith(PowerMockRunner.class)
|
|
20
|
-
@PrepareForTest({Arguments.class, SystemClock.class})
|
|
21
17
|
public class ComponentEventTest {
|
|
22
18
|
|
|
19
|
+
private MockedStatic<Arguments> mockedStaticArguments;
|
|
20
|
+
private MockedStatic<SystemClock> mockedStaticSystemClock;
|
|
21
|
+
|
|
23
22
|
@Before
|
|
24
23
|
public void setup() {
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
mockedStaticArguments = Mockito.mockStatic(Arguments.class);
|
|
25
|
+
Mockito.when(Arguments.createArray())
|
|
27
26
|
.thenAnswer(invocation -> {
|
|
28
27
|
return new JavaOnlyArray();
|
|
29
28
|
});
|
|
30
|
-
|
|
29
|
+
Mockito.when(Arguments.createMap())
|
|
31
30
|
.thenAnswer(invocation -> {
|
|
32
31
|
return new JavaOnlyMap();
|
|
33
32
|
});
|
|
34
|
-
|
|
33
|
+
mockedStaticSystemClock = Mockito.mockStatic(SystemClock.class);
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
@After
|
|
38
37
|
public void teardown() {
|
|
39
|
-
|
|
38
|
+
mockedStaticArguments.close();
|
|
39
|
+
mockedStaticSystemClock.close();
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
@Test
|
|
@@ -7,22 +7,22 @@ import com.klarna.mobile.sdk.api.KlarnaProduct;
|
|
|
7
7
|
import com.klarna.mobile.sdk.api.KlarnaProductEvent;
|
|
8
8
|
import com.klarna.mobile.sdk.reactnative.common.util.ArgumentsUtil;
|
|
9
9
|
|
|
10
|
+
import org.junit.After;
|
|
10
11
|
import org.junit.Before;
|
|
11
12
|
import org.junit.Test;
|
|
12
13
|
import org.junit.runner.RunWith;
|
|
14
|
+
import org.mockito.MockedStatic;
|
|
13
15
|
import org.mockito.Mockito;
|
|
14
|
-
import org.
|
|
15
|
-
import org.powermock.core.classloader.annotations.PrepareForTest;
|
|
16
|
-
import org.powermock.modules.junit4.PowerMockRunner;
|
|
16
|
+
import org.mockito.junit.MockitoJUnitRunner;
|
|
17
17
|
|
|
18
18
|
import java.util.HashMap;
|
|
19
19
|
import java.util.HashSet;
|
|
20
20
|
import java.util.List;
|
|
21
21
|
|
|
22
|
-
@RunWith(
|
|
23
|
-
@PrepareForTest({ArgumentsUtil.class})
|
|
22
|
+
@RunWith(MockitoJUnitRunner.class)
|
|
24
23
|
public class KlarnaEventHandlerEventsUtilTest {
|
|
25
24
|
|
|
25
|
+
private MockedStatic<ArgumentsUtil> mockedStaticArgumentsUtil;
|
|
26
26
|
private ComponentEventSender componentEventSender;
|
|
27
27
|
private View view;
|
|
28
28
|
|
|
@@ -31,10 +31,15 @@ public class KlarnaEventHandlerEventsUtilTest {
|
|
|
31
31
|
componentEventSender = Mockito.mock(ComponentEventSender.class);
|
|
32
32
|
view = Mockito.mock(View.class);
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
mockedStaticArgumentsUtil = Mockito.mockStatic(ArgumentsUtil.class);
|
|
35
35
|
Mockito.when(ArgumentsUtil.createMap(Mockito.anyMap())).thenAnswer(invocation -> null);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
@After
|
|
39
|
+
public void teardown() {
|
|
40
|
+
mockedStaticArgumentsUtil.close();
|
|
41
|
+
}
|
|
42
|
+
|
|
38
43
|
@Test
|
|
39
44
|
public void sendKlarnaProductEvent() {
|
|
40
45
|
// Given
|
package/android/src/test/java/com/klarna/mobile/sdk/reactnative/payments/KlarnaPaymentEventTest.java
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
package com.klarna.mobile.sdk.reactnative.payments;
|
|
2
2
|
|
|
3
|
+
import static com.klarna.mobile.sdk.reactnative.payments.KlarnaPaymentEvent.EVENT_NAME_ON_AUTHORIZE;
|
|
4
|
+
import static com.klarna.mobile.sdk.reactnative.payments.KlarnaPaymentEvent.EVENT_NAME_ON_ERROR;
|
|
5
|
+
import static com.klarna.mobile.sdk.reactnative.payments.KlarnaPaymentEvent.EVENT_NAME_ON_FINALIZE;
|
|
6
|
+
import static com.klarna.mobile.sdk.reactnative.payments.KlarnaPaymentEvent.EVENT_NAME_ON_INITIALIZE;
|
|
7
|
+
import static com.klarna.mobile.sdk.reactnative.payments.KlarnaPaymentEvent.EVENT_NAME_ON_LOAD;
|
|
8
|
+
import static com.klarna.mobile.sdk.reactnative.payments.KlarnaPaymentEvent.EVENT_NAME_ON_LOAD_PAYMENT_REVIEW;
|
|
9
|
+
import static com.klarna.mobile.sdk.reactnative.payments.KlarnaPaymentEvent.EVENT_NAME_ON_REAUTHORIZE;
|
|
10
|
+
import static org.mockito.Mockito.mock;
|
|
11
|
+
|
|
3
12
|
import android.os.SystemClock;
|
|
4
13
|
|
|
5
14
|
import com.facebook.react.bridge.Arguments;
|
|
@@ -18,40 +27,23 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
|
|
|
18
27
|
import org.junit.After;
|
|
19
28
|
import org.junit.Assert;
|
|
20
29
|
import org.junit.Before;
|
|
21
|
-
import org.junit.Rule;
|
|
22
30
|
import org.junit.Test;
|
|
23
31
|
import org.junit.runner.RunWith;
|
|
32
|
+
import org.mockito.MockedStatic;
|
|
24
33
|
import org.mockito.Mockito;
|
|
25
34
|
import org.mockito.invocation.InvocationOnMock;
|
|
35
|
+
import org.mockito.junit.MockitoJUnitRunner;
|
|
26
36
|
import org.mockito.stubbing.Answer;
|
|
27
|
-
import org.powermock.api.mockito.PowerMockito;
|
|
28
|
-
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
|
29
|
-
import org.powermock.core.classloader.annotations.PrepareForTest;
|
|
30
|
-
import org.powermock.modules.junit4.rule.PowerMockRule;
|
|
31
|
-
import org.robolectric.RobolectricTestRunner;
|
|
32
37
|
|
|
33
|
-
|
|
34
|
-
import static com.klarna.mobile.sdk.reactnative.payments.KlarnaPaymentEvent.EVENT_NAME_ON_ERROR;
|
|
35
|
-
import static com.klarna.mobile.sdk.reactnative.payments.KlarnaPaymentEvent.EVENT_NAME_ON_FINALIZE;
|
|
36
|
-
import static com.klarna.mobile.sdk.reactnative.payments.KlarnaPaymentEvent.EVENT_NAME_ON_INITIALIZE;
|
|
37
|
-
import static com.klarna.mobile.sdk.reactnative.payments.KlarnaPaymentEvent.EVENT_NAME_ON_LOAD;
|
|
38
|
-
import static com.klarna.mobile.sdk.reactnative.payments.KlarnaPaymentEvent.EVENT_NAME_ON_LOAD_PAYMENT_REVIEW;
|
|
39
|
-
import static com.klarna.mobile.sdk.reactnative.payments.KlarnaPaymentEvent.EVENT_NAME_ON_REAUTHORIZE;
|
|
40
|
-
import static org.mockito.Mockito.mock;
|
|
41
|
-
import static org.powermock.api.mockito.PowerMockito.when;
|
|
42
|
-
|
|
43
|
-
@PrepareForTest({ReactChoreographer.class, Arguments.class, SystemClock.class})
|
|
44
|
-
@RunWith(RobolectricTestRunner.class)
|
|
45
|
-
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*", "com.android.*"})
|
|
38
|
+
@RunWith(MockitoJUnitRunner.class)
|
|
46
39
|
public class KlarnaPaymentEventTest {
|
|
47
40
|
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
private MockedStatic<ReactChoreographer> mockedStaticReactChoreographer;
|
|
42
|
+
private MockedStatic<Arguments> mockedStaticArguments;
|
|
43
|
+
private MockedStatic<SystemClock> mockedStaticSystemClock;
|
|
50
44
|
|
|
51
45
|
private CatalystInstance catalystInstance;
|
|
52
46
|
private ReactApplicationContext reactContext;
|
|
53
|
-
|
|
54
|
-
private UIManagerModule uiManagerModuleMock;
|
|
55
47
|
private EventDispatcher eventDispatcherMock;
|
|
56
48
|
|
|
57
49
|
@Before
|
|
@@ -59,22 +51,19 @@ public class KlarnaPaymentEventTest {
|
|
|
59
51
|
reactContext = mock(ReactApplicationContext.class);
|
|
60
52
|
catalystInstance = mock(CatalystInstance.class);
|
|
61
53
|
|
|
62
|
-
uiManagerModuleMock = mock(UIManagerModule.class);
|
|
63
54
|
eventDispatcherMock = new EventDispatcherImpl(reactContext);
|
|
64
|
-
when(uiManagerModuleMock.getEventDispatcher())
|
|
65
|
-
.thenReturn(eventDispatcherMock);
|
|
66
55
|
|
|
67
56
|
final ReactChoreographer choreographerMock = mock(ReactChoreographer.class);
|
|
68
|
-
|
|
69
|
-
when(ReactChoreographer.getInstance()).thenAnswer(new Answer<Object>() {
|
|
57
|
+
mockedStaticReactChoreographer = Mockito.mockStatic(ReactChoreographer.class);
|
|
58
|
+
Mockito.when(ReactChoreographer.getInstance()).thenAnswer(new Answer<Object>() {
|
|
70
59
|
@Override
|
|
71
60
|
public Object answer(InvocationOnMock invocation) throws Throwable {
|
|
72
61
|
return choreographerMock;
|
|
73
62
|
}
|
|
74
63
|
});
|
|
75
64
|
|
|
76
|
-
|
|
77
|
-
|
|
65
|
+
mockedStaticArguments = Mockito.mockStatic(Arguments.class);
|
|
66
|
+
Mockito.when(Arguments.createArray())
|
|
78
67
|
.thenAnswer(
|
|
79
68
|
new Answer<Object>() {
|
|
80
69
|
@Override
|
|
@@ -82,7 +71,7 @@ public class KlarnaPaymentEventTest {
|
|
|
82
71
|
return new JavaOnlyArray();
|
|
83
72
|
}
|
|
84
73
|
});
|
|
85
|
-
|
|
74
|
+
Mockito.when(Arguments.createMap())
|
|
86
75
|
.thenAnswer(
|
|
87
76
|
new Answer<Object>() {
|
|
88
77
|
@Override
|
|
@@ -90,12 +79,15 @@ public class KlarnaPaymentEventTest {
|
|
|
90
79
|
return new JavaOnlyMap();
|
|
91
80
|
}
|
|
92
81
|
});
|
|
93
|
-
|
|
82
|
+
mockedStaticSystemClock = Mockito.mockStatic(SystemClock.class);
|
|
94
83
|
}
|
|
95
84
|
|
|
96
85
|
@After
|
|
97
86
|
public void teardown() {
|
|
98
|
-
Mockito.reset(reactContext, catalystInstance
|
|
87
|
+
Mockito.reset(reactContext, catalystInstance);
|
|
88
|
+
mockedStaticReactChoreographer.close();
|
|
89
|
+
mockedStaticArguments.close();
|
|
90
|
+
mockedStaticSystemClock.close();
|
|
99
91
|
}
|
|
100
92
|
|
|
101
93
|
@Test
|
|
@@ -23,26 +23,19 @@ import com.klarna.mobile.sdk.api.payments.KlarnaPaymentsSDKError;
|
|
|
23
23
|
import org.junit.After;
|
|
24
24
|
import org.junit.Assert;
|
|
25
25
|
import org.junit.Before;
|
|
26
|
-
import org.junit.Rule;
|
|
27
26
|
import org.junit.Test;
|
|
28
27
|
import org.junit.runner.RunWith;
|
|
28
|
+
import org.mockito.MockedStatic;
|
|
29
29
|
import org.mockito.Mockito;
|
|
30
|
-
import org.
|
|
31
|
-
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
|
32
|
-
import org.powermock.core.classloader.annotations.PrepareForTest;
|
|
33
|
-
import org.powermock.modules.junit4.rule.PowerMockRule;
|
|
30
|
+
import org.mockito.junit.MockitoJUnitRunner;
|
|
34
31
|
import org.robolectric.RobolectricTestRunner;
|
|
35
32
|
|
|
36
33
|
import java.util.Collections;
|
|
37
34
|
|
|
38
|
-
@PrepareForTest({Arguments.class})
|
|
39
35
|
@RunWith(RobolectricTestRunner.class)
|
|
40
|
-
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*", "com.android.*"})
|
|
41
36
|
public class KlarnaPaymentViewManagerTest {
|
|
42
37
|
|
|
43
|
-
|
|
44
|
-
public PowerMockRule rule = new PowerMockRule();
|
|
45
|
-
|
|
38
|
+
private MockedStatic<Arguments> mockedStaticArguments;
|
|
46
39
|
private KlarnaPaymentViewManager manager;
|
|
47
40
|
private PaymentViewWrapper wrapper;
|
|
48
41
|
|
|
@@ -56,16 +49,17 @@ public class KlarnaPaymentViewManagerTest {
|
|
|
56
49
|
wrapper = Mockito.mock(PaymentViewWrapper.class);
|
|
57
50
|
wrapper.paymentView = Mockito.mock(KlarnaPaymentView.class);
|
|
58
51
|
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
mockedStaticArguments = Mockito.mockStatic(Arguments.class);
|
|
53
|
+
Mockito.when(Arguments.createArray())
|
|
61
54
|
.thenAnswer(invocation -> new JavaOnlyArray());
|
|
62
|
-
|
|
55
|
+
Mockito.when(Arguments.createMap())
|
|
63
56
|
.thenAnswer(invocation -> new JavaOnlyMap());
|
|
64
57
|
}
|
|
65
58
|
|
|
66
59
|
@After
|
|
67
60
|
public void teardown() {
|
|
68
61
|
Mockito.reset(wrapper, wrapper.paymentView);
|
|
62
|
+
mockedStaticArguments.close();
|
|
69
63
|
}
|
|
70
64
|
|
|
71
65
|
@Test
|
|
@@ -51,25 +51,23 @@
|
|
|
51
51
|
3FC0A2F5614F1B06C1249CA3 /* Pods-RNKlarnaMobileSDK-RNKlarnaMobileSDKTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNKlarnaMobileSDK-RNKlarnaMobileSDKTests.debug.xcconfig"; path = "Target Support Files/Pods-RNKlarnaMobileSDK-RNKlarnaMobileSDKTests/Pods-RNKlarnaMobileSDK-RNKlarnaMobileSDKTests.debug.xcconfig"; sourceTree = "<group>"; };
|
|
52
52
|
42BC05FD2AC57D950044A9FE /* KlarnaStandaloneWebViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaStandaloneWebViewManager.h; sourceTree = "<group>"; };
|
|
53
53
|
42BC05FE2AC57E110044A9FE /* KlarnaStandaloneWebViewManager.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaStandaloneWebViewManager.mm; sourceTree = "<group>"; };
|
|
54
|
-
42BC06002AC585950044A9FE /* KlarnaStandaloneWebViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaStandaloneWebViewWrapper.h; sourceTree = "<group>"; };
|
|
55
|
-
42BC06012AC5866B0044A9FE /* KlarnaStandaloneWebViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaStandaloneWebViewWrapper.h; sourceTree = "<group>"; };
|
|
56
54
|
42BC06022AC586C50044A9FE /* KlarnaStandaloneWebViewWrapper.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaStandaloneWebViewWrapper.mm; sourceTree = "<group>"; };
|
|
57
55
|
42BC06042AC588180044A9FE /* KlarnaStandaloneWebViewWrapper.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaStandaloneWebViewWrapper.mm; sourceTree = "<group>"; };
|
|
58
56
|
7917D752255C45FB00E16799 /* RNKlarnaMobileSDKTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNKlarnaMobileSDKTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
59
57
|
7917D754255C45FB00E16799 /* PaymentViewWrapperTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PaymentViewWrapperTests.m; sourceTree = "<group>"; };
|
|
60
58
|
7917D756255C45FB00E16799 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
|
61
59
|
792F67BB2AB8AD7D00675E18 /* PaymentViewWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PaymentViewWrapper.mm; sourceTree = "<group>"; };
|
|
62
|
-
792F67BC2AB8AD7D00675E18 /* PaymentViewWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaymentViewWrapper.h; sourceTree = "<group>"; };
|
|
63
60
|
792F67BE2AB8AD7D00675E18 /* PaymentViewWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PaymentViewWrapper.mm; sourceTree = "<group>"; };
|
|
64
|
-
|
|
61
|
+
796795862C1B39E700BAB0C1 /* KlarnaCheckoutViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaCheckoutViewWrapper.h; sourceTree = "<group>"; };
|
|
62
|
+
796795872C1B39F100BAB0C1 /* KlarnaStandaloneWebViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaStandaloneWebViewWrapper.h; sourceTree = "<group>"; };
|
|
63
|
+
796795882C1B39FB00BAB0C1 /* PaymentViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaymentViewWrapper.h; sourceTree = "<group>"; };
|
|
65
64
|
79BD25F82BC97A0100D2D92A /* KlarnaCheckoutViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaCheckoutViewManager.h; sourceTree = "<group>"; };
|
|
66
65
|
79BD25F92BC97A3000D2D92A /* KlarnaCheckoutViewManager.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaCheckoutViewManager.mm; sourceTree = "<group>"; };
|
|
67
66
|
79BD25FB2BC97B0900D2D92A /* KlarnaCheckoutViewWrapper.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaCheckoutViewWrapper.mm; sourceTree = "<group>"; };
|
|
68
|
-
79BD25FD2BC97B2200D2D92A /* KlarnaCheckoutViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaCheckoutViewWrapper.h; sourceTree = "<group>"; };
|
|
69
|
-
79BD25FE2BCD4F5A00D2D92A /* KlarnaCheckoutViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaCheckoutViewWrapper.h; sourceTree = "<group>"; };
|
|
70
67
|
79BD25FF2BCD4F6C00D2D92A /* KlarnaCheckoutViewWrapper.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaCheckoutViewWrapper.mm; sourceTree = "<group>"; };
|
|
71
68
|
79BD26022BCD56D400D2D92A /* RNMobileSDKUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNMobileSDKUtils.h; sourceTree = "<group>"; };
|
|
72
69
|
79BD26032BCD572600D2D92A /* RNMobileSDKUtils.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RNMobileSDKUtils.mm; sourceTree = "<group>"; };
|
|
70
|
+
79E2A0B02BFBA653002923A5 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = "<group>"; };
|
|
73
71
|
7A4208B9D3B0F45669A2E06F /* Pods-RNKlarnaMobileSDK.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNKlarnaMobileSDK.release.xcconfig"; path = "Target Support Files/Pods-RNKlarnaMobileSDK/Pods-RNKlarnaMobileSDK.release.xcconfig"; sourceTree = "<group>"; };
|
|
74
72
|
B074D4744315BBCD94D119E9 /* Pods-RNKlarnaMobileSDK.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNKlarnaMobileSDK.debug.xcconfig"; path = "Target Support Files/Pods-RNKlarnaMobileSDK/Pods-RNKlarnaMobileSDK.debug.xcconfig"; sourceTree = "<group>"; };
|
|
75
73
|
B3E7B5881CC2AC0600A0062D /* KlarnaPaymentViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KlarnaPaymentViewManager.h; sourceTree = "<group>"; };
|
|
@@ -135,13 +133,14 @@
|
|
|
135
133
|
isa = PBXGroup;
|
|
136
134
|
children = (
|
|
137
135
|
79BD26012BCD56C000D2D92A /* common */,
|
|
136
|
+
9CDEDC2923475BAC006C9C97 /* view */,
|
|
138
137
|
79BD25F82BC97A0100D2D92A /* KlarnaCheckoutViewManager.h */,
|
|
139
138
|
79BD25F92BC97A3000D2D92A /* KlarnaCheckoutViewManager.mm */,
|
|
140
139
|
B3E7B5881CC2AC0600A0062D /* KlarnaPaymentViewManager.h */,
|
|
141
140
|
B3E7B5891CC2AC0600A0062D /* KlarnaPaymentViewManager.mm */,
|
|
142
141
|
42BC05FD2AC57D950044A9FE /* KlarnaStandaloneWebViewManager.h */,
|
|
143
142
|
42BC05FE2AC57E110044A9FE /* KlarnaStandaloneWebViewManager.mm */,
|
|
144
|
-
|
|
143
|
+
79E2A0B02BFBA653002923A5 /* PrefixHeader.pch */,
|
|
145
144
|
);
|
|
146
145
|
path = Sources;
|
|
147
146
|
sourceTree = "<group>";
|
|
@@ -173,11 +172,8 @@
|
|
|
173
172
|
792F67BA2AB8AD7D00675E18 /* newarch */ = {
|
|
174
173
|
isa = PBXGroup;
|
|
175
174
|
children = (
|
|
176
|
-
79BD25FE2BCD4F5A00D2D92A /* KlarnaCheckoutViewWrapper.h */,
|
|
177
175
|
79BD25FF2BCD4F6C00D2D92A /* KlarnaCheckoutViewWrapper.mm */,
|
|
178
176
|
792F67BB2AB8AD7D00675E18 /* PaymentViewWrapper.mm */,
|
|
179
|
-
792F67BC2AB8AD7D00675E18 /* PaymentViewWrapper.h */,
|
|
180
|
-
42BC06012AC5866B0044A9FE /* KlarnaStandaloneWebViewWrapper.h */,
|
|
181
177
|
42BC06022AC586C50044A9FE /* KlarnaStandaloneWebViewWrapper.mm */,
|
|
182
178
|
);
|
|
183
179
|
path = newarch;
|
|
@@ -186,11 +182,8 @@
|
|
|
186
182
|
792F67BD2AB8AD7D00675E18 /* oldarch */ = {
|
|
187
183
|
isa = PBXGroup;
|
|
188
184
|
children = (
|
|
189
|
-
79BD25FD2BC97B2200D2D92A /* KlarnaCheckoutViewWrapper.h */,
|
|
190
185
|
79BD25FB2BC97B0900D2D92A /* KlarnaCheckoutViewWrapper.mm */,
|
|
191
186
|
792F67BE2AB8AD7D00675E18 /* PaymentViewWrapper.mm */,
|
|
192
|
-
792F67BF2AB8AD7D00675E18 /* PaymentViewWrapper.h */,
|
|
193
|
-
42BC06002AC585950044A9FE /* KlarnaStandaloneWebViewWrapper.h */,
|
|
194
187
|
42BC06042AC588180044A9FE /* KlarnaStandaloneWebViewWrapper.mm */,
|
|
195
188
|
);
|
|
196
189
|
path = oldarch;
|
|
@@ -208,6 +201,9 @@
|
|
|
208
201
|
9CDEDC2923475BAC006C9C97 /* view */ = {
|
|
209
202
|
isa = PBXGroup;
|
|
210
203
|
children = (
|
|
204
|
+
796795862C1B39E700BAB0C1 /* KlarnaCheckoutViewWrapper.h */,
|
|
205
|
+
796795872C1B39F100BAB0C1 /* KlarnaStandaloneWebViewWrapper.h */,
|
|
206
|
+
796795882C1B39FB00BAB0C1 /* PaymentViewWrapper.h */,
|
|
211
207
|
792F67BA2AB8AD7D00675E18 /* newarch */,
|
|
212
208
|
792F67BD2AB8AD7D00675E18 /* oldarch */,
|
|
213
209
|
);
|
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
#import <React/RCTUIManager.h>
|
|
4
4
|
#import <React/RCTLog.h>
|
|
5
5
|
|
|
6
|
-
#
|
|
7
|
-
#import "view/newarch/KlarnaCheckoutViewWrapper.h"
|
|
8
|
-
#else
|
|
9
|
-
#import "view/oldarch/KlarnaCheckoutViewWrapper.h"
|
|
10
|
-
#endif
|
|
6
|
+
#import "view/KlarnaCheckoutViewWrapper.h"
|
|
11
7
|
|
|
12
8
|
@implementation KlarnaCheckoutViewManager
|
|
13
9
|
|
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
#import <React/RCTUIManager.h>
|
|
4
4
|
#import <React/RCTLog.h>
|
|
5
5
|
|
|
6
|
-
#
|
|
7
|
-
#import "view/newarch/PaymentViewWrapper.h"
|
|
8
|
-
#else
|
|
9
|
-
#import "view/oldarch/PaymentViewWrapper.h"
|
|
10
|
-
#endif
|
|
6
|
+
#import "view/PaymentViewWrapper.h"
|
|
11
7
|
|
|
12
8
|
@implementation KlarnaPaymentViewManager
|
|
13
9
|
|
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
#import <React/RCTUIManager.h>
|
|
4
4
|
#import <React/RCTLog.h>
|
|
5
5
|
|
|
6
|
-
#
|
|
7
|
-
#import "view/newarch/KlarnaStandaloneWebViewWrapper.h"
|
|
8
|
-
#else
|
|
9
|
-
#import "view/oldarch/KlarnaStandaloneWebViewWrapper.h"
|
|
10
|
-
#endif
|
|
6
|
+
#import "view/KlarnaStandaloneWebViewWrapper.h"
|
|
11
7
|
|
|
12
8
|
@implementation KlarnaStandaloneWebViewManager
|
|
13
9
|
|
|
@@ -16,6 +12,7 @@ RCT_EXPORT_MODULE(RNKlarnaStandaloneWebView)
|
|
|
16
12
|
#pragma mark - View
|
|
17
13
|
|
|
18
14
|
RCT_EXPORT_VIEW_PROPERTY(returnUrl, NSString)
|
|
15
|
+
RCT_EXPORT_VIEW_PROPERTY(bounces, BOOL)
|
|
19
16
|
RCT_EXPORT_VIEW_PROPERTY(onLoadStart, RCTDirectEventBlock)
|
|
20
17
|
RCT_EXPORT_VIEW_PROPERTY(onLoadEnd, RCTDirectEventBlock)
|
|
21
18
|
RCT_EXPORT_VIEW_PROPERTY(onError, RCTDirectEventBlock)
|
package/ios/Sources/view/{oldarch/KlarnaCheckoutViewWrapper.h → KlarnaCheckoutViewWrapper.h}
RENAMED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
#if !RCT_NEW_ARCH_ENABLED
|
|
2
|
-
|
|
3
1
|
#import <React/RCTUIManager.h>
|
|
2
|
+
#import <UIKit/UIKit.h>
|
|
4
3
|
|
|
4
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
5
|
+
#import <React/RCTViewComponentView.h>
|
|
6
|
+
#else
|
|
5
7
|
#import <AVFoundation/AVFoundation.h>
|
|
6
|
-
#import <UIKit/UIKit.h>
|
|
7
8
|
#import <React/RCTView.h>
|
|
8
|
-
#
|
|
9
|
+
#endif
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
NS_ASSUME_NONNULL_BEGIN
|
|
11
13
|
|
|
14
|
+
|
|
15
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
16
|
+
@interface KlarnaCheckoutViewWrapper : RCTViewComponentView
|
|
17
|
+
#else
|
|
12
18
|
@interface KlarnaCheckoutViewWrapper : UIView
|
|
13
19
|
|
|
14
20
|
@property (nonatomic, copy) RCTDirectEventBlock onEvent;
|
|
@@ -17,10 +23,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
17
23
|
|
|
18
24
|
@property (nonatomic, strong) NSString* returnUrl;
|
|
19
25
|
|
|
20
|
-
#pragma mark - React Native Overrides
|
|
21
26
|
- (void) setReturnUrl:(NSString * _Nonnull)returnUrl;
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
#pragma mark - React Native Overrides
|
|
24
30
|
|
|
25
31
|
@property (nonatomic, weak) RCTUIManager* uiManager;
|
|
26
32
|
|
|
@@ -32,6 +38,5 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
32
38
|
|
|
33
39
|
@end
|
|
34
40
|
|
|
35
|
-
NS_ASSUME_NONNULL_END
|
|
36
41
|
|
|
37
|
-
|
|
42
|
+
NS_ASSUME_NONNULL_END
|