Adding ios to react native module

This commit is contained in:
Yousef Hamza 2016-10-09 14:50:04 +02:00
parent 866dc12bb9
commit 681d2e8db4
390 changed files with 3371 additions and 280 deletions

View File

@ -7,17 +7,18 @@
### Mostly automatic installation ### Mostly automatic installation
`$ react-native link instabug-reactnative` `$ rnpm link instabug-reactnative`
### Manual installation ### Manual installation
#### iOS #### iOS
1. In XCode, in the project navigator, right click `Libraries``Add Files to [your project's name]` 1. Open your app `.xcodeproj` file
2. Go to `node_modules``instabug-reactnative` and add `RNInstabugReactnative.xcodeproj` 2. Add `instabug.framework` and `instabug.bundle` from 'instabug-reactnative/ios' to the app project directory.
3. In XCode, in the project navigator, select your project. Add `libRNInstabugReactnative.a` to your project's `Build Phases``Link Binary With Libraries` 3. In XCode, in the project navigator, select your project. Add `instabug.framework` to your project's `Build Phases``Link Binary With Libraries`
4. Run your project (`Cmd+R`)< 4. 3. In XCode, in the project navigator, select your project. Add `instabug.bundle` to your project's `Build Phases``Copy Bundle Resources`
5. Run your project (`Cmd+R`)<
#### Android #### Android
@ -34,13 +35,17 @@
compile project(':instabug-reactnative') compile project(':instabug-reactnative')
``` ```
## Usage ## Usage
```javascript ```javascript
import RNInstabugReactnative from 'instabug-reactnative'; import RNInstabugReactnative from 'instabug-reactnative';
// TODO: What do with the module? class testApp extends Component {
RNInstabugReactnative; constructor() {
super();
Instabug.startWithToken('0f0dc916bd9175e3b5d2fdf0cfa49a69', Instabug.IBGConstants.invocationEvent.FloatingButton);
}
...
}
``` ```
## License ## License

227
index.ios.js Normal file
View File

