Skip to content
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
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,17 @@ This is opt-in and fully backward compatible — existing calls to `triggerTrans

**Using incognito for a different (e.g. linked/family) account:** `incognito: true` on its own does not switch which smallcase account the SDK is acting as — it only changes how that call's browser session behaves. To connect or transact on behalf of a different smallcase account than the one currently authenticated, call `SmallcaseGateway.init(sdkToken)` again with that account's own token before calling `triggerTransaction` — the same way you would for any account switch, incognito or not.

## Native SDK debug mode

The native Gateway and Loans SDK versions this package depends on are pinned in `native-sdk.json`, once for `release` (default) and once for `debug`. Debug builds of the native SDKs enable WebView inspection and debug logging, and are published to smallcase's internal registries only.

To consume the debug builds:

- Android: add `SmallcaseGateway_sdkMode=debug` to the host app's `android/gradle.properties`, then sync. Artifactory access to `SCGateway-internal` is required.
- iOS: add `source 'git@github.com:smallcase/cocoapodspec-internal.git'` and `source 'https://cdn.cocoapods.org/'` to the host app's `Podfile`, then run `SMALLCASE_SDK_MODE=debug pod install`. Run a plain `pod install` to switch back.

The build fails with an explicit error if debug mode is selected but `native-sdk.json` has no debug pin for an SDK.

## Debug / Contribution

Make sure you have react native dev environment set up
Expand Down
20 changes: 16 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,25 @@ repositories {

def kotlin_version = getExtOrDefault('kotlinVersion')

// Native SDK pins live in native-sdk.json. Set SmallcaseGateway_sdkMode=debug in the
// host app's gradle.properties to consume debug builds of the native SDKs.
def sdkMode = getExtOrDefault('sdkMode') ?: 'release'
def nativeSdks = new groovy.json.JsonSlurper().parse(file("$projectDir/../native-sdk.json"))
if (!nativeSdks.containsKey(sdkMode)) {
throw new GradleException("${project.name}: unknown SmallcaseGateway_sdkMode '${sdkMode}', expected one of ${nativeSdks.keySet()}")
}
def androidSdks = nativeSdks[sdkMode].android
androidSdks.each { sdk, coordinate ->
if (!coordinate) {
throw new GradleException("${project.name}: no ${sdk} SDK pinned for mode '${sdkMode}' in native-sdk.json")
}
}

dependencies {
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+' // From node_modules
// INTERNAL TEST PIN: feat/incognito-mode branch build.
// Revert to: implementation 'com.smallcase.gateway:sdk:6.1.1'
implementation 'com.smallcase.gateway:sdk-feat-incognito-mode-c1b21c9:6.1.2-3193-release'
implementation 'com.smallcase.loans:sdk-sourav-native-dark-theme-cb54bf9:5.1.4-92-release'
implementation androidSdks.gateway
implementation androidSdks.loans
implementation "androidx.core:core-ktx:1.3.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Expand Down
28 changes: 28 additions & 0 deletions native-sdk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"release": {
"android": {
"gateway": "com.smallcase.gateway:sdk-feat-incognito-mode-c1b21c9:6.1.2-3193-release",
"loans": "com.smallcase.loans:sdk-sourav-native-dark-theme-cb54bf9:5.1.4-92-release"
},
"ios": {
"gateway": {
"name": "SCGateway-feat-incognito-mode-2d15c7b",
"version": "7.2.0-28-release"
},
"loans": {
"name": "SCLoans-sourav-native-dark-theme-37c97d9",
"version": "7.1.2-45-release"
}
}
},
"debug": {
"android": {
"gateway": null,
"loans": null
},
"ios": {
"gateway": null,
"loans": null
}
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"cpp",
"types",
"react-native-smallcase-gateway.podspec",
"native-sdk.json",
"!lib/typescript/example",
"!lib/typescript/smart_investing_react_native",
"!android/build",
Expand Down
20 changes: 14 additions & 6 deletions react-native-smallcase-gateway.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))

# Native SDK pins live in native-sdk.json. Run `SMALLCASE_SDK_MODE=debug pod install`
# in the host app to consume debug builds of the native SDKs.
native_sdks = JSON.parse(File.read(File.join(__dir__, "native-sdk.json")))
sdk_mode = ENV.fetch("SMALLCASE_SDK_MODE", "release")
unless native_sdks.key?(sdk_mode)
raise "react-native-smallcase-gateway: unknown SMALLCASE_SDK_MODE '#{sdk_mode}', expected one of #{native_sdks.keys}"
end
ios_sdks = native_sdks[sdk_mode]["ios"]
ios_sdks.each do |sdk, pod|
raise "react-native-smallcase-gateway: no #{sdk} SDK pinned for mode '#{sdk_mode}' in native-sdk.json" if pod.nil?
end
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'

Pod::Spec.new do |s|
Expand Down Expand Up @@ -34,10 +46,6 @@ Pod::Spec.new do |s|
s.dependency "ReactCommon/turbomodule/core"
end

# INTERNAL TEST PIN: feat/incognito-mode branch build.
# Revert to: s.dependency 'SCGateway', '7.2.0'
s.dependency 'SCGateway-feat-incognito-mode-2d15c7b', '7.2.0-28-release'
# INTERNAL TEST PIN: dark-theme branch build (mirrors the android/build.gradle pin).
# Revert to: s.dependency 'SCLoans', '7.2.0'
s.dependency 'SCLoans-sourav-native-dark-theme-37c97d9', '7.1.2-45-release'
s.dependency ios_sdks["gateway"]["name"], ios_sdks["gateway"]["version"]
s.dependency ios_sdks["loans"]["name"], ios_sdks["loans"]["version"]
end
Loading