diff --git a/CHANGELOG.md b/CHANGELOG.md index d7d4a21..c666afc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 4.0.0 (2026-08-11) + +**Breaking changes** + +- Update Castle iOS SDK to 4.2.0. +- Minimum iOS version raised to 13.0. +- Update Castle Android SDK to 4.0.2. +- Android raised `minSdkVersion` to 26 (Android 8.0) and `compileSdkVersion` to 36. +- Removed `userAgent()` and `queueSize()`. +- Removed the `sensorTrackingEnabled` configuration option. +- `flushIfNeeded()` and `baseUrl()` are iOS only. On Android `flushIfNeeded()` is a no-op and `baseUrl()` resolves `null`. +- `createRequestToken()` resolves `null` instead of an empty string when called before the SDK has been configured. +- `configure()` and `configureWithPublishableKey()` now reject the promise if the SDK fails to configure. + +**Enhancements** + +- `setAdvertisingIdentifier()` is now implemented on Android. +- `baseURLAllowList` entries are converted to URLs on iOS, so allow list matching works as documented. Entries must include a scheme, for example `https://api.example.com`. + ## 2.3.0 (2026-05-28) - Update Castle iOS SDK to 3.2.0. diff --git a/README.md b/README.md index e734300..108c3f0 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,8 @@ - Xcode 16.3+ ### Android - - Android 7.0 + - Android 8.0 (API 26) + - compileSdkVersion 36 ## Installation @@ -41,6 +42,9 @@ Run `pod install` in the `ios` directory in order to link to the native iOS proj npx pod-install ``` +The Castle iOS SDK ships as a binary XCFramework vendored inside this package, so +CocoaPods links, embeds and signs it for you. No extra Podfile setup is required. + Once completed, re-build the app binary and start using the library ```bash diff --git a/RELEASING.md b/RELEASING.md index 87c8863..e227ec9 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -1,5 +1,34 @@ # Releasing +## Updating the Castle iOS SDK + +Castle iOS 4.x is not published to CocoaPods, so `ios/CastleSDK.xcframework` is +vendored in this repository and has to be refreshed by hand whenever the native +SDK is bumped: + +```bash +VERSION=4.2.0 +gh release download "$VERSION" --repo castle/castle-ios --pattern "Castle.xcframework.zip" --clobber + +# Verify the download matches the checksum in castle-ios' Package.swift +shasum -a 256 Castle.xcframework.zip + +rm -rf ios/CastleSDK.xcframework +unzip -q Castle.xcframework.zip +mv Castle.xcframework ios/CastleSDK.xcframework +rm Castle.xcframework.zip +``` + +The release ships the bundle as `Castle.xcframework`, but it **must** be renamed +to `CastleSDK.xcframework`. CocoaPods derives the linker flag from the file name, +so leaving it as `Castle.xcframework` produces `-framework Castle` and the build +fails with `ld: framework 'Castle' not found`. The framework inside is named +`CastleSDK.framework`. + +After updating, run `pod install` in `example/ios` and check that the example app +still launches — a missing or misnamed framework links fine but crashes at +startup with `dyld: Library not loaded: @rpath/CastleSDK.framework/CastleSDK`. + ## Pre-release Create a new `X.Y.Z` branch from `master` and run: diff --git a/android/build.gradle b/android/build.gradle index c5ea8a7..20e6e73 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -30,7 +30,7 @@ android { compileSdkVersion getExtOrIntegerDefault('compileSdkVersion') buildToolsVersion getExtOrDefault('buildToolsVersion') defaultConfig { - minSdkVersion 24 + minSdkVersion 26 targetSdkVersion getExtOrIntegerDefault('targetSdkVersion') } @@ -138,5 +138,5 @@ dependencies { // noinspection GradleDynamicVersion api 'com.facebook.react:react-native:+' implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - api 'io.castle.android:castle:3.1.8' + api 'io.castle.android:castle:4.0.2' } diff --git a/android/gradle.properties b/android/gradle.properties index 3239cbc..3573240 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ Castle_kotlinVersion=2.1.20 -Castle_compileSdkVersion=34 -Castle_buildToolsVersion=35.0.0 -Castle_targetSdkVersion=35 +Castle_compileSdkVersion=36 +Castle_buildToolsVersion=36.0.0 +Castle_targetSdkVersion=36 android.useAndroidX=true diff --git a/android/src/main/java/com/reactnativecastle/CastleModule.kt b/android/src/main/java/com/reactnativecastle/CastleModule.kt index bf882d7..7405cc6 100644 --- a/android/src/main/java/com/reactnativecastle/CastleModule.kt +++ b/android/src/main/java/com/reactnativecastle/CastleModule.kt @@ -2,11 +2,13 @@ package com.reactnativecastle import android.app.Application import com.facebook.react.bridge.* -import io.castle.android.Castle -import io.castle.android.CastleConfiguration +import io.castle.Castle +import io.castle.Configuration class CastleModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) { + private var advertisingIdentifier: String? = null + override fun getName(): String { return "Castle" } @@ -18,40 +20,51 @@ class CastleModule(reactContext: ReactApplicationContext) : ReactContextBaseJava @ReactMethod fun configure(options: ReadableMap?, promise: Promise) { - if (options != null) { - val builder = CastleConfiguration.Builder() - builder.publishableKey(options.getString("publishableKey")) - builder.screenTrackingEnabled(false) - if (options.hasKey("debugLoggingEnabled")) { - builder.debugLoggingEnabled(options.getBoolean("debugLoggingEnabled")) - } - if (options.hasKey("maxQueueLimit")) { - builder.maxQueueLimit(options.getInt("maxQueueLimit")) - } - if (options.hasKey("flushLimit")) { - builder.flushLimit(options.getInt("flushLimit")) - } - if (options.hasKey("baseURLAllowList")) { - val array = options.getArray("baseURLAllowList") - array?.let { - val baseURLAllowList = mutableListOf() - for (i in 0 until array.size()) { - array.getString(i)?.let { - s -> baseURLAllowList.add(s) - } + if (options == null) { + promise.reject("castle_configuration_error", "Invalid configuration") + return + } + + val publishableKey = options.getString("publishableKey") + if (publishableKey == null) { + promise.reject("castle_configuration_error", "Missing publishableKey") + return + } + + val builder = Configuration.Builder() + builder.publishableKey(publishableKey) + builder.screenTrackingEnabled(false) + builder.adIdProvider { advertisingIdentifier ?: "" } + if (options.hasKey("debugLoggingEnabled")) { + builder.debugLoggingEnabled(options.getBoolean("debugLoggingEnabled")) + } + if (options.hasKey("maxQueueLimit")) { + builder.maxQueueLimit(options.getInt("maxQueueLimit")) + } + if (options.hasKey("flushLimit")) { + builder.flushLimit(options.getInt("flushLimit")) + } + if (options.hasKey("baseURLAllowList")) { + val array = options.getArray("baseURLAllowList") + array?.let { + val baseURLAllowList = mutableListOf() + for (i in 0 until array.size()) { + array.getString(i)?.let { + s -> baseURLAllowList.add(s) } - builder.baseURLAllowList(baseURLAllowList) } - } - if (options.hasKey("lifeCycleEventsEnabled")) { - builder.applicationLifecycleTrackingEnabled(options.getBoolean("lifeCycleEventsEnabled")) - } + builder.baseURLAllowList(baseURLAllowList) + } + } + if (options.hasKey("lifeCycleEventsEnabled")) { + builder.applicationLifecycleTrackingEnabled(options.getBoolean("lifeCycleEventsEnabled")) + } + try { Castle.configure(reactApplicationContext.applicationContext as Application, builder.build()) - promise.resolve(null) - } else { - promise.reject("Invalid configuration") + } catch (e: RuntimeException) { + promise.reject("castle_configuration_error", e.message, e) } } @@ -62,12 +75,12 @@ class CastleModule(reactContext: ReactApplicationContext) : ReactContextBaseJava @ReactMethod fun resetConfiguration() { - Castle.reset() + Castle.resetConfiguration() } @ReactMethod fun userJwt(userJwt: String) { - Castle.userJwt(userJwt) + Castle.setUserJwt(userJwt) } @ReactMethod @@ -92,7 +105,7 @@ class CastleModule(reactContext: ReactApplicationContext) : ReactContextBaseJava @ReactMethod fun flushIfNeeded(url: String) { - Castle.flushIfNeeded(url) + // Not available on Android since Castle Android 4.0.0, iOS only. } @ReactMethod @@ -102,7 +115,8 @@ class CastleModule(reactContext: ReactApplicationContext) : ReactContextBaseJava @ReactMethod fun baseUrl(promise: Promise) { - promise.resolve(Castle.baseUrl()) + // Not available on Android since Castle Android 4.0.0, iOS only. + promise.resolve(null) } @ReactMethod @@ -112,16 +126,6 @@ class CastleModule(reactContext: ReactApplicationContext) : ReactContextBaseJava @ReactMethod fun setAdvertisingIdentifier(idfa: String) { - // Do nothing, setting IDFA is not applicable on Android - } - - @ReactMethod - fun userAgent(promise: Promise) { - promise.resolve(Castle.userAgent()) - } - - @ReactMethod - fun queueSize(promise: Promise) { - promise.resolve(Castle.queueSize()) + advertisingIdentifier = idfa } } diff --git a/example/android/build.gradle b/example/android/build.gradle index 5a82bb3..2be48ef 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,9 +1,9 @@ buildscript { ext { - buildToolsVersion = "34.0.0" - minSdkVersion = 24 - compileSdkVersion = 35 - targetSdkVersion = 34 + buildToolsVersion = "36.0.0" + minSdkVersion = 26 + compileSdkVersion = 36 + targetSdkVersion = 36 ndkVersion = "27.1.12297006" kotlinVersion = "2.0.21" } diff --git a/example/ios/CastleExample.xcodeproj/project.pbxproj b/example/ios/CastleExample.xcodeproj/project.pbxproj index 8a3fc81..be933ac 100644 --- a/example/ios/CastleExample.xcodeproj/project.pbxproj +++ b/example/ios/CastleExample.xcodeproj/project.pbxproj @@ -8,10 +8,10 @@ /* Begin PBXBuildFile section */ 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; - 532E0611E0C56E470189E591 /* libPods-CastleExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B5F3EE976AFAD5D53153C839 /* libPods-CastleExample.a */; }; 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; 9EB2394123E1745F9D9D92F0 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 0D2312465685223C87B663F6 /* PrivacyInfo.xcprivacy */; }; B6A09F982E2F925C00505B0A /* Appdelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6A09F972E2F925C00505B0A /* Appdelegate.swift */; }; + D6BA01F102E93AE12BB56748 /* libPods-CastleExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 876CB16ACB2DA29C48367FD1 /* libPods-CastleExample.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -33,8 +33,8 @@ 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = CastleExample/Info.plist; sourceTree = ""; }; 19781D9CC10C3637F42736B6 /* Pods-CastleExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CastleExample.release.xcconfig"; path = "Target Support Files/Pods-CastleExample/Pods-CastleExample.release.xcconfig"; sourceTree = ""; }; 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = CastleExample/LaunchScreen.storyboard; sourceTree = ""; }; + 876CB16ACB2DA29C48367FD1 /* libPods-CastleExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-CastleExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 94571458C340E4FCBBD7504F /* Pods-CastleExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CastleExample.debug.xcconfig"; path = "Target Support Files/Pods-CastleExample/Pods-CastleExample.debug.xcconfig"; sourceTree = ""; }; - B5F3EE976AFAD5D53153C839 /* libPods-CastleExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-CastleExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; B6A09F972E2F925C00505B0A /* Appdelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Appdelegate.swift; path = CastleExample/Appdelegate.swift; sourceTree = ""; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ @@ -51,7 +51,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 532E0611E0C56E470189E591 /* libPods-CastleExample.a in Frameworks */, + D6BA01F102E93AE12BB56748 /* libPods-CastleExample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -75,7 +75,7 @@ isa = PBXGroup; children = ( ED297162215061F000B7C4FE /* JavaScriptCore.framework */, - B5F3EE976AFAD5D53153C839 /* libPods-CastleExample.a */, + 876CB16ACB2DA29C48367FD1 /* libPods-CastleExample.a */, ); name = Frameworks; sourceTree = ""; @@ -262,19 +262,17 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-CastleExample/Pods-CastleExample-frameworks.sh", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/Castle/Highwind.framework/Highwind", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/Castle/GeoZip.framework/GeoZip", "${PODS_XCFRAMEWORKS_BUILD_DIR}/React-Core-prebuilt/React.framework/React", "${PODS_XCFRAMEWORKS_BUILD_DIR}/ReactNativeDependencies/ReactNativeDependencies.framework/ReactNativeDependencies", "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/Pre-built/hermesvm.framework/hermesvm", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/react-native-castle/CastleSDK.framework/CastleSDK", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Highwind.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GeoZip.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/React.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ReactNativeDependencies.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/hermesvm.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CastleSDK.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -288,13 +286,11 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-CastleExample/Pods-CastleExample-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/Castle/Castle.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/React-Core_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/React-cxxreact/React-cxxreact_privacy.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Castle.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-Core_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-cxxreact_privacy.bundle", ); @@ -490,6 +486,21 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "${PODS_ROOT}/ReactCommon", + "${PODS_ROOT}/ReactCommon/react/nativemodule/core", + "${PODS_ROOT}/React-runtimeexecutor", + "${PODS_ROOT}/React-runtimeexecutor/platform/ios", + "${PODS_ROOT}/ReactCommon-Samples", + "${PODS_ROOT}/ReactCommon-Samples/platform/ios", + "${PODS_ROOT}/React-Fabric/react/renderer/components/view/platform/cxx", + "${PODS_ROOT}/React-NativeModulesApple", + "${PODS_ROOT}/React-graphics", + "${PODS_ROOT}/React-graphics/react/renderer/graphics/platform/ios", + "${PODS_ROOT}/React-featureflags", + "${PODS_ROOT}/React-renderercss", + ); IPHONEOS_DEPLOYMENT_TARGET = 15.1; LD = ""; LDPLUSPLUS = ""; @@ -564,6 +575,21 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "${PODS_ROOT}/ReactCommon", + "${PODS_ROOT}/ReactCommon/react/nativemodule/core", + "${PODS_ROOT}/React-runtimeexecutor", + "${PODS_ROOT}/React-runtimeexecutor/platform/ios", + "${PODS_ROOT}/ReactCommon-Samples", + "${PODS_ROOT}/ReactCommon-Samples/platform/ios", + "${PODS_ROOT}/React-Fabric/react/renderer/components/view/platform/cxx", + "${PODS_ROOT}/React-NativeModulesApple", + "${PODS_ROOT}/React-graphics", + "${PODS_ROOT}/React-graphics/react/renderer/graphics/platform/ios", + "${PODS_ROOT}/React-featureflags", + "${PODS_ROOT}/React-renderercss", + ); IPHONEOS_DEPLOYMENT_TARGET = 15.1; LD = ""; LDPLUSPLUS = ""; diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 5913225..c734f8d 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,5 +1,4 @@ PODS: - - Castle (3.2.0) - FBLazyVector (0.85.3) - hermes-engine (250829098.0.10): - hermes-engine/Pre-built (= 250829098.0.10) @@ -1403,8 +1402,7 @@ PODS: - ReactCommon/turbomodule/core - ReactNativeDependencies - Yoga - - react-native-castle (2.3.0): - - Castle (= 3.2.0) + - react-native-castle (3.0.0): - React-Core - React-NativeModulesApple (0.85.3): - hermes-engine @@ -1871,10 +1869,6 @@ DEPENDENCIES: - ReactNativeDependencies (from `../node_modules/react-native/third-party-podspecs/ReactNativeDependencies.podspec`) - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) -SPEC REPOS: - trunk: - - Castle - EXTERNAL SOURCES: FBLazyVector: :path: "../node_modules/react-native/Libraries/FBLazyVector" @@ -2029,9 +2023,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/yoga" SPEC CHECKSUMS: - Castle: de26fa2c40a8bb11bd87c917a1cc7b6310cf6ab8 FBLazyVector: 24e62c765683b8d89006a88a2c8f5cf019f0074d - hermes-engine: ceff15eb649aac6a0f72bb7352cb9f0850fec7ed + hermes-engine: 5f16cb72bde3837717bcd7ee1a6eba5272c9ae34 RCTDeprecation: a4c521821fab57cbb125b36effe84d897d0dfa12 RCTRequired: 9f3a7e5645d4bc3f551593de7550bb66ab6e42bc RCTSwiftUI: 239ed2eb9e73de5a6f518810630f0c95e01c8702 @@ -2040,7 +2033,7 @@ SPEC CHECKSUMS: React: e2dc35338068bbd299c66f043ae0d7f25de8499e React-callinvoker: 28b25d21b124c26cebaea713ba7d801b9351dc48 React-Core: 02ed7d2ffb70437bdf2aba074a13078a7b0b9ff0 - React-Core-prebuilt: d83271843df4d66c8357e60778a293cf7aa8f631 + React-Core-prebuilt: a49cfcf78b8fddd433b5b1c0743f12148adafc88 React-CoreModules: b3a5a42dadcde3b5d47b325bd912eb2ced89e146 React-cxxreact: fe8f88dda044e5905e99a00f41b7a874c3908716 React-debug: 92944dc4d89f56d640e75498266cbde557a48189 @@ -2069,7 +2062,7 @@ SPEC CHECKSUMS: React-Mapbuffer: fec3e025f0ffba6b32cd2a1d7bbdee3e269aae90 React-microtasksnativemodule: ab33a818d339f5a1da308893c11b487be66121a8 React-mutationobservernativemodule: a42d1626651ccd7d0dc02a56e69d4ec77c248893 - react-native-castle: 6eaa29898f25ba24b25ffee31ec1a3a539279944 + react-native-castle: ea06a9b7d424cb5e7ca90ff7a15df22748a68d40 React-NativeModulesApple: deba264b03bd79c6bd61014fa30e40321b5e443a React-networking: 35e6070b084f435429f85c5db40b4d5b38652fe9 React-oscompat: 64a0c7ef5441855dc6e2a6afe8ba8f92aa05075e @@ -2103,7 +2096,7 @@ SPEC CHECKSUMS: ReactAppDependencyProvider: 25c9c516839be2c5e3d3344f95dc7da5f7e63fc2 ReactCodegen: c8f81e6c6f762dcf442a6203a1fb58f7dafc8014 ReactCommon: 7dfc3250793bf36cf221096ff59e1179e13eef7f - ReactNativeDependencies: 41190cc41f185728f1a0c393942acf856b72befb + ReactNativeDependencies: 8866ecee771aedf7cf5d8dfccd973664fa7b40fc Yoga: 77dfa8673de2874e1855002ae59c68b8be9b007b PODFILE CHECKSUM: a422ee55ebd5f04db0fae5066b4fdf4f6a61eace diff --git a/example/src/App.tsx b/example/src/App.tsx index d7bcad8..5e59c38 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -10,24 +10,21 @@ import { import Castle from '@castleio/react-native-castle'; export default function App() { - const [requestToken, setRequestToken] = useState(); + const [requestToken, setRequestToken] = useState(); const [requestTokenHeaderName, setRequestTokenHeaderName] = useState< string | undefined >(); - const [baseUrl, setBaseUrl] = useState(); - const [queueSize, setQueueSize] = useState(); - const [userAgent, setUserAgent] = useState(); + const [baseUrl, setBaseUrl] = useState(); useEffect(() => { Castle.configure({ publishableKey: 'pk_CTsfAeRTqxGgA7HHxqpEESvjfPp4QAKA', debugLoggingEnabled: true, lifeCycleEventsEnabled: true, - sensorTrackingEnabled: true, maxQueueLimit: 1000, flushLimit: 20, useCloudflareApp: false, - baseURLAllowList: ['google.com', 'docs.castle.io'], + baseURLAllowList: ['https://google.com', 'https://docs.castle.io'], }).then(async () => { await Castle.userJwt( 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImVjMjQ0ZjMwLTM0MzItNGJiYy04OGYxLTFlM2ZjMDFiYzFmZSIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsInJlZ2lzdGVyZWRfYXQiOiIyMDIyLTAxLTAxVDA5OjA2OjE0LjgwM1oifQ.eAwehcXZDBBrJClaE0bkO9XAr4U3vqKUpyZ-d3SxnH0' @@ -35,9 +32,8 @@ export default function App() { // Fetch properties Castle.createRequestToken().then(setRequestToken); + // baseUrl is iOS only, resolves null on Android Castle.baseUrl().then(setBaseUrl); - Castle.queueSize().then(setQueueSize); - Castle.userAgent().then(setUserAgent); Castle.requestTokenHeaderName().then(setRequestTokenHeaderName); // Set mock IDFA @@ -51,8 +47,6 @@ export default function App() { Request token: {requestToken} Request token header name: {requestTokenHeaderName} BaseUrl: {baseUrl} - Queue size: {queueSize} - User Agent: {userAgent}