-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from testfairy/android-sdk
Android sdk Updated to ios sdk 1.7.4
- Loading branch information
Showing
9 changed files
with
165 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.testfairy; | ||
|
||
import org.apache.cordova.CallbackContext; | ||
import org.apache.cordova.CordovaPlugin; | ||
import org.apache.cordova.CordovaInterface; | ||
import org.json.JSONArray; | ||
import org.json.JSONObject; | ||
import org.json.JSONException; | ||
import android.content.Intent; | ||
|
||
import android.content.Context; | ||
|
||
public class CDVTestFairy extends CordovaPlugin { | ||
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { | ||
if ("begin".equals(action)) { | ||
String apiKey = args.optString(0); | ||
TestFairy.begin(cordova.getActivity(), apiKey); | ||
} else if ("pushFeedbackController".equals(action)) { | ||
|
||
} else if ("updateLocation".equals(action)) { | ||
|
||
} else if ("checkpoint".equals(action)) { | ||
String name = args.optString(0); | ||
TestFairy.addCheckpoint(name); | ||
} else if ("setCorrelationId".equals(action)) { | ||
String id = args.optString(0); | ||
TestFairy.setCorrelationId(id); | ||
} else if ("pause".equals(action)) { | ||
TestFairy.pause(); | ||
} else if ("resume".equals(action)) { | ||
TestFairy.resume(); | ||
} else { | ||
return false; | ||
} | ||
|
||
callbackContext.success(); | ||
return true; | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#!/bin/sh | ||
|
||
TESTFAIRY_ENDPOINT="http://app.testfairy.com/upload/dsym/" | ||
|
||
ZIP=zip | ||
CURL=curl | ||
STAT=stat | ||
DATE=date | ||
|
||
log() { | ||
NOW=$($DATE +"%Y-%m-%d %H:%M:%S") | ||
echo "${NOW} ${1}" | ||
} | ||
|
||
help() { | ||
echo "Usage: ${0} [-f] TESTFAIRY_API_KEY [-p DSYM_PATH]" | ||
exit 1 | ||
} | ||
|
||
DAEMON=1 | ||
if [ "${1}" == "-f" ]; then | ||
DAEMON=0 | ||
shift | ||
elif [ "${1}" == "-d" ]; then | ||
# backward compatible when -f was the default | ||
shift | ||
fi | ||
|
||
|
||
API_KEY="${1}" | ||
if [ ! "${API_KEY}" ]; then | ||
help | ||
fi | ||
|
||
DSYM_PATH=${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME} | ||
|
||
if [ "${#}" -gt 1 ]; then | ||
shift | ||
if [ "${1}" != "-p" ]; then | ||
help | ||
fi | ||
|
||
shift | ||
DSYM_PATH="${1}" | ||
fi | ||
|
||
if [ "${DSYM_PATH}" == "" ] || [ "${DSYM_PATH}" == "/" ] || [ ! -d "${DSYM_PATH}" ]; then | ||
echo "Fatal: Can't find .dSYM folder!" | ||
help | ||
fi | ||
|
||
NOW=$($DATE +%s) | ||
TMP_FILENAME="/tmp/${NOW}-${DWARF_DSYM_FILE_NAME}.zip" | ||
|
||
# Compress the .dSYM folder into a zip file | ||
log "Compressing .dSYM folder ${DSYM_PATH}" | ||
$ZIP -qrp9 "${TMP_FILENAME}" "${DSYM_PATH}" | ||
FILE_SIZE=$($STAT -f "%z" "${TMP_FILENAME}") | ||
|
||
foreground_upload() { | ||
# Upload zipped .dSYM file to TestFairy's servers | ||
STARTED=$($DATE +"%s") | ||
$CURL -s -F api_key="${API_KEY}" -F dsym=@"${1}" -o /dev/null "${TESTFAIRY_ENDPOINT}" | ||
ENDED=$($DATE +"%s") | ||
DIFF=$(expr ${ENDED} - ${STARTED}) | ||
log "Symbols uploaded in ${DIFF} seconds" | ||
|
||
# Clean up behind | ||
rm -f ${TMP_FILENAME} | ||
} | ||
|
||
background_upload() { | ||
sh -c "$CURL -F api_key=\"${API_KEY}\" -F dsym=@\"${1}\" -s -o /dev/null \"${TESTFAIRY_ENDPOINT}\"; rm -f ${TMP_FILENAME};" /dev/null 2>&1 & | ||
} | ||
|
||
if [ "$DAEMON" == "0" ]; then | ||
log "Uploading ${FILE_SIZE} bytes to dsym server in foreground" | ||
foreground_upload "${TMP_FILENAME}" | ||
else | ||
log "Uploading ${FILE_SIZE} bytes to dsym server in background" | ||
background_upload "${TMP_FILENAME}" | ||
fi | ||
|
||
log "TestFairy .dSYM upload script ends" | ||
|