Skip to content

Commit

Permalink
Merge pull request #255 from klarna/fix-multiple-header-files
Browse files Browse the repository at this point in the history
Combined objc header files for both architectures
  • Loading branch information
NMGuner authored Jun 18, 2024
2 parents ac2f8e7 + 0efb978 commit a72e51d
Show file tree
Hide file tree
Showing 20 changed files with 137 additions and 167 deletions.
5 changes: 5 additions & 0 deletions .github/actions/prepare-ios/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,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
47 changes: 47 additions & 0 deletions .github/workflows/native_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Native Tests

on:
push:
branches:
- master
pull_request:
branches:
- master

env:
BUNDLE_GEMFILE: ${{ github.workspace }}/TestApp/Gemfile

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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Native Tests & Apps
name: Test Apps

on:
push:
Expand All @@ -8,8 +8,11 @@ on:
branches:
- master

env:
BUNDLE_GEMFILE: ${{ github.workspace }}/TestApp/Gemfile

jobs:
test-native-android:
build-testapp-android:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -21,9 +24,14 @@ jobs:
- name: Prepare Android
uses: ./.github/actions/prepare-android

- name: Run Unit Tests for Android
run: yarn test:android
build-testapp-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: |
yarn run build:android
build-testapp-newarch-android:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -40,9 +48,9 @@ jobs:

- name: Build TestApp for Android
run: |
yarn run build:android
ORG_GRADLE_PROJECT_newArchEnabled=true yarn run build:android
test-native-ios:
build-testapp-ios:
runs-on: macos-latest
steps:
- name: Checkout
Expand All @@ -54,13 +62,18 @@ jobs:
- name: Prepare iOS
uses: ./.github/actions/prepare-ios

- name: Install Lib cocoapods
- name: Install TestApp cocoapods
run: |
(cd ios;pod install)
(cd TestApp/ios;bundle exec pod install)
- name: Run Unit Tests for iOS
run: yarn test:ios
build-testapp-ios:
- name: Bundle TestApp JS for iOS
run: (cd TestApp;yarn bundle:ios)

- name: Build TestApp for iOS
run: |
yarn run build:ios
build-testapp-newarch-ios:
runs-on: macos-latest
steps:
- name: Checkout
Expand All @@ -74,7 +87,7 @@ jobs:

