Skip to content

feat: support expo updates #1391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2b094ca
Release:v14.1.0 (#1338)
ahmedAlaaInstabug Jan 2, 2025
4266b4e
Merge branch 'dev' into dev-to-master
AyaMahmoud148 Apr 15, 2025
7ff76ea
Merge pull request #1380 from Instabug/dev-to-master
mzelzoghbi Apr 15, 2025
06a2ebc
feat: xcode 16 support
ahmedAlaaInstabug Apr 22, 2025
c0ec017
feat: xcode 16 support
ahmedAlaaInstabug Apr 28, 2025
8bdf690
feat: xcode 16 support
ahmedAlaaInstabug Apr 28, 2025
6ac4e42
feat: xcode 16 support
ahmedAlaaInstabug Apr 28, 2025
40bb064
feat: xcode 16 support
ahmedAlaaInstabug Apr 28, 2025
0b4f99c
feat: xcode 16 support
ahmedAlaaInstabug Apr 28, 2025
14cf708
feat: xcode 16 support
ahmedAlaaInstabug Apr 28, 2025
272b456
feat: xcode 16 support
ahmedAlaaInstabug Apr 28, 2025
7db8966
feat: xcode 16 support
ahmedAlaaInstabug Apr 28, 2025
e00c9c7
feat: xcode 16 support
ahmedAlaaInstabug Apr 28, 2025
a80db8d
feat: xcode 16 support
ahmedAlaaInstabug Apr 28, 2025
ea749d4
chore: integrate iOS expo updates support custom build
kholood-ea May 14, 2025
b454240
feat[ios]: add setOverAirVersion
kholood-ea May 14, 2025
051024a
feat[ios]: test setOverAirVersion
kholood-ea May 14, 2025
d42d927
feat: add setOverAirVersion
kholood-ea May 14, 2025
f37fd3e
feat: test setOverAirVersion
kholood-ea May 14, 2025
bb56fac
chore[ios]: revert old cocoapods version
kholood-ea May 14, 2025
d20ce0a
chore(example): revert old example app
kholood-ea May 15, 2025
2bad26a
chore (example): fix lint
kholood-ea May 15, 2025
285ecfd
chore(android): integrate with expo updates android snapshot
kholood-ea May 16, 2025
f8bb491
feat(android): add setOverAirVersion API
kholood-ea May 16, 2025
e84dfd7
chore: add changelog item
kholood-ea May 19, 2025
92749b9
chore(android): remove log
kholood-ea May 19, 2025
2327790
chore(iOS): fix failing CI
kholood-ea May 19, 2025
3cfaf49
chore(ios): workaround failing CI
kholood-ea May 19, 2025
b4b129b
ci: fix ci running
ahmedAlaaInstabug May 20, 2025
f0293bb
ci: fix ci running
ahmedAlaaInstabug May 20, 2025
be14bf5
Merge remote-tracking branch 'origin/dev' into feat/support-expo-updates
kholood-ea May 21, 2025
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Added

- Add support for expo updates versioning ([#1391](https://github.com/Instabug/Instabug-React-Native/pull/1391))

- Add support enable/disable screenshot auto masking. ([#1389](https://github.com/Instabug/Instabug-React-Native/pull/1389))

- Add support for BugReporting user consents. ([#1383](https://github.com/Instabug/Instabug-React-Native/pull/1383))
Expand Down
2 changes: 1 addition & 1 deletion android/native.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project.ext.instabug = [
version: '14.3.0.6752106-SNAPSHOT'
version: '14.3.0.6745894-SNAPSHOT'
]

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.instabug.library.invocation.util.InstabugVideoRecordingButtonPosition;
import com.instabug.library.sessionreplay.model.SessionMetadata;
import com.instabug.library.ui.onboarding.WelcomeMessage;
import com.instabug.library.util.overairversion.OverAirVersionType;
import com.instabug.library.MaskingType;

import java.util.ArrayList;
Expand Down Expand Up @@ -61,6 +62,7 @@ static Map<String, Object> getAll() {
putAll(locales);
putAll(placeholders);
putAll(launchType);
putAll(overAirUpdateService);
putAll(autoMaskingTypes);
putAll(userConsentActionType);
}};
Expand Down Expand Up @@ -255,6 +257,11 @@ static Map<String, Object> getAll() {
put("warm",SessionMetadata.LaunchType.WARM );
put("unknown","unknown");
}};

public static ArgsMap<Integer> overAirUpdateService = new ArgsMap<Integer>() {{
put("expo", OverAirVersionType.EXPO);
put("codePush",OverAirVersionType.CODE_PUSH );
}};

// Temporary workaround to be removed in future release
// This is used for mapping native `LaunchType` values into React Native enum values.
Expand Down
27 changes: 27 additions & 0 deletions android/src/main/java/com/instabug/reactlibrary/RNInstabug.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;

import com.facebook.react.bridge.ReadableMap;
import com.instabug.apm.APM;
import com.instabug.library.Instabug;
import com.instabug.library.LogLevel;
Expand Down Expand Up @@ -156,6 +157,11 @@ public static class Builder {
*/
private String codePushVersion;

/**
* The overAirUpdate Version to be used for all reports.
*/
private ReadableMap overAirVersion;

/**
* The events that trigger the SDK's user interface.
*/
Expand Down Expand Up @@ -210,6 +216,16 @@ public Builder setCodePushVersion(String codePushVersion) {
return this;
}

/**
* Sets over air update version to be used for all reports.
*
* @param overAirVersion the over air update version and service map.
*/
public Builder setOverAirVersion(ReadableMap overAirVersion) {
this.overAirVersion = overAirVersion;
return this;
}

/**
* Sets the invocation triggering events for the SDK's user interface
*
Expand Down Expand Up @@ -237,6 +253,17 @@ public void build() {
instabugBuilder.setCodePushVersion(codePushVersion);
}

if (overAirVersion != null ) {
if (overAirVersion.hasKey("service") && overAirVersion.hasKey("version"))
{
if (overAirVersion.getString("service")!=null && overAirVersion.getString("version")!=null)
{
instabugBuilder.setOverAirVersion(overAirVersion.getString("version"),
ArgsRegistry.overAirUpdateService.get(overAirVersion.getString("service")));
}
}
}

instabugBuilder.build();

// Temporarily disabling APM hot launches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ public void init(
final ReadableArray invocationEventValues,
final String logLevel,
final boolean useNativeNetworkInterception,
@Nullable final String codePushVersion
@Nullable final String codePushVersion,
@Nullable final ReadableMap overAirVersion
) {
MainThreadHandler.runOnMainThread(new Runnable() {
@Override
Expand All @@ -170,6 +171,16 @@ public void run() {
builder.setCodePushVersion(codePushVersion);
}
}

if(overAirVersion != null ) {
if(Instabug.isBuilt()) {
Instabug.setOverAirVersion(overAirVersion.getString("version"),
ArgsRegistry.overAirUpdateService.get(overAirVersion.getString("service")));
} else {
builder.setOverAirVersion(overAirVersion);
}
}

builder.build();
}
});
Expand All @@ -189,6 +200,22 @@ public void run() {
});
}

@ReactMethod
public void setOverAirVersion(@Nullable final ReadableMap overAirVersion) {
MainThreadHandler.runOnMainThread(new Runnable() {
@Override
public void run() {
try {
Instabug.setOverAirVersion(overAirVersion.getString("version"),
ArgsRegistry.overAirUpdateService.get(overAirVersion.getString("service")));

} catch (Exception e) {
e.printStackTrace();
}
}
});
}


/**
* Adds tag(s) to issues before sending them
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.instabug.library.featuresflags.model.IBGFeatureFlag;
import com.instabug.library.internal.module.InstabugLocale;
import com.instabug.library.ui.onboarding.WelcomeMessage;
import com.instabug.library.util.overairversion.OverAirVersionType;
import com.instabug.reactlibrary.utils.MainThreadHandler;
import com.instabug.library.MaskingType;

Expand Down Expand Up @@ -214,6 +215,21 @@ public void testSetCodePushVersion() {
mockInstabug.verify(() -> Instabug.setCodePushVersion(codePushVersion));
}

@Test
public void testSetOverAirVersion() {
WritableMap mockMap = mock(WritableMap.class);

String version="D0A12345-6789-4B3C-A123-4567ABCDEF0";

when(mockMap.getString("version")).thenReturn(version);
when(mockMap.getString("service")).thenReturn("expo");

rnModule.setOverAirVersion(mockMap);

mockInstabug.verify(() -> Instabug.setOverAirVersion(
version, OverAirVersionType.EXPO));
}

@Test
public void testIdentifyUserWithNoId() {
// given
Expand Down
28 changes: 25 additions & 3 deletions examples/default/ios/InstabugTests/InstabugSampleTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,26 @@ - (void)testInit {
NSString *appToken = @"app_token";
NSString *codePushVersion = @"1.0.0(1)";
NSArray *invocationEvents = [NSArray arrayWithObjects:[NSNumber numberWithInteger:floatingButtonInvocationEvent], nil];
NSDictionary *overAirVersion = @{
@"service":@"expo",
@"version":@"D0A12345-6789-4B3C-A123-4567ABCDEF01"
};
BOOL useNativeNetworkInterception = YES;
IBGSDKDebugLogsLevel sdkDebugLogsLevel = IBGSDKDebugLogsLevelDebug;
IBGOverAirType service = [ArgsRegistry.overAirServices[overAirVersion[@"service"]] intValue];

OCMStub([mock setCodePushVersion:codePushVersion]);
OCMStub([mock setOverAirVersion:overAirVersion[@"version"] withType:service]);

[self.instabugBridge init:appToken invocationEvents:invocationEvents debugLogsLevel:sdkDebugLogsLevel useNativeNetworkInterception:useNativeNetworkInterception codePushVersion:codePushVersion];
[self.instabugBridge init:appToken invocationEvents:invocationEvents debugLogsLevel:sdkDebugLogsLevel useNativeNetworkInterception:useNativeNetworkInterception codePushVersion:codePushVersion overAirVersion:overAirVersion];
OCMVerify([mock setCodePushVersion:codePushVersion]);


OCMVerify([mock setOverAirVersion:overAirVersion[@"version"] withType:service]);

OCMVerify([self.mRNInstabug initWithToken:appToken invocationEvents:floatingButtonInvocationEvent debugLogsLevel:sdkDebugLogsLevel useNativeNetworkInterception:useNativeNetworkInterception]);
}

- (void)testSetCodePushVersion {
- (void)test {
id mock = OCMClassMock([Instabug class]);
NSString *codePushVersion = @"123";

Expand All @@ -90,6 +98,20 @@ - (void)testSetCodePushVersion {
OCMVerify([mock setCodePushVersion:codePushVersion]);
}

- (void)testSetOverAirVersion {
id mock = OCMClassMock([Instabug class]);
NSDictionary *overAirVersion = @{
@"service":@"expo",
@"version":@"D0A12345-6789-4B3C-A123-4567ABCDEF01"
};

[self.instabugBridge setOverAirVersion:overAirVersion];

IBGOverAirType service = [ArgsRegistry.overAirServices[overAirVersion[@"service"]] intValue];

OCMVerify([mock setOverAirVersion:overAirVersion[@"version"] withType:service]);
}

- (void)testSetUserData {
id mock = OCMClassMock([Instabug class]);
NSString *userData = @"user_data";
Expand Down
22 changes: 22 additions & 0 deletions examples/default/ios/InstabugTests/RNInstabugTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,26 @@ - (void) testSetCodePushVersion {
OCMVerify([self.mInstabug setCodePushVersion:codePushVersion]);
}

- (void)testSetOverAirVersionExpo {
NSDictionary *overAirVersion = @{
@"service":@"expo",
@"version":@"D0A12345-6789-4B3C-A123-4567ABCDEF01"
};

[RNInstabug setOverAirVersion:overAirVersion];

OCMVerify([self.mInstabug setOverAirVersion:overAirVersion[@"version"] withType:IBGOverAirTypeExpo]);
}

- (void)testSetOverAirVersionCodepush {
NSDictionary *overAirVersion = @{
@"service":@"codePush",
@"version":@"2.0.0"
};

[RNInstabug setOverAirVersion:overAirVersion];

OCMVerify([self.mInstabug setOverAirVersion:overAirVersion[@"version"] withType:IBGOverAirTypeCodePush]);
}

@end
3 changes: 1 addition & 2 deletions examples/default/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ target 'InstabugExample' do
rn_maps_path = '../node_modules/react-native-maps'
pod 'react-native-google-maps', :path => rn_maps_path
# add this line
pod 'Instabug', :podspec => 'https://ios-releases.instabug.com/custom/fix-main-thread-warning/15.0.0/Instabug.podspec'

pod 'Instabug', :podspec => 'https://ios-releases.instabug.com/custom/feature-support_expo_updates-base/15.0.1/Instabug.podspec'
# Flags change depending on the env values.
flags = get_default_flags()

Expand Down
14 changes: 7 additions & 7 deletions examples/default/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ PODS:
- hermes-engine (0.75.4):
- hermes-engine/Pre-built (= 0.75.4)
- hermes-engine/Pre-built (0.75.4)
- Instabug (15.0.0)
- Instabug (15.0.1)
- instabug-reactnative-ndk (0.1.0):
- DoubleConversion
- glog
Expand Down Expand Up @@ -1626,7 +1626,7 @@ PODS:
- ReactCommon/turbomodule/core
- Yoga
- RNInstabug (14.3.0):
- Instabug (= 15.0.0)
- Instabug (= 15.0.1)
- React-Core
- RNReanimated (3.16.1):
- DoubleConversion
Expand Down Expand Up @@ -1770,7 +1770,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/fix-main-thread-warning/15.0.0/Instabug.podspec`)
- Instabug (from `https://ios-releases.instabug.com/custom/feature-support_expo_updates-base/15.0.1/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`)
Expand Down Expand Up @@ -1869,7 +1869,7 @@ EXTERNAL SOURCES:
: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/fix-main-thread-warning/15.0.0/Instabug.podspec
:podspec: https://ios-releases.instabug.com/custom/feature-support_expo_updates-base/15.0.1/Instabug.podspec
instabug-reactnative-ndk:
:path: "../node_modules/instabug-reactnative-ndk"
RCT-Folly:
Expand Down Expand Up @@ -2024,7 +2024,7 @@ SPEC CHECKSUMS:
Google-Maps-iOS-Utils: f77eab4c4326d7e6a277f8e23a0232402731913a
GoogleMaps: 032f676450ba0779bd8ce16840690915f84e57ac
hermes-engine: ea92f60f37dba025e293cbe4b4a548fd26b610a0
Instabug: 3b1db5a683e85ec5a02946aa2b3314036f9022be
Instabug: 0361d294a630f64f4d6f43a5b14b752c05ed33bd
instabug-reactnative-ndk: d765ac289d56e8896398d02760d9abf2562fc641
OCMock: 589f2c84dacb1f5aaf6e4cec1f292551fe748e74
RCT-Folly: 4464f4d875961fce86008d45f4ecf6cef6de0740
Expand Down Expand Up @@ -2092,14 +2092,14 @@ SPEC CHECKSUMS:
ReactCommon: 6a952e50c2a4b694731d7682aaa6c79bc156e4ad
RNCClipboard: 2821ac938ef46f736a8de0c8814845dde2dcbdfb
RNGestureHandler: 511250b190a284388f9dd0d2e56c1df76f14cfb8
RNInstabug: fd8d5ad4eab9a25aa85534e3b32f400cb0a4b61c
RNInstabug: 8e04255f8502e9d5ed698cfa6004250eb5f47c34
RNReanimated: f42a5044d121d68e91680caacb0293f4274228eb
RNScreens: c7ceced6a8384cb9be5e7a5e88e9e714401fd958
RNSVG: 8b1a777d54096b8c2a0fd38fc9d5a454332bbb4d
RNVectorIcons: 6382277afab3c54658e9d555ee0faa7a37827136
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Yoga: 055f92ad73f8c8600a93f0e25ac0b2344c3b07e6

PODFILE CHECKSUM: 62df19179352b0c81c037eac790f1c5fb84b8ed0
PODFILE CHECKSUM: ebb62efa2907f35cc654c399e2dc850dd23a40c1

COCOAPODS: 1.14.0
2 changes: 2 additions & 0 deletions examples/default/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Instabug, {
ReproStepsMode,
SessionReplay,
LaunchType,
OverAirUpdateServices,
} from 'instabug-reactnative';
import type { SessionMetadata } from 'instabug-reactnative';
import { NativeBaseProvider } from 'native-base';
Expand Down Expand Up @@ -45,6 +46,7 @@ export const App: React.FC = () => {
token: 'deb1910a7342814af4e4c9210c786f35',
invocationEvents: [InvocationEvent.floatingButton],
debugLogsLevel: LogLevel.verbose,
overAirVersion: { service: OverAirUpdateServices.codePush, version: '1.0.0' },
});
CrashReporting.setNDKCrashesEnabled(true);

Expand Down
1 change: 0 additions & 1 deletion examples/default/src/screens/HomeScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';

import type { NativeStackScreenProps } from '@react-navigation/native-stack';

import { ListTile } from '../components/ListTile';
import { Screen } from '../components/Screen';
import type { HomeStackParamList } from '../navigation/HomeStack';
Expand Down
1 change: 1 addition & 0 deletions ios/RNInstabug/ArgsRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ typedef NSDictionary<NSString*, NSNumber*> ArgsDictionary;
+ (ArgsDictionary *) locales;
+ (ArgsDictionary *)nonFatalExceptionLevel;
+ (ArgsDictionary *) launchType;
+ (ArgsDictionary *) overAirServices;
+ (ArgsDictionary *) userConsentActionTypes;

+ (NSDictionary<NSString *, NSString *> *) placeholders;
Expand Down
8 changes: 8 additions & 0 deletions ios/RNInstabug/ArgsRegistry.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ + (NSMutableDictionary *) getAll {
[all addEntriesFromDictionary:ArgsRegistry.nonFatalExceptionLevel];
[all addEntriesFromDictionary:ArgsRegistry.placeholders];
[all addEntriesFromDictionary:ArgsRegistry.launchType];
[all addEntriesFromDictionary:ArgsRegistry.overAirServices];

[all addEntriesFromDictionary:ArgsRegistry.autoMaskingTypes];
[all addEntriesFromDictionary:ArgsRegistry.userConsentActionTypes];

Expand Down Expand Up @@ -256,6 +258,12 @@ + (ArgsDictionary *) launchType {
@"unknown":@(LaunchTypeUnknown)
};
}
+ (ArgsDictionary *) overAirServices {
return @{
@"expo":@(IBGOverAirTypeExpo) ,
@"codePush":@(IBGOverAirTypeCodePush),
};
}

+ (ArgsDictionary *)autoMaskingTypes {
return @{
Expand Down
4 changes: 3 additions & 1 deletion ios/RNInstabug/InstabugReactBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@

- (void)setEnabled:(BOOL)isEnabled;

- (void)init:(NSString *)token invocationEvents:(NSArray *)invocationEventsArray debugLogsLevel:(IBGSDKDebugLogsLevel)sdkDebugLogsLevel useNativeNetworkInterception:(BOOL)useNativeNetworkInterception codePushVersion:(NSString *)codePushVersion;
- (void)init:(NSString *)token invocationEvents:(NSArray *)invocationEventsArray debugLogsLevel:(IBGSDKDebugLogsLevel)sdkDebugLogsLevel useNativeNetworkInterception:(BOOL)useNativeNetworkInterception codePushVersion:(NSString *)codePushVersion overAirVersion:(NSDictionary *)overAirVersion;

- (void)setCodePushVersion:(NSString *)version;

- (void)setOverAirVersion:(NSDictionary *)overAirVersion;

- (void)setUserData:(NSString *)userData;

- (void)setTrackUserSteps:(BOOL)isEnabled;
Expand Down
Loading