diff --git a/.circleci/config.yml b/.circleci/config.yml index 3586cc48e0..77071bad1e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,6 +17,12 @@ references: - e2e_ios - e2e_android + dream11_prepare_config: &dream11_prepare_config + prepare_steps: + - prepare_dream11 + requires: + - hold_test_dream11 + commands: install_node_modules: parameters: @@ -36,15 +42,28 @@ commands: parameters: working_directory: type: string + deployment: + type: boolean + default: false steps: - restore_cache: name: Restore Pods Cache keys: - v1-pods-{{ checksum "<< parameters.working_directory >>/Podfile.lock" }} - - run: - name: Install Pods - working_directory: << parameters.working_directory >> - command: pod install --deployment + - when: + condition: << parameters.deployment >> + steps: + - run: + name: Install Pods + working_directory: << parameters.working_directory >> + command: pod install --deployment + - unless: + condition: << parameters.deployment >> + steps: + - run: + name: Install Pods + working_directory: << parameters.working_directory >> + command: pod install - save_cache: name: Save Pods Cache key: v1-pods-{{ checksum "<< parameters.working_directory >>/Podfile.lock" }} @@ -59,10 +78,72 @@ commands: type: string replace: type: string + working_directory: + type: string + default: ~/project steps: - run: name: Find and Replace in << parameters.files >> command: node ~/project/scripts/replace.js << parameters.search >> << parameters.replace >> << parameters.files >> + working_directory: << parameters.working_directory >> + + prepare_custom_package: + parameters: + npm_package: + type: string + android_package: + type: string + api_endpoint: + type: string + working_directory: + type: string + default: ~/project + steps: + - run: + name: Remove README.md file + command: rm README.md + working_directory: << parameters.working_directory >> + - find_and_replace: + files: package.json android/sourcemaps.gradle ios/sourcemaps.sh + search: instabug-reactnative + replace: << parameters.npm_package >> + working_directory: << parameters.working_directory >> + - find_and_replace: + files: cli/upload/uploadSourcemaps.ts cli/upload/uploadSoFiles.ts + search: api.instabug.com + replace: << parameters.api_endpoint >> + working_directory: << parameters.working_directory >> + - find_and_replace: + files: android/native.gradle + search: 'com.instabug.library:instabug:' + replace: 'com.instabug.library-<< parameters.android_package >>:instabug:' + working_directory: << parameters.working_directory >> + + prepare_dream11: + parameters: + working_directory: + type: string + default: ~/project + steps: + - install_node_modules + - prepare_custom_package: + npm_package: '@instabug/instabug-reactnative-dream11' + android_package: dream11 + api_endpoint: st001012dream11.instabug.com + working_directory: << parameters.working_directory >> + - run: + name: Give execute permission to Dream11 script + command: chmod +x ./scripts/dream-11-delete-unused-features.sh + working_directory: << parameters.working_directory >> + - run: + name: Remove unused features + command: ./scripts/dream-11-delete-unused-features.sh + working_directory: << parameters.working_directory >> + # Remove the NDK package to avoid dependency conflicts on Android. + - run: + name: Remove the NDK package + command: yarn remove instabug-reactnative-ndk + working_directory: << parameters.working_directory >>/examples/default notify_github: parameters: @@ -101,10 +182,15 @@ jobs: command: yarn lint:ci test_module: + parameters: + prepare_steps: + type: steps + default: [] executor: name: node/default steps: - advanced-checkout/shallow-checkout + - steps: << parameters.prepare_steps >> - install_node_modules - run: name: Run Tests @@ -115,6 +201,10 @@ jobs: - lcov.info test_android: + parameters: + prepare_steps: + type: steps + default: [] executor: name: android/android-machine tag: '2024.01.1' @@ -123,7 +213,7 @@ jobs: INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true steps: - advanced-checkout/shallow-checkout - # - node/install-yarn + - steps: << parameters.prepare_steps >> - install_node_modules - android/run-tests: working-directory: android @@ -160,10 +250,15 @@ jobs: app-dir: examples/default - install_pods: working_directory: examples/default/ios + deployment: true - run: git --no-pager diff - run: git diff-index HEAD --exit-code -p -I EXCLUDED_ARCHS # Ignore Arch Changes test_ios: + parameters: + prepare_steps: + type: steps + default: [] macos: xcode: 13.4.1 resource_class: macos.m1.medium.gen1 @@ -172,6 +267,7 @@ jobs: INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true steps: - advanced-checkout/shallow-checkout + - steps: << parameters.prepare_steps >> - install_node_modules - install_pods: working_directory: ios @@ -196,6 +292,10 @@ jobs: - xcode.json e2e_ios: + parameters: + prepare_steps: + type: steps + default: [] macos: xcode: 13.4.1 resource_class: macos.m1.medium.gen1 @@ -203,6 +303,7 @@ jobs: INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true steps: - advanced-checkout/shallow-checkout + - steps: << parameters.prepare_steps >> - install_node_modules - node/install-packages: pkg-manager: yarn @@ -219,6 +320,11 @@ jobs: name: Rebuild Detox.framework Cache working_directory: examples/default command: detox clean-framework-cache && detox build-framework-cache + # This is a workaround until the iOS SDK is updated to prioritize the custom + # Instabug.plist over the internal Config.plist. + - run: + name: Customize API Endpoints + command: ./scripts/customize-ios-endpoints.sh - run: name: Detox - Build Release App working_directory: examples/default @@ -229,6 +335,10 @@ jobs: command: detox test --configuration ios.sim.release --cleanup e2e_android: + parameters: + prepare_steps: + type: steps + default: [] executor: name: android/android-machine tag: '2024.01.1' @@ -237,7 +347,7 @@ jobs: INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true steps: - advanced-checkout/shallow-checkout - # - node/install-yarn + - steps: << parameters.prepare_steps >> - install_node_modules - node/install-packages: pkg-manager: yarn @@ -264,33 +374,16 @@ jobs: release_custom_package: parameters: - npm_package: - type: string - android_package: - type: string - api_endpoint: - type: string + prepare_steps: + type: steps + default: [] working_directory: ~/project executor: name: node/default steps: - advanced-checkout/shallow-checkout + - steps: << parameters.prepare_steps >> - install_node_modules - - run: - name: Remove README.md file - command: rm README.md - - find_and_replace: - files: package.json android/sourcemaps.gradle ios/sourcemaps.sh - search: instabug-reactnative - replace: << parameters.npm_package >> - - find_and_replace: - files: cli/UploadSourcemaps.ts cli/UploadSoFiles.ts - search: api.instabug.com - replace: << parameters.api_endpoint >> - - find_and_replace: - files: android/native.gradle - search: 'com.instabug.library:instabug:' - replace: 'com.instabug.library-<< parameters.android_package >>:instabug:' - run: name: Build the SDK command: yarn build @@ -301,45 +394,6 @@ jobs: name: Publish new enterprise version command: npm publish - # Automate the enterprise D11 sdk changes - release_d11: - working_directory: ~/project - executor: - name: node/default - steps: - - advanced-checkout/shallow-checkout - - install_node_modules - - run: - name: Remove README.md file - command: rm README.md - - find_and_replace: - files: package.json ios/sourcemaps.sh android/sourcemaps.gradle - search: instabug-reactnative - replace: '@instabug/instabug-reactnative-dream11' - - find_and_replace: - files: cli/UploadSourcemaps.ts cli/UploadSoFiles.ts - search: api.instabug.com - replace: st001012dream11.instabug.com - - find_and_replace: - files: android/native.gradle - search: com.instabug.library:instabug - replace: 'com.instabug.library-dream11:instabug' - - run: - name: give exec permssion to d11 script - command: chmod +x ./scripts/dream-11-delete-unused-features.sh - - run: - name: remove un-required features - command: ./scripts/dream-11-delete-unused-features.sh - - run: - name: Build the SDK - command: yarn build - - run: - name: Authorize with npm - command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc - - run: - name: Publish new enterprise version - command: npm publish - publish: macos: xcode: 13.4.1 @@ -463,17 +517,6 @@ workflows: filters: branches: only: master - - hold_release_d11: - # edit to publish 13.0.6 version,,since 13.0.6 version is for dream11 only and we don't have public version for it - requires: - - lint - - test_module - - validate_shell_files - - sync_generated_files - type: approval - filters: - branches: - only: dream11 - publish: requires: - hold_publish @@ -486,6 +529,7 @@ workflows: filters: branches: only: master + - hold_release_nn: requires: *release_dependencies type: approval @@ -499,9 +543,12 @@ workflows: filters: branches: only: master - npm_package: '@instabug/react-native-nn' - android_package: nn - api_endpoint: st001009nn.instabug.com + prepare_steps: + - prepare_custom_package: + npm_package: '@instabug/react-native-nn' + android_package: nn + api_endpoint: st001009nn.instabug.com + - hold_release_injazat: requires: *release_dependencies type: approval @@ -515,12 +562,49 @@ workflows: filters: branches: only: master - npm_package: '@instabug/react-native-injazat' - android_package: injazat - api_endpoint: st001013mec1.instabug.com - - release_d11: + prepare_steps: + - prepare_custom_package: + npm_package: '@instabug/react-native-injazat' + android_package: injazat + api_endpoint: st001013mec1.instabug.com + + # Dream11 tests + - hold_test_dream11: + type: approval + - test_module: + name: test_module_dream11 + <<: *dream11_prepare_config + - test_android: + name: test_android_dream11 + <<: *dream11_prepare_config + - test_ios: + name: test_ios_dream11 + <<: *dream11_prepare_config + - e2e_android: + name: e2e_android_dream11 + <<: *dream11_prepare_config + - e2e_ios: + name: e2e_ios_dream11 + <<: *dream11_prepare_config + + # Dream11 release + - hold_release_dream11: + requires: + - test_module_dream11 + - test_android_dream11 + - test_ios_dream11 + - e2e_android_dream11 + - e2e_ios_dream11 + type: approval + filters: + branches: + only: dream11 + - release_custom_package: + name: release_dream11 requires: - - hold_release_d11 + - hold_release_dream11 filters: branches: only: dream11 + prepare_steps: + - prepare_dream11 diff --git a/examples/default/ios/InstabugTests/InstabugFeatureRequestsTests.m b/examples/default/ios/InstabugTests/InstabugFeatureRequestsTests.m deleted file mode 100644 index 4c300ab4c1..0000000000 --- a/examples/default/ios/InstabugTests/InstabugFeatureRequestsTests.m +++ /dev/null @@ -1,68 +0,0 @@ -// -// InstabugFeatureRequestsTests.m -// InstabugSampleTests -// -// Created by Salma Ali on 7/31/19. -// Copyright © 2019 Facebook. All rights reserved. -// - -#import -#import "OCMock/OCMock.h" -#import "InstabugFeatureRequestsBridge.h" -#import -#import "Instabug/Instabug.h" -#import "IBGConstants.h" - -@interface InstabugFeatureRequestsTests : XCTestCase -@property (nonatomic, retain) InstabugFeatureRequestsBridge *instabugBridge; -@end - -@implementation InstabugFeatureRequestsTests - -- (void)setUp { - // Put setup code here. This method is called before the invocation of each test method in the class. - self.instabugBridge = [[InstabugFeatureRequestsBridge alloc] init]; -} - -/* - +------------------------------------------------------------------------+ - | Feature Requets Module | - +------------------------------------------------------------------------+ - */ - -- (void) testgivenArgs$setEmailFieldRequiredForFeatureRequests_whenQuery_thenShouldCallNativeApi { - id mock = OCMClassMock([IBGFeatureRequests class]); - BOOL required = true; - NSArray *actionTypesArray = [NSArray arrayWithObjects: @(IBGActionReportBug), nil]; - IBGAction actionTypes = 0; - for (NSNumber *boxedValue in actionTypesArray) { - actionTypes |= [boxedValue intValue]; - } - OCMStub([mock setEmailFieldRequired:required forAction:actionTypes]); - [self.instabugBridge setEmailFieldRequiredForFeatureRequests:required forAction:actionTypesArray]; - OCMVerify([mock setEmailFieldRequired:required forAction:actionTypes]); -} - -- (void) testgive$show_whenQuery_thenShouldCallNativeApi { - id mock = OCMClassMock([IBGFeatureRequests class]); - 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]; -} - -- (void) testgivenBoolean$setEnabled_whenQuery_thenShouldCallNativeApi { - BOOL enabled = false; - [self.instabugBridge setEnabled:enabled]; - XCTAssertFalse(IBGFeatureRequests.enabled); -} - - -@end - diff --git a/examples/default/ios/Podfile b/examples/default/ios/Podfile index 3ee1d2b37f..50799ce5ec 100644 --- a/examples/default/ios/Podfile +++ b/examples/default/ios/Podfile @@ -14,7 +14,7 @@ prepare_react_native_project! # dependencies: { # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}), # ``` -flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled +flipper_config = FlipperConfiguration.disabled linkage = ENV['USE_FRAMEWORKS'] if linkage != nil diff --git a/ios/RNInstabug/InstabugFeatureRequestsBridge.h b/ios/RNInstabug/InstabugFeatureRequestsBridge.h deleted file mode 100644 index fa4e9dced9..0000000000 --- a/ios/RNInstabug/InstabugFeatureRequestsBridge.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// InstabugFeatureRequestsBridge.h -// RNInstabug -// -// Created by Salma Ali on 7/30/19. -// Copyright © 2019 instabug. All rights reserved. -// - -#import -#import -#import -#import - -@interface InstabugFeatureRequestsBridge : RCTEventEmitter -/* - +------------------------------------------------------------------------+ - | Feature Requests Module | - +------------------------------------------------------------------------+ - */ - -- (void)setEmailFieldRequiredForFeatureRequests:(BOOL)isEmailFieldRequired forAction:(NSArray *)actionTypesArray; - -- (void)show; - -- (void)setEnabled:(BOOL) isEnabled; - - -@end - - diff --git a/ios/RNInstabug/InstabugFeatureRequestsBridge.m b/ios/RNInstabug/InstabugFeatureRequestsBridge.m deleted file mode 100644 index 2d469859a9..0000000000 --- a/ios/RNInstabug/InstabugFeatureRequestsBridge.m +++ /dev/null @@ -1,60 +0,0 @@ -// -// InstabugFeatureRequestsBridge.m -// RNInstabug -// -// Created by Salma Ali on 7/30/19. -// Copyright © 2019 instabug. All rights reserved. -// - -#import "InstabugFeatureRequestsBridge.h" -#import -#import -#import -#import -#import - -@implementation InstabugFeatureRequestsBridge - -- (dispatch_queue_t)methodQueue { - return dispatch_get_main_queue(); -} - -+ (BOOL)requiresMainQueueSetup -{ - return NO; -} - -- (NSArray *)supportedEvents { - return @[]; -} - -RCT_EXPORT_MODULE(IBGFeatureRequests) - -RCT_EXPORT_METHOD(show) { - [[NSRunLoop mainRunLoop] performSelector:@selector(show) target:[IBGFeatureRequests class] argument:nil order:0 modes:@[NSDefaultRunLoopMode]]; -} - -RCT_EXPORT_METHOD(setEmailFieldRequiredForFeatureRequests:(BOOL)isEmailFieldRequired - forAction:(NSArray *)actionTypesArray) { - IBGAction actionTypes = 0; - - for (NSNumber *boxedValue in actionTypesArray) { - actionTypes |= [boxedValue intValue]; - } - - [IBGFeatureRequests setEmailFieldRequired:isEmailFieldRequired forAction:actionTypes]; -} - -RCT_EXPORT_METHOD(setEnabled: (BOOL) isEnabled) { - IBGFeatureRequests.enabled = isEnabled; -} - -@synthesize description; - -@synthesize hash; - -@synthesize superclass; - -@end - - diff --git a/ios/RNInstabug/InstabugReactBridge.h b/ios/RNInstabug/InstabugReactBridge.h index 893906426d..4edf8b0fd6 100644 --- a/ios/RNInstabug/InstabugReactBridge.h +++ b/ios/RNInstabug/InstabugReactBridge.h @@ -58,7 +58,7 @@ - (void)logVerbose:(NSString *)log; -- (void)setReproStepsConfig: (IBGUserStepsMode)bugMode :(IBGUserStepsMode)crashMode:(IBGUserStepsMode)sessionReplayMode :(IBGUserStepsMode)anr :(IBGUserStepsMode)appHangsMode :(IBGUserStepsMode)fatalCrashMode :(IBGUserStepsMode)nonFatalCrashMode :(IBGUserStepsMode)forceRestartMode : (IBGUserStepsMode) oomMode; +- (void)setReproStepsConfig: (IBGUserStepsMode)bugMode :(IBGUserStepsMode)sessionReplayMode :(IBGUserStepsMode) anr :(IBGUserStepsMode)appHangsMode :(IBGUserStepsMode)fatalCrashMode :(IBGUserStepsMode)nonFatalCrashMode :(IBGUserStepsMode)forceRestartMode : (IBGUserStepsMode) oomMode ; - (void)setUserAttribute:(NSString *)key withValue:(NSString *)value; diff --git a/ios/RNInstabug/InstabugSurveysBridge.h b/ios/RNInstabug/InstabugSurveysBridge.h deleted file mode 100644 index fe483130eb..0000000000 --- a/ios/RNInstabug/InstabugSurveysBridge.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// InstabugSurveysBridge.h -// RNInstabug -// -// Created by Salma Ali on 7/30/19. -// Copyright © 2019 instabug. All rights reserved. -// - -#import -#import -#import -#import - -@interface InstabugSurveysBridge : RCTEventEmitter -/* - +------------------------------------------------------------------------+ - | Surveys Module | - +------------------------------------------------------------------------+ - */ - -- (void)showSurvey:(NSString *)surveyToken; - -- (void)showSurveysIfAvailable; - -- (void)setOnShowHandler:(RCTResponseSenderBlock)callBack; - -- (void)setOnDismissHandler:(RCTResponseSenderBlock)callBack; - -- (void)setAutoShowingEnabled:(BOOL)autoShowingSurveysEnabled; - -- (void)setShouldShowWelcomeScreen:(BOOL)shouldShowWelcomeScreen; - -- (void)hasRespondedToSurvey:(NSString *)surveyToken - :(RCTPromiseResolveBlock)resolve - :(RCTPromiseRejectBlock)reject; - -- (void)getAvailableSurveys:(RCTPromiseResolveBlock)resolve :(RCTPromiseRejectBlock)reject; - -- (void)setEnabled:(BOOL)surveysEnabled; - -- (void)setAppStoreURL:(NSString *)appStoreURL; - - -@end - - diff --git a/ios/RNInstabug/InstabugSurveysBridge.m b/ios/RNInstabug/InstabugSurveysBridge.m deleted file mode 100644 index 81c5e51b89..0000000000 --- a/ios/RNInstabug/InstabugSurveysBridge.m +++ /dev/null @@ -1,106 +0,0 @@ -// -// InstabugSurveysBridge.m -// RNInstabug -// -// Created by Salma Ali on 7/30/19. -// Copyright © 2019 instabug. All rights reserved. -// - -#import "InstabugSurveysBridge.h" -#import -#import -#import -#import -#import - -@implementation InstabugSurveysBridge - -- (dispatch_queue_t)methodQueue { - return dispatch_get_main_queue(); -} - -+ (BOOL)requiresMainQueueSetup -{ - return NO; -} - -- (NSArray *)supportedEvents { - return @[ - @"IBGWillShowSurvey", - @"IBGDidDismissSurvey" - ]; -} - -RCT_EXPORT_MODULE(IBGSurveys) - -RCT_EXPORT_METHOD(showSurvey:(NSString *)surveyToken) { - [IBGSurveys showSurveyWithToken:surveyToken]; -} - -RCT_EXPORT_METHOD(hasRespondedToSurvey:(NSString *)surveyToken :(RCTPromiseResolveBlock)resolve :(RCTPromiseRejectBlock)reject) { - [IBGSurveys hasRespondedToSurveyWithToken:surveyToken - completionHandler:^(BOOL hasResponded) { - resolve(@(hasResponded)); - }]; -} - -RCT_EXPORT_METHOD(getAvailableSurveys:(RCTPromiseResolveBlock)resolve :(RCTPromiseRejectBlock)reject) { - [IBGSurveys availableSurveysWithCompletionHandler:^(NSArray *availableSurveys) { - NSMutableArray* mappedSurveys = [[NSMutableArray alloc] init]; - for (IBGSurvey* survey in availableSurveys) { - [mappedSurveys addObject:@{@"title": survey.title }]; - } - resolve(mappedSurveys); - }]; -} - -RCT_EXPORT_METHOD(setEnabled:(BOOL)surveysEnabled) { - IBGSurveys.enabled = surveysEnabled; -} - -RCT_EXPORT_METHOD(showSurveysIfAvailable) { - [IBGSurveys showSurveyIfAvailable]; -} - -RCT_EXPORT_METHOD(setOnShowHandler:(RCTResponseSenderBlock)callBack) { - if (callBack != nil) { - IBGSurveys.willShowSurveyHandler = ^{ - [self sendEventWithName:@"IBGWillShowSurvey" body:nil]; - }; - } else { - IBGSurveys.willShowSurveyHandler = ^{}; - } -} - -RCT_EXPORT_METHOD(setOnDismissHandler:(RCTResponseSenderBlock)callBack) { - if (callBack != nil) { - IBGSurveys.didDismissSurveyHandler = ^{ - [self sendEventWithName:@"IBGDidDismissSurvey" body:nil]; - }; - } else { - IBGSurveys.didDismissSurveyHandler = ^{}; - } -} - -RCT_EXPORT_METHOD(setAutoShowingEnabled:(BOOL)autoShowingSurveysEnabled) { - IBGSurveys.autoShowingEnabled = autoShowingSurveysEnabled; -} - -RCT_EXPORT_METHOD(setShouldShowWelcomeScreen:(BOOL)shouldShowWelcomeScreen) { - IBGSurveys.shouldShowWelcomeScreen = shouldShowWelcomeScreen; -} - -RCT_EXPORT_METHOD(setAppStoreURL:(NSString *)appStoreURL) { - IBGSurveys.appStoreURL = appStoreURL; -} - -@synthesize description; - -@synthesize hash; - -@synthesize superclass; - -@end - - -