Skip to content

Commit 9814122

Browse files
committed
add isRunningLive
1 parent ba85a8b commit 9814122

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

InstabugSample/index.ios.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ export default class InstabugSample extends Component {
2727

2828
constructor(props) {
2929
super(props);
30+
31+
Instabug.isRunningLive(function (isLive) {
32+
if (isLive) {
33+
console.log("live");
34+
} else {
35+
console.log("not live");
36+
}
37+
});
38+
3039
Instabug.startWithToken('0f0dc916bd9175e3b5d2fdf0cfa49a69', Instabug.invocationEvent.shake);
3140

3241
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,10 @@ module.exports = {
740740
}
741741
},
742742

743+
isRunningLive: function(runningLiveCallBack) {
744+
Instabug.isRunningLive(runningLiveCallBack)
745+
},
746+
743747
/**
744748
* The event used to invoke the feedback form
745749
* @readonly

ios/RNInstabug/InstabugReactBridge.m

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,22 @@ - (dispatch_queue_t)methodQueue {
326326
[Instabug setViewHierarchyEnabled:viewHirearchyEnabled];
327327
}
328328

329+
RCT_EXPORT_METHOD(isRunningLive:(RCTResponseSenderBlock)callback) {
330+
BOOL result = NO;
331+
#if TARGET_OS_SIMULATOR
332+
result = NO;
333+
#else
334+
BOOL isRunningTestFlightBeta = [[[[NSBundle mainBundle] appStoreReceiptURL] lastPathComponent] isEqualToString:@"sandboxReceipt"];
335+
BOOL hasEmbeddedMobileProvision = !![[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"];
336+
if (isRunningTestFlightBeta || hasEmbeddedMobileProvision)
337+
{
338+
result = NO;
339+
}
340+
result = YES;
341+
#endif
342+
callback(@[[NSNumber numberWithBool:result]]);
343+
}
344+
329345
- (NSDictionary *)constantsToExport
330346
{
331347
return @{ @"invocationEventNone" : @(IBGInvocationEventNone),

0 commit comments

Comments
 (0)