diff --git a/indra/newview/llappviewermacosx-objc.h b/indra/newview/llappviewermacosx-objc.h index c6dcec8e34e7161b3d9424f12cf75e29e3059095..9ac36b6c4d3e55cc4d9c96b0196a5055b4c8cc9e 100644 --- a/indra/newview/llappviewermacosx-objc.h +++ b/indra/newview/llappviewermacosx-objc.h @@ -31,6 +31,7 @@ #include <vector> //Why? Because BOOL +void setCrashUserMetadataWrapper(const std::string& userid, const std::string& username); void launchApplication(const std::string* app_name, const std::vector<std::string>* args); #endif // LL_LLAPPVIEWERMACOSX_OBJC_H diff --git a/indra/newview/llappviewermacosx-objc.mm b/indra/newview/llappviewermacosx-objc.mm index 8ffc978aab93d2a5e17e7e655e1ddc3a994256a6..57ab7841dcb0a14b3909db0d6738733163627d94 100644 --- a/indra/newview/llappviewermacosx-objc.mm +++ b/indra/newview/llappviewermacosx-objc.mm @@ -33,6 +33,20 @@ #include "llappviewermacosx-objc.h" +#if defined(USE_SENTRY) +#import "Sentry.h" +#endif + +void setCrashUserMetadataWrapper(const std::string& userid, const std::string& username) +{ +#if defined(USE_SENTRY) + SentryUser *user = [[SentryUser alloc] init]; + user.userId = @(userid.c_str()); + user.username = @(username.c_str()); + [SentrySDK setUser:user]; +#endif +} + void launchApplication(const std::string* app_name, const std::vector<std::string>* args) { @autoreleasepool diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index 68d4c6c8042adb7678191aaac76a6e3c6d3a2ec0..ed293a92054c613e12b9a489be312d2415a07481 100644 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -227,6 +227,11 @@ bool LLAppViewerMacOSX::init() return success; } +void LLAppViewerMacOSX::setCrashUserMetadata(const LLUUID& user_id, const std::string& avatar_name) +{ + setCrashUserMetadataWrapper(user_id.asString(), avatar_name); +} + // MacOSX may add and addition command line arguement for the process serial number. // The option takes a form like '-psn_0_12345'. The following method should be able to recognize // and either ignore or return a pair of values for the option. diff --git a/indra/newview/llappviewermacosx.h b/indra/newview/llappviewermacosx.h index d5a80864be3dc0a5f0a599788f632a655806f1fc..e96cee0f3ade5b32efcae1b7ab612b03bfac8923 100644 --- a/indra/newview/llappviewermacosx.h +++ b/indra/newview/llappviewermacosx.h @@ -31,23 +31,25 @@ #include "llappviewer.h" #endif -class LLAppViewerMacOSX : public LLAppViewer +class LLAppViewerMacOSX final : public LLAppViewer { public: LLAppViewerMacOSX(); - virtual ~LLAppViewerMacOSX(); + ~LLAppViewerMacOSX() override; // // Main application logic // - virtual bool init(); // Override to do application initialization + bool init(); // Override to do application initialization + void setCrashUserMetadata(const LLUUID& user_id, const std::string& avatar_name) override; + protected: - virtual bool restoreErrorTrap(); - virtual void initCrashReporting(bool reportFreeze); + bool restoreErrorTrap() override; + void initCrashReporting(bool reportFreeze) override; std::string generateSerialNumber(); - virtual bool initParseCommandLine(LLCommandLineParser& clp); + bool initParseCommandLine(LLCommandLineParser& clp) override; }; #endif // LL_LLAPPVIEWERMACOSX_H