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

Draft
wants to merge 30 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 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
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

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

### Added

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

## [14.3.0](https://github.com/Instabug/Instabug-React-Native/compare/v14.1.0...14.3.0)

### Added
Expand Down
2 changes: 1 addition & 1 deletion RNInstabug.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Pod::Spec.new do |s|
s.homepage = package["homepage"]
s.source = { :git => "https://github.com/Instabug/Instabug-React-Native.git", :tag => 'v' + package["version"] }

s.platform = :ios, "9.0"
s.platform = :ios, "13.0"
s.source_files = "ios/**/*.{h,m,mm}"

s.dependency 'React-Core'
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.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 java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -60,6 +61,7 @@ static Map<String, Object> getAll() {
putAll(locales);
putAll(placeholders);
putAll(launchType);
putAll(overAirUpdateService);
}};
}

Expand Down Expand Up @@ -246,6 +248,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 @@ -144,7 +144,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 @@ -169,6 +170,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 @@ -188,6 +199,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 org.junit.After;
Expand Down Expand Up @@ -213,6 +214,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 Expand Up @@ -663,18 +679,18 @@ public void testW3CCaughtHeaderFlag(){
verify(promise).resolve(expected);
}


@Test
public void testSetNetworkLogBodyEnabled() {
rnModule.setNetworkLogBodyEnabled(true);

mockInstabug.verify(() -> Instabug.setNetworkLogBodyEnabled(true));
}

@Test
public void testSetNetworkLogBodyDisabled() {
rnModule.setNetworkLogBodyEnabled(false);

mockInstabug.verify(() -> Instabug.setNetworkLogBodyEnabled(false));
}
}
6 changes: 3 additions & 3 deletions examples/default/ios/InstabugTests/InstabugAPMTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#import <XCTest/XCTest.h>
#import "OCMock/OCMock.h"
#import "InstabugAPMBridge.h"
#import <Instabug/IBGTypes.h>
#import <Instabug/IBGAPM.h>
#import "Instabug/Instabug.h"
#import <InstabugSDK/IBGTypes.h>
#import <InstabugSDK/IBGAPM.h>
#import "InstabugSDK/InstabugSDK.h"
#import "IBGConstants.h"
#import "RNInstabug/IBGAPM+PrivateAPIs.h"

Expand Down
14 changes: 7 additions & 7 deletions examples/default/ios/InstabugTests/InstabugBugReportingTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#import <XCTest/XCTest.h>
#import "OCMock/OCMock.h"
#import "InstabugBugReportingBridge.h"
#import <Instabug/IBGTypes.h>
#import "Instabug/Instabug.h"
#import <InstabugSDK/IBGTypes.h>
#import "InstabugSDK/InstabugSDK.h"
#import "IBGConstants.h"

