Skip to content
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

upgrade: native Android & iOS snapshots to 14.1.0 #1334

Open
wants to merge 3 commits into
base: feat/network-spans
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
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.0.0.6273368-SNAPSHOT'
version: '14.1.0.6273967-SNAPSHOT'
]

dependencies {
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.0.0.6273368-SNAPSHOT")
classpath("com.instabug.library:instabug-plugin:14.1.0.6273967-SNAPSHOT")
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/default/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ target 'InstabugExample' do
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/release-support_cp_network_filtering_obfuscation-add_reset_network_state/13.4.3/Instabug.podspec'
pod 'Instabug', :podspec => 'https://ios-releases.instabug.com/custom/feature-support_cp_network_filtering_obfuscation-base/14.1.0/Instabug.podspec'
use_react_native!(
:path => config[:reactNativePath],
# An absolute path to your application root.
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 (13.4.3)
- Instabug (14.1.0)
- instabug-reactnative-ndk (0.1.0):
- DoubleConversion
- glog
Expand Down Expand Up @@ -1603,7 +1603,7 @@ PODS:
- ReactCommon/turbomodule/core
- Yoga
- RNInstabug (13.4.0):
- Instabug (= 13.4.3)
- Instabug (= 14.1.0)
- React-Core
- RNReanimated (3.16.1):
- DoubleConversion
Expand Down Expand Up @@ -1747,7 +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/release-support_cp_network_filtering_obfuscation-add_reset_network_state/13.4.3/Instabug.podspec`)
- Instabug (from `https://ios-releases.instabug.com/custom/feature-support_cp_network_filtering_obfuscation-base/14.1.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`)
Expand Down Expand Up @@ -1844,7 +1844,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/release-support_cp_network_filtering_obfuscation-add_reset_network_state/13.4.3/Instabug.podspec
:podspec: https://ios-releases.instabug.com/custom/feature-support_cp_network_filtering_obfuscation-base/14.1.0/Instabug.podspec
instabug-reactnative-ndk:
:path: "../node_modules/instabug-reactnative-ndk"
RCT-Folly:
Expand Down Expand Up @@ -1995,7 +1995,7 @@ SPEC CHECKSUMS:
Google-Maps-iOS-Utils: f77eab4c4326d7e6a277f8e23a0232402731913a
GoogleMaps: 032f676450ba0779bd8ce16840690915f84e57ac
hermes-engine: ea92f60f37dba025e293cbe4b4a548fd26b610a0
Instabug: 12ea6990039094c48a7c7e8103ba8679c0833f5e
Instabug: afe23192d5487aa2afd4f3baa76913cc2c421cda
instabug-reactnative-ndk: d765ac289d56e8896398d02760d9abf2562fc641
OCMock: 589f2c84dacb1f5aaf6e4cec1f292551fe748e74
RCT-Folly: 4464f4d875961fce86008d45f4ecf6cef6de0740
Expand Down Expand Up @@ -2061,14 +2061,14 @@ SPEC CHECKSUMS:
ReactCommon: 6a952e50c2a4b694731d7682aaa6c79bc156e4ad
RNCClipboard: 2821ac938ef46f736a8de0c8814845dde2dcbdfb
RNGestureHandler: 511250b190a284388f9dd0d2e56c1df76f14cfb8
RNInstabug: 514b187e5b884939fd337eefb3244ea75e7e34f8
RNInstabug: 6e109844b6a8cb6d905e3dacd644973839862715
RNReanimated: f42a5044d121d68e91680caacb0293f4274228eb
RNScreens: c7ceced6a8384cb9be5e7a5e88e9e714401fd958
RNSVG: 8b1a777d54096b8c2a0fd38fc9d5a454332bbb4d
RNVectorIcons: 6382277afab3c54658e9d555ee0faa7a37827136
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Yoga: aa3df615739504eebb91925fc9c58b4922ea9a08

PODFILE CHECKSUM: 784fde5e5fa833eeefea8a5deaa699d18167d101
PODFILE CHECKSUM: 48043b3d903923ac80ca4e335406e87f2daba40f

COCOAPODS: 1.15.2
3 changes: 2 additions & 1 deletion examples/default/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Instabug, {
CrashReporting,
InvocationEvent,
LogLevel,
NetworkInterceptionMode,
NetworkLogger,
ReproStepsMode,
} from 'instabug-reactnative';
Expand All @@ -29,7 +30,7 @@ export const App: React.FC = () => {
token: '0fcc87b8bf731164828cc411eccc802a',
invocationEvents: [InvocationEvent.floatingButton],
debugLogsLevel: LogLevel.verbose,
// networkInterceptionMode: NetworkInterceptionMode.native,
networkInterceptionMode: NetworkInterceptionMode.native,
});

CrashReporting.setNDKCrashesEnabled(true);
Expand Down
2 changes: 1 addition & 1 deletion ios/native.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$instabug = { :version => '13.4.3' }
$instabug = { :version => '14.1.0' }

def use_instabug! (spec = nil)
version = $instabug[:version]
Expand Down
45 changes: 0 additions & 45 deletions src/modules/Instabug.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//todo: remove all logs tagged with 'Andrew' in the file
import {
AppState,
type AppStateStatus,
Expand Down Expand Up @@ -74,25 +73,6 @@ function reportCurrentViewForAndroid(screenName: string | null) {
}
}

function _logFlags() {
if (Platform.OS === 'android') {
console.log(
`Andrew: APM Flags -> {
isNativeInterceptionFeatureEnabled: ${isNativeInterceptionFeatureEnabled},
hasAPMNetworkPlugin: ${hasAPMNetworkPlugin},
shouldEnableNativeInterception: ${shouldEnableNativeInterception}
}`,
);
} else {
console.log(
`Andrew: APM Flags -> {
isNativeInterceptionFeatureEnabled: ${isNativeInterceptionFeatureEnabled},
shouldEnableNativeInterception: ${shouldEnableNativeInterception}
}`,
);
}
}

/**
* Initializes the SDK.
* This is the main SDK method that does all the magic. This is the only
Expand Down Expand Up @@ -148,14 +128,11 @@ const handleAppStateChange = async (nextAppState: AppStateStatus, config: Instab
const isUpdated = await fetchApmNetworkFlags();

if (isUpdated) {
console.log('Andrew: App has come to the foreground!');
console.log('Andrew: APM network flags updated.');
refreshAPMNetworkConfigs(config);
}
}

_currentAppState = nextAppState;
console.log(`Andrew: Current AppState: ${_currentAppState}`);
};

/**
Expand All @@ -176,10 +153,6 @@ const fetchApmNetworkFlags = async () => {
isUpdated = true;
}
}

console.log(
`Andrew: fetchApmNetworkFlags {isNativeInterceptionFeatureEnabled: ${isNativeInterceptionFeatureEnabled}, hasAPMNetworkPlugin: ${hasAPMNetworkPlugin}}`,
);
return isUpdated;
};

Expand Down Expand Up @@ -241,13 +214,6 @@ function handleAndroidNativeInterception() {
* Control either to enable or disable the native interception for iOS after the init method is called.
*/
function handleIOSNativeInterception(config: InstabugConfig) {
console.log(
`Andrew: handleIOSNativeInterception(${
shouldEnableNativeInterception &&
config.networkInterceptionMode === NetworkInterceptionMode.native
})`,
);

if (
shouldEnableNativeInterception &&
config.networkInterceptionMode === NetworkInterceptionMode.native
Expand Down Expand Up @@ -295,12 +261,6 @@ const handleInterceptionModeForIOS = (config: InstabugConfig) => {
* Initializes Instabug with the given configuration.
*/
const initializeNativeInstabug = (config: InstabugConfig) => {
console.log(
`Andrew: initializeNativeInstabug -> NativeNetworkInterceptionMode ${
shouldEnableNativeInterception &&
config.networkInterceptionMode === NetworkInterceptionMode.native
}`,
);
NativeInstabug.init(
config.token,
config.invocationEvents,
Expand All @@ -319,7 +279,6 @@ function refreshAPMNetworkConfigs(config: InstabugConfig, forceRefreshIOS: boole
if (Platform.OS === 'ios' && forceRefreshIOS) {
handleIOSNativeInterception(config);
}
_logFlags();
setApmNetworkFlagsIfChanged({
isNativeInterceptionFeatureEnabled,
hasAPMNetworkPlugin,
Expand All @@ -339,10 +298,6 @@ function refreshAPMNetworkConfigs(config: InstabugConfig, forceRefreshIOS: boole
function addOnFeatureUpdatedListener(config: InstabugConfig) {
emitter.addListener(NativeEvents.IBG_ON_FEATURES_UPDATED_CALLBACK, (flags) => {
const { cpNativeInterceptionEnabled, hasAPMPlugin } = flags;
console.log(`Andrew: addOnFeatureUpdatedListener ->
isNativeInterceptionFeatureEnabled: ${cpNativeInterceptionEnabled},
hasAPMNetworkPlugin: ${hasAPMPlugin}.
`);
isNativeInterceptionFeatureEnabled = cpNativeInterceptionEnabled;
hasAPMNetworkPlugin = hasAPMPlugin;
shouldEnableNativeInterception =
Expand Down
16 changes: 0 additions & 16 deletions src/modules/NetworkLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ export const setEnabled = (isEnabled: boolean) => {
try {
if (_networkDataObfuscationHandler) {
network = await _networkDataObfuscationHandler(network);
console.log(
`Andrew: xhr.setOnDoneCallback -> _networkDataObfuscationHandler ${network.url}`,
);
}

if (network.requestBodySize > InstabugConstants.MAX_NETWORK_BODY_SIZE_IN_BYTES) {
Expand Down Expand Up @@ -88,7 +85,6 @@ export const setEnabled = (isEnabled: boolean) => {
* @param isEnabled
*/
export const setNativeInterceptionEnabled = (isEnabled: boolean) => {
console.log(`Andrew: NetworkLogger -> setNativeInterceptionEnabled ${isEnabled}`);
_isNativeInterceptionEnabled = isEnabled;
};

Expand All @@ -108,12 +104,8 @@ export const setNetworkDataObfuscationHandler = (
_networkDataObfuscationHandler = handler;
if (_isNativeInterceptionEnabled && Platform.OS === 'ios') {
if (hasFilterExpression) {
console.log(
'Andrew: setNetworkDataObfuscationHandler -> registerFilteringAndObfuscationListenerV2',
);
registerFilteringAndObfuscationListener(_requestFilterExpression);
} else {
console.log('Andrew: setNetworkDataObfuscationHandler -> registerObfuscationListener');
registerObfuscationListener();
}
}
Expand All @@ -129,12 +121,8 @@ export const setRequestFilterExpression = (expression: string) => {

if (_isNativeInterceptionEnabled && Platform.OS === 'ios') {
if (_networkDataObfuscationHandler) {
console.log(
'Andrew: setRequestFilterExpression -> registerFilteringAndObfuscationListenerV2',
);
registerFilteringAndObfuscationListener(_requestFilterExpression);
} else {
console.log('Andrew: setRequestFilterExpression -> registerFilteringListener');
registerFilteringListener(_requestFilterExpression);
}
}
Expand Down Expand Up @@ -186,11 +174,8 @@ export const registerNetworkLogsListener = (
handler?: (networkSnapshot: NetworkData) => void,
) => {
if (Platform.OS === 'ios') {
console.log('Andrew: registerNetworkLogsListener called');

// remove old listeners
if (NetworkLoggerEmitter.listenerCount(NativeNetworkLoggerEvent.NETWORK_LOGGER_HANDLER) > 0) {
console.log('Andrew: removeAllListeners called');
NetworkLoggerEmitter.removeAllListeners(NativeNetworkLoggerEvent.NETWORK_LOGGER_HANDLER);
}

Expand All @@ -201,7 +186,6 @@ export const registerNetworkLogsListener = (
// attach a new listener to the existing one.
_networkListener = NetworkListenerType.both;
}
console.log(`Andrew: new NetworkLogsListener (${_networkListener}) attached`);
}

NetworkLoggerEmitter.addListener(
Expand Down
16 changes: 0 additions & 16 deletions src/utils/InstabugUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,11 @@ export function isContentTypeNotAllowed(contentType: string) {
return allowed.every((type) => !contentType.includes(type));
}

//todo: remove all logs tagged with 'Andrew' in the file
export const reportNetworkLog = (network: NetworkData) => {
if (Platform.OS === 'android') {
const requestHeaders = JSON.stringify(network.requestHeaders);
const responseHeaders = JSON.stringify(network.responseHeaders);

console.log('Andrew: ' + `NetworkLogger -> ${JSON.stringify(apmFlags)}`);
console.log('Andrew: ' + 'NetworkLogger -> NativeInstabug.networkLogAndroid');

NativeInstabug.networkLogAndroid(
network.url,
network.requestBody,
Expand All @@ -196,8 +192,6 @@ export const reportNetworkLog = (network: NetworkData) => {
!apmFlags.hasAPMNetworkPlugin ||
!apmFlags.shouldEnableNativeInterception
) {
console.log('Andrew: ' + 'NetworkLogger -> NativeAPM.networkLogAndroid');
console.log('Andrew: ' + `NetworkLogger -> ${network.url}`);
NativeAPM.networkLogAndroid(
network.startTime,
network.duration,
Expand All @@ -218,12 +212,6 @@ export const reportNetworkLog = (network: NetworkData) => {
);
}
} else {
console.log(
'Andrew: ' +
`NetworkLogger -> {isNativeInterceptionEnabled: ${apmFlags.isNativeInterceptionFeatureEnabled}}`,
);
console.log('Andrew: ' + 'NetworkLogger -> NativeInstabug.networkLogIOS');

NativeInstabug.networkLogIOS(
network.url,
network.method,
Expand Down Expand Up @@ -308,10 +296,6 @@ export function checkNetworkRequestHandlers() {
const obfuscationHandler = NetworkLogger.getNetworkDataObfuscationHandler();
const hasFilterExpression = NetworkLogger.hasRequestFilterExpression();

console.log(
`Andrew: handlers
{filtering = ${hasFilterExpression}, obfuscation = ${obfuscationHandler != null}}`,
);
if (hasFilterExpression && obfuscationHandler) {
// Register listener that handles both (Filtering & Obfuscation)
registerFilteringAndObfuscationListener(NetworkLogger.getRequestFilterExpression());
Expand Down