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 45 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 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
6f4b1f0
chore(android): add dependency
kholood-ea May 22, 2025
00941f1
Merge remote-tracking branch 'origin/dev' into feat/support-expo-updates
kholood-ea May 22, 2025
446c0dd
chore(CI): fix sync_generated_files task
kholood-ea May 26, 2025
269f1ee
chore(CI): fix sync_generated_files task
kholood-ea May 26, 2025
3be4aec
chore(android): update snapshot
kholood-ea May 26, 2025
5dd2171
chore(CI): fix ios sync
kholood-ea May 27, 2025
8b46001
Merge remote-tracking branch 'origin/dev' into feat/support-expo-updates
kholood-ea May 27, 2025
4d0028f
chore: fix CI sync_generated_files job
kholood-ea May 27, 2025
2bba167
hore: fix CI sync_generated_files job
kholood-ea May 27, 2025
cc16257
chore(ios): update custom build
kholood-ea May 28, 2025
1147b5e
chore: fix CI sync_generated_files job
kholood-ea May 28, 2025
92a7cfb
fix(ios): service type mismatch
kholood-ea Jun 2, 2025
e40e4b9
fix(ios): fix test SetOverAirVersion
kholood-ea Jun 4, 2025
e2c613d
fix(ios): fix test SetOverAirVersion
kholood-ea Jun 4, 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'
version: '14.3.1.6745207-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 @@ -148,7 +148,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 @@ -173,6 +174,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 @@ -192,6 +203,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
2 changes: 1 addition & 1 deletion examples/default/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ buildscript {
classpath("com.android.tools.build:gradle:8.1.0")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("com.instabug.library:instabug-plugin:14.1.0.6273967-SNAPSHOT")
classpath("com.instabug.library:instabug-plugin:14.3.1.6745207-SNAPSHOT")
}
}

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":@(IBGOverAirTypeExpo),
@"version":@"D0A12345-6789-4B3C-A123-4567ABCDEF01"
};

[RNInstabug setOverAirVersion:overAirVersion];

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

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

[RNInstabug setOverAirVersion:overAirVersion];

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

@end
2 changes: 1 addition & 1 deletion examples/default/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +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/sanity/15.0.1/Instabug.podspec'
pod 'Instabug', :podspec => 'https://ios-releases.instabug.com/custom/feature-expose_network_limit-expose_body_limit/15.0.1/Instabug.podspec'
# Flags change depending on the env values.
flags = get_default_flags()

Expand Down
8 changes: 4 additions & 4 deletions examples/default/ios/Podfile.lock
Original file line number Diff line number Diff line change
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/sanity/15.0.1/Instabug.podspec`)
- Instabug (from `https://ios-releases.instabug.com/custom/feature-expose_network_limit-expose_body_limit/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/sanity/15.0.1/Instabug.podspec
:podspec: https://ios-releases.instabug.com/custom/feature-expose_network_limit-expose_body_limit/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: 9e81b71be68626dafc74759f3458f7c5894dd2e1
Instabug: ba6587d15ad5e3ffa265afc8174ff83af4eed29d
instabug-reactnative-ndk: d765ac289d56e8896398d02760d9abf2562fc641
OCMock: 589f2c84dacb1f5aaf6e4cec1f292551fe748e74
RCT-Folly: 4464f4d875961fce86008d45f4ecf6cef6de0740
Expand Down Expand Up @@ -2100,6 +2100,6 @@ SPEC CHECKSUMS:
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Yoga: 055f92ad73f8c8600a93f0e25ac0b2344c3b07e6

PODFILE CHECKSUM: a1b532d67a1a86843e1f086101751ad55afa52da
PODFILE CHECKSUM: f7f8d2b03a0b566cb0f5b4b422469af0a1a278b1

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 @@ -13,6 +13,7 @@ import Instabug, {
NetworkLogger,
ReproStepsMode,
SessionReplay,
OverAirUpdateServices,
} from 'instabug-reactnative';
import { NativeBaseProvider } from 'native-base';

Expand Down Expand Up @@ -51,6 +52,7 @@ export const App: React.FC = () => {
invocationEvents: [InvocationEvent.floatingButton],
debugLogsLevel: LogLevel.verbose,
networkInterceptionMode: NetworkInterceptionMode.native,
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