Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated from objective C to Swift #78

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ await SmallcaseGateway.setConfigEnvironment({
});

// initialize session
await SmallcaseGateway.init(sdkToken);
await SmallcaseGateway.initSDK(sdkToken);

// execute a transaction
const res = await SmallcaseGateway.triggerTransaction(transactionId);
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
dependencies {
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+' // From node_modules
implementation 'com.smallcase.gateway:sdk:4.1.0'
implementation 'com.smallcase.gateway:sdk:4.2.1'
implementation 'com.smallcase.loans:sdk:3.1.0'
implementation "androidx.core:core-ktx:1.3.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
Expand Down
2 changes: 1 addition & 1 deletion example/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const App = () => {
const init = useCallback(async () => {
setLog((p) => p + '\n starting init');
try {
await SmallcaseGateway.init(sdkToken);
await SmallcaseGateway.initSDK(sdkToken);
setLog((p) => p + '\n init success');
} catch (err: any) {
setLog((p) => p + '\n error during init' + JSON.stringify(err.userInfo));
Expand Down
2 changes: 1 addition & 1 deletion ios/SmallcaseGateway-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#import <React/RCTBridgeModule.h>
#import <React/RCTViewManager.h>
#import <React/RCTBridgeModule.h>
792 changes: 95 additions & 697 deletions ios/SmallcaseGateway.m

Large diffs are not rendered by default.

570 changes: 570 additions & 0 deletions ios/SmallcaseGateway.swift

Large diffs are not rendered by default.

17 changes: 5 additions & 12 deletions ios/SmallcaseGateway.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
5E555C0D2413F4C50049A1A2 /* SmallcaseGateway.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* SmallcaseGateway.m */; };
F4FF95D7245B92E800C19C63 /* SmallcaseGateway.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* SmallcaseGateway.swift */; };
F4FF95D7245B92E800C19C63 /* SmallcaseGateway.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* SmallcaseGateway.swift */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -49,13 +48,6 @@
name = Products;
sourceTree = "<group>";
};
158F56C62901D6B600238D90 /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
58B511D21A9E6C8500147676 = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -124,7 +116,6 @@
buildActionMask = 2147483647;
files = (
F4FF95D7245B92E800C19C63 /* SmallcaseGateway.swift in Sources */,
B3E7B58A1CC2AC0600A0062D /* SmallcaseGateway.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -229,13 +220,14 @@
58B511F01A9E6C8500147676 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../../React/**",
"$(SRCROOT)/../../react-native/React/**",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
LIBRARY_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = SmallcaseGateway;
SKIP_INSTALL = YES;
Expand All @@ -248,13 +240,14 @@
58B511F11A9E6C8500147676 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../../React/**",
"$(SRCROOT)/../../react-native/React/**",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
LIBRARY_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = SmallcaseGateway;
SKIP_INSTALL = YES;
Expand Down
4 changes: 2 additions & 2 deletions react-native-smallcase-gateway.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ Pod::Spec.new do |s|
s.dependency "ReactCommon/turbomodule/core"
end

s.dependency 'SCGateway', '4.0.1'
s.dependency 'SCLoans', '3.1.0'
s.dependency 'SCGateway', '4.1.1'
s.dependency 'SCLoans', '3.1.1'
end
6 changes: 3 additions & 3 deletions src/SmallcaseGateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ const setConfigEnvironment = async (envConfig) => {
* note: this must be called after `setConfigEnvironment()`
* @param {string} sdkToken
*/
const init = async (sdkToken) => {
const initSDK = async (sdkToken) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why initSDK instead of just init?

const safeToken = typeof sdkToken === 'string' ? sdkToken : '';
return SmallcaseGatewayNative.init(safeToken);
return SmallcaseGatewayNative.initSDK(safeToken);
};

/**
Expand Down Expand Up @@ -278,7 +278,7 @@ const getSdkVersion = async () => {
};

const SmallcaseGateway = {
init,
initSDK,
logoutUser,
triggerLeadGen,
triggerLeadGenWithStatus,
Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ declare const _default: {
authorizeHoldings: string;
mfHoldingsImport: string;
};
init: (sdkToken: string) => unknown;
initSDK: (sdkToken: string) => unknown;
logoutUser: () => Promise;
triggerLeadGen: (userDetails?: import("./SmallcaseGateway").userDetails, utmParams?: any) => any;
triggerLeadGenWithStatus: (userDetails?: import("./SmallcaseGateway").userDetails) => Promise;
Expand Down