- name: Install TestApp cocoapods
run: |
(cd TestApp/ios;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)
Expand Down
18 changes: 6 additions & 12 deletions ios/RNKlarnaMobileSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<group>"; };
42BC05FD2AC57D950044A9FE /* KlarnaStandaloneWebViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaStandaloneWebViewManager.h; sourceTree = "<group>"; };
42BC05FE2AC57E110044A9FE /* KlarnaStandaloneWebViewManager.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaStandaloneWebViewManager.mm; sourceTree = "<group>"; };
42BC06002AC585950044A9FE /* KlarnaStandaloneWebViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaStandaloneWebViewWrapper.h; sourceTree = "<group>"; };
42BC06012AC5866B0044A9FE /* KlarnaStandaloneWebViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaStandaloneWebViewWrapper.h; sourceTree = "<group>"; };
42BC06022AC586C50044A9FE /* KlarnaStandaloneWebViewWrapper.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaStandaloneWebViewWrapper.mm; sourceTree = "<group>"; };
42BC06042AC588180044A9FE /* KlarnaStandaloneWebViewWrapper.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaStandaloneWebViewWrapper.mm; sourceTree = "<group>"; };
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 = "<group>"; };
7917D756255C45FB00E16799 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
792F67BB2AB8AD7D00675E18 /* PaymentViewWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PaymentViewWrapper.mm; sourceTree = "<group>"; };
792F67BC2AB8AD7D00675E18 /* PaymentViewWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaymentViewWrapper.h; sourceTree = "<group>"; };
792F67BE2AB8AD7D00675E18 /* PaymentViewWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PaymentViewWrapper.mm; sourceTree = "<group>"; };
792F67BF2AB8AD7D00675E18 /* PaymentViewWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaymentViewWrapper.h; sourceTree = "<group>"; };
796795862C1B39E700BAB0C1 /* KlarnaCheckoutViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaCheckoutViewWrapper.h; sourceTree = "<group>"; };
796795872C1B39F100BAB0C1 /* KlarnaStandaloneWebViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaStandaloneWebViewWrapper.h; sourceTree = "<group>"; };
796795882C1B39FB00BAB0C1 /* PaymentViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaymentViewWrapper.h; sourceTree = "<group>"; };
79BD25F82BC97A0100D2D92A /* KlarnaCheckoutViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaCheckoutViewManager.h; sourceTree = "<group>"; };
79BD25F92BC97A3000D2D92A /* KlarnaCheckoutViewManager.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaCheckoutViewManager.mm; sourceTree = "<group>"; };
79BD25FB2BC97B0900D2D92A /* KlarnaCheckoutViewWrapper.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaCheckoutViewWrapper.mm; sourceTree = "<group>"; };
79BD25FD2BC97B2200D2D92A /* KlarnaCheckoutViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaCheckoutViewWrapper.h; sourceTree = "<group>"; };
79BD25FE2BCD4F5A00D2D92A /* KlarnaCheckoutViewWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KlarnaCheckoutViewWrapper.h; sourceTree = "<group>"; };
79BD25FF2BCD4F6C00D2D92A /* KlarnaCheckoutViewWrapper.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KlarnaCheckoutViewWrapper.mm; sourceTree = "<group>"; };
79BD26022BCD56D400D2D92A /* RNMobileSDKUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNMobileSDKUtils.h; sourceTree = "<group>"; };
79BD26032BCD572600D2D92A /* RNMobileSDKUtils.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RNMobileSDKUtils.mm; sourceTree = "<group>"; };
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -210,6 +201,9 @@
9CDEDC2923475BAC006C9C97 /* view */ = {
isa = PBXGroup;
children = (
796795862C1B39E700BAB0C1 /* KlarnaCheckoutViewWrapper.h */,
796795872C1B39F100BAB0C1 /* KlarnaStandaloneWebViewWrapper.h */,
796795882C1B39FB00BAB0C1 /* PaymentViewWrapper.h */,
792F67BA2AB8AD7D00675E18 /* newarch */,
792F67BD2AB8AD7D00675E18 /* oldarch */,
);
Expand Down
6 changes: 1 addition & 5 deletions ios/Sources/KlarnaCheckoutViewManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
#import <React/RCTUIManager.h>
#import <React/RCTLog.h>

#ifdef RCT_NEW_ARCH_ENABLED
#import "view/newarch/KlarnaCheckoutViewWrapper.h"
#else
#import "view/oldarch/KlarnaCheckoutViewWrapper.h"
#endif
#import "view/KlarnaCheckoutViewWrapper.h"

@implementation KlarnaCheckoutViewManager

Expand Down
6 changes: 1 addition & 5 deletions ios/Sources/KlarnaPaymentViewManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
#import <React/RCTUIManager.h>
#import <React/RCTLog.h>

#ifdef RCT_NEW_ARCH_ENABLED
#import "view/newarch/PaymentViewWrapper.h"
#else
#import "view/oldarch/PaymentViewWrapper.h"
#endif
#import "view/PaymentViewWrapper.h"

@implementation KlarnaPaymentViewManager

Expand Down
6 changes: 1 addition & 5 deletions ios/Sources/KlarnaStandaloneWebViewManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
#import <React/RCTUIManager.h>
#import <React/RCTLog.h>

#ifdef RCT_NEW_ARCH_ENABLED
#import "view/newarch/KlarnaStandaloneWebViewWrapper.h"
#else
#import "view/oldarch/KlarnaStandaloneWebViewWrapper.h"
#endif
#import "view/KlarnaStandaloneWebViewWrapper.h"

@implementation KlarnaStandaloneWebViewManager

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
#if !RCT_NEW_ARCH_ENABLED

#import <React/RCTUIManager.h>
#import <UIKit/UIKit.h>

#if RCT_NEW_ARCH_ENABLED
#import <React/RCTViewComponentView.h>
#else
#import <AVFoundation/AVFoundation.h>
#import <UIKit/UIKit.h>
#import <React/RCTView.h>
#import <React/RCTUIManager.h>
#endif


NS_ASSUME_NONNULL_BEGIN


#if RCT_NEW_ARCH_ENABLED
@interface KlarnaCheckoutViewWrapper : RCTViewComponentView
#else
@interface KlarnaCheckoutViewWrapper : UIView

@property (nonatomic, copy) RCTDirectEventBlock onEvent;
Expand All @@ -17,10 +23,10 @@ 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;

Expand All @@ -32,6 +38,5 @@ NS_ASSUME_NONNULL_BEGIN

@end

NS_ASSUME_NONNULL_END

#endif
NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#if !RCT_NEW_ARCH_ENABLED

#import <React/RCTUIManager.h>
#import <UIKit/UIKit.h>

#if RCT_NEW_ARCH_ENABLED
#import <React/RCTViewComponentView.h>
#else
#import <AVFoundation/AVFoundation.h>
#import <UIKit/UIKit.h>
#import <React/RCTView.h>
#import <React/RCTUIManager.h>
#endif

NS_ASSUME_NONNULL_BEGIN

#if RCT_NEW_ARCH_ENABLED
@interface KlarnaStandaloneWebViewWrapper : RCTViewComponentView
#else
@interface KlarnaStandaloneWebViewWrapper : UIView

@property (nonatomic, copy) RCTDirectEventBlock onLoadStart;
Expand All @@ -18,11 +22,10 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) RCTDirectEventBlock onKlarnaMessage;

@property (nonatomic, strong) NSString* returnUrl;
#endif

#pragma mark - React Native Overrides

- (void)initializeKlarnaStandaloneWebView;

@property (nonatomic, weak) RCTUIManager* uiManager;

- (void)load:(nonnull NSString*)url;
Expand All @@ -36,7 +39,3 @@ NS_ASSUME_NONNULL_BEGIN
@end

NS_ASSUME_NONNULL_END

#endif


Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#if !RCT_NEW_ARCH_ENABLED

#import <React/RCTUIManager.h>
#import <UIKit/UIKit.h>

#if RCT_NEW_ARCH_ENABLED
#import <React/RCTViewComponentView.h>
#else
#import <AVFoundation/AVFoundation.h>
#import <UIKit/UIKit.h>
#import <React/RCTView.h>
#import <React/RCTUIManager.h>
#endif

NS_ASSUME_NONNULL_BEGIN

#if RCT_NEW_ARCH_ENABLED
@interface PaymentViewWrapper : RCTViewComponentView
#else
@interface PaymentViewWrapper : UIView

@property (nonatomic, copy) RCTDirectEventBlock onInitialized;
Expand All @@ -23,10 +27,10 @@ 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;

Expand All @@ -44,6 +48,5 @@ NS_ASSUME_NONNULL_BEGIN

@end

NS_ASSUME_NONNULL_END

#endif
NS_ASSUME_NONNULL_END
Loading

0 comments on commit a72e51d

Please sign in to comment.