Skip to content

Commit

Permalink
Revert "Revert "Merge branch 'master' of https://github.com/Instabug/…
Browse files Browse the repository at this point in the history
…instabug-reactnative""

This reverts commit 4cdeaaf.
  • Loading branch information
DevHossamHassan committed Jun 22, 2017
1 parent d8276f9 commit 9d8ad92
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 50 deletions.
11 changes: 10 additions & 1 deletion InstabugSample/index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default class InstabugSample extends Component {
constructor(props) {
super(props);
Instabug.startWithToken('0f0dc916bd9175e3b5d2fdf0cfa49a69', Instabug.invocationEvent.shake);

const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
dataSource: ds.cloneWithRows(this._genRows({})),
Expand Down Expand Up @@ -61,7 +62,8 @@ export default class InstabugSample extends Component {
"Unread messages count",
"Set locale",
"Set color theme",
"Set primary color"
"Set primary color",
"Show surveys"
];
return dataBlob;
}
Expand All @@ -85,6 +87,8 @@ export default class InstabugSample extends Component {
this._showColorThemeActionSheet();
} else if (rowID == 7) {
this._showPrimaryColorActionSheet();
} else if (rowID == 8) {
this._showSurveys();
}
}

Expand Down Expand Up @@ -225,6 +229,11 @@ export default class InstabugSample extends Component {
});
}

_showSurveys() {
console.log("show surveys")
Instabug.showSurveysIfAvailable()
}

