diff --git a/platform-darwin/MasterPassword-iOS.xcodeproj/project.pbxproj b/platform-darwin/MasterPassword-iOS.xcodeproj/project.pbxproj index 8bb1cb89..247a4b0d 100644 --- a/platform-darwin/MasterPassword-iOS.xcodeproj/project.pbxproj +++ b/platform-darwin/MasterPassword-iOS.xcodeproj/project.pbxproj @@ -3453,6 +3453,7 @@ DA5BFA42147E415C00F98B1E /* Resources */, DA6556E314D55F3000841C99 /* Run Script: GIT version -> Info.plist */, 4A87858EE3659604089E2F9F /* [CP] Embed Pods Frameworks */, + DA3C4EB32439438B00A6C4A8 /* Upload Sentry dSYM */, ); buildRules = ( ); @@ -3952,6 +3953,24 @@ 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; }; + DA3C4EB32439438B00A6C4A8 /* Upload Sentry dSYM */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Upload Sentry dSYM"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = "/bin/sh -e"; + shellScript = "if hash sentry-cli 2>/dev/null; then\n if ! ERROR=$(SENTRY_ORG=lyndir SENTRY_PROJECT=masterpassword-ios sentry-cli upload-dif --log-level info \"$DWARF_DSYM_FOLDER_PATH\" 2>&1 >/dev/null); then\n echo >&2 \"warning: sentry-cli: $ERROR\"\n fi\nelse\n echo >&2 \"warning: sentry-cli not installed: try brew install getsentry/tools/sentry-cli\"\nfi\n"; + }; DA6556E314D55F3000841C99 /* Run Script: GIT version -> Info.plist */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -4505,10 +4524,6 @@ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = NO; CODE_SIGN_ENTITLEMENTS = Source/iOS/MasterPassword.entitlements; CODE_SIGN_STYLE = Manual; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/External/iOS\"", - ); GCC_C_LANGUAGE_STANDARD = c11; GCC_PREFIX_HEADER = "Source/MasterPassword-Prefix.pch"; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; @@ -4551,10 +4566,6 @@ CODE_SIGN_ENTITLEMENTS = Source/iOS/MasterPassword.entitlements; CODE_SIGN_STYLE = Manual; EXCLUDED_SOURCE_FILE_NAMES = libDCIntrospect.a; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/External/iOS\"", - ); GCC_C_LANGUAGE_STANDARD = c11; GCC_PREFIX_HEADER = "Source/MasterPassword-Prefix.pch"; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; diff --git a/platform-darwin/MasterPassword-macOS.xcodeproj/project.pbxproj b/platform-darwin/MasterPassword-macOS.xcodeproj/project.pbxproj index c271787b..3182139a 100644 --- a/platform-darwin/MasterPassword-macOS.xcodeproj/project.pbxproj +++ b/platform-darwin/MasterPassword-macOS.xcodeproj/project.pbxproj @@ -2428,6 +2428,7 @@ DAD9B5EE1762CA3A001835F9 /* Copy LoginHelper */, DA6556E314D55F3000841C99 /* Run Script: GIT version -> Info.plist */, 43E5966C8C236E86824DDADE /* [CP] Embed Pods Frameworks */, + DA3C4EB2243941AE00A6C4A8 /* Upload Sentry dSYM */, ); buildRules = ( ); @@ -2729,6 +2730,25 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-MasterPassword-macOS/Pods-MasterPassword-macOS-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; + DA3C4EB2243941AE00A6C4A8 /* Upload Sentry dSYM */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 8; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Upload Sentry dSYM"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 1; + shellPath = "/bin/sh -e"; + shellScript = "if hash sentry-cli 2>/dev/null; then\n if ! ERROR=$(SENTRY_ORG=lyndir SENTRY_PROJECT=masterpassword-macos sentry-cli upload-dif --log-level info \"$DWARF_DSYM_FOLDER_PATH\" 2>&1 >/dev/null); then\n echo >&2 \"warning: sentry-cli: $ERROR\"\n fi\nelse\n echo >&2 \"warning: sentry-cli not installed: try brew install getsentry/tools/sentry-cli\"\nfi\n"; + showEnvVarsInLog = 0; + }; DA4EF9CB19FD4B600032ECB5 /* Run Script: genassets */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -3342,10 +3362,6 @@ CODE_SIGN_IDENTITY = "Mac Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development"; COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/External/Mac\"", - ); GCC_PREFIX_HEADER = "Source/MasterPassword-Prefix.pch"; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; HEADER_SEARCH_PATHS = ( @@ -3382,10 +3398,6 @@ CODE_SIGN_IDENTITY = "Mac Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development"; COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/External/Mac\"", - ); GCC_PREFIX_HEADER = "Source/MasterPassword-Prefix.pch"; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; HEADER_SEARCH_PATHS = ( diff --git a/platform-darwin/Source/MPAppDelegate_Shared.m b/platform-darwin/Source/MPAppDelegate_Shared.m index 59ced1ff..cf4eaaf7 100644 --- a/platform-darwin/Source/MPAppDelegate_Shared.m +++ b/platform-darwin/Source/MPAppDelegate_Shared.m @@ -73,7 +73,7 @@ static MPAppDelegate_Shared *instance; - (void)setActiveUser:(MPUserEntity *)activeUser { NSManagedObjectID *activeUserOID = activeUser.permanentObjectID; - if ([self.activeUserOID isEqualTo:activeUserOID]) + if ([self.activeUserOID isEqual:activeUserOID]) return; if (self.key) diff --git a/platform-darwin/Source/MPTypes.h b/platform-darwin/Source/MPTypes.h index 912f78fd..12db47e0 100644 --- a/platform-darwin/Source/MPTypes.h +++ b/platform-darwin/Source/MPTypes.h @@ -40,11 +40,10 @@ __END_DECLS err( message_ @"%@%@", ##__VA_ARGS__, __error && [message_ length]? @"\n": @"", [__error fullDescription]?: @"" ); \ \ if (__error && [[MPConfig get].sendInfo boolValue]) { \ - SentryEvent *event = [[SentryEvent alloc] initWithLevel:kSentrySeverityError]; \ + SentryEvent *event = [[SentryEvent alloc] initWithLevel:kSentryLevelError]; \ event.message = strf(@"%@: %@", message_, [__error localizedDescription]); \ event.logger = @"MPError"; \ - [SentryClient.sharedClient appendStacktraceToEvent:event]; \ - [SentryClient.sharedClient sendEvent:event withCompletionHandler:nil]; \ + [SentrySDK captureEvent:event]; \ } \ __error; \ }) diff --git a/platform-darwin/Source/Mac/MPMacAppDelegate.m b/platform-darwin/Source/Mac/MPMacAppDelegate.m index 7300b685..0570365c 100644 --- a/platform-darwin/Source/Mac/MPMacAppDelegate.m +++ b/platform-darwin/Source/Mac/MPMacAppDelegate.m @@ -75,42 +75,45 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven @try { // Sentry - SentryClient.sharedClient = [[SentryClient alloc] initWithDsn:decrypt( sentryDSN ) didFailWithError:nil]; + [SentrySDK initWithOptions:@{ + @"dsn" : decrypt( sentryDSN ), #ifdef DEBUG - SentryClient.sharedClient.environment = @"Development"; + @"debug" : @(YES), + @"environment": @"Development", #elif PUBLIC - SentryClient.sharedClient.environment = @"Public"; + @"debug" : @(NO), + @"environment": @"Public", #else - SentryClient.sharedClient.environment = @"Private"; + @"debug" : @(NO), + @"environment": @"Private", #endif - SentryClient.sharedClient.enabled = [MPMacConfig get].sendInfo; - [SentryClient.sharedClient enableAutomaticBreadcrumbTracking]; - [SentryClient.sharedClient startCrashHandlerWithError:nil]; + @"enabled" : [MPMacConfig get].sendInfo, + }]; [[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) { PearlLogLevel level = PearlLogLevelWarn; if ([[MPConfig get].sendInfo boolValue]) level = PearlLogLevelDebug; if (message.level >= level) { - SentrySeverity sentryLevel = kSentrySeverityInfo; + SentryLevel sentryLevel = kSentryLevelInfo; switch (message.level) { case PearlLogLevelTrace: - sentryLevel = kSentrySeverityDebug; + sentryLevel = kSentryLevelDebug; break; case PearlLogLevelDebug: - sentryLevel = kSentrySeverityDebug; + sentryLevel = kSentryLevelDebug; break; case PearlLogLevelInfo: - sentryLevel = kSentrySeverityInfo; + sentryLevel = kSentryLevelInfo; break; case PearlLogLevelWarn: - sentryLevel = kSentrySeverityWarning; + sentryLevel = kSentryLevelWarning; break; case PearlLogLevelError: - sentryLevel = kSentrySeverityError; + sentryLevel = kSentryLevelError; break; case PearlLogLevelFatal: - sentryLevel = kSentrySeverityFatal; + sentryLevel = kSentryLevelFatal; break; } SentryBreadcrumb *breadcrumb = [[SentryBreadcrumb alloc] initWithLevel:sentryLevel category:@"Pearl"]; @@ -118,7 +121,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven breadcrumb.message = message.message; breadcrumb.timestamp = message.occurrence; breadcrumb.data = @{ @"file": message.fileName, @"line": @(message.lineNumber), @"function": message.function }; - [SentryClient.sharedClient.breadcrumbs addBreadcrumb:breadcrumb]; + [SentrySDK addBreadcrumb:breadcrumb]; } return YES; diff --git a/platform-darwin/Source/iOS/MPiOSAppDelegate.m b/platform-darwin/Source/iOS/MPiOSAppDelegate.m index 172d7457..6561e1a9 100644 --- a/platform-darwin/Source/iOS/MPiOSAppDelegate.m +++ b/platform-darwin/Source/iOS/MPiOSAppDelegate.m @@ -83,42 +83,45 @@ void mpw_log_sink_pearl(const MPLogEvent *record) { @try { // Sentry - SentryClient.sharedClient = [[SentryClient alloc] initWithDsn:decrypt( sentryDSN ) didFailWithError:nil]; + [SentrySDK initWithOptions:@{ + @"dsn" : decrypt( sentryDSN ), #ifdef DEBUG - SentryClient.sharedClient.environment = @"Development"; + @"debug" : @(YES), + @"environment": @"Development", #elif PUBLIC - SentryClient.sharedClient.environment = @"Public"; + @"debug" : @(NO), + @"environment": @"Public", #else - SentryClient.sharedClient.environment = @"Private"; + @"debug" : @(NO), + @"environment": @"Private", #endif - SentryClient.sharedClient.enabled = [MPiOSConfig get].sendInfo; - [SentryClient.sharedClient enableAutomaticBreadcrumbTracking]; - [SentryClient.sharedClient startCrashHandlerWithError:nil]; + @"enabled" : [MPiOSConfig get].sendInfo, + }]; [[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) { PearlLogLevel level = PearlLogLevelWarn; if ([[MPConfig get].sendInfo boolValue]) level = PearlLogLevelDebug; if (message.level >= level) { - SentrySeverity sentryLevel = kSentrySeverityInfo; + SentryLevel sentryLevel = kSentryLevelInfo; switch (message.level) { case PearlLogLevelTrace: - sentryLevel = kSentrySeverityDebug; + sentryLevel = kSentryLevelNone; break; case PearlLogLevelDebug: - sentryLevel = kSentrySeverityDebug; + sentryLevel = kSentryLevelDebug; break; case PearlLogLevelInfo: - sentryLevel = kSentrySeverityInfo; + sentryLevel = kSentryLevelInfo; break; case PearlLogLevelWarn: - sentryLevel = kSentrySeverityWarning; + sentryLevel = kSentryLevelWarning; break; case PearlLogLevelError: - sentryLevel = kSentrySeverityError; + sentryLevel = kSentryLevelError; break; case PearlLogLevelFatal: - sentryLevel = kSentrySeverityFatal; + sentryLevel = kSentryLevelFatal; break; } SentryBreadcrumb *breadcrumb = [[SentryBreadcrumb alloc] initWithLevel:sentryLevel category:@"Pearl"]; @@ -126,7 +129,7 @@ void mpw_log_sink_pearl(const MPLogEvent *record) { breadcrumb.message = message.message; breadcrumb.timestamp = message.occurrence; breadcrumb.data = @{ @"file": message.fileName, @"line": @(message.lineNumber), @"function": message.function }; - [SentryClient.sharedClient.breadcrumbs addBreadcrumb:breadcrumb]; + [SentrySDK addBreadcrumb:breadcrumb]; } return YES; @@ -716,13 +719,11 @@ void mpw_log_sink_pearl(const MPLogEvent *record) { #else prefs[@"reviewedVersion"] = @(YES); #endif - PearlMainQueueOperation( ^{ - if (![[SentryClient.sharedClient.extra dictionaryWithValuesForKeys:prefs.allKeys] isEqualToDictionary:prefs]) { - NSMutableDictionary *extra = [SentryClient.sharedClient.extra mutableCopy]?: [NSMutableDictionary dictionary]; - [extra addEntriesFromDictionary:prefs]; - SentryClient.sharedClient.extra = extra; - } - } ); + + [SentrySDK configureScope:^(SentryScope *scope) { + for (NSString *pref in prefs.allKeys) + [scope setExtraValue:prefs[pref] forKey:pref]; + }]; } else { [Countly.sharedInstance cancelConsentForAllFeatures];