Commit 0a888d2d authored by Steven杜宇's avatar Steven杜宇

Merge branch 'develop-tx-618' into 'develop'

增加sentry

See merge request !15
parents 4bcba4d5 b2393772
...@@ -78,3 +78,5 @@ fastlane/report.xml ...@@ -78,3 +78,5 @@ fastlane/report.xml
fastlane/Preview.html fastlane/Preview.html
fastlane/screenshots fastlane/screenshots
fastlane/test_output fastlane/test_output
.sentryclirc
...@@ -171,6 +171,8 @@ target 'galaxy' do ...@@ -171,6 +171,8 @@ target 'galaxy' do
pod 'xxtea', '1.0.2' pod 'xxtea', '1.0.2'
#代码规范 #代码规范
pod 'SwiftLint', :configurations => ['Debug'] pod 'SwiftLint', :configurations => ['Debug']
# 跟踪app性能
pod 'Sentry'
#腾讯IM #腾讯IM
tencentIM_pods tencentIM_pods
#腾讯客服 #腾讯客服
......
...@@ -7038,6 +7038,7 @@ ...@@ -7038,6 +7038,7 @@
47BB31035D3DBEB9235AC809 /* [CP] Copy Pods Resources */, 47BB31035D3DBEB9235AC809 /* [CP] Copy Pods Resources */,
04794DEC2D83D71100F14A4E /* SwiftLint */, 04794DEC2D83D71100F14A4E /* SwiftLint */,
043F0ED42E02A60C003354EB /* Embed Foundation Extensions */, 043F0ED42E02A60C003354EB /* Embed Foundation Extensions */,
820D18C0782D47DA8622DE7D /* Upload Debug Symbols to Sentry */,
); );
buildRules = ( buildRules = (
); );
...@@ -7285,6 +7286,21 @@ ...@@ -7285,6 +7286,21 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
820D18C0782D47DA8622DE7D /* Upload Debug Symbols to Sentry */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}",
);
name = "Upload Debug Symbols to Sentry";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# This script is responsible for uploading debug symbols and source context for Sentry.\nif which sentry-cli >/dev/null; then\nexport SENTRY_ORG=galaxysentry\nexport SENTRY_PROJECT=galaxy-ios\nERROR=$(sentry-cli debug-files upload --include-sources \"$DWARF_DSYM_FOLDER_PATH\" 2>&1 >/dev/null)\nif [ ! $? -eq 0 ]; then\necho \"warning: sentry-cli - $ERROR\"\nfi\nelse\necho \"warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases\"\nfi\n";
};
E45A5FF5F7AF9C08C3CC4919 /* [CP] Check Pods Manifest.lock */ = { E45A5FF5F7AF9C08C3CC4919 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
...@@ -8772,6 +8788,7 @@ ...@@ -8772,6 +8788,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = RXHYW88XR7; DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
...@@ -8920,6 +8937,7 @@ ...@@ -8920,6 +8937,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = RXHYW88XR7; DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
...@@ -9130,6 +9148,7 @@ ...@@ -9130,6 +9148,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = RXHYW88XR7; DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
...@@ -9180,6 +9199,7 @@ ...@@ -9180,6 +9199,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = RXHYW88XR7; DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
// //
import UIKit import UIKit
import Sentry
import ESTabBarController_swift import ESTabBarController_swift
import IQKeyboardManagerSwift import IQKeyboardManagerSwift
import SmartCodable import SmartCodable
...@@ -28,7 +30,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate { ...@@ -28,7 +30,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
var window: UIWindow? var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
configSentry()
Thread.sleep(forTimeInterval: 0.5) // 应产品同学Nick要求 启动页时间展示长点 Thread.sleep(forTimeInterval: 0.5) // 应产品同学Nick要求 启动页时间展示长点
setupAudionConfig() setupAudionConfig()
...@@ -313,6 +315,37 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate { ...@@ -313,6 +315,37 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
} }
extension AppDelegate { extension AppDelegate {
private func configSentry() {
SentrySDK.start { options in
options.dsn = "https://41235d99f7163a287785964dae61d5a9@dev-sentry.galaxy-immi.com/7"
options.debug = true // Enabled debug when first installing is always helpful
// Adds IP for users.
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
options.sendDefaultPii = true
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0
// Configure profiling. Visit https://docs.sentry.io/platforms/apple/profiling/ to learn more.
options.configureProfiling = {
$0.sessionSampleRate = 1.0 // We recommend adjusting this value in production.
$0.lifecycle = .trace
}
#if DEBUG || TESTENV
// Uncomment the following lines to add more data to your events
options.attachScreenshot = true // This adds a screenshot to the error events
options.attachViewHierarchy = true // This adds the view hierarchy to the error events
#else
//
#endif
}
// Remove the next line after confirming that your Sentry integration is working.
// SentrySDK.capture(message: "This app uses Sentry! :)")
}
private func thirdSetting() { private func thirdSetting() {
// 1.数据解析 // 1.数据解析
#if DEBUG #if DEBUG
......
#!/bin/sh
set -eu
# allow overriding the version
VERSION=${SENTRY_CLI_VERSION:-latest}
PLATFORM=`uname -s`
ARCH=`uname -m`
case "$PLATFORM" in
CYGWIN*) PLATFORM="Windows"
;;
MINGW*) PLATFORM="Windows"
;;
MSYS*) PLATFORM="Windows"
;;
Darwin) ARCH="universal"
;;
esac
case "$ARCH" in
armv6*) ARCH="armv7"
;;
armv7*) ARCH="armv7"
;;
armv8*) ARCH="aarch64"
;;
armv64*) ARCH="aarch64"
;;
aarch64*) ARCH="aarch64"
;;
esac
# If the install directory is not set, set it to a default
if [ -z ${INSTALL_DIR+x} ]; then
INSTALL_DIR=/usr/local/bin
fi
if [ -z ${INSTALL_PATH+x} ]; then
INSTALL_PATH="${INSTALL_DIR}/sentry-cli"
fi
DOWNLOAD_URL="https://release-registry.services.sentry.io/apps/sentry-cli/${VERSION}?response=download&arch=${ARCH}&platform=${PLATFORM}&package=sentry-cli"
echo "This script will automatically install sentry-cli (${VERSION}) for you."
echo "Installation path: ${INSTALL_PATH}"
if [ "x$(id -u)" = "x0" ]; then
echo "Warning: this script is currently running as root. This is dangerous. "
echo " Instead run it as normal user. We will sudo as needed."
fi
if [ -f "$INSTALL_PATH" ]; then
echo "error: sentry-cli is already installed."
echo " run \"sentry-cli update\" to update to latest version"
exit 1
fi
if ! hash curl 2> /dev/null; then
echo "error: you do not have 'curl' installed which is required for this script."
exit 1
fi
TEMP_FILE=`mktemp "${TMPDIR:-/tmp}/.sentrycli.XXXXXXXX"`
TEMP_HEADER_FILE=`mktemp "${TMPDIR:-/tmp}/.sentrycli-headers.XXXXXXXX"`
cleanup() {
rm -f "$TEMP_FILE"
rm -f "$TEMP_HEADER_FILE"
}
trap cleanup EXIT
HTTP_CODE=$(curl -SL --progress-bar "$DOWNLOAD_URL" -D "$TEMP_HEADER_FILE" --output "$TEMP_FILE" --write-out "%{http_code}")
if [ ${HTTP_CODE} -lt 200 ] || [ ${HTTP_CODE} -gt 299 ]; then
echo "error: your platform and architecture (${PLATFORM}-${ARCH}) is unsupported."
exit 1
fi
for PYTHON in python3 python2 python ''; do
if hash "$PYTHON"; then
break
fi
done
if [ "$PYTHON" ]; then
"$PYTHON" - <<EOF "${TEMP_FILE}" "${TEMP_HEADER_FILE}"
if 1:
import sys
import re
import hashlib
import binascii
validated = False
with open(sys.argv[2], "r") as f:
for line in f:
match = re.search("(?i)^digest:.?sha256=([^,\n ]+)", line)
if match is not None:
with open(sys.argv[1], "rb") as downloaded:
hasher = hashlib.sha256()
while True:
chunk = downloaded.read(4096)
if not chunk:
break
hasher.update(chunk)
calculated = hasher.digest()
expected = binascii.a2b_base64(match.group(1))
if calculated != expected:
print("error: checksum mismatch (got %s, expected %s)" % (
binascii.b2a_hex(calculated).decode("ascii"),
binascii.b2a_hex(expected).decode("ascii")
))
sys.exit(1)
validated = True
break
if not validated:
print("warning: unable to validate checksum because no checksum available")
EOF
else
echo "warning: python not available, unable to verify checksums"
fi
chmod 0755 "$TEMP_FILE"
if ! (mkdir -p "$(dirname "$INSTALL_PATH")" && mv "$TEMP_FILE" "$INSTALL_PATH") 2> /dev/null; then
sudo -k sh -c "mkdir -p \"$(dirname "$INSTALL_PATH")\" && mv \"$TEMP_FILE\" \"$INSTALL_PATH\""
fi
echo "Sucessfully installed $("$INSTALL_PATH" --version)"
VERSION=$("$INSTALL_PATH" --version | awk '{print $2}')
MAJOR=$(echo "$VERSION" | cut -d. -f1)
MINOR=$(echo "$VERSION" | cut -d. -f2)
if (test -d "${HOME}/.oh-my-zsh") 2>/dev/null && [ $MAJOR -eq 2 ] && [ $MINOR -ge 22 ]; then
echo 'Detected Oh My Zsh, installing Zsh completions...'
if (mkdir -p "${HOME}/.oh-my-zsh/completions") 2>&1 && ("$INSTALL_PATH" completions zsh > "${HOME}/.oh-my-zsh/completions/_sentry_cli") 2>&1; then
echo "Successfully installed Zsh completions."
else
echo 'Warning: failed to install Zsh completions.'
fi
fi
echo 'Done!'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment