Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
343 changes: 220 additions & 123 deletions .circleci/config.yml

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [Unreleased](https://github.com/Instabug/Instabug-React-Native/compare/v13.3.0...dev)

### Added

- Add support for Expo Router navigation tracking ([#1270](https://github.com/Instabug/Instabug-React-Native/pull/1270)).

### Fixed

- Fix APM network logging on iOS when the response body is missing or empty. ([#1273](https://github.com/Instabug/Instabug-React-Native/pull/1273)).

## [13.3.0](https://github.com/Instabug/Instabug-React-Native/compare/v13.2.0...v13.3.0) (August 4, 2024)

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import com.instabug.reactlibrary.RNInstabugAPMModule;
import com.instabug.reactlibrary.RNInstabugBugReportingModule;
import com.instabug.reactlibrary.RNInstabugCrashReportingModule;
import com.instabug.reactlibrary.RNInstabugFeatureRequestsModule;
import com.instabug.reactlibrary.RNInstabugReactnativeModule;
import com.instabug.reactlibrary.RNInstabugRepliesModule;
import com.instabug.reactlibrary.RNInstabugSessionReplayModule;
import com.instabug.reactlibrary.RNInstabugSurveysModule;

import java.util.ArrayList;
import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"instabug-domain": "api.instabug.com",
"apm-domain": "api-apm.instabug.com"
}
8 changes: 8 additions & 0 deletions examples/default/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,13 @@ allprojects {
maven {
url("$rootDir/../node_modules/detox/Detox-android")
}

maven {
credentials {
username System.getenv("DREAM11_MAVEN_USERNAME")
password System.getenv("DREAM11_MAVEN_PASSWORD")
}
url "https://mvn.instabug.com/nexus/repository/dream-11"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
CC3DF8932A1DFC9A003E9914 /* InstabugSurveysTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC3DF88B2A1DFC99003E9914 /* InstabugSurveysTests.m */; };
CC3DF8942A1DFC9A003E9914 /* InstabugAPMTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC3DF88C2A1DFC99003E9914 /* InstabugAPMTests.m */; };
CC3DF8952A1DFC9A003E9914 /* IBGConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = CC3DF88D2A1DFC9A003E9914 /* IBGConstants.m */; };
CC487A9C2C71FCFC0021F680 /* Instabug.plist in Resources */ = {isa = PBXBuildFile; fileRef = CC487A9B2C71FCFC0021F680 /* Instabug.plist */; };
CCF1E4092B022CF20024802D /* RNInstabugTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CCF1E4082B022CF20024802D /* RNInstabugTests.m */; };
CD36F4707EA1F435D2CC7A15 /* libPods-InstabugExample-InstabugTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AF7A6E02D40E0CEEA833CC4 /* libPods-InstabugExample-InstabugTests.a */; };
F7BF47401EF3A435254C97BB /* libPods-InstabugExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BAED0D0441A708AE2390E153 /* libPods-InstabugExample.a */; };
Expand Down Expand Up @@ -64,6 +65,7 @@
CC3DF88B2A1DFC99003E9914 /* InstabugSurveysTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InstabugSurveysTests.m; sourceTree = "<group>"; };
CC3DF88C2A1DFC99003E9914 /* InstabugAPMTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InstabugAPMTests.m; sourceTree = "<group>"; };
CC3DF88D2A1DFC9A003E9914 /* IBGConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IBGConstants.m; sourceTree = "<group>"; };
CC487A9B2C71FCFC0021F680 /* Instabug.plist */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; name = Instabug.plist; path = InstabugExample/Instabug.plist; sourceTree = "<group>"; };
CCF1E4082B022CF20024802D /* RNInstabugTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNInstabugTests.m; sourceTree = "<group>"; };
DBCB1B1D023646D84146C91E /* Pods-InstabugExample-InstabugTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InstabugExample-InstabugTests.release.xcconfig"; path = "Target Support Files/Pods-InstabugExample-InstabugTests/Pods-InstabugExample-InstabugTests.release.xcconfig"; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -120,6 +122,7 @@
13B07FAE1A68108700A75B9A /* InstabugExample */ = {
isa = PBXGroup;
children = (
CC487A9B2C71FCFC0021F680 /* Instabug.plist */,
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
13B07FB01A68108700A75B9A /* AppDelegate.mm */,
13B07FB51A68108700A75B9A /* Images.xcassets */,
Expand Down Expand Up @@ -296,6 +299,7 @@
buildActionMask = 2147483647;
files = (
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
CC487A9C2C71FCFC0021F680 /* Instabug.plist in Resources */,
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Binary file added examples/default/ios/InstabugExample/Instabug.plist
Binary file not shown.
1 change: 0 additions & 1 deletion examples/default/ios/InstabugTests/InstabugSampleTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#import <XCTest/XCTest.h>
#import "OCMock/OCMock.h"
#import "Instabug/Instabug.h"
#import "Instabug/IBGSurvey.h"
#import "InstabugReactBridge.h"
#import <Instabug/IBGTypes.h>
#import "IBGConstants.h"
Expand Down
1 change: 0 additions & 1 deletion examples/default/ios/InstabugTests/RNInstabugTests.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#import <XCTest/XCTest.h>
#import "OCMock/OCMock.h"
#import "Instabug/Instabug.h"
#import "Instabug/IBGSurvey.h"
#import <Instabug/IBGTypes.h>
#import "RNInstabug.h"
#import "RNInstabug/Instabug+CP.h"
Expand Down
4 changes: 3 additions & 1 deletion examples/default/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export const App: React.FC = () => {
}, []);

useEffect(() => {
Instabug.setNavigationListener(navigationRef);
const unregisterListener = Instabug.setNavigationListener(navigationRef);

return unregisterListener;
}, [navigationRef]);

return (
Expand Down
1 change: 0 additions & 1 deletion ios/RNInstabug/InstabugReactBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#import <Instabug/Instabug.h>
#import <Instabug/IBGBugReporting.h>
#import <Instabug/IBGCrashReporting.h>
#import <Instabug/IBGSurveys.h>
#import <Instabug/IBGLog.h>
#import <Instabug/IBGTypes.h>
#import "ArgsRegistry.h"
Expand Down
1 change: 0 additions & 1 deletion ios/RNInstabug/InstabugReactBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#import <Instabug/Instabug.h>
#import <Instabug/IBGBugReporting.h>
#import <Instabug/IBGCrashReporting.h>
#import <Instabug/IBGSurveys.h>
#import <Instabug/IBGLog.h>
#import <Instabug/IBGAPM.h>
#import <asl.h>
Expand Down
28 changes: 28 additions & 0 deletions scripts/customize-ios-endpoints.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# Replaces the internal Config.plist file inside the Instabug iOS SDK with the
# Instabug.plist file in the example app.
#
# This is a workaround until the iOS SDK is updated to prioritize the custom
# Instabug.plist over the internal Config.plist.

instabug_plist=examples/default/ios/InstabugExample/Instabug.plist

if [ ! -f $instabug_plist ]; then
echo "Instabug.plist not found"
exit 1
fi

for dir in examples/default/ios/Pods/Instabug/Instabug.xcframework/ios-*/
do
echo "Replacing Config.plist in $dir"

config_path=$dir/Instabug.framework/InstabugResources.bundle/Config.plist

if [ ! -f $config_path ]; then
echo "Config.plist not found in $dir"
exit 1
fi

cp -f $instabug_plist $config_path
done
70 changes: 42 additions & 28 deletions scripts/dream-11-delete-unused-features.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,61 @@

# remove survey and featureRequest features in JavaScript files
deletedFeaturesFilesInJavaScript=("Surveys" "FeatureRequests" "Survey")
for feature in "${deletedFeaturesFilesInJavaScript[@]}";
do
echo "$feature"
rm -f src/modules/"$feature".ts
rm -f test/mocks/mock"$feature".ts
sed -i "s/import..*$feature';//g" src/index.ts
sed -i "s/$feature,//g" src/index.ts

for feature in "${deletedFeaturesFilesInJavaScript[@]}"; do
echo "$feature"

rm -f src/modules/"$feature".ts
rm -f src/native/Native"$feature".ts
rm -f test/mocks/mock"$feature".ts
rm -f test/modules/"$feature".spec.ts

node scripts/replace.js --pattern "import.+$feature';" "" src/index.ts
node scripts/replace.js --pattern "$feature," "" src/index.ts
node scripts/replace.js --pattern ".*$feature.*" "" src/native/NativePackage.ts
node scripts/replace.js --pattern ".*$feature.*" "" test/mocks/mockNativeModules.ts
done
npx eslint src/index.ts --fix

npx eslint src/index.ts --fix

# remove survey and featureRequest features in Android files
deletedFeaturesFilesInAndroidApp=("RNInstabugSurveysModule" "RNInstabugFeatureRequestsModule")
for feature in "${deletedFeaturesFilesInAndroidApp[@]}";
do
echo "$feature"

rm -f android/src/main/java/com/instabug/reactlibrary/"$feature".java
rm -f android/src/test/java/com/instabug/reactlibrary/"$feature"Test.java
sed -i "s/modules.add(new $feature(reactContext));//g" android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativePackage.java
for feature in "${deletedFeaturesFilesInAndroidApp[@]}"; do
echo "$feature"

rm -f android/src/main/java/com/instabug/reactlibrary/"$feature".java
rm -f android/src/test/java/com/instabug/reactlibrary/"$feature"Test.java
node scripts/replace.js "modules.add(new $feature(reactContext));" "" android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativePackage.java
done

# remove survey and featureRequest features in IOS files
deletedFeaturesFilesInIosApp=("InstabugSurveysBridge" "InstabugFeatureRequestsBridge")
for feature in "${deletedFeaturesFilesInIosApp[@]}";
do
echo "$feature"
rm -f ios/RNInstabug/"$feature".h
rm -f ios/RNInstabug/"$feature".m
for feature in "${deletedFeaturesFilesInIosApp[@]}"; do
echo "$feature"
rm -f ios/RNInstabug/"$feature".h
rm -f ios/RNInstabug/"$feature".m
done
sed -i "s/\#import <Instabug\/IBGSurveys.h>//g" ios/RNInstabug/InstabugReactBridge.m
sed -i "s/\#import <Instabug\/IBGSurveys.h>//g" ios/RNInstabug/InstabugReactBridge.h

# Remove unused features iOS test files
iosTestFiles=("InstabugSurveysTests.m" "InstabugFeatureRequestsTests.m")
for file in "${iosTestFiles[@]}"; do
echo "Deleting $file"

rm -f examples/default/ios/InstabugTests/"$file"
node scripts/replace.js --pattern ".*$file.*" "" examples/default/ios/InstabugExample.xcodeproj/project.pbxproj
done

# remove all locales except English locale
sed -i -E '/english/!s/.*constants.locale.*//g' src/utils/Enums.ts
npx eslint src/index.ts --fix src/utils/Enums.ts
node scripts/replace.js "#import <Instabug/IBGSurveys.h>" "" ios/RNInstabug/InstabugReactBridge.m
node scripts/replace.js "#import <Instabug/IBGSurveys.h>" "" ios/RNInstabug/InstabugReactBridge.h

sed -i "s/return (major == 7 && minor >= 3) || major >= 8/return false/g" android/build.gradle
# Remove all locales except for English
# This ugly regular expression matches all lines not containing "english" and containing "constants.locale"
node scripts/replace.js --pattern "^(?!.*english).+constants\.locale.*" "" src/utils/Enums.ts
npx eslint src/index.ts --fix src/utils/Enums.ts

sed -i "s/static boolean supportsNamespace() {/static boolean supportsNamespace() { \n return false/g" android/build.gradle
node scripts/replace.js "return (major == 7 && minor >= 3) || major >= 8" "return false" android/build.gradle

# Note: printf is used here as the string contains a newline character which would be escaped otherwise.
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
24 changes: 20 additions & 4 deletions scripts/replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,33 @@

const fs = require('fs');
const path = require('path');
const { parseArgs } = require('util');

const [search, replace, ...files] = process.argv.slice(2);
const { values, positionals } = parseArgs({
allowPositionals: true,
options: {
pattern: {
type: 'boolean',
default: false,
short: 'p',
},
},
});

if (!search || !replace || !files.length) {
const [search, replace, ...files] = positionals;

/** Whether to replace the search string as a regular expression or as a literal string. */
const isPattern = values.pattern;

if (search == null || replace == null || !files.length) {
// The path of the script relative to the directory where the user ran the
// script to be used in the error message demonstrating the usage.
const scriptPath = path.relative(process.cwd(), __filename);

console.error('Missing arguments.');
console.table({ search, replace, files });

console.error(`Usage: node ${scriptPath} <search> <replace> <files...>`);
console.error(`Usage: node ${scriptPath} [-p | --pattern] <search> <replace> <files...>`);
process.exit(1);
}

Expand All @@ -31,7 +46,8 @@ for (const file of files) {

const fileContent = fs.readFileSync(filePath, 'utf8');

const newContent = fileContent.replaceAll(search, replace);
const searchPattern = isPattern ? new RegExp(search, 'gm') : search;
const newContent = fileContent.replaceAll(searchPattern, replace);

fs.writeFileSync(filePath, newContent);
} catch (error) {
Expand Down
30 changes: 0 additions & 30 deletions scripts/snapshot-branch.sh

This file was deleted.

4 changes: 2 additions & 2 deletions scripts/snapshot-comment.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ Your snapshot has been generated! :rocket:
You can install the snapshot through NPM:

```sh
npm install https://github.com/Instabug/Instabug-React-Native\#{BRANCH}
npm install instabug-reactnative@{VERSION}
```

or Yarn:

```sh
yarn add https://github.com/Instabug/Instabug-React-Native\#{BRANCH}
yarn add instabug-reactnative@{VERSION}
```
11 changes: 11 additions & 0 deletions scripts/snapshot-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Generates a snapshot version following the format {version}-{pr}{random-3-digit}-SNAPSHOT
# Example: 13.3.0-502861-SNAPSHOT

pr=$(basename $CIRCLE_PULL_REQUEST)
random=$(($RANDOM % 900 + 100))
version=$(jq -r '.version' package.json)
suffix="SNAPSHOT"

SNAPSHOT_VERSION="$version-$pr$random-$suffix"
2 changes: 1 addition & 1 deletion src/modules/Instabug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ export const onStateChange = (state?: NavigationStateV5) => {
export const setNavigationListener = (
navigationRef: NavigationContainerRefWithCurrent<ReactNavigation.RootParamList>,
) => {
navigationRef.addListener('state', () => {
return navigationRef.addListener('state', () => {
onStateChange(navigationRef.getRootState());
});
};
Expand Down
2 changes: 1 addition & 1 deletion src/utils/XhrNetworkInterceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default {
const _response = this._response;
cloneNetwork.requestBody =
typeof _response === 'string' ? _response : JSON.stringify(_response);
cloneNetwork.responseBody = null;
cloneNetwork.responseBody = '';
}

if (this.response) {
Expand Down
Loading