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),