From 98141221ef5c5c9a3cce6f5b842eef25197b46e3 Mon Sep 17 00:00:00 2001 From: yousefhamza Date: Tue, 27 Jun 2017 13:31:25 +0200 Subject: [PATCH 1/5] add isRunningLive --- InstabugSample/index.ios.js | 9 +++++++++ index.js | 4 ++++ ios/RNInstabug/InstabugReactBridge.m | 16 ++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/InstabugSample/index.ios.js b/InstabugSample/index.ios.js index ba7ebfe..8155d79 100644 --- a/InstabugSample/index.ios.js +++ b/InstabugSample/index.ios.js @@ -27,6 +27,15 @@ export default class InstabugSample extends Component { constructor(props) { super(props); + + Instabug.isRunningLive(function (isLive) { + if (isLive) { + console.log("live"); + } else { + console.log("not live"); + } + }); + Instabug.startWithToken('0f0dc916bd9175e3b5d2fdf0cfa49a69', Instabug.invocationEvent.shake); const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); diff --git a/index.js b/index.js index bb7cf2f..e72b730 100644 --- a/index.js +++ b/index.js @@ -740,6 +740,10 @@ module.exports = { } }, + isRunningLive: function(runningLiveCallBack) { + Instabug.isRunningLive(runningLiveCallBack) + }, + /** * The event used to invoke the feedback form * @readonly diff --git a/ios/RNInstabug/InstabugReactBridge.m b/ios/RNInstabug/InstabugReactBridge.m index 8ddba31..948c594 100644 --- a/ios/RNInstabug/InstabugReactBridge.m +++ b/ios/RNInstabug/InstabugReactBridge.m @@ -326,6 +326,22 @@ RCT_EXPORT_METHOD(setViewHirearchyEnabled:(BOOL)viewHirearchyEnabled) { [Instabug setViewHierarchyEnabled:viewHirearchyEnabled]; } +RCT_EXPORT_METHOD(isRunningLive:(RCTResponseSenderBlock)callback) { + BOOL result = NO; +#if TARGET_OS_SIMULATOR + result = NO; +#else + BOOL isRunningTestFlightBeta = [[[[NSBundle mainBundle] appStoreReceiptURL] lastPathComponent] isEqualToString:@"sandboxReceipt"]; + BOOL hasEmbeddedMobileProvision = !![[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"]; + if (isRunningTestFlightBeta || hasEmbeddedMobileProvision) + { + result = NO; + } + result = YES; +#endif + callback(@[[NSNumber numberWithBool:result]]); +} + - (NSDictionary *)constantsToExport { return @{ @"invocationEventNone" : @(IBGInvocationEventNone), From 881859419c89828d5d0ef055677a25496f1fb6f1 Mon Sep 17 00:00:00 2001 From: yousefhamza Date: Tue, 27 Jun 2017 13:38:25 +0200 Subject: [PATCH 2/5] Replace console logs with startWithToken --- InstabugSample/index.ios.js | 8 +++----- .../ios/InstabugSample.xcodeproj/project.pbxproj | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/InstabugSample/index.ios.js b/InstabugSample/index.ios.js index 8155d79..42a2841 100644 --- a/InstabugSample/index.ios.js +++ b/InstabugSample/index.ios.js @@ -27,17 +27,15 @@ export default class InstabugSample extends Component { constructor(props) { super(props); - + Instabug.isRunningLive(function (isLive) { if (isLive) { - console.log("live"); + Instabug.startWithToken('LIVE_TOKEN', Instabug.invocationEvent.shake); } else { - console.log("not live"); + Instabug.startWithToken('BETA_TOKEN', Instabug.invocationEvent.shake); } }); - Instabug.startWithToken('0f0dc916bd9175e3b5d2fdf0cfa49a69', Instabug.invocationEvent.shake); - const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); this.state = { dataSource: ds.cloneWithRows(this._genRows({})), diff --git a/InstabugSample/ios/InstabugSample.xcodeproj/project.pbxproj b/InstabugSample/ios/InstabugSample.xcodeproj/project.pbxproj index 2a9b573..6a8a321 100644 --- a/InstabugSample/ios/InstabugSample.xcodeproj/project.pbxproj +++ b/InstabugSample/ios/InstabugSample.xcodeproj/project.pbxproj @@ -442,6 +442,7 @@ 24ED9F161EFA6BE300D771DA /* Recovered References */ = { isa = PBXGroup; children = ( + 5632439F28464ECB86D23318 /* libRNInstabug.a */, ); name = "Recovered References"; sourceTree = ""; From 432c3a5619bf5b4922a2482b2500451b69aa832e Mon Sep 17 00:00:00 2001 From: yousefhamza Date: Tue, 27 Jun 2017 14:14:04 +0200 Subject: [PATCH 3/5] add docs --- index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index e72b730..4cd1c33 100644 --- a/index.js +++ b/index.js @@ -740,8 +740,17 @@ module.exports = { } }, + /** + * @summary Checks wether app is development/Beta testing OR live + * Note: This API is iOS only + * It reutrns in the callback false if in development or beta testing on Test Flight, and true if app is live on the + * app store. + * @param {function} isInstabugNotificationCallback callback with argument as return value 'isLive' + */ isRunningLive: function(runningLiveCallBack) { - Instabug.isRunningLive(runningLiveCallBack) + if (Platform.OS === 'ios') { + Instabug.isRunningLive(runningLiveCallBack) + } }, /** From 861a8959f01e9263dfd7b4f7e6105053e7091f5e Mon Sep 17 00:00:00 2001 From: DevHossamHassan Date: Tue, 27 Jun 2017 14:25:32 +0200 Subject: [PATCH 4/5] Fix typos --- index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 4cd1c33..bf844ad 100644 --- a/index.js +++ b/index.js @@ -712,9 +712,9 @@ module.exports = { * none is enabled, Bug * reporting becomes the default invocation option. * - * @param {boolean} chat weather Talk to us is enable or not - * @param {boolean} bug weather Report a Problem is enable or not - * @param {boolean} feedback weather General Feedback is enable or not + * @param {boolean} chat whether Talk to us is enable or not + * @param {boolean} bug whether Report a Problem is enable or not + * @param {boolean} feedback whether General Feedback is enable or not * */ setPromptOptionsEnabled: function (chat, bug, feedback) { Instabug.setPromptOptionsEnabled(chat, bug, feedback); @@ -741,11 +741,11 @@ module.exports = { }, /** - * @summary Checks wether app is development/Beta testing OR live + * @summary Checks whether app is development/Beta testing OR live * Note: This API is iOS only - * It reutrns in the callback false if in development or beta testing on Test Flight, and true if app is live on the + * It returns in the callback false if in development or beta testing on Test Flight, and true if app is live on the * app store. - * @param {function} isInstabugNotificationCallback callback with argument as return value 'isLive' + * @param {function} runningLiveCallBack callback with argument as return value 'isLive' */ isRunningLive: function(runningLiveCallBack) { if (Platform.OS === 'ios') { From 62ec3f18bd698be5b140eac59c47682bdc58fa24 Mon Sep 17 00:00:00 2001 From: DevHossamHassan Date: Tue, 27 Jun 2017 14:26:22 +0200 Subject: [PATCH 5/5] Pump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e9ff80f..101e6f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "instabug-reactnative", - "version": "1.1.2", + "version": "1.1.3", "description": "React Native plugin for integrating the Instabug SDK", "main": "index.js", "repository": {