_renderSeparator(sectionID: number, rowID: number, adjacentRowHighlighted: bool) {
return (
<View
Expand Down
41 changes: 28 additions & 13 deletions InstabugSample/ios/InstabugSample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
2D02E4C81E0B4AEC006451C7 /* libRCTWebSocket-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */; };
2D02E4C91E0B4AEC006451C7 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact.a */; };
2DCD954D1E0B4F2C00145EB5 /* InstabugSampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* InstabugSampleTests.m */; };
3F14AAB3F8DF4F53A90F3677 /* libRNInstabug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E4D43295C2849C9ABADE838 /* libRNInstabug.a */; };
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
E55D333604B942E09167708C /* libRNInstabug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5632439F28464ECB86D23318 /* libRNInstabug.a */; };
FB6237B8BC81FC0C990E8BE6 /* libPods-InstabugSample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E9562565B465A2839B076D83 /* libPods-InstabugSample.a */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -104,9 +104,9 @@
remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
remoteInfo = React;
};
2460ED191E530B9B0043EDA4 /* PBXContainerItemProxy */ = {
24C9AC781EFA773C00D07EFB /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 330102236E534C228083A4A1 /* RNInstabug.xcodeproj */;
containerPortal = 68353C997C7F4ED0910B4CFA /* RNInstabug.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 24DF11ED1DA3A2B90056F77C;
remoteInfo = RNInstabug;
Expand Down Expand Up @@ -262,9 +262,9 @@
21DED4D3594E0D93E837631F /* Pods-InstabugSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InstabugSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-InstabugSample/Pods-InstabugSample.release.xcconfig"; sourceTree = "<group>"; };
2D02E47B1E0B4A5D006451C7 /* InstabugSample-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "InstabugSample-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
2D02E4901E0B4A5D006451C7 /* InstabugSample-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "InstabugSample-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
330102236E534C228083A4A1 /* RNInstabug.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNInstabug.xcodeproj; path = "../node_modules/instabug-reactnative/ios/RNInstabug.xcodeproj"; sourceTree = "<group>"; };
5E4D43295C2849C9ABADE838 /* libRNInstabug.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNInstabug.a; sourceTree = "<group>"; };
5632439F28464ECB86D23318 /* libRNInstabug.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNInstabug.a; sourceTree = "<group>"; };
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
68353C997C7F4ED0910B4CFA /* RNInstabug.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNInstabug.xcodeproj; path = "../node_modules/instabug-reactnative/ios/RNInstabug.xcodeproj"; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
8601D784DB38337F6E545397 /* Pods-InstabugSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InstabugSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InstabugSample/Pods-InstabugSample.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -295,8 +295,8 @@
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
3F14AAB3F8DF4F53A90F3677 /* libRNInstabug.a in Frameworks */,
FB6237B8BC81FC0C990E8BE6 /* libPods-InstabugSample.a in Frameworks */,
E55D333604B942E09167708C /* libRNInstabug.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -431,14 +431,21 @@
name = Products;
sourceTree = "<group>";
};
2460ECFD1E530B9B0043EDA4 /* Products */ = {
24C9AC5C1EFA773C00D07EFB /* Products */ = {
isa = PBXGroup;
children = (
2460ED1A1E530B9B0043EDA4 /* libRNInstabug.a */,
24C9AC791EFA773C00D07EFB /* libRNInstabug.a */,
);
name = Products;
sourceTree = "<group>";
};
24ED9F161EFA6BE300D771DA /* Recovered References */ = {
isa = PBXGroup;
children = (
);
name = "Recovered References";
sourceTree = "<group>";
};
443E311BD736B6F07D8B5811 /* Frameworks */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -488,7 +495,7 @@
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
330102236E534C228083A4A1 /* RNInstabug.xcodeproj */,
68353C997C7F4ED0910B4CFA /* RNInstabug.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
Expand All @@ -511,6 +518,7 @@
83CBBA001A601CBA00E9B192 /* Products */,
8098B839B3C5F5897B38D9B3 /* Pods */,
443E311BD736B6F07D8B5811 /* Frameworks */,
24ED9F161EFA6BE300D771DA /* Recovered References */,
);
indentWidth = 2;
sourceTree = "<group>";
Expand Down Expand Up @@ -618,6 +626,9 @@
CreatedOnToolsVersion = 6.2;
TestTargetID = 13B07F861A680F5B00A75B9A;
};
13B07F861A680F5B00A75B9A = {
DevelopmentTeam = 56S6Q9SA8U;
};
2D02E47A1E0B4A5D006451C7 = {
CreatedOnToolsVersion = 8.2.1;
ProvisioningStyle = Automatic;
Expand Down Expand Up @@ -686,8 +697,8 @@
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
},
{
ProductGroup = 2460ECFD1E530B9B0043EDA4 /* Products */;
ProjectRef = 330102236E534C228083A4A1 /* RNInstabug.xcodeproj */;
ProductGroup = 24C9AC5C1EFA773C00D07EFB /* Products */;
ProjectRef = 68353C997C7F4ED0910B4CFA /* RNInstabug.xcodeproj */;
},
);
projectRoot = "";
Expand Down Expand Up @@ -757,11 +768,11 @@
remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2460ED1A1E530B9B0043EDA4 /* libRNInstabug.a */ = {
24C9AC791EFA773C00D07EFB /* libRNInstabug.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRNInstabug.a;
remoteRef = 2460ED191E530B9B0043EDA4 /* PBXContainerItemProxy */;
remoteRef = 24C9AC781EFA773C00D07EFB /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */ = {
Expand Down Expand Up @@ -1110,7 +1121,9 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = 56S6Q9SA8U;
INFOPLIST_FILE = InstabugSample/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = (
"$(inherited)",
Expand All @@ -1128,7 +1141,9 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 56S6Q9SA8U;
INFOPLIST_FILE = InstabugSample/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = (
"$(inherited)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ public void clearFileAttachment() {
/**
* Sets a block of code that gets executed when a new message is received.
*
* @param {onNewMessgaeHandler} onNewMessageHandler - A callback that gets
* @param {onNewMessageHandler} onNewMessageHandler - A callback that gets
* executed when a new message is received.
*/
@ReactMethod
Expand Down
75 changes: 42 additions & 33 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,6 @@ module.exports = {
Instabug.dismiss();
},

/**
* Attaches a file to each report being sent.
* A new copy of the file at fileLocation will be attached with each bug
* report being sent.
* Each call to this method overrides the file to be attached.
* The file has to be available locally at the provided path.
* @param {string} fileLocation Path to a file that's going to be attached
* to each report.
*/
// Not yet tested
setFileAttachment: function (fileLocation) {
Instabug.setFileAttachment(fileLocation);
},

/**
* Attaches user data to each report being sent.
* Each call to this method overrides the user data to be attached.
Expand Down Expand Up @@ -98,7 +84,7 @@ module.exports = {
* Sets a block of code to be executed before sending each report.
* This block is executed in the background before sending each report. Could
* be used for attaching logs and extra data to reports.
* @param {preSendingHandler} preSendingHandler - A callback that gets executed before sending each bug
* @param {function} preSendingHandler - A callback that gets executed before sending each bug
* report.
*/
setPreSendingHandler: function (preSendingHandler) {
Expand All @@ -119,7 +105,7 @@ module.exports = {
* Sets a block of code to be executed just before the SDK's UI is presented.
* This block is executed on the UI thread. Could be used for performing any
* UI changes before the SDK's UI is shown.
* @param {preInvocationHandler} preInvocationHandler - A callback that gets executed before invoking the SDK
* @param {function} preInvocationHandler - A callback that gets executed before invoking the SDK
*/
setPreInvocationHandler: function (preInvocationHandler) {
if (Platform.OS === 'ios') {
Expand All @@ -138,7 +124,7 @@ module.exports = {
* Sets a block of code to be executed right after the SDK's UI is dismissed.
* This block is executed on the UI thread. Could be used for performing any
* UI changes after the SDK's UI is dismissed.
* @param {postInvocationHandler} postInvocationHandler - A callback to get executed after
* @param {function} postInvocationHandler - A callback to get executed after
* dismissing the SDK.
*/
setPostInvocationHandler: function (postInvocationHandler) {
Expand Down Expand Up @@ -390,15 +376,15 @@ module.exports = {

/**
* Sets a block of code that gets executed when a new message is received.
* @param {onNewMessgaeHandler} onNewMessageHandler - A callback that gets
* @param {function} onNewMessageHandler - A callback that gets
* executed when a new message is received.
*/
setOnNewMessageHandler: function (onNewMessageHandler) {
if (Platform.OS === 'ios') {
Instabug.addListener('IBGonNewMessageHandler');
NativeAppEventEmitter.addListener(
'IBGonNewMessageHandler',
onNewMessgaeHandler
onNewMessageHandler
);
}

Expand All @@ -413,7 +399,7 @@ module.exports = {
* you should call didReceiveRemoteNotification: to let the Instabug handle
* the notification. Otherwise, handle the notification on your own.
* @param {Object} dict Notification's userInfo
* @param {isInstabugNotificationCallback} isInstabugNotificationCallback callback with
* @param {function} isInstabugNotificationCallback callback with
* argument isInstabugNotification
*/
isInstabugNotification: function (dict, isInstabugNotificationCallback) {
Expand Down Expand Up @@ -449,7 +435,7 @@ module.exports = {
* feedback.
* Use this method to give users a list of choices of categories their bug report or feedback might be related
* to. Selected category will be shown as a tag on your dashboard.
* @param {array} titles titles to be shown in the list.
* @param {Array} titles titles to be shown in the list.
*/
setReportCategories: function (...titles) {
if (Platform.OS == 'ios') {
Expand Down Expand Up @@ -604,7 +590,7 @@ module.exports = {
* Returns the user attribute associated with a given key.
aKey
* @param {string} key The attribute key as string
* @param {userAttributeCallback} userAttributeCallback callback with argument as the desired user attribute value
* @param {function} userAttributeCallback callback with argument as the desired user attribute value
*/
getUserAttribute: function (key, userAttributeCallback) {
Instabug.getUserAttribute(key, userAttributeCallback);
Expand All @@ -624,7 +610,7 @@ module.exports = {

/**
* @summary Returns all user attributes.
* @param {userAttributesCallback} userAttributesCallback callback with argument A new dictionary containing all the currently set user attributes,
* @param {function} userAttributesCallback callback with argument A new dictionary containing all the currently set user attributes,
* or an empty dictionary if no user attributes have been set.
*/
getAllUserAttributes: function (userAttributesCallback) {
Expand All @@ -638,18 +624,43 @@ module.exports = {
Instabug.clearAllUserAttributes();
},

setViewHirearchyEnabled: function (viewHirearchyEnabled) {
Instabug.setViewHirearchyEnabled(viewHirearchyEnabled);
/**
* @summary Enables/disables inspect view hierarchy when reporting a bug/feedback.
* @param {boolean} viewHierarchyEnabled A boolean to set whether view hierarchy are enabled or disabled.
*/
setViewHierarchyEnabled: function (viewHierarchyEnabled) {
if (Platform.OS === 'ios') {
Instabug.setViewHierarchyEnabled(viewHierarchyEnabled);
}
},

/**
* @summary Sets whether surveys are enabled or not.
* If you disable surveys on the SDK but still have active surveys on your Instabug dashboard,
* those surveys are still going to be sent to the device, but are not going to be shown automatically.
* To manually display any available surveys, call `Instabug.showSurveyIfAvailable()`.
* Defaults to `true`.
* @param {boolean} surveysEnabled A boolean to set whether Instabug Surveys is enabled or disabled.
*/
setSurveysEnabled: function (surveysEnabled) {
Instabug.setSurveysEnabled(surveysEnabled)
},

/**
* @summary Shows one of the surveys that were not shown before, that also have conditions that match the current device/user.
* Does nothing if there are no available surveys or if a survey has already been shown in the current session.
*/
showSurveysIfAvailable: function () {
Instabug.showSurveysIfAvailable()
},

/**
* @summary Sets a block of code to be executed just before the survey's UI is presented.
* This block is executed on the UI thread. Could be used for performing any UI changes before
* the survey's UI is shown.
* @param {function} willShowSurveyHandler - A block of code that gets executed before presenting the survey's UI.
* report.
*/
setWillShowSurveyHandler: function (willShowSurveyHandler) {
if (Platform.OS === 'ios') {
Instabug.addListener('IBGWillShowSurvey');
Expand All @@ -663,6 +674,12 @@ module.exports = {

},

/**
* @summary Sets a block of code to be executed right after the survey's UI is dismissed.
* This block is executed on the UI thread. Could be used for performing any UI changes after the survey's UI
* is dismissed.
* @param {function} didDismissSurveyHandler - A block of code that gets executed after the survey's UI is dismissed.
*/
setDidDismissSurveyHandler: function (didDismissSurveyHandler) {
if (Platform.OS === 'ios') {
Instabug.addListener('IBGDidDismissSurvey');
Expand Down Expand Up @@ -691,14 +708,6 @@ module.exports = {
Instabug.setPromptOptionsEnabled(chat, bug, feedback);
},

/**
* Clears all Uris of the attached files.
* The URIs which added via {@link Instabug#addFileAttachment} API not the physical files.
*/
clearFileAttachment: function () {
Instabug.clearFileAttachment();
},

/**
* The event used to invoke the feedback form
* @readonly
Expand Down
Loading

0 comments on commit 9d8ad92

Please sign in to comment.