diff --git a/.circleci/config.yml b/.circleci/config.yml index e8f7c390aa..827ea865e8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -419,7 +419,7 @@ jobs: command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc - run: name: Publish new enterprise version - command: npm publish + command: npm publish --tag snapshot publish: macos: @@ -613,15 +613,9 @@ workflows: - e2e_android_dream11 - e2e_ios_dream11 type: approval - filters: - branches: - only: dream11 - release_custom_package: name: release_dream11 requires: - hold_release_dream11 - filters: - branches: - only: dream11 prepare_steps: - prepare_dream11 diff --git a/android/build.gradle b/android/build.gradle index 55ebd450fa..26e1805ca5 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -52,7 +52,11 @@ android { compileSdkVersion getExtOrDefault('compileSdkVersion').toInteger() buildToolsVersion getExtOrDefault('buildToolsVersion') - + testOptions { + unitTests { + returnDefaultValues = true + } + } defaultConfig { minSdkVersion getExtOrDefault('minSdkVersion').toInteger() targetSdkVersion getExtOrDefault('targetSdkVersion').toInteger() diff --git a/android/native.gradle b/android/native.gradle index 4976189e25..118833cad0 100644 --- a/android/native.gradle +++ b/android/native.gradle @@ -1,5 +1,5 @@ project.ext.instabug = [ - version: '14.0.2.1' + version: '14.2.0.1' ] dependencies { diff --git a/android/src/main/java/com/instabug/reactlibrary/RNInstabugSessionReplayModule.java b/android/src/main/java/com/instabug/reactlibrary/RNInstabugSessionReplayModule.java index 2ded8df7fa..e7d987fb5a 100644 --- a/android/src/main/java/com/instabug/reactlibrary/RNInstabugSessionReplayModule.java +++ b/android/src/main/java/com/instabug/reactlibrary/RNInstabugSessionReplayModule.java @@ -1,6 +1,8 @@ package com.instabug.reactlibrary; +import android.util.Log; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -18,6 +20,7 @@ import com.instabug.library.sessionreplay.model.SessionMetadata; import com.instabug.reactlibrary.utils.EventEmitterModule; import com.instabug.reactlibrary.utils.MainThreadHandler; + import java.util.ArrayList; import java.util.List; import java.util.concurrent.CountDownLatch; @@ -120,26 +123,26 @@ public void onSessionReplayLinkReady(@Nullable String link) { } - public ReadableMap getSessionMetadataMap(SessionMetadata sessionMetadata){ + public ReadableMap getSessionMetadataMap(SessionMetadata sessionMetadata) { WritableMap params = Arguments.createMap(); - params.putString("appVersion",sessionMetadata.getAppVersion()); - params.putString("OS",sessionMetadata.getOs()); - params.putString("device",sessionMetadata.getDevice()); - params.putDouble("sessionDurationInSeconds",(double)sessionMetadata.getSessionDurationInSeconds()); - params.putBoolean("hasLinkToAppReview",sessionMetadata.getLinkedToReview()); - params.putArray("networkLogs",getNetworkLogsArray(sessionMetadata.getNetworkLogs())); + params.putString("appVersion", sessionMetadata.getAppVersion()); + params.putString("OS", sessionMetadata.getOs()); + params.putString("device", sessionMetadata.getDevice()); + params.putDouble("sessionDurationInSeconds", (double) sessionMetadata.getSessionDurationInSeconds()); + params.putBoolean("hasLinkToAppReview", sessionMetadata.getLinkedToReview()); + params.putArray("networkLogs", getNetworkLogsArray(sessionMetadata.getNetworkLogs())); String launchType = sessionMetadata.getLaunchType(); Long launchDuration = sessionMetadata.getLaunchDuration(); if (launchType != null) { - params.putString("launchType",ArgsRegistry.launchTypeReversed.get(sessionMetadata.getLaunchType()) ); + params.putString("launchType", ArgsRegistry.launchTypeReversed.get(sessionMetadata.getLaunchType())); } else { - params.putString("launchType",ArgsRegistry.launchType.get("unknown")); + params.putString("launchType", ArgsRegistry.launchType.get("unknown")); } if (launchDuration != null) { - params.putDouble("launchDuration", (double)launchDuration); + params.putDouble("launchDuration", (double) launchDuration); } else { params.putDouble("launchDuration", 0.0); } @@ -147,7 +150,7 @@ public ReadableMap getSessionMetadataMap(SessionMetadata sessionMetadata){ return params; } - public ReadableArray getNetworkLogsArray(List networkLogList ) { + public ReadableArray getNetworkLogsArray(List networkLogList) { WritableArray networkLogs = Arguments.createArray(); if (networkLogList != null) { @@ -166,6 +169,7 @@ public ReadableArray getNetworkLogsArray(List networ private boolean shouldSync = true; private CountDownLatch latch; + @ReactMethod public void setSyncCallback() { MainThreadHandler.runOnMainThread(new Runnable() { @@ -176,22 +180,28 @@ public void run() { @Override public boolean onSessionReadyToSync(@NonNull SessionMetadata sessionMetadata) { - sendEvent(Constants.IBG_SESSION_REPLAY_ON_SYNC_CALLBACK_INVOCATION,getSessionMetadataMap(sessionMetadata)); + Log.v("IBG-RN", "The android callback is called"); + + sendEvent(Constants.IBG_SESSION_REPLAY_ON_SYNC_CALLBACK_INVOCATION, getSessionMetadataMap(sessionMetadata)); latch = new CountDownLatch(1); try { + Log.v("IBG-RN", "waiting for RN callback"); + latch.await(); + } catch (InterruptedException e) { e.printStackTrace(); return true; } + Log.v("IBG-RN", "The onSessionReadyToSync returned with " + shouldSync); + return shouldSync; } }); - } - catch(Exception e){ + } catch (Exception e) { e.printStackTrace(); } @@ -202,6 +212,7 @@ public boolean onSessionReadyToSync(@NonNull SessionMetadata sessionMetadata) { @ReactMethod public void evaluateSync(boolean result) { shouldSync = result; + Log.v("IBG-RN", "The RN evaluateSync returned with " + result); if (latch != null) { latch.countDown(); @@ -209,5 +220,4 @@ public void evaluateSync(boolean result) { } - } diff --git a/examples/default/ios/Podfile b/examples/default/ios/Podfile index be64f98652..219b4a777c 100644 --- a/examples/default/ios/Podfile +++ b/examples/default/ios/Podfile @@ -15,7 +15,7 @@ target 'InstabugExample' do config = use_native_modules! rn_maps_path = '../node_modules/react-native-maps' pod 'react-native-google-maps', :path => rn_maps_path -# pod 'Instabug', :podspec => 'https://ios-releases.instabug.com/custom/dream11/14.0.0/Instabug.podspec' + pod 'Instabug', :podspec => 'https://ios-releases.instabug.com/custom/dream11/14.0.0/Instabug.podspec' # Flags change depending on the env values. flags = get_default_flags() diff --git a/examples/default/ios/Podfile.lock b/examples/default/ios/Podfile.lock index b4fa2ffe57..edd35b4e17 100644 --- a/examples/default/ios/Podfile.lock +++ b/examples/default/ios/Podfile.lock @@ -1602,7 +1602,7 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - Yoga - - RNInstabug (14.0.2): + - RNInstabug (14.2.1-SNAPSHOT): - Instabug (= 14.0.0) - React-Core - RNReanimated (3.16.1): @@ -1747,6 +1747,7 @@ DEPENDENCIES: - fmt (from `../node_modules/react-native/third-party-podspecs/fmt.podspec`) - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`) + - Instabug (from `https://ios-releases.instabug.com/custom/dream11/14.0.0/Instabug.podspec`) - instabug-reactnative-ndk (from `../node_modules/instabug-reactnative-ndk`) - OCMock - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) @@ -1825,7 +1826,6 @@ SPEC REPOS: trunk: - Google-Maps-iOS-Utils - GoogleMaps - - Instabug - OCMock - SocketRocket @@ -1843,6 +1843,8 @@ EXTERNAL SOURCES: hermes-engine: :podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec" :tag: hermes-2024-08-15-RNv0.75.1-4b3bf912cc0f705b51b71ce1a5b8bd79b93a451b + Instabug: + :podspec: https://ios-releases.instabug.com/custom/dream11/14.0.0/Instabug.podspec instabug-reactnative-ndk: :path: "../node_modules/instabug-reactnative-ndk" RCT-Folly: @@ -1993,7 +1995,7 @@ SPEC CHECKSUMS: Google-Maps-iOS-Utils: f77eab4c4326d7e6a277f8e23a0232402731913a GoogleMaps: 032f676450ba0779bd8ce16840690915f84e57ac hermes-engine: ea92f60f37dba025e293cbe4b4a548fd26b610a0 - Instabug: a0beffc01658773e2fac549845782f8937707dc4 + Instabug: 88b979bbd80e12580254585b99402a60f680d959 instabug-reactnative-ndk: d765ac289d56e8896398d02760d9abf2562fc641 OCMock: 589f2c84dacb1f5aaf6e4cec1f292551fe748e74 RCT-Folly: 4464f4d875961fce86008d45f4ecf6cef6de0740 @@ -2059,7 +2061,7 @@ SPEC CHECKSUMS: ReactCommon: 6a952e50c2a4b694731d7682aaa6c79bc156e4ad RNCClipboard: 2821ac938ef46f736a8de0c8814845dde2dcbdfb RNGestureHandler: 511250b190a284388f9dd0d2e56c1df76f14cfb8 - RNInstabug: 6660dcbf339b47468206d37659c67977b143484e + RNInstabug: 7a5c07f970be44aa73d2698a79a1d6954d929800 RNReanimated: f42a5044d121d68e91680caacb0293f4274228eb RNScreens: c7ceced6a8384cb9be5e7a5e88e9e714401fd958 RNSVG: 8b1a777d54096b8c2a0fd38fc9d5a454332bbb4d @@ -2067,6 +2069,6 @@ SPEC CHECKSUMS: SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d Yoga: 055f92ad73f8c8600a93f0e25ac0b2344c3b07e6 -PODFILE CHECKSUM: e337c2376579dfe7bf7bbaaeb766b185ea3fc261 +PODFILE CHECKSUM: a0fb4e0c8e6dcbeb77d9fab053936b2d0f2395a2 COCOAPODS: 1.14.0 diff --git a/examples/default/yarn.lock b/examples/default/yarn.lock index dac31901fa..dd630751fd 100644 --- a/examples/default/yarn.lock +++ b/examples/default/yarn.lock @@ -4411,7 +4411,7 @@ inline-style-prefixer@^6.0.1: "instabug-reactnative-ndk@github:https://github.com/Instabug/Instabug-React-Native-NDK": version "0.1.0" - resolved "https://codeload.github.com/Instabug/Instabug-React-Native-NDK/tar.gz/f1c06b354156d7ea301a361d3f246b38dc2aea51" + resolved "https://codeload.github.com/Instabug/Instabug-React-Native-NDK/tar.gz/d1bd019a5d0292eaac96ffd70fd584eeed0ef32e" "instabug-reactnative@link:../..": version "0.0.0" diff --git a/package.json b/package.json index 4c4f9e0f12..32b999f2a1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "instabug-reactnative", "description": "React Native plugin for integrating the Instabug SDK", - "version": "14.0.2", + "version": "14.2.1-SNAPSHOT", "author": "Instabug (https://instabug.com)", "repository": "github:Instabug/Instabug-React-Native", "homepage": "https://www.instabug.com/platforms/react-native", diff --git a/scripts/dream-11-delete-unused-features.sh b/scripts/dream-11-delete-unused-features.sh index fa10a9181e..1374988b58 100644 --- a/scripts/dream-11-delete-unused-features.sh +++ b/scripts/dream-11-delete-unused-features.sh @@ -59,4 +59,4 @@ node scripts/replace.js "return (major == 7 && minor >= 3) || major >= 8" "retur node scripts/replace.js "static boolean supportsNamespace() {" "$(printf "static boolean supportsNamespace() {\n return false")" android/build.gradle # Add Dream11 custom iOS build podspec to Podfile -node scripts/replace.js "target 'InstabugExample' do" "$(printf "target 'InstabugExample' do\n pod 'Instabug', :podspec => 'https://ios-releases.instabug.com/custom/dream11/Instabug.podspec'")" examples/default/ios/Podfile +#node scripts/replace.js "target 'InstabugExample' do" "$(printf "target 'InstabugExample' do\n pod 'Instabug', :podspec => 'https://ios-releases.instabug.com/custom/dream11/Instabug.podspec'")" examples/default/ios/Podfile diff --git a/src/modules/SessionReplay.ts b/src/modules/SessionReplay.ts index a0abcd3d76..04ec887bb2 100644 --- a/src/modules/SessionReplay.ts +++ b/src/modules/SessionReplay.ts @@ -94,6 +94,7 @@ export const getSessionReplayLink = async (): Promise => { export const setSyncCallback = async ( handler: (payload: SessionMetadata) => boolean, ): Promise => { + emitter.removeAllListeners(NativeEvents.SESSION_REPLAY_ON_SYNC_CALLBACK_INVOCATION); emitter.addListener(NativeEvents.SESSION_REPLAY_ON_SYNC_CALLBACK_INVOCATION, (payload) => { const result = handler(payload); const shouldSync = Boolean(result); @@ -104,6 +105,7 @@ export const setSyncCallback = async ( ); } + console.warn('IBG-RN: The callback passed to SessionReplay.setSyncCallback'); NativeSessionReplay.evaluateSync(shouldSync); });