@ -0,0 +1,227 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import { NativeModules } from 'react-native';
let {Instabug} = NativeModules;
module.exports = {
startWithToken: function(toke, invocationEvent) {
Instabug.startWithToken(token, invocationEvent);
},
invoke: function() {
Instabug.invoke();
},
invokeWithInvocationMode: function(invocationMode) {
Instabug.invokeWithInvocationMode(invocationMode);
},
dismiss: function () {
Instabug.dismiss();
},
setFileAttachment: function(fileLocation) {
Instabug.setFileAttachment(fileLocation);
},
setUserData: function(userData) {
Instabug.setUserData(userData);
},
IBGLog: function(log) {
Instabug.IBGLog(log);
},
setUserStepsEnabled: function(isUserStepsEnabled) {
Instabug.setUserStepsEnabled(isUserStepsEnabled);
},
setPreSendingHandler: function(handler) {
Instabug.setPreSendingHandler(handler);
},
setPreInvocationHandler: function(handler) {
Instabug.setPreInvocationHandler(handler);
},
setPostInvocatioHandler: function(handler) {
Instabug.setPostInvocatioHandler(handler);
},
showIntroMessage: function() {
Instabug.showIntroMessage();
},
setUserEmail: function(userEmail) {
Instabug.setUserEmail(userEmail);
},
setUserName: function(userName) {
Instabug.setUserName(userName);
},
setWillSkipScreenshotAnnotation: function(willSkipeScreenshotAnnotation) {
Instabug.setWillSkipScreenshotAnnotation(willSkipeScreenshotAnnotation);
},
getUnreadMessagesCount: function() {
var count = 0;
returnCallBack = function(response) {
count = response;
}
Instabug.getUnreadMessagesCount(returnCallBack);
return count;
},
setInvocationEvent: function(invocationEvent) {
Instabug.setInvocationEvent(invocationEvent);
},
setPushNotificationsEnabled: function(isPushNotificationEnabled) {
Instabug.setPushNotificationsEnabled(isPushNotificationEnabled);
},
setEmailFieldRequired: function(isEmailFieldRequired) {
Instabug.setEmailFieldRequired(isEmailFieldRequired);
},
setCommentFieldRequired: function(isCommentFieldRequired) {
Instabug.setCommentFieldRequired(isCommentFieldRequired);
},
setShakingThresholdForiPhone: function(iphoneThreshold, ipadThreshold) {
Instabug.setShakingThresholdForiPhone(iphoneThreshold, ipadThreshold);
},
setFloatingButtonEdge: function(floatingButtonEdge, offsetFromTop) {
Instabug.setFloatingButtonEdge(floatingButtonEdge, offsetFromTop);
},
setLocal: function(local) {
Instabug.setLocal(local);
},
setIntroMessageEnabled: function(isIntroMessageEnabled) {
Instabug.setIntroMessageEnabled(isIntroMessageEnabled);
},
setColorTheme: function(colorTheme) {
Instabug.setColorTheme(colorTheme);
},
// Make sure to test it
setPrimaryColor: function(primaryColor) {
Instabug.setPrimaryColor(primaryColor);
},
addTags: function(tags) {
Instabug.addTags(tags);
},
// TODO: research this: vvvv
// + (void)setScreenshotCapturingHandler:(UIImage *(^)())screenshotCapturingHandler;
resetTags: function () {
Instabug.resetTags();
},
getTags: function() {
var tags = [];
returnCallBack = function(response) {
tags = response;
}
Instabug.getUnreadMessagesCount(returnCallBack);
return tags;
},
setStringToKey: function(string, key) {
Instabug.setString(string, key);
}
replaceKeyWithString: function(string, key) {
Instabug.setString(string, key);
},
// TODO: investigate doing it in more like JS pattern
setAttachmentTypesEnabled: function(screenshot, extraScreenshot, galleryImage, screenRecording) {
Instabug.setAttachmentTypesEnabledScreenShot(screenshot, extraScreenshot, galleryImage, screenRecording);
},
setChatNotificationEnabled: function(isChatNotificationEnabled) {
Instabug.setChatNotificationEnabled(isChatNotificationEnabled);
},
// TODO: investigate doing it in more like JS pattern
setPromptOptions: function(isBugReportingEnabled, isFeedbackReportingEnabled, isChatEnabled) {
Instabug.setPromptOptionsEnabledWithBug(isBugReportingEnabled, isFeedbackReportingEnabled, isChatEnabled);
},
isInstabugNotification: function(notification) {
var ibgNotifcation = false;
returnCallBack = function(response) {
ibgNotifcation = response;
}
Instabug.isInstabugNotification(returnCallBack);
return ibgNotifcation;
},
IBGConstants: {
invocationEvent: {
None: Instabug.invocationEventNone,
Shake: Instabug.invocationEventShake,
Screenshot: Instabug.invocationEventScreenshot,
TwoFingersSwipe: Instabug.invocationEventTwoFingersSwipe,
RightEdgePan: Instabug.invocationEventRightEdgePan,
FloatingButton: Instabug.invocationEventFloatingButton
},
dismissType: {
Submit: Instabug.dismissTypeSubmit,
Cancel: Instabug.dismissTypeCancel,
AddAttachment: Instabug.dismissTypeAddAttachment
},
reportType: {
Bug: Instabug.reportTypeBug,
Feedback: Instabug.reportTypeFeedback
},
invocationMode: {
NA: Instabug.invocationModeNA,
NewBug: Instabug.invocationModeNewBug,
NewFeedback: Instabug.invocationModeNewFeedback,
NewChat: Instabug.invocationModeNewChat,
ChatsList: Instabug.invocationModeChatsList
},
local: {
Arabic: Instabug.localArabic,
ChineseSimplified: Instabug.localChineseSimplified,
ChineseTraditional: Instabug.localChineseTraditional,
Czech: Instabug.localCzech,
Danish: Instabug.localDanish,
English: Instabug.localEnglish,
French: Instabug.localFrench,
German: Instabug.localGerman,
Italian: Instabug.localItalian,
Japanese: Instabug.localJapanese,
Polish: Instabug.localPolish,
PortugueseBrazil: Instabug.localPortugueseBrazil,
Russian: Instabug.localRussian,
Spanish: Instabug.localSpanish,
Swedish: Instabug.localSwedish,
Turkish: Instabug.localTurkish
},
colorTheme: {
Light: Instabug.colorThemeLight,
Dark: Instabug.colorThemeDark
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
ios/Instabug.bundle/IBGActionSheetCell.nib generated Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
ios/Instabug.bundle/IBGBugVC-iPhone.nib generated Normal file

Binary file not shown.

BIN
ios/Instabug.bundle/IBGChatCell-iPad.nib generated Normal file

Binary file not shown.

BIN
ios/Instabug.bundle/IBGChatCell.nib generated Normal file

Binary file not shown.

BIN
ios/Instabug.bundle/IBGChatVC-iPhone.nib generated Normal file

Binary file not shown.

BIN
ios/Instabug.bundle/IBGChatsVC-iPhone.nib generated Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
ios/Instabug.bundle/IBGInboundCell.nib generated Normal file

Binary file not shown.

Binary file not shown.

BIN
ios/Instabug.bundle/IBGMessagesView.nib generated Normal file

Binary file not shown.

BIN
ios/Instabug.bundle/IBGOutboundCell.nib generated Normal file

Binary file not shown.

BIN
ios/Instabug.bundle/IBGPoweredByView.nib generated Normal file

Binary file not shown.

BIN
ios/Instabug.bundle/IBGPromptCell.nib generated Normal file

Binary file not shown.

BIN
ios/Instabug.bundle/IBGPromptVC-iPhone.nib generated Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

View File

@ -0,0 +1,115 @@
# Copyright 2014 Instabug, Inc. All rights reserved.
#
# Usage:
# * In the project editor, select your target.
# * Click "Build Phases" at the top of the project editor.
# * Click "+" button in the top left corner.
# * Choose "New Run Script Build Phase."
# * Uncomment and paste the following script.
#
# --- INVOCATION SCRIPT BEGIN ---
# # SKIP_SIMULATOR_BUILDS=1
# SCRIPT_SRC=$(find "$PROJECT_DIR" -name 'Instabug_dsym_upload.sh' | head -1)
# if [ ! "${SCRIPT_SRC}" ]; then
# echo "Instabug: err: script not found. Make sure that you're including Instabug.bundle in your project directory"
# exit 1
# fi
# source "${SCRIPT_SRC}"
# --- INVOCATION SCRIPT END ---
echo "Instabug: Started uploading dSYM"
# Check for simulator builds
if [ "$EFFECTIVE_PLATFORM_NAME" == "-iphonesimulator" ]; then
if [ "${SKIP_SIMULATOR_BUILDS}" ] && [ "${SKIP_SIMULATOR_BUILDS}" -eq 1 ]; then
echo "Instabug: Skipping simulator build"
exit 0
fi
fi
# Check to make sure the app token exists
if [ ! "${APP_TOKEN}" ]; then
APP_TOKEN=$(grep -r 'Instabug startWithToken:@\"[0-9a-zA-Z]*\"' ./ -m 1 | grep -o '\"[0-9a-zA-Z]*\"' | cut -d "\"" -f 2)
fi
if [ ! "${APP_TOKEN}" ]; then
APP_TOKEN=$(grep -r 'Instabug.startWithToken(\"[0-9a-zA-Z]*\"' ./ -m 1 | grep -o '\"[0-9a-zA-Z]*\"' | cut -d "\"" -f 2)
fi
if [ ! "${APP_TOKEN}" ] || [ -z "${APP_TOKEN}" ];then
echo "Instabug: err: APP_TOKEN not found. Make sure you've added the SDK initialization line [Instabug startWithToken: invocationEvent:]"
exit 1
fi
echo "Instabug: found APP_TOKEN=${APP_TOKEN}"
# Check internet connection
if [ "`curl -s https://api.instabug.com | grep status | grep -c OK`" != "1" ]; then
echo "ERROR connecting to api.instabug.com."
exit 0
fi
# Create temp directory if not exists
CURRENT_USER=$(whoami| tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]')
TEMP_ROOT="/tmp/Instabug-${CURRENT_USER}"
if [ ! -d "${TEMP_ROOT}" ]; then
mkdir "${TEMP_ROOT}"
fi
TEMP_DIRECTORY="${TEMP_ROOT}/$EXECUTABLE_NAME"
if [ ! -d "${TEMP_DIRECTORY}" ]; then
mkdir "${TEMP_DIRECTORY}"
fi
# Check dSYM file
if [ ! "${DSYM_PATH}" ]; then
if [ ! "${DWARF_DSYM_FOLDER_PATH}" ] || [ ! "${DWARF_DSYM_FILE_NAME}" ]; then
echo "Instabug: err: DWARF_DSYM_FOLDER_PATH or DWARF_DSYM_FILE_NAME not defined"
exit 0
fi
DSYM_PATH=${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}
fi
echo "Instabug: found DSYM_PATH=${DSYM_PATH}"
# Check if UUIDs exists
DSYM_UUIDs=$(dwarfdump --uuid "${DSYM_PATH}" | cut -d' ' -f2)
DSYM_UUIDs_PATH="${TEMP_DIRECTORY}/UUIDs.dat"
DSYM_UUIDs_TOKEN="${DSYM_UUIDs//$'\n'/-${APP_TOKEN}$'\n'}"-${APP_TOKEN}
if [ -f "${DSYM_UUIDs_PATH}" ]; then
if grep -Fxq "${DSYM_UUIDs_TOKEN}" "${DSYM_UUIDs_PATH}"; then
exit 0
fi
fi
# Create dSYM .zip file
DSYM_PATH_ZIP="${TEMP_DIRECTORY}/$DWARF_DSYM_FILE_NAME.zip"
if [ ! -d "$DSYM_PATH" ]; then
echo "Instabug: err: dSYM not found: ${DSYM_PATH}"
exit 0
fi
echo "Instabug: Compressing dSYM file..."
(/usr/bin/zip --recurse-paths --quiet "${DSYM_PATH_ZIP}" "${DSYM_PATH}") || exit 0
# Upload dSYM
echo "Instabug: Uploading dSYM file..."
ENDPOINT="https://api.instabug.com/api/ios/v1/dsym"
STATUS=$(curl "${ENDPOINT}" --write-out %{http_code} --silent --output /dev/null -F dsym=@"${DSYM_PATH_ZIP}" -F token="${APP_TOKEN}")
if [ $STATUS -ne 200 ]; then
echo "Instabug: err: dSYM archive not succesfully uploaded."
echo "Instabug: deleting temporary dSYM archive..."
/bin/rm -f "${DSYM_PATH_ZIP}"
exit 0
fi
# Remove temp dSYM archive
echo "Instabug: deleting temporary dSYM archive..."
/bin/rm -f "${DSYM_PATH_ZIP}"
# Save UUIDs
echo "${DSYM_UUIDs_TOKEN}" >> "${DSYM_UUIDs_PATH}"
# Finalize
echo "Instabug: dSYM upload complete."
if [ "$?" -ne 0 ]; then
echo "Instabug: err: an error was encountered uploading dSYM"
exit 0
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 B

BIN
ios/Instabug.bundle/bug.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 891 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Some files were not shown because too many files have changed in this diff Show More