From eb5d637ae79d603aafe2175a9a7376c9a2d5b08e Mon Sep 17 00:00:00 2001 From: Nuri Mertcan Guner Date: Wed, 12 Jun 2024 13:42:20 +0200 Subject: [PATCH 01/10] reduce view headers to one --- ios/Sources/KlarnaCheckoutViewManager.mm | 6 +--- ios/Sources/KlarnaPaymentViewManager.mm | 6 +--- ios/Sources/KlarnaStandaloneWebViewManager.mm | 6 +--- .../{oldarch => }/KlarnaCheckoutViewWrapper.h | 21 ++++++++---- .../KlarnaStandaloneWebViewWrapper.h | 23 +++++++------ .../view/{oldarch => }/PaymentViewWrapper.h | 21 ++++++++---- .../view/newarch/KlarnaCheckoutViewWrapper.h | 26 --------------- .../view/newarch/KlarnaCheckoutViewWrapper.mm | 2 +- .../newarch/KlarnaStandaloneWebViewWrapper.h | 29 ---------------- .../newarch/KlarnaStandaloneWebViewWrapper.mm | 2 +- ios/Sources/view/newarch/PaymentViewWrapper.h | 33 ------------------- .../view/newarch/PaymentViewWrapper.mm | 2 +- .../view/oldarch/KlarnaCheckoutViewWrapper.mm | 2 +- .../oldarch/KlarnaStandaloneWebViewWrapper.mm | 2 +- .../view/oldarch/PaymentViewWrapper.mm | 2 +- 15 files changed, 50 insertions(+), 133 deletions(-) rename ios/Sources/view/{oldarch => }/KlarnaCheckoutViewWrapper.h (81%) rename ios/Sources/view/{oldarch => }/KlarnaStandaloneWebViewWrapper.h (77%) rename ios/Sources/view/{oldarch => }/PaymentViewWrapper.h (85%) delete mode 100644 ios/Sources/view/newarch/KlarnaCheckoutViewWrapper.h delete mode 100644 ios/Sources/view/newarch/KlarnaStandaloneWebViewWrapper.h delete mode 100644 ios/Sources/view/newarch/PaymentViewWrapper.h diff --git a/ios/Sources/KlarnaCheckoutViewManager.mm b/ios/Sources/KlarnaCheckoutViewManager.mm index ace54e8e..8cdd960c 100644 --- a/ios/Sources/KlarnaCheckoutViewManager.mm +++ b/ios/Sources/KlarnaCheckoutViewManager.mm @@ -3,11 +3,7 @@ #import #import -#ifdef RCT_NEW_ARCH_ENABLED -#import "view/newarch/KlarnaCheckoutViewWrapper.h" -#else -#import "view/oldarch/KlarnaCheckoutViewWrapper.h" -#endif +#import "view/KlarnaCheckoutViewWrapper.h" @implementation KlarnaCheckoutViewManager diff --git a/ios/Sources/KlarnaPaymentViewManager.mm b/ios/Sources/KlarnaPaymentViewManager.mm index 5266f723..f665d1f3 100644 --- a/ios/Sources/KlarnaPaymentViewManager.mm +++ b/ios/Sources/KlarnaPaymentViewManager.mm @@ -3,11 +3,7 @@ #import #import -#ifdef RCT_NEW_ARCH_ENABLED -#import "view/newarch/PaymentViewWrapper.h" -#else -#import "view/oldarch/PaymentViewWrapper.h" -#endif +#import "view/PaymentViewWrapper.h" @implementation KlarnaPaymentViewManager diff --git a/ios/Sources/KlarnaStandaloneWebViewManager.mm b/ios/Sources/KlarnaStandaloneWebViewManager.mm index 1695a85f..b53d837f 100644 --- a/ios/Sources/KlarnaStandaloneWebViewManager.mm +++ b/ios/Sources/KlarnaStandaloneWebViewManager.mm @@ -3,11 +3,7 @@ #import #import -#ifdef RCT_NEW_ARCH_ENABLED -#import "view/newarch/KlarnaStandaloneWebViewWrapper.h" -#else -#import "view/oldarch/KlarnaStandaloneWebViewWrapper.h" -#endif +#import "view/KlarnaStandaloneWebViewWrapper.h" @implementation KlarnaStandaloneWebViewManager diff --git a/ios/Sources/view/oldarch/KlarnaCheckoutViewWrapper.h b/ios/Sources/view/KlarnaCheckoutViewWrapper.h similarity index 81% rename from ios/Sources/view/oldarch/KlarnaCheckoutViewWrapper.h rename to ios/Sources/view/KlarnaCheckoutViewWrapper.h index 8ee717f4..a910a0a9 100644 --- a/ios/Sources/view/oldarch/KlarnaCheckoutViewWrapper.h +++ b/ios/Sources/view/KlarnaCheckoutViewWrapper.h @@ -1,14 +1,20 @@ -#if !RCT_NEW_ARCH_ENABLED - #import +#import +#if RCT_NEW_ARCH_ENABLED +#import +#else #import -#import #import -#import +#endif + NS_ASSUME_NONNULL_BEGIN + +#if RCT_NEW_ARCH_ENABLED +@interface KlarnaCheckoutViewWrapper : RCTViewComponentView +#else @interface KlarnaCheckoutViewWrapper : UIView @property (nonatomic, copy) RCTDirectEventBlock onEvent; @@ -17,10 +23,12 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, strong) NSString* returnUrl; -#pragma mark - React Native Overrides - (void) setReturnUrl:(NSString * _Nonnull)returnUrl; - (void) evaluateProps; - (void) initializeActualCheckoutView; +#endif + +#pragma mark - React Native Overrides @property (nonatomic, weak) RCTUIManager* uiManager; @@ -32,6 +40,5 @@ NS_ASSUME_NONNULL_BEGIN @end -NS_ASSUME_NONNULL_END -#endif +NS_ASSUME_NONNULL_END diff --git a/ios/Sources/view/oldarch/KlarnaStandaloneWebViewWrapper.h b/ios/Sources/view/KlarnaStandaloneWebViewWrapper.h similarity index 77% rename from ios/Sources/view/oldarch/KlarnaStandaloneWebViewWrapper.h rename to ios/Sources/view/KlarnaStandaloneWebViewWrapper.h index acefe5ea..c8f15120 100644 --- a/ios/Sources/view/oldarch/KlarnaStandaloneWebViewWrapper.h +++ b/ios/Sources/view/KlarnaStandaloneWebViewWrapper.h @@ -1,14 +1,20 @@ -#if !RCT_NEW_ARCH_ENABLED - #import +#import +#if RCT_NEW_ARCH_ENABLED +#import +#else #import -#import #import -#import +#endif NS_ASSUME_NONNULL_BEGIN +#if RCT_NEW_ARCH_ENABLED +@interface KlarnaStandaloneWebViewWrapper : RCTViewComponentView + +- (void) initializeKlarnaStandaloneWebView:(nonnull NSString*)returnUrl; +#else @interface KlarnaStandaloneWebViewWrapper : UIView @property (nonatomic, copy) RCTDirectEventBlock onLoadStart; @@ -19,9 +25,10 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, strong) NSString* returnUrl; -#pragma mark - React Native Overrides - - (void)initializeKlarnaStandaloneWebView; +#endif + +#pragma mark - React Native Overrides @property (nonatomic, weak) RCTUIManager* uiManager; @@ -36,7 +43,3 @@ NS_ASSUME_NONNULL_BEGIN @end NS_ASSUME_NONNULL_END - -#endif - - diff --git a/ios/Sources/view/oldarch/PaymentViewWrapper.h b/ios/Sources/view/PaymentViewWrapper.h similarity index 85% rename from ios/Sources/view/oldarch/PaymentViewWrapper.h rename to ios/Sources/view/PaymentViewWrapper.h index a5476f15..f0641bd4 100644 --- a/ios/Sources/view/oldarch/PaymentViewWrapper.h +++ b/ios/Sources/view/PaymentViewWrapper.h @@ -1,14 +1,20 @@ -#if !RCT_NEW_ARCH_ENABLED - #import +#import +#if RCT_NEW_ARCH_ENABLED +#import +#else #import -#import #import -#import +#endif NS_ASSUME_NONNULL_BEGIN +#if RCT_NEW_ARCH_ENABLED +@interface PaymentViewWrapper : RCTViewComponentView + +- (void) initializeActualPaymentView:(NSString*)category withReturnUrl:(NSString*)returnUrl; +#else @interface PaymentViewWrapper : UIView @property (nonatomic, copy) RCTDirectEventBlock onInitialized; @@ -23,10 +29,12 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, strong) NSString* category; @property (nonatomic, strong) NSString* returnUrl; -#pragma mark - React Native Overrides - (void) setCategory:(NSString *)category; - (void) evaluateProps; - (void) initializeActualPaymentView; +#endif + +#pragma mark - React Native Overrides @property (nonatomic, weak) RCTUIManager* uiManager; @@ -44,6 +52,5 @@ NS_ASSUME_NONNULL_BEGIN @end -NS_ASSUME_NONNULL_END -#endif +NS_ASSUME_NONNULL_END diff --git a/ios/Sources/view/newarch/KlarnaCheckoutViewWrapper.h b/ios/Sources/view/newarch/KlarnaCheckoutViewWrapper.h deleted file mode 100644 index 1c525059..00000000 --- a/ios/Sources/view/newarch/KlarnaCheckoutViewWrapper.h +++ /dev/null @@ -1,26 +0,0 @@ -#if RCT_NEW_ARCH_ENABLED - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface KlarnaCheckoutViewWrapper : RCTViewComponentView - -#pragma mark - React Native Overrides - -@property (nonatomic, weak) RCTUIManager* uiManager; - -- (void)setSnippet:(NSString*)snippet; - -- (void)suspend; - -- (void)resume; - -@end - - -NS_ASSUME_NONNULL_END - -#endif diff --git a/ios/Sources/view/newarch/KlarnaCheckoutViewWrapper.mm b/ios/Sources/view/newarch/KlarnaCheckoutViewWrapper.mm index ecc64a88..c32b614f 100644 --- a/ios/Sources/view/newarch/KlarnaCheckoutViewWrapper.mm +++ b/ios/Sources/view/newarch/KlarnaCheckoutViewWrapper.mm @@ -1,6 +1,6 @@ #if RCT_NEW_ARCH_ENABLED -#import "KlarnaCheckoutViewWrapper.h" +#import "../KlarnaCheckoutViewWrapper.h" #import "../../common/RNMobileSDKUtils.h" #import diff --git a/ios/Sources/view/newarch/KlarnaStandaloneWebViewWrapper.h b/ios/Sources/view/newarch/KlarnaStandaloneWebViewWrapper.h deleted file mode 100644 index b58b5a08..00000000 --- a/ios/Sources/view/newarch/KlarnaStandaloneWebViewWrapper.h +++ /dev/null @@ -1,29 +0,0 @@ -#if RCT_NEW_ARCH_ENABLED - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface KlarnaStandaloneWebViewWrapper : RCTViewComponentView - -#pragma mark - React Native Overrides - -@property (nonatomic, weak) RCTUIManager* uiManager; - -- (void) initializeKlarnaStandaloneWebView:(nonnull NSString*)returnUrl; - -- (void)load:(nonnull NSString*)url; - -- (void)goForward; - -- (void)goBack; - -- (void)reload; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/ios/Sources/view/newarch/KlarnaStandaloneWebViewWrapper.mm b/ios/Sources/view/newarch/KlarnaStandaloneWebViewWrapper.mm index dd69734d..ad63391c 100644 --- a/ios/Sources/view/newarch/KlarnaStandaloneWebViewWrapper.mm +++ b/ios/Sources/view/newarch/KlarnaStandaloneWebViewWrapper.mm @@ -1,6 +1,6 @@ #if RCT_NEW_ARCH_ENABLED -#import "KlarnaStandaloneWebViewWrapper.h" +#import "../KlarnaStandaloneWebViewWrapper.h" #import #import diff --git a/ios/Sources/view/newarch/PaymentViewWrapper.h b/ios/Sources/view/newarch/PaymentViewWrapper.h deleted file mode 100644 index 04a5e421..00000000 --- a/ios/Sources/view/newarch/PaymentViewWrapper.h +++ /dev/null @@ -1,33 +0,0 @@ -#if RCT_NEW_ARCH_ENABLED - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface PaymentViewWrapper : RCTViewComponentView - -#pragma mark - React Native Overrides -- (void) initializeActualPaymentView:(NSString*)category withReturnUrl:(NSString*)returnUrl; - -@property (nonatomic, weak) RCTUIManager* uiManager; - -- (void)initializePaymentViewWithClientToken:(NSString*)clientToken withReturnUrl:(NSString*)returnUrl; - -- (void)loadPaymentViewWithSessionData:(nullable NSString*)sessionData; - -- (void)loadPaymentReview; - -- (void)authorizePaymentViewWithAutoFinalize:(BOOL)autoFinalize sessionData:(nullable NSString*)sessionData; - -- (void)reauthorizePaymentViewWithSessionData:(nullable NSString*)sessionData; - -- (void)finalizePaymentViewWithSessionData:(nullable NSString*)sessionData; - -@end - - -NS_ASSUME_NONNULL_END - -#endif diff --git a/ios/Sources/view/newarch/PaymentViewWrapper.mm b/ios/Sources/view/newarch/PaymentViewWrapper.mm index 9869e24d..349c11eb 100644 --- a/ios/Sources/view/newarch/PaymentViewWrapper.mm +++ b/ios/Sources/view/newarch/PaymentViewWrapper.mm @@ -1,6 +1,6 @@ #if RCT_NEW_ARCH_ENABLED -#import "PaymentViewWrapper.h" +#import "../PaymentViewWrapper.h" #import #import diff --git a/ios/Sources/view/oldarch/KlarnaCheckoutViewWrapper.mm b/ios/Sources/view/oldarch/KlarnaCheckoutViewWrapper.mm index 57fabf34..828dce2c 100644 --- a/ios/Sources/view/oldarch/KlarnaCheckoutViewWrapper.mm +++ b/ios/Sources/view/oldarch/KlarnaCheckoutViewWrapper.mm @@ -1,6 +1,6 @@ #if !RCT_NEW_ARCH_ENABLED -#import "KlarnaCheckoutViewWrapper.h" +#import "../KlarnaCheckoutViewWrapper.h" #import "../../common/RNMobileSDKUtils.h" #import diff --git a/ios/Sources/view/oldarch/KlarnaStandaloneWebViewWrapper.mm b/ios/Sources/view/oldarch/KlarnaStandaloneWebViewWrapper.mm index 0d8646f3..38ad1886 100644 --- a/ios/Sources/view/oldarch/KlarnaStandaloneWebViewWrapper.mm +++ b/ios/Sources/view/oldarch/KlarnaStandaloneWebViewWrapper.mm @@ -1,6 +1,6 @@ #if !RCT_NEW_ARCH_ENABLED -#import "KlarnaStandaloneWebViewWrapper.h" +#import "../KlarnaStandaloneWebViewWrapper.h" #import #import diff --git a/ios/Sources/view/oldarch/PaymentViewWrapper.mm b/ios/Sources/view/oldarch/PaymentViewWrapper.mm index c8e1147b..c536b401 100644 --- a/ios/Sources/view/oldarch/PaymentViewWrapper.mm +++ b/ios/Sources/view/oldarch/PaymentViewWrapper.mm @@ -1,6 +1,6 @@ #if !RCT_NEW_ARCH_ENABLED -#import "PaymentViewWrapper.h" +#import "../PaymentViewWrapper.h" #import #import From b9919dc1f159a695a261b41698f26d014535cf08 Mon Sep 17 00:00:00 2001 From: Nuri Mertcan Guner Date: Thu, 13 Jun 2024 13:49:28 +0200 Subject: [PATCH 02/10] separate test and app workflows --- .github/workflows/native_tests.yml | 44 +++++++++++++++++++ ...ative_tests_and_apps.yml => test_apps.yml} | 34 +------------- 2 files changed, 45 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/native_tests.yml rename .github/workflows/{native_tests_and_apps.yml => test_apps.yml} (59%) diff --git a/.github/workflows/native_tests.yml b/.github/workflows/native_tests.yml new file mode 100644 index 00000000..26a29788 --- /dev/null +++ b/.github/workflows/native_tests.yml @@ -0,0 +1,44 @@ +name: Native Tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test-native-android: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Prepare Android + uses: ./.github/actions/prepare-android + + - name: Run Unit Tests for Android + run: yarn test:android + + test-native-ios: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Prepare iOS + uses: ./.github/actions/prepare-ios + + - name: Install Lib cocoapods + run: | + (cd ios;pod install) + + - name: Run Unit Tests for iOS + run: yarn test:ios diff --git a/.github/workflows/native_tests_and_apps.yml b/.github/workflows/test_apps.yml similarity index 59% rename from .github/workflows/native_tests_and_apps.yml rename to .github/workflows/test_apps.yml index e142e6bd..52be0411 100644 --- a/.github/workflows/native_tests_and_apps.yml +++ b/.github/workflows/test_apps.yml @@ -1,4 +1,4 @@ -name: Native Tests & Apps +name: Test Apps on: push: @@ -9,20 +9,6 @@ on: - master jobs: - test-native-android: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup - uses: ./.github/actions/setup - - - name: Prepare Android - uses: ./.github/actions/prepare-android - - - name: Run Unit Tests for Android - run: yarn test:android build-testapp-android: runs-on: ubuntu-latest steps: @@ -42,24 +28,6 @@ jobs: run: | yarn run build:android - test-native-ios: - runs-on: macos-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup - uses: ./.github/actions/setup - - - name: Prepare iOS - uses: ./.github/actions/prepare-ios - - - name: Install Lib cocoapods - run: | - (cd ios;pod install) - - - name: Run Unit Tests for iOS - run: yarn test:ios build-testapp-ios: runs-on: macos-latest steps: From 006f4042575f741c3aeccff5270537a7614353c8 Mon Sep 17 00:00:00 2001 From: Nuri Mertcan Guner Date: Thu, 13 Jun 2024 13:49:52 +0200 Subject: [PATCH 03/10] add new arch testapp builds --- .github/workflows/test_apps.yml | 42 +++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/.github/workflows/test_apps.yml b/.github/workflows/test_apps.yml index 52be0411..93627b76 100644 --- a/.github/workflows/test_apps.yml +++ b/.github/workflows/test_apps.yml @@ -28,6 +28,25 @@ jobs: run: | yarn run build:android + build-testapp-newarch-android: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Prepare Android + uses: ./.github/actions/prepare-android + + - name: Bundle TestApp JS for Android + run: mkdir TestApp/android/app/src/main/assets && (cd TestApp;yarn bundle:android) + + - name: Build TestApp for Android + run: | + ORG_GRADLE_PROJECT_newArchEnabled=true yarn run build:android + build-testapp-ios: runs-on: macos-latest steps: @@ -50,3 +69,26 @@ jobs: - name: Build TestApp for iOS run: | yarn run build:ios + + build-testapp-newarch-ios: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Prepare iOS + uses: ./.github/actions/prepare-ios + + - name: Install TestApp cocoapods + run: | + (cd TestApp/ios;RCT_NEW_ARCH_ENABLED=1 pod install) + + - name: Bundle TestApp JS for iOS + run: (cd TestApp;yarn bundle:ios) + + - name: Build TestApp for iOS + run: | + yarn run build:ios From 4f9d309a9fb1c25071f60b770175ba2a3fb64434 Mon Sep 17 00:00:00 2001 From: Nuri Mertcan Guner Date: Thu, 13 Jun 2024 13:50:59 +0200 Subject: [PATCH 04/10] add ruby setup and bundler to workflows --- .github/actions/prepare-ios/action.yml | 7 +++++++ .github/workflows/test_apps.yml | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/actions/prepare-ios/action.yml b/.github/actions/prepare-ios/action.yml index 20f523c1..c879c02b 100644 --- a/.github/actions/prepare-ios/action.yml +++ b/.github/actions/prepare-ios/action.yml @@ -3,6 +3,8 @@ description: Prepare iOS environment runs: using: composite + env: + BUNDLE_GEMFILE: ${{ github.workspace }}/TestApp/Gemfile steps: - name: Cache Pods uses: actions/cache@v4 @@ -13,3 +15,8 @@ runs: key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} restore-keys: | ${{ runner.os }}-pods- + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2' + bundler-cache: true diff --git a/.github/workflows/test_apps.yml b/.github/workflows/test_apps.yml index 93627b76..83a8f3b1 100644 --- a/.github/workflows/test_apps.yml +++ b/.github/workflows/test_apps.yml @@ -61,7 +61,7 @@ jobs: - name: Install TestApp cocoapods run: | - (cd TestApp/ios;pod install) + (cd TestApp/ios;bundle exec pod install) - name: Bundle TestApp JS for iOS run: (cd TestApp;yarn bundle:ios) @@ -84,7 +84,7 @@ jobs: - name: Install TestApp cocoapods run: | - (cd TestApp/ios;RCT_NEW_ARCH_ENABLED=1 pod install) + (cd TestApp/ios;RCT_NEW_ARCH_ENABLED=1 bundle exec pod install) - name: Bundle TestApp JS for iOS run: (cd TestApp;yarn bundle:ios) From 389c182ba7d98b03e87dbd671ac6613ed30681d4 Mon Sep 17 00:00:00 2001 From: Nuri Mertcan Guner Date: Thu, 13 Jun 2024 15:24:52 +0200 Subject: [PATCH 05/10] remove lockfile before switching architecture --- .github/workflows/test_apps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_apps.yml b/.github/workflows/test_apps.yml index 83a8f3b1..10bca27b 100644 --- a/.github/workflows/test_apps.yml +++ b/.github/workflows/test_apps.yml @@ -84,7 +84,7 @@ jobs: - name: Install TestApp cocoapods run: | - (cd TestApp/ios;RCT_NEW_ARCH_ENABLED=1 bundle exec pod install) + (cd TestApp/ios;rm Podfile.lock;RCT_NEW_ARCH_ENABLED=1 bundle exec pod install) - name: Bundle TestApp JS for iOS run: (cd TestApp;yarn bundle:ios) From b89debb1f23c27834fe7970029c5344ae848aa77 Mon Sep 17 00:00:00 2001 From: Nuri Mertcan Guner Date: Thu, 13 Jun 2024 16:23:29 +0200 Subject: [PATCH 06/10] clean up internal methods in header files --- ios/Sources/view/KlarnaCheckoutViewWrapper.h | 2 -- ios/Sources/view/KlarnaStandaloneWebViewWrapper.h | 4 ---- ios/Sources/view/PaymentViewWrapper.h | 4 ---- 3 files changed, 10 deletions(-) diff --git a/ios/Sources/view/KlarnaCheckoutViewWrapper.h b/ios/Sources/view/KlarnaCheckoutViewWrapper.h index a910a0a9..4ed31f03 100644 --- a/ios/Sources/view/KlarnaCheckoutViewWrapper.h +++ b/ios/Sources/view/KlarnaCheckoutViewWrapper.h @@ -24,8 +24,6 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, strong) NSString* returnUrl; - (void) setReturnUrl:(NSString * _Nonnull)returnUrl; -- (void) evaluateProps; -- (void) initializeActualCheckoutView; #endif #pragma mark - React Native Overrides diff --git a/ios/Sources/view/KlarnaStandaloneWebViewWrapper.h b/ios/Sources/view/KlarnaStandaloneWebViewWrapper.h index c8f15120..e09d879d 100644 --- a/ios/Sources/view/KlarnaStandaloneWebViewWrapper.h +++ b/ios/Sources/view/KlarnaStandaloneWebViewWrapper.h @@ -12,8 +12,6 @@ NS_ASSUME_NONNULL_BEGIN #if RCT_NEW_ARCH_ENABLED @interface KlarnaStandaloneWebViewWrapper : RCTViewComponentView - -- (void) initializeKlarnaStandaloneWebView:(nonnull NSString*)returnUrl; #else @interface KlarnaStandaloneWebViewWrapper : UIView @@ -24,8 +22,6 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, copy) RCTDirectEventBlock onKlarnaMessage; @property (nonatomic, strong) NSString* returnUrl; - -- (void)initializeKlarnaStandaloneWebView; #endif #pragma mark - React Native Overrides diff --git a/ios/Sources/view/PaymentViewWrapper.h b/ios/Sources/view/PaymentViewWrapper.h index f0641bd4..7bbc1d42 100644 --- a/ios/Sources/view/PaymentViewWrapper.h +++ b/ios/Sources/view/PaymentViewWrapper.h @@ -12,8 +12,6 @@ NS_ASSUME_NONNULL_BEGIN #if RCT_NEW_ARCH_ENABLED @interface PaymentViewWrapper : RCTViewComponentView - -- (void) initializeActualPaymentView:(NSString*)category withReturnUrl:(NSString*)returnUrl; #else @interface PaymentViewWrapper : UIView @@ -30,8 +28,6 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, strong) NSString* returnUrl; - (void) setCategory:(NSString *)category; -- (void) evaluateProps; -- (void) initializeActualPaymentView; #endif #pragma mark - React Native Overrides From 71157724f65ae2aae4e4eff10574bfc105dc0a2e Mon Sep 17 00:00:00 2001 From: Nuri Mertcan Guner Date: Thu, 13 Jun 2024 16:31:20 +0200 Subject: [PATCH 07/10] update lib project file --- .../project.pbxproj | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/ios/RNKlarnaMobileSDK.xcodeproj/project.pbxproj b/ios/RNKlarnaMobileSDK.xcodeproj/project.pbxproj index 006c2a8e..1360d76b 100644 --- a/ios/RNKlarnaMobileSDK.xcodeproj/project.pbxproj +++ b/ios/RNKlarnaMobileSDK.xcodeproj/project.pbxproj @@ -51,22 +51,19 @@ 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 = ""; }; 42BC05FD2AC57D950044A9FE /* KlarnaStandaloneWebViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaStandaloneWebViewManager.h; sourceTree = ""; }; 42BC05FE2AC57E110044A9FE /* KlarnaStandaloneWebViewManager.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaStandaloneWebViewManager.mm; sourceTree = ""; }; - 42BC06002AC585950044A9FE /* KlarnaStandaloneWebViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaStandaloneWebViewWrapper.h; sourceTree = ""; }; - 42BC06012AC5866B0044A9FE /* KlarnaStandaloneWebViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaStandaloneWebViewWrapper.h; sourceTree = ""; }; 42BC06022AC586C50044A9FE /* KlarnaStandaloneWebViewWrapper.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaStandaloneWebViewWrapper.mm; sourceTree = ""; }; 42BC06042AC588180044A9FE /* KlarnaStandaloneWebViewWrapper.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaStandaloneWebViewWrapper.mm; sourceTree = ""; }; 7917D752255C45FB00E16799 /* RNKlarnaMobileSDKTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNKlarnaMobileSDKTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 7917D754255C45FB00E16799 /* PaymentViewWrapperTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PaymentViewWrapperTests.m; sourceTree = ""; }; 7917D756255C45FB00E16799 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 792F67BB2AB8AD7D00675E18 /* PaymentViewWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PaymentViewWrapper.mm; sourceTree = ""; }; - 792F67BC2AB8AD7D00675E18 /* PaymentViewWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaymentViewWrapper.h; sourceTree = ""; }; 792F67BE2AB8AD7D00675E18 /* PaymentViewWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PaymentViewWrapper.mm; sourceTree = ""; }; - 792F67BF2AB8AD7D00675E18 /* PaymentViewWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaymentViewWrapper.h; sourceTree = ""; }; + 796795862C1B39E700BAB0C1 /* KlarnaCheckoutViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaCheckoutViewWrapper.h; sourceTree = ""; }; + 796795872C1B39F100BAB0C1 /* KlarnaStandaloneWebViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaStandaloneWebViewWrapper.h; sourceTree = ""; }; + 796795882C1B39FB00BAB0C1 /* PaymentViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaymentViewWrapper.h; sourceTree = ""; }; 79BD25F82BC97A0100D2D92A /* KlarnaCheckoutViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaCheckoutViewManager.h; sourceTree = ""; }; 79BD25F92BC97A3000D2D92A /* KlarnaCheckoutViewManager.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaCheckoutViewManager.mm; sourceTree = ""; }; 79BD25FB2BC97B0900D2D92A /* KlarnaCheckoutViewWrapper.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaCheckoutViewWrapper.mm; sourceTree = ""; }; - 79BD25FD2BC97B2200D2D92A /* KlarnaCheckoutViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaCheckoutViewWrapper.h; sourceTree = ""; }; - 79BD25FE2BCD4F5A00D2D92A /* KlarnaCheckoutViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaCheckoutViewWrapper.h; sourceTree = ""; }; 79BD25FF2BCD4F6C00D2D92A /* KlarnaCheckoutViewWrapper.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaCheckoutViewWrapper.mm; sourceTree = ""; }; 79BD26022BCD56D400D2D92A /* RNMobileSDKUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNMobileSDKUtils.h; sourceTree = ""; }; 79BD26032BCD572600D2D92A /* RNMobileSDKUtils.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RNMobileSDKUtils.mm; sourceTree = ""; }; @@ -175,11 +172,8 @@ 792F67BA2AB8AD7D00675E18 /* newarch */ = { isa = PBXGroup; children = ( - 79BD25FE2BCD4F5A00D2D92A /* KlarnaCheckoutViewWrapper.h */, 79BD25FF2BCD4F6C00D2D92A /* KlarnaCheckoutViewWrapper.mm */, 792F67BB2AB8AD7D00675E18 /* PaymentViewWrapper.mm */, - 792F67BC2AB8AD7D00675E18 /* PaymentViewWrapper.h */, - 42BC06012AC5866B0044A9FE /* KlarnaStandaloneWebViewWrapper.h */, 42BC06022AC586C50044A9FE /* KlarnaStandaloneWebViewWrapper.mm */, ); path = newarch; @@ -188,11 +182,8 @@ 792F67BD2AB8AD7D00675E18 /* oldarch */ = { isa = PBXGroup; children = ( - 79BD25FD2BC97B2200D2D92A /* KlarnaCheckoutViewWrapper.h */, 79BD25FB2BC97B0900D2D92A /* KlarnaCheckoutViewWrapper.mm */, 792F67BE2AB8AD7D00675E18 /* PaymentViewWrapper.mm */, - 792F67BF2AB8AD7D00675E18 /* PaymentViewWrapper.h */, - 42BC06002AC585950044A9FE /* KlarnaStandaloneWebViewWrapper.h */, 42BC06042AC588180044A9FE /* KlarnaStandaloneWebViewWrapper.mm */, ); path = oldarch; @@ -210,6 +201,9 @@ 9CDEDC2923475BAC006C9C97 /* view */ = { isa = PBXGroup; children = ( + 796795862C1B39E700BAB0C1 /* KlarnaCheckoutViewWrapper.h */, + 796795872C1B39F100BAB0C1 /* KlarnaStandaloneWebViewWrapper.h */, + 796795882C1B39FB00BAB0C1 /* PaymentViewWrapper.h */, 792F67BA2AB8AD7D00675E18 /* newarch */, 792F67BD2AB8AD7D00675E18 /* oldarch */, ); From 4e45df3d609a95d9bff743da786b704c9a77a241 Mon Sep 17 00:00:00 2001 From: Nuri Mertcan Guner Date: Thu, 13 Jun 2024 16:43:26 +0200 Subject: [PATCH 08/10] move env variable for gemfile location --- .github/actions/prepare-ios/action.yml | 2 -- .github/workflows/native_tests.yml | 3 +++ .github/workflows/test_apps.yml | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/actions/prepare-ios/action.yml b/.github/actions/prepare-ios/action.yml index c879c02b..b4c59ac0 100644 --- a/.github/actions/prepare-ios/action.yml +++ b/.github/actions/prepare-ios/action.yml @@ -3,8 +3,6 @@ description: Prepare iOS environment runs: using: composite - env: - BUNDLE_GEMFILE: ${{ github.workspace }}/TestApp/Gemfile steps: - name: Cache Pods uses: actions/cache@v4 diff --git a/.github/workflows/native_tests.yml b/.github/workflows/native_tests.yml index 26a29788..895865bb 100644 --- a/.github/workflows/native_tests.yml +++ b/.github/workflows/native_tests.yml @@ -8,6 +8,9 @@ on: branches: - master +env: + BUNDLE_GEMFILE: ${{ github.workspace }}/TestApp/Gemfile + jobs: test-native-android: runs-on: ubuntu-latest diff --git a/.github/workflows/test_apps.yml b/.github/workflows/test_apps.yml index 10bca27b..3da21f41 100644 --- a/.github/workflows/test_apps.yml +++ b/.github/workflows/test_apps.yml @@ -8,6 +8,9 @@ on: branches: - master +env: + BUNDLE_GEMFILE: ${{ github.workspace }}/TestApp/Gemfile + jobs: build-testapp-android: runs-on: ubuntu-latest From e57678822c97c141e05bd94a249238c24a98ecb3 Mon Sep 17 00:00:00 2001 From: Nuri Mertcan Guner Date: Thu, 13 Jun 2024 17:39:33 +0200 Subject: [PATCH 09/10] fix header file path in tests --- ios/Tests/PaymentViewWrapperTests.m | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ios/Tests/PaymentViewWrapperTests.m b/ios/Tests/PaymentViewWrapperTests.m index 000e751d..7b5ac08f 100644 --- a/ios/Tests/PaymentViewWrapperTests.m +++ b/ios/Tests/PaymentViewWrapperTests.m @@ -12,11 +12,7 @@ #import #import "../Sources/KlarnaPaymentViewManager.h" -#ifdef RCT_NEW_ARCH_ENABLED -#import "../Sources/view/newarch/PaymentViewWrapper.h" -#else -#import "../Sources/view/oldarch/PaymentViewWrapper.h" -#endif +#import "../Sources/view/PaymentViewWrapper.h" @interface PaymentViewWrapperTests : XCTestCase From 0efb9786838e7cefc4abb5e3b7e5f87bc7504f04 Mon Sep 17 00:00:00 2001 From: Nuri Mertcan Guner Date: Thu, 13 Jun 2024 18:01:52 +0200 Subject: [PATCH 10/10] add private method declarations to tests --- ios/Tests/PaymentViewWrapperTests.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ios/Tests/PaymentViewWrapperTests.m b/ios/Tests/PaymentViewWrapperTests.m index 7b5ac08f..acb8e99b 100644 --- a/ios/Tests/PaymentViewWrapperTests.m +++ b/ios/Tests/PaymentViewWrapperTests.m @@ -14,6 +14,14 @@ #import "../Sources/view/PaymentViewWrapper.h" +@interface PaymentViewWrapper () + +// declaring private methods to be able to verify them with OCMock +- (void) evaluateProps; +- (void) initializeActualPaymentView; + +@end + @interface PaymentViewWrapperTests : XCTestCase @property (nonatomic, strong) PaymentViewWrapper* paymentViewWrapper;