diff --git a/README.md b/README.md index 3b17d04..58e1c9d 100644 --- a/README.md +++ b/README.md @@ -39,38 +39,18 @@ cd ios && pod install && cd .. Call `Shake.start()` method in the *index.js* file. ```javascript title="index.js" -import {AppRegistry} from 'react-native'; +import {AppRegistry, Platform} from 'react-native'; import App from './src/App'; import {name as appName} from './app.json'; import Shake from '@shakebugs/react-native-shake'; AppRegistry.registerComponent(appName, () => App); -Shake.start('client-id', 'client-secret'); +const apiKey = Platform.OS === 'ios' ? 'ios-app-api-key' : 'android-app-api-key'; +Shake.start(apiKey); ``` -Replace `client-id` and `client-secret` with the actual values you have in [your workspace settings](https://app.shakebugs.com/settings/workspace#general). - -## Troubleshooting - -If you get the following error during the build time: - -``` -Execution failed for task ':app:mergeDexDebug'. -``` - -You should set *multiDexEnabled* flag in app-level *build.gradle* like below: - -```groovy title="app/build.gradle" -defaultConfig { - applicationId "com.shakebugs.react.example" - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 1 - versionName "1.0.0" - multiDexEnabled true -} -``` +Replace `ios-app-api-key` and `android-app-api-key` with the actual values you have in your app settings. ## Resources diff --git a/android/build.gradle b/android/build.gradle index 14aee6c..fd83706 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -76,5 +76,5 @@ repositories { dependencies { //noinspection GradleDynamicVersion implementation 'com.facebook.react:react-native:+' // From node_modules - api "$System.env.ANDROID_DEPENDENCY:16.2.+" + api "$System.env.ANDROID_DEPENDENCY:17.0.+" } diff --git a/android/src/main/java/com/shakebugs/react/ShakeModule.java b/android/src/main/java/com/shakebugs/react/ShakeModule.java index 8e73ffd..9f5cb24 100644 --- a/android/src/main/java/com/shakebugs/react/ShakeModule.java +++ b/android/src/main/java/com/shakebugs/react/ShakeModule.java @@ -84,7 +84,7 @@ private ShakeInfo buildShakePlatformInfo() { } @ReactMethod - public void start(final String clientId, final String clientSecret, final Promise promise) { + public void start(final String apiKey, final Promise promise) { getReactApplicationContext().runOnUiQueueThread(new Runnable() { @Override public void run() { @@ -92,10 +92,10 @@ public void run() { Activity activity = getCurrentActivity(); if (activity != null) { - ShakeReflection.start(activity, clientId, clientSecret); + ShakeReflection.start(activity, apiKey); } else { Application app = (Application) getReactApplicationContext().getApplicationContext(); - Shake.start(app, clientId, clientSecret); + Shake.start(app, apiKey); } startShakeCallbacksEmitter(); diff --git a/android/src/main/java/com/shakebugs/react/ShakeReflection.java b/android/src/main/java/com/shakebugs/react/ShakeReflection.java index a2d0a7d..1f93d04 100644 --- a/android/src/main/java/com/shakebugs/react/ShakeReflection.java +++ b/android/src/main/java/com/shakebugs/react/ShakeReflection.java @@ -13,11 +13,11 @@ public class ShakeReflection { private static final String CLASS_NAME = "com.shakebugs.shake.Shake"; - public static void start(Activity activity, String clientId, String clientSecret) { + public static void start(Activity activity, String apiKey) { try { - Method method = Reflection.getMethod(Class.forName(CLASS_NAME), "startFromWrapper", Activity.class, String.class, String.class); + Method method = Reflection.getMethod(Class.forName(CLASS_NAME), "startFromWrapper", Activity.class, String.class); //noinspection ConstantConditions - method.invoke(null, activity, clientId, clientSecret); + method.invoke(null, activity, apiKey); } catch (Exception e) { Logger.e("Failed to start Shake", e); } diff --git a/android/src/main/java/com/shakebugs/react/utils/Constants.java b/android/src/main/java/com/shakebugs/react/utils/Constants.java index bbae91b..9ceb57e 100644 --- a/android/src/main/java/com/shakebugs/react/utils/Constants.java +++ b/android/src/main/java/com/shakebugs/react/utils/Constants.java @@ -3,5 +3,5 @@ public class Constants { public static final String PLATFORM = "ReactNative"; public static final String VERSION_CODE = "1"; - public static final String VERSION_NAME = "16.2.0"; + public static final String VERSION_NAME = "17.0.0"; } diff --git a/example/index.js b/example/index.js index ac39a94..0743bcd 100644 --- a/example/index.js +++ b/example/index.js @@ -6,10 +6,6 @@ import Shake from 'react-native-shake'; import messaging from '@react-native-firebase/messaging'; const startShake = async () => { - const CLIENT_ID = 'HtTFUmUziF5Qjk1XLraAJXtVB1cL62yHWWqsDnrG'; - const CLIENT_SECRET = - 'IPRqEI2iSQhmUP6NGQcPNKCs7JQCJrpFUG0qDmLx4Yx2spd3caXnC3o'; - Shake.setInvokeShakeOnScreenshot(true); Shake.setInvokeShakeOnShakeDeviceEvent(true); Shake.setShowFloatingReportButton(true); @@ -30,7 +26,12 @@ const startShake = async () => { console.log('Shake submitted!'); }); - await Shake.start(CLIENT_ID, CLIENT_SECRET); + const apiKey = + Platform.OS === 'ios' + ? 'Ny6x1eMCwSTNltepD8vLQ6iiYXqatEp2nWM7cFGM01opctfQfC802wf' + : 'K9CeeyYp8aWIIWrKnT63c9StRXQa05pWzP1rYruYsIvmg1q0brwuvGM'; + await Shake.start(apiKey); + Shake.registerUser('test_user'); }; diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index c1a66a6..6879543 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -21,9 +21,9 @@ PODS: - GoogleUtilities/Logger (~> 7.8) - FirebaseCoreExtension (10.12.0): - FirebaseCore (~> 10.0) - - FirebaseCoreInternal (10.18.0): + - FirebaseCoreInternal (10.25.0): - "GoogleUtilities/NSData+zlib (~> 7.8)" - - FirebaseInstallations (10.18.0): + - FirebaseInstallations (10.25.0): - FirebaseCore (~> 10.0) - GoogleUtilities/Environment (~> 7.8) - GoogleUtilities/UserDefaults (~> 7.8) @@ -39,27 +39,35 @@ PODS: - nanopb (< 2.30910.0, >= 2.30908.0) - fmt (6.2.1) - glog (0.3.5) - - GoogleDataTransport (9.2.5): + - GoogleDataTransport (9.4.1): - GoogleUtilities/Environment (~> 7.7) - - nanopb (< 2.30910.0, >= 2.30908.0) + - nanopb (< 2.30911.0, >= 2.30908.0) - PromisesObjC (< 3.0, >= 1.2) - - GoogleUtilities/AppDelegateSwizzler (7.12.0): + - GoogleUtilities/AppDelegateSwizzler (7.13.3): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - - GoogleUtilities/Environment (7.12.0): + - GoogleUtilities/Privacy + - GoogleUtilities/Environment (7.13.3): + - GoogleUtilities/Privacy - PromisesObjC (< 3.0, >= 1.2) - - GoogleUtilities/Logger (7.12.0): + - GoogleUtilities/Logger (7.13.3): - GoogleUtilities/Environment - - GoogleUtilities/Network (7.12.0): + - GoogleUtilities/Privacy + - GoogleUtilities/Network (7.13.3): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" + - GoogleUtilities/Privacy - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (7.12.0)" - - GoogleUtilities/Reachability (7.12.0): + - "GoogleUtilities/NSData+zlib (7.13.3)": + - GoogleUtilities/Privacy + - GoogleUtilities/Privacy (7.13.3) + - GoogleUtilities/Reachability (7.13.3): - GoogleUtilities/Logger - - GoogleUtilities/UserDefaults (7.12.0): + - GoogleUtilities/Privacy + - GoogleUtilities/UserDefaults (7.13.3): - GoogleUtilities/Logger + - GoogleUtilities/Privacy - hermes-engine (0.71.14): - hermes-engine/Pre-built (= 0.71.14) - hermes-engine/Pre-built (0.71.14) @@ -69,7 +77,7 @@ PODS: - nanopb/encode (= 2.30909.1) - nanopb/decode (2.30909.1) - nanopb/encode (2.30909.1) - - PromisesObjC (2.3.1) + - PromisesObjC (2.4.0) - RCT-Folly (2021.07.22.00): - boost - DoubleConversion @@ -329,7 +337,7 @@ PODS: - ReactCommon/turbomodule/core - react-native-shake (16.2.0): - React - - Shake-Staging (~> 16.2.0-rc) + - Shake-Staging (~> 17.0.0-rc) - react-native-slider (4.4.2): - React-Core - React-perflogger (0.71.14) @@ -469,7 +477,7 @@ PODS: - RNScreens (3.20.0): - React-Core - React-RCTImage - - Shake-Staging (16.2.2-rc.1586) + - Shake-Staging (17.0.0-rc.1603) - Yoga (1.14.0) DEPENDENCIES: @@ -649,17 +657,17 @@ SPEC CHECKSUMS: Firebase: 07150e75d142fb9399f6777fa56a187b17f833a0 FirebaseCore: f86a1394906b97ac445ae49c92552a9425831bed FirebaseCoreExtension: 0ce5ac36042001cfa233ce7bfa28e5c313cf80f4 - FirebaseCoreInternal: 8eb002e564b533bdcf1ba011f33f2b5c10e2ed4a - FirebaseInstallations: e842042ec6ac1fd2e37d7706363ebe7f662afea4 + FirebaseCoreInternal: 910a81992c33715fec9263ca7381d59ab3a750b7 + FirebaseInstallations: 91950fe859846fff0fbd296180909dd273103b09 FirebaseMessaging: bb2c4f6422a753038fe137d90ae7c1af57251316 fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b - GoogleDataTransport: 54dee9d48d14580407f8f5fbf2f496e92437a2f2 - GoogleUtilities: 0759d1a57ebb953965c2dfe0ba4c82e95ccc2e34 + GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a + GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15 hermes-engine: d7cc127932c89c53374452d6f93473f1970d8e88 libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 nanopb: d4d75c12cd1316f4a64e3c6963f879ecd4b5e0d5 - PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4 + PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1 RCTRequired: e9df143e880d0e879e7a498dc06923d728809c79 RCTTypeSafety: c2d89c8308829c12c038ec1f431191eaa0d8c15c @@ -675,7 +683,7 @@ SPEC CHECKSUMS: React-jsinspector: 7bf923954b4e035f494b01ac16633963412660d7 React-logger: 655ff5db8bd922acfbe76a4983ffab048916343e react-native-safe-area-context: 39c2d8be3328df5d437ac1700f4f3a4f75716acc - react-native-shake: 11bfe589c915b008a4c39e85965de8b604604c20 + react-native-shake: 4a919b9b093747b790d35effd4f1b0d0d4958fa5 react-native-slider: 33b8d190b59d4f67a541061bb91775d53d617d9d React-perflogger: 4987ad83731c23d11813c84263963b0d3028c966 React-RCTActionSheet: 5ad952b2a9740d87a5bd77280c4bc23f6f89ea0c @@ -701,9 +709,9 @@ SPEC CHECKSUMS: RNGestureHandler: 071d7a9ad81e8b83fe7663b303d132406a7d8f39 RNReanimated: f0dd6b881808e635ef0673f89642937d6c141314 RNScreens: 218801c16a2782546d30bd2026bb625c0302d70f - Shake-Staging: fc62dde4ce849ae43ba6d932c42b75fe1be6c492 + Shake-Staging: 923b41d9c902e1f02e87acbe5f6899d905b76e60 Yoga: e71803b4c1fff832ccf9b92541e00f9b873119b9 PODFILE CHECKSUM: 851bc641080bb227691dcf7987476de3f8a70a9e -COCOAPODS: 1.12.1 +COCOAPODS: 1.14.3 diff --git a/example/ios/example.xcodeproj/project.pbxproj b/example/ios/example.xcodeproj/project.pbxproj index a44515a..695385c 100644 --- a/example/ios/example.xcodeproj/project.pbxproj +++ b/example/ios/example.xcodeproj/project.pbxproj @@ -386,10 +386,20 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-example-exampleTests/Pods-example-exampleTests-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/FirebaseCoreInternal/FirebaseCoreInternal_Privacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/FirebaseInstallations/FirebaseInstallations_Privacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/GoogleDataTransport/GoogleDataTransport_Privacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/GoogleUtilities/GoogleUtilities_Privacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/PromisesObjC/FBLPromises_Privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FirebaseCoreInternal_Privacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FirebaseInstallations_Privacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleDataTransport_Privacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleUtilities_Privacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FBLPromises_Privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", ); runOnlyForDeploymentPostprocessing = 0; @@ -446,10 +456,20 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/FirebaseCoreInternal/FirebaseCoreInternal_Privacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/FirebaseInstallations/FirebaseInstallations_Privacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/GoogleDataTransport/GoogleDataTransport_Privacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/GoogleUtilities/GoogleUtilities_Privacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/PromisesObjC/FBLPromises_Privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FirebaseCoreInternal_Privacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FirebaseInstallations_Privacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleDataTransport_Privacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleUtilities_Privacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FBLPromises_Privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", ); runOnlyForDeploymentPostprocessing = 0; diff --git a/example/package.json b/example/package.json index cd0895b..a42fb48 100644 --- a/example/package.json +++ b/example/package.json @@ -1,6 +1,6 @@ { "name": "example", - "version": "16.2.0", + "version": "17.0.0", "private": true, "config": { "android": { diff --git a/index.d.ts b/index.d.ts index e732f6c..3f28568 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,5 +1,5 @@ declare module "react-native-shake" { - export function start(clientId: string, clientSecret: string): Promise; + export function start(apiKey: string): Promise; export function show(): void; diff --git a/index.js b/index.js index 9962539..d0e3a8f 100644 --- a/index.js +++ b/index.js @@ -58,7 +58,7 @@ export { ShakeSubmitAction }; export { ChatNotification }; /** - * Interface for native methods. + * Shake SDK interface. */ class Shake { static shake = NativeModules.RNShake; @@ -73,11 +73,10 @@ class Shake { /** * Starts Shake SDK. * - * @param clientId client id - * @param clientSecret client secret + * @param apiKey api key */ - static async start(clientId, clientSecret) { - await this.shake.start(clientId, clientSecret); + static async start(apiKey) { + await this.shake.start(apiKey); this.notificationTracker.setEnabled(true); this.homeActionsTracker.setEnabled(true); this.shakeCallbacks.startListening(); diff --git a/ios/RNShake.m b/ios/RNShake.m index c54b180..2e0eb3e 100644 --- a/ios/RNShake.m +++ b/ios/RNShake.m @@ -40,10 +40,9 @@ - (dispatch_queue_t)methodQueue RCT_EXPORT_MODULE() -RCT_REMAP_METHOD(start, clientId:(NSString*)clientId clientSecret:(NSString*)clientSecret startResolver:(RCTPromiseResolveBlock)resolve - rejecter:(RCTPromiseRejectBlock)reject) +RCT_REMAP_METHOD(start, apiKey:(NSString*)apiKey startResolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { - [SHKShake startWithClientId:clientId clientSecret:clientSecret]; + [SHKShake startWithApiKey:apiKey]; /// Forward Shake callbacks to the RN SHKShake.configuration.shakeOpenListener = ^() { @@ -857,7 +856,7 @@ - (void)setPlatformInfo { NSDictionary *shakeInfo = @{ @"platform": @"ReactNative", - @"sdkVersion": @"16.2.0" + @"sdkVersion": @"17.0.0" }; [SHKShake performSelector:sel_getUid(@"_setPlatformAndSDKVersion:".UTF8String) withObject:shakeInfo]; } diff --git a/package.json b/package.json index 1f03a86..4e6a5a9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-native-shake", "title": "React Native Shake SDK", - "version": "16.2.0", + "version": "17.0.0", "description": "Shake SDK wrapper", "main": "index.js", "scripts": { diff --git a/react-native-shake.podspec b/react-native-shake.podspec index 6eea83b..68614de 100644 --- a/react-native-shake.podspec +++ b/react-native-shake.podspec @@ -7,22 +7,22 @@ Pod::Spec.new do |s| s.version = package["version"] s.summary = package["description"] s.description = <<-DESC - react-native-shake + Bug reporting SDK for React Native apps DESC - s.homepage = "https://github.com/github_account/react-native-shake" + s.homepage = "https://www.shakebugs.com" # brief license entry: s.license = "MIT" # optional - use expanded license entry instead: # s.license = { :type => "MIT", :file => "LICENSE" } - s.authors = { "Your Name" => "yourname@email.com" } + s.authors = { "Shakebugs" => "friends@shakebugs.com" } s.platforms = { :ios => "9.0" } - s.source = { :git => "https://github.com/github_account/react-native-shake.git", :tag => "#{s.version}" } + s.source = { :git => "https://github.com/shakebugs/shake-react-native", :tag => "#{s.version}" } s.source_files = "ios/**/*.{h,m,swift}" s.requires_arc = true s.dependency "React" - s.dependency "#{ENV['IOS_DEPENDENCY']}", "~> 16.2.0-rc" + s.dependency "#{ENV['IOS_DEPENDENCY']}", "~> 17.0.0-rc" # ... # s.dependency "..." end