feat: add native SDK debug mode switch - #210
Open
DeepakSingh80 wants to merge 3 commits into
Open
DeepakSingh80 wants to merge 3 commits into
DeepakSingh80 wants to merge 3 commits into
Conversation
Move the native Gateway and Loans SDK pins into native-sdk.json with release and debug entries. Host apps opt into debug builds of the native SDKs with SmallcaseGateway_sdkMode=debug (Android) or SMALLCASE_SDK_MODE=debug pod install (iOS); release stays the default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ClickUp: https://app.clickup.com/t/603234/86d4bpgpd
Requirement
We need to build this package against the native SDKs in release and debug mode separately, so debug builds of the Gateway/Loans SDKs (logs, WebView inspection) can be used for internal debugging without affecting production.
Suggested approaches
-debugnative SDKs and consumers installgithub:smallcase/react-native-smallcase-gateway#<branch>.-debugpins and publishes a separate debug version of the package.Current implementation
Neither of the above. This PR keeps one package and one npm release, and adds a mode switch:
native-sdk.json, with areleaseblock (the default) and adebugblock.SmallcaseGateway_sdkMode=debug(Androidgradle.properties) orSMALLCASE_SDK_MODE=debug pod install(iOS).Summary
Lets host apps switch the RN wrapper to debug builds of the native Gateway/Loans SDKs (WebView inspection, debug logging) without a separate branch or npm release.
Background
This package is a bridge between a React Native app's JavaScript and the native Gateway and Loans SDKs, which exist separately for Android and iOS. The package doesn't bundle those SDKs. It declares them as dependencies, which Gradle (Android) and CocoaPods (iOS) download when the host app builds.
Until now the dependency list was hardcoded to the release SDKs. Debugging an issue inside a native SDK meant hand-editing the pins on a separate branch (the "INTERNAL TEST PIN" commits).
Changes
native-sdk.json, withrelease(default) anddebugentries. Thereleaseblock carries the pinsdevelopmentalready uses (incognito-mode Gateway and dark-theme Loans internal builds), so resolved SDK versions don't change.android/build.gradlereads the pins. Opt in withSmallcaseGateway_sdkMode=debugin the host'sgradle.properties.SMALLCASE_SDK_MODE=debug pod install, withcocoapodspec-internaladded as a Podfile source.native-sdk.jsonis added tofilesso it ships in the npm package.How release and debug work separately
There is one npm package and one codebase. Release and debug differ only in which native SDK versions get downloaded, and the host app picks one at build / install time:
android/build.gradleand CocoaPods evaluates the podspec onpod install.native-sdk.jsonand looks for the mode flag. If the flag is missing, the mode isrelease.SCGateway-internal(Android) orcocoapodspec-internal(iOS). This path is only taken when someone opts in, so the published package never makes customers resolve internal artifacts.null, the build stops with an explicit error instead of silently falling back.The mode is set per project / per
pod install, not per Debug/Release build variant of the host app. That keeps Android and iOS behaving the same.How to use debug mode
Requires internal access: Artifactory
SCGateway-internalfor Android, and SSH access tosmallcase/cocoapodspec-internalfor iOS.Android
android/gradle.properties, add:SmallcaseGateway_sdkMode=debugnpx react-native run-android). Gradle now resolves the debug SDKs.iOS
ios/Podfile, add:iosfolder, run:pod install.Things to know before relying on it
debugpin innative-sdk.jsonis stillnull, so turning on debug mode fails with the "no SDK pinned" error until real debug versions are filled in.gw-mob-iosBuildScripts/phases/create-xc-framework.sharchives without-configuration, so it always builds Release. A real debug xcframework needs-configuration Debugthere plus a CI run.sdkMode=debugis left ingradle.properties, release APKs also get the debug SDK. On iOS, the mode from the lastpod installstays in effect. Switch back before building for the Play Store / App Store.Follow-ups
debugpins with published internal debug versions.-configuration Debugto the xcframework build ingw-mob-iosand publish a debug pod.debugImplementation <debug pin>/releaseImplementation <release pin>on Android in debug mode, so a release build can never pick up the debug SDK.ENV['SMALLCASE_SDK_MODE'] = 'debug'at the top of the Podfile, so teammates and CI don't depend on remembering the env var.Test plan
pod ipc specondevelopment: release mode resolves to the same pods as before (SCGateway-feat-incognito-mode-2d15c7b 7.2.0-28-release,SCLoans-sourav-native-dark-theme-37c97d9 7.1.2-45-release); debug mode with no pins errors out.🤖 Generated with Claude Code