Skip to content

Commit 48cb140

Browse files
Merge pull request #44 from Instabug/master
Merge master into dev
2 parents f4d1958 + 62ec3f1 commit 48cb140

File tree

5 files changed

+42
-5
lines changed

5 files changed

+42
-5
lines changed

InstabugSample/index.ios.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@ export default class InstabugSample extends Component {
2727

2828
constructor(props) {
2929
super(props);
30-
Instabug.startWithToken('0f0dc916bd9175e3b5d2fdf0cfa49a69', Instabug.invocationEvent.shake);
30+
31+
Instabug.isRunningLive(function (isLive) {
32+
if (isLive) {
33+
Instabug.startWithToken('LIVE_TOKEN', Instabug.invocationEvent.shake);
34+
} else {
35+
Instabug.startWithToken('BETA_TOKEN', Instabug.invocationEvent.shake);
36+
}
37+
});
3138

3239
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
3340
this.state = {

InstabugSample/ios/InstabugSample.xcodeproj/project.pbxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@
442442
24ED9F161EFA6BE300D771DA /* Recovered References */ = {
443443
isa = PBXGroup;
444444
children = (
445+
5632439F28464ECB86D23318 /* libRNInstabug.a */,
445446
);
446447
name = "Recovered References";
447448
sourceTree = "<group>";

index.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,9 +712,9 @@ module.exports = {
712712
* none is enabled, Bug
713713
* reporting becomes the default invocation option.
714714
*
715-
* @param {boolean} chat weather Talk to us is enable or not
716-
* @param {boolean} bug weather Report a Problem is enable or not
717-
* @param {boolean} feedback weather General Feedback is enable or not
715+
* @param {boolean} chat whether Talk to us is enable or not
716+
* @param {boolean} bug whether Report a Problem is enable or not
717+
* @param {boolean} feedback whether General Feedback is enable or not
718718
* */
719719
setPromptOptionsEnabled: function (chat, bug, feedback) {
720720
Instabug.setPromptOptionsEnabled(chat, bug, feedback);
@@ -740,6 +740,19 @@ module.exports = {
740740
}
741741
},
742742

743+
/**
744+
* @summary Checks whether app is development/Beta testing OR live
745+
* Note: This API is iOS only
746+
* It returns in the callback false if in development or beta testing on Test Flight, and true if app is live on the
747+
* app store.
748+
* @param {function} runningLiveCallBack callback with argument as return value 'isLive'
749+
*/
750+
isRunningLive: function(runningLiveCallBack) {
751+
if (Platform.OS === 'ios') {
752+
Instabug.isRunningLive(runningLiveCallBack)
753+
}
754+
},
755+
743756
/**
744757
* The event used to invoke the feedback form
745758
* @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),

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "instabug-reactnative",
3-
"version": "1.1.2",
3+
"version": "1.1.3",
44
"description": "React Native plugin for integrating the Instabug SDK",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)