Skip to content
This repository was archived by the owner on Jul 23, 2025. It is now read-only.
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
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ dependencies {
api 'com.facebook.react:react-native:+'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

implementation 'com.github.tangem.tangem-sdk-android:android:3.6.2'
implementation 'com.github.tangem.tangem-sdk-android:core:3.6.2'
implementation 'com.github.tangem.tangem-sdk-android:android:3.8.1'
implementation 'com.github.tangem.tangem-sdk-android:core:3.8.1'

implementation 'com.squareup.moshi:moshi:1.12.0'
implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.content.IntentFilter
import android.nfc.NfcAdapter
import android.os.Handler
import android.os.Looper
import androidx.fragment.app.FragmentActivity
import com.facebook.react.bridge.*
import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter
import com.tangem.Log
Expand All @@ -17,12 +18,10 @@ import com.tangem.common.core.Config
import com.tangem.common.core.TangemSdkError
import com.tangem.common.extensions.hexToBytes
import com.tangem.common.json.MoshiJsonConverter
import com.tangem.common.services.secure.SecureStorage
import com.tangem.tangem_sdk_new.DefaultSessionViewDelegate
import com.tangem.tangem_sdk_new.extensions.createLogger
import com.tangem.tangem_sdk_new.extensions.localizedDescription
import com.tangem.tangem_sdk_new.nfc.NfcManager
import com.tangem.tangem_sdk_new.storage.create
import com.tangem.sdk.DefaultSessionViewDelegate
import com.tangem.sdk.extensions.*
import com.tangem.sdk.nfc.NfcManager
import com.tangem.sdk.storage.create
import org.json.JSONArray
import org.json.JSONException
import org.json.JSONObject
Expand All @@ -44,16 +43,17 @@ class TangemSdkReactNativeModule(private val reactContext: ReactApplicationConte
override fun initialize() {
super.initialize()

val activity = currentActivity ?: return
val activity = currentActivity?.let { it as? FragmentActivity ?: error("required FragmentActivity") } ?: return

wActivity = WeakReference(activity)

Log.addLogger(TangemSdk.createLogger())

nfcManager = NfcManager().apply { setCurrentActivity(activity) }
val delegate = DefaultSessionViewDelegate(nfcManager, nfcManager.reader, activity)
val storage = SecureStorage.create(activity)
sdk = TangemSdk(nfcManager.reader, delegate, storage, Config())

Handler(Looper.getMainLooper()).post {
sdk = TangemSdk.initWithBiometrics(activity, Config())
}

nfcManager.onStart()
nfcManagerStarted = true
Expand Down Expand Up @@ -89,7 +89,8 @@ class TangemSdkReactNativeModule(private val reactContext: ReactApplicationConte
sdk.startSessionWithJsonRequest(
param.extract("JSONRPCRequest"),
param.extractOptional("cardId"),
param.extractOptional("initialMessage")
param.extractOptional("initialMessage"),
param.extractOptional("accessCode")
) { handler.post { promise.resolve(normalizeResponse(it)) } }
} catch (ex: Exception) {
handleException(ex, promise)
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ target 'TangemSdkReactNativeExample' do

use_react_native!(:path => config["reactNativePath"])

pod 'tangem-sdk-react-native', :path => '../..'
pod 'tangem-sdk', :path => '../..'

use_frameworks!
inhibit_all_warnings!
Expand Down
16 changes: 8 additions & 8 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,10 @@ PODS:
- React-jsi (= 0.66.1)
- React-logger (= 0.66.1)
- React-perflogger (= 0.66.1)
- tangem-sdk-react-native (1.0.0):
- tangem-sdk (0.7.0):
- React-Core
- TangemSdk (= 3.3.4)
- TangemSdk (3.3.4)
- TangemSdk (= 3.6.0)
- TangemSdk (3.6.0)
- Yoga (1.14.0)

DEPENDENCIES:
Expand Down Expand Up @@ -312,7 +312,7 @@ DEPENDENCIES:
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- tangem-sdk-react-native (from `../..`)
- tangem-sdk (from `../..`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
Expand Down Expand Up @@ -379,7 +379,7 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/runtimeexecutor"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
tangem-sdk-react-native:
tangem-sdk:
:path: "../.."
Yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"
Expand Down Expand Up @@ -415,10 +415,10 @@ SPEC CHECKSUMS:
React-RCTVibration: 6600b5eed7c0fda4a433fa1198d1cb2690151791
React-runtimeexecutor: 33a949a51bec5f8a3c9e8d8092deb259600d761e
ReactCommon: 620442811dc6f707b4bf5e3b27d4f19c12d5a821
tangem-sdk-react-native: 10f3e750fe3ab6550f65d42a5a282710a4ad8781
TangemSdk: 9ea2c230bd616787bdccc5fb3ab36925d06199d4
tangem-sdk: 1355eb5b04d0a04e06e38a11f498f76325bde446
TangemSdk: 9e5fcf315b5bc63b6a0651759fb3451f2a25f9f3
Yoga: 2b4a01651f42a32f82e6cef3830a3ba48088237f

PODFILE CHECKSUM: bf0a1cc1c0a69436c759f1e22d4f99b28e6bcf32
PODFILE CHECKSUM: 8ce40a1dba0afaf55f61cb1ec917fbef2ae9ff8d

COCOAPODS: 1.11.2
114 changes: 2 additions & 112 deletions example/ios/TangemSdkReactNativeExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
objects = {

/* Begin PBXBuildFile section */
00E356F31AD99517003FC87E /* TangemSdkReactNativeExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* TangemSdkReactNativeExampleTests.m */; };
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
Expand All @@ -21,13 +20,6 @@
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
remoteInfo = TangemSdkReactNativeExample;
};
2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
Expand All @@ -38,7 +30,6 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
00E356EE1AD99517003FC87E /* TangemSdkReactNativeExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TangemSdkReactNativeExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
00E356F21AD99517003FC87E /* TangemSdkReactNativeExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TangemSdkReactNativeExampleTests.m; sourceTree = "<group>"; };
13B07F961A680F5B00A75B9A /* TangemSdkReactNativeExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TangemSdkReactNativeExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -60,13 +51,6 @@
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
00E356EB1AD99517003FC87E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -169,7 +153,6 @@
isa = PBXGroup;
children = (
13B07F961A680F5B00A75B9A /* TangemSdkReactNativeExample.app */,
00E356EE1AD99517003FC87E /* TangemSdkReactNativeExampleTests.xctest */,
2D02E47B1E0B4A5D006451C7 /* TangemSdkReactNativeExample-tvOS.app */,
2D02E4901E0B4A5D006451C7 /* TangemSdkReactNativeExample-tvOSTests.xctest */,
);
Expand All @@ -179,24 +162,6 @@
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
00E356ED1AD99517003FC87E /* TangemSdkReactNativeExampleTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "TangemSdkReactNativeExampleTests" */;
buildPhases = (
00E356EA1AD99517003FC87E /* Sources */,
00E356EB1AD99517003FC87E /* Frameworks */,
00E356EC1AD99517003FC87E /* Resources */,
);
buildRules = (
);
dependencies = (
00E356F51AD99517003FC87E /* PBXTargetDependency */,
);
name = TangemSdkReactNativeExampleTests;
productName = TangemSdkReactNativeExampleTests;
productReference = 00E356EE1AD99517003FC87E /* TangemSdkReactNativeExampleTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
13B07F861A680F5B00A75B9A /* TangemSdkReactNativeExample */ = {
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "TangemSdkReactNativeExample" */;
Expand Down Expand Up @@ -262,10 +227,6 @@
attributes = {
LastUpgradeCheck = 1250;
TargetAttributes = {
00E356ED1AD99517003FC87E = {
CreatedOnToolsVersion = 6.2;
TestTargetID = 13B07F861A680F5B00A75B9A;
};
13B07F861A680F5B00A75B9A = {
DevelopmentTeam = 4897UJ6D8C;
LastSwiftMigration = 1120;
Expand Down Expand Up @@ -296,21 +257,13 @@
projectRoot = "";
targets = (
13B07F861A680F5B00A75B9A /* TangemSdkReactNativeExample */,
00E356ED1AD99517003FC87E /* TangemSdkReactNativeExampleTests */,
2D02E47A1E0B4A5D006451C7 /* TangemSdkReactNativeExample-tvOS */,
2D02E48F1E0B4A5D006451C7 /* TangemSdkReactNativeExample-tvOSTests */,
);
};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
00E356EC1AD99517003FC87E /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
13B07F8E1A680F5B00A75B9A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -371,7 +324,7 @@
"${BUILT_PRODUCTS_DIR}/Yoga/yoga.framework",
"${BUILT_PRODUCTS_DIR}/fmt/fmt.framework",
"${BUILT_PRODUCTS_DIR}/glog/glog.framework",
"${BUILT_PRODUCTS_DIR}/tangem-sdk-react-native/tangem_sdk_react_native.framework",
"${BUILT_PRODUCTS_DIR}/tangem-sdk/tangem_sdk.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
Expand Down Expand Up @@ -400,7 +353,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/yoga.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/fmt.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/tangem_sdk_react_native.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/tangem_sdk.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -484,14 +437,6 @@
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
00E356EA1AD99517003FC87E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
00E356F31AD99517003FC87E /* TangemSdkReactNativeExampleTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
13B07F871A680F5B00A75B9A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -521,11 +466,6 @@
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
00E356F51AD99517003FC87E /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 13B07F861A680F5B00A75B9A /* TangemSdkReactNativeExample */;
targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */;
};
2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 2D02E47A1E0B4A5D006451C7 /* TangemSdkReactNativeExample-tvOS */;
Expand All @@ -534,47 +474,6 @@
/* End PBXTargetDependency section */

/* Begin XCBuildConfiguration section */
00E356F61AD99517003FC87E /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = TangemSdkReactNativeExampleTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
"$(inherited)",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.TangemSdkReactNative;
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TangemSdkReactNativeExample.app/TangemSdkReactNativeExample";
};
name = Debug;
};
00E356F71AD99517003FC87E /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = NO;
INFOPLIST_FILE = TangemSdkReactNativeExampleTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
"$(inherited)",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.TangemSdkReactNative;
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TangemSdkReactNativeExample.app/TangemSdkReactNativeExample";
};
name = Release;
};
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = D66996B062A50BA37870BA82 /* Pods-TangemSdkReactNativeExample.debug.xcconfig */;
Expand Down Expand Up @@ -851,15 +750,6 @@
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "TangemSdkReactNativeExampleTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
00E356F61AD99517003FC87E /* Debug */,
00E356F71AD99517003FC87E /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "TangemSdkReactNativeExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
Expand Down
2 changes: 2 additions & 0 deletions example/ios/TangemSdkReactNativeExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
<true/>
<key>NFCReaderUsageDescription</key>
<string>Some reason</string>
<key>NSFaceIDUsageDescription</key>
<string>Use Face ID to save access codes in the app</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
Expand Down
Loading