diff --git a/InstabugSample/index.ios.js b/InstabugSample/index.ios.js index ba7ebfe..42a2841 100644 --- a/InstabugSample/index.ios.js +++ b/InstabugSample/index.ios.js @@ -27,7 +27,14 @@ export default class InstabugSample extends Component { constructor(props) { super(props); - Instabug.startWithToken('0f0dc916bd9175e3b5d2fdf0cfa49a69', Instabug.invocationEvent.shake); + + Instabug.isRunningLive(function (isLive) { + if (isLive) { + Instabug.startWithToken('LIVE_TOKEN', Instabug.invocationEvent.shake); + } else { + Instabug.startWithToken('BETA_TOKEN', Instabug.invocationEvent.shake); + } + }); const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); this.state = { 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 = ""; diff --git a/index.js b/index.js index bb7cf2f..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); @@ -740,6 +740,19 @@ module.exports = { } }, + /** + * @summary Checks whether app is development/Beta testing OR live + * Note: This API is iOS only + * 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} runningLiveCallBack callback with argument as return value 'isLive' + */ + isRunningLive: function(runningLiveCallBack) { + if (Platform.OS === 'ios') { + 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), 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": {