@interface InstabugBugReportingTests : XCTestCase
Expand Down Expand Up @@ -39,7 +39,7 @@ - (void) testgivenBoolean$setBugReportingEnabled_whenQuery_thenShouldCallNativeA
- (void) testgivenInvocationEvent$setInvocationEvents_whenQuery_thenShouldCallNativeApiWithArgs {
NSArray *invocationEventsArr;
invocationEventsArr = [NSArray arrayWithObjects: @(IBGInvocationEventScreenshot), nil];

[self.instabugBridge setInvocationEvents:invocationEventsArr];
IBGInvocationEvent invocationEvents = 0;
for (NSNumber *boxedValue in invocationEventsArr) {
Expand Down Expand Up @@ -76,7 +76,7 @@ - (void) testgivenHandlerSUBMIT$setOnSDKDismissedHandler_whenQuery_thenShouldCal
RCTResponseSenderBlock callback = ^(NSArray *response) {};
[partialMock setOnSDKDismissedHandler:callback];
XCTAssertNotNil(IBGBugReporting.didDismissHandler);

NSDictionary *result = @{ @"dismissType": @"SUBMIT",
@"reportType": @"feedback"};
OCMStub([partialMock sendEventWithName:@"IBGpostInvocationHandler" body:result]);
Expand Down Expand Up @@ -137,14 +137,14 @@ - (void) testgivenArgs$showBugReportingWithReportTypeAndOptions_whenQuery_thenSh
}
OCMStub([mock showWithReportType:reportType options:parsedOptions]);
[self.instabugBridge show:reportType options:options];

XCTestExpectation *expectation = [self expectationWithDescription:@"Test ME PLX"];

[[NSRunLoop mainRunLoop] performBlock:^{
OCMVerify([mock showWithReportType:reportType options:parsedOptions]);
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:EXPECTATION_TIMEOUT handler:nil];
}

Expand Down
12 changes: 6 additions & 6 deletions examples/default/ios/InstabugTests/InstabugCrashReportingTests.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import <XCTest/XCTest.h>
#import "Instabug/Instabug.h"
#import "InstabugSDK/InstabugSDK.h"
#import "InstabugCrashReportingBridge.h"
#import "OCMock/OCMock.h"
#import "Util/IBGCrashReporting+CP.h"
Expand All @@ -19,10 +19,10 @@ - (void)setUp {
}

- (void)testSetEnabled {

[self.bridge setEnabled:NO];
XCTAssertFalse(IBGCrashReporting.enabled);

[self.bridge setEnabled:YES];
XCTAssertTrue(IBGCrashReporting.enabled);

Expand All @@ -37,7 +37,7 @@ - (void)testSendJSCrash {
[expectation fulfill];
};
RCTPromiseRejectBlock reject = ^(NSString *code, NSString *message, NSError *error) {};

[self.bridge sendJSCrash:stackTrace resolver:resolve rejecter:reject];

[self waitForExpectations:@[expectation] timeout:1];
Expand All @@ -52,9 +52,9 @@ - (void)testSendNonFatalErrorJsonCrash {
NSDictionary *userAttributes = @{ @"key" : @"value", };
IBGNonFatalLevel ibgNonFatalLevel = IBGNonFatalLevelInfo;


[self.bridge sendHandledJSCrash:jsonCrash userAttributes:userAttributes fingerprint:fingerPrint nonFatalExceptionLevel:ibgNonFatalLevel resolver:resolve rejecter:reject];

OCMVerify([self.mCrashReporting cp_reportNonFatalCrashWithStackTrace:jsonCrash
level:IBGNonFatalLevelInfo
groupingString:fingerPrint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#import <XCTest/XCTest.h>
#import "OCMock/OCMock.h"
#import "InstabugFeatureRequestsBridge.h"
#import <Instabug/IBGTypes.h>
#import "Instabug/Instabug.h"
#import <InstabugSDK/IBGTypes.h>
#import "InstabugSDK/InstabugSDK.h"
#import "IBGConstants.h"

@interface InstabugFeatureRequestsTests : XCTestCase
Expand Down Expand Up @@ -48,12 +48,12 @@ - (void) testgive$show_whenQuery_thenShouldCallNativeApi {
OCMStub([mock show]);
[self.instabugBridge show];
XCTestExpectation *expectation = [self expectationWithDescription:@"Test ME PLX"];

[[NSRunLoop mainRunLoop] performBlock:^{
OCMVerify([mock show]);
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:EXPECTATION_TIMEOUT handler:nil];
}

Expand Down
12 changes: 6 additions & 6 deletions examples/default/ios/InstabugTests/InstabugRepliesTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#import <XCTest/XCTest.h>
#import "OCMock/OCMock.h"
#import "InstabugRepliesBridge.h"
#import <Instabug/IBGTypes.h>
#import "Instabug/Instabug.h"
#import <InstabugSDK/IBGTypes.h>
#import "InstabugSDK/InstabugSDK.h"
#import "IBGConstants.h"

@interface InstabugRepliesTests : XCTestCase
Expand Down Expand Up @@ -53,12 +53,12 @@ - (void) testgiven$show_whenQuery_thenShouldCallNativeApi {
OCMStub([mock show]);
[self.instabugBridge show];
XCTestExpectation *expectation = [self expectationWithDescription:@"Test ME PLX"];

[[NSRunLoop mainRunLoop] performBlock:^{
OCMVerify([mock show]);
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:EXPECTATION_TIMEOUT handler:nil];
}

Expand All @@ -67,7 +67,7 @@ - (void) testgivenOnNewReplyReceivedHandler$setOnNewReplyReceivedCallback_whenQu
RCTResponseSenderBlock callback = ^(NSArray *response) {};
[partialMock setOnNewReplyReceivedHandler:callback];
XCTAssertNotNil(IBGReplies.didReceiveReplyHandler);

OCMStub([partialMock sendEventWithName:@"IBGOnNewReplyReceivedCallback" body:nil]);
IBGReplies.didReceiveReplyHandler();
OCMVerify([partialMock sendEventWithName:@"IBGOnNewReplyReceivedCallback" body:nil]);
Expand All @@ -90,7 +90,7 @@ - (void) testgivenBoolean$setInAppNotificationEnabled_whenQuery_thenShouldCallNa
- (void)testSetPushNotificationsEnabled {
id mock = OCMClassMock([IBGReplies class]);
BOOL isPushNotificationEnabled = true;

OCMStub([mock setPushNotificationsEnabled:isPushNotificationEnabled]);
[self.instabugBridge setPushNotificationsEnabled:isPushNotificationEnabled];
OCMVerify([mock setPushNotificationsEnabled:isPushNotificationEnabled]);
Expand Down
Loading