Skip to content

Commit b66f96d

Browse files
authored
Merge branch 'main' into feat/new-feedback
2 parents 46d5dc0 + 03bfe50 commit b66f96d

16 files changed

+172
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@
1313

1414
### Features
1515

16-
- Added new API for capturing user feedback ([#1051](https://github.com/getsentry/sentry-unreal/pull/1051))
16+
- Add functionality to give/revoke user consent for crash uploads ([#1053](https://github.com/getsentry/sentry-unreal/pull/1053))
17+
- Add new API for capturing user feedback ([#1051](https://github.com/getsentry/sentry-unreal/pull/1051))
1718

1819
### Dependencies
1920

2021
- Bump CLI from v2.51.1 to v2.52.0 ([#1049](https://github.com/getsentry/sentry-unreal/pull/1049))
2122
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2520)
2223
- [diff](https://github.com/getsentry/sentry-cli/compare/2.51.1...2.52.0)
24+
- Bump Cocoa SDK (iOS and Mac) from v8.54.0 to v8.55.0 ([#1050](https://github.com/getsentry/sentry-unreal/pull/1050))
25+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8550)
26+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.54.0...8.55.0)
2327

2428
## 1.0.0-beta.8
2529

modules/sentry-cocoa.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version=8.54.0
1+
version=8.55.0
22
repo=https://github.com/getsentry/sentry-cocoa

plugin-dev/Source/Sentry/Private/Android/AndroidSentrySubsystem.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,21 @@ void FAndroidSentrySubsystem::EndSession()
255255
FSentryJavaObjectWrapper::CallStaticMethod<void>(SentryJavaClasses::Sentry, "endSession", "()V", nullptr);
256256
}
257257

258+
void FAndroidSentrySubsystem::GiveUserConsent()
259+
{
260+
// No-op; feature not currently implemented for this platform
261+
}
262+
263+
void FAndroidSentrySubsystem::RevokeUserConsent()
264+
{
265+
// No-op; feature not currently implemented for this platform
266+
}
267+
268+
EUserConsent FAndroidSentrySubsystem::GetUserConsent() const
269+
{
270+
return EUserConsent::Unknown;
271+
}
272+
258273
TSharedPtr<ISentryTransaction> FAndroidSentrySubsystem::StartTransaction(const FString& name, const FString& operation)
259274
{
260275
auto transaction = FSentryJavaObjectWrapper::CallStaticObjectMethod<jobject>(SentryJavaClasses::Sentry, "startTransaction", "(Ljava/lang/String;Ljava/lang/String;)Lio/sentry/ITransaction;",

plugin-dev/Source/Sentry/Private/Android/AndroidSentrySubsystem.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class FAndroidSentrySubsystem : public ISentrySubsystem
3131
virtual void SetLevel(ESentryLevel level) override;
3232
virtual void StartSession() override;
3333
virtual void EndSession() override;
34+
virtual void GiveUserConsent() override;
35+
virtual void RevokeUserConsent() override;
36+
virtual EUserConsent GetUserConsent() const override;
3437
virtual TSharedPtr<ISentryTransaction> StartTransaction(const FString& name, const FString& operation) override;
3538
virtual TSharedPtr<ISentryTransaction> StartTransactionWithContext(TSharedPtr<ISentryTransactionContext> context) override;
3639
virtual TSharedPtr<ISentryTransaction> StartTransactionWithContextAndTimestamp(TSharedPtr<ISentryTransactionContext> context, int64 timestamp) override;

plugin-dev/Source/Sentry/Private/Apple/AppleSentrySubsystem.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,21 @@ void FAppleSentrySubsystem::EndSession()
347347
[SENTRY_APPLE_CLASS(SentrySDK) endSession];
348348
}
349349

350+
void FAppleSentrySubsystem::GiveUserConsent()
351+
{
352+
// No-op; feature not currently implemented for this platform
353+
}
354+
355+
void FAppleSentrySubsystem::RevokeUserConsent()
356+
{
357+
// No-op; feature not currently implemented for this platform
358+
}
359+
360+
EUserConsent FAppleSentrySubsystem::GetUserConsent() const
361+
{
362+
return EUserConsent::Unknown;
363+
}
364+
350365
TSharedPtr<ISentryTransaction> FAppleSentrySubsystem::StartTransaction(const FString& name, const FString& operation)
351366
{
352367
id<SentrySpan> transaction = [SENTRY_APPLE_CLASS(SentrySDK) startTransactionWithName:name.GetNSString() operation:operation.GetNSString()];

plugin-dev/Source/Sentry/Private/Apple/AppleSentrySubsystem.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class FAppleSentrySubsystem : public ISentrySubsystem
3131
virtual void SetLevel(ESentryLevel level) override;
3232
virtual void StartSession() override;
3333
virtual void EndSession() override;
34+
virtual void GiveUserConsent() override;
35+
virtual void RevokeUserConsent() override;
36+
virtual EUserConsent GetUserConsent() const override;
3437
virtual TSharedPtr<ISentryTransaction> StartTransaction(const FString& name, const FString& operation) override;
3538
virtual TSharedPtr<ISentryTransaction> StartTransactionWithContext(TSharedPtr<ISentryTransactionContext> context) override;
3639
virtual TSharedPtr<ISentryTransaction> StartTransactionWithContextAndTimestamp(TSharedPtr<ISentryTransactionContext> context, int64 timestamp) override;

plugin-dev/Source/Sentry/Private/GenericPlatform/GenericPlatformSentrySubsystem.cpp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,11 @@ void FGenericPlatformSentrySubsystem::InitWithSettings(const USentrySettings* se
313313
sentry_options_set_shutdown_timeout(options, 3000);
314314
sentry_options_set_crashpad_wait_for_upload(options, settings->CrashpadWaitForUpload);
315315

316+
if (settings->bRequireUserConsent)
317+
{
318+
sentry_options_set_require_user_consent(options, 1);
319+
}
320+
316321
int initResult = sentry_init(options);
317322

318323
UE_LOG(LogSentrySdk, Log, TEXT("Sentry initialization completed with result %d (0 on success)."), initResult);
@@ -323,6 +328,20 @@ void FGenericPlatformSentrySubsystem::InitWithSettings(const USentrySettings* se
323328

324329
isStackTraceEnabled = settings->AttachStacktrace;
325330
isPiiAttachmentEnabled = settings->SendDefaultPii;
331+
332+
// Best-effort at writing user consent to disk so that user consent can change at runtime and persist
333+
// We should never have a valid user consent state return "Unknown", so assume that no consent value is written if we see this
334+
if (settings->bRequireUserConsent && GetUserConsent() == EUserConsent::Unknown)
335+
{
336+
if (settings->bDefaultUserConsentGiven)
337+
{
338+
GiveUserConsent();
339+
}
340+
else
341+
{
342+
RevokeUserConsent();
343+
}
344+
}
326345
}
327346

328347
void FGenericPlatformSentrySubsystem::Close()
@@ -598,6 +617,29 @@ void FGenericPlatformSentrySubsystem::EndSession()
598617
sentry_end_session();
599618
}
600619

620+
void FGenericPlatformSentrySubsystem::GiveUserConsent()
621+
{
622+
sentry_user_consent_give();
623+
}
624+
625+
void FGenericPlatformSentrySubsystem::RevokeUserConsent()
626+
{
627+
sentry_user_consent_revoke();
628+
}
629+
630+
EUserConsent FGenericPlatformSentrySubsystem::GetUserConsent() const
631+
{
632+
switch (sentry_user_consent_get())
633+
{
634+
case 0:
635+
return EUserConsent::Revoked;
636+
case 1:
637+
return EUserConsent::Given;
638+
default:
639+
return EUserConsent::Unknown;
640+
}
641+
}
642+
601643
TSharedPtr<ISentryTransaction> FGenericPlatformSentrySubsystem::StartTransaction(const FString& name, const FString& operation)
602644
{
603645
TSharedPtr<ISentryTransactionContext> transactionContext = MakeShareable(new FGenericPlatformSentryTransactionContext(name, operation));

plugin-dev/Source/Sentry/Private/GenericPlatform/GenericPlatformSentrySubsystem.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ class FGenericPlatformSentrySubsystem : public ISentrySubsystem
4343
virtual void SetLevel(ESentryLevel level) override;
4444
virtual void StartSession() override;
4545
virtual void EndSession() override;
46+
virtual void GiveUserConsent() override;
47+
virtual void RevokeUserConsent() override;
48+
virtual EUserConsent GetUserConsent() const override;
4649
virtual TSharedPtr<ISentryTransaction> StartTransaction(const FString& name, const FString& operation) override;
4750
virtual TSharedPtr<ISentryTransaction> StartTransactionWithContext(TSharedPtr<ISentryTransactionContext> context) override;
4851
virtual TSharedPtr<ISentryTransaction> StartTransactionWithContextAndTimestamp(TSharedPtr<ISentryTransactionContext> context, int64 timestamp) override;

plugin-dev/Source/Sentry/Private/Interface/SentrySubsystemInterface.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ class ISentrySubsystem
5454
virtual void SetLevel(ESentryLevel level) = 0;
5555
virtual void StartSession() = 0;
5656
virtual void EndSession() = 0;
57+
virtual void GiveUserConsent() = 0;
58+
virtual void RevokeUserConsent() = 0;
59+
virtual EUserConsent GetUserConsent() const = 0;
5760
virtual TSharedPtr<ISentryTransaction> StartTransaction(const FString& name, const FString& operation) = 0;
5861
virtual TSharedPtr<ISentryTransaction> StartTransactionWithContext(TSharedPtr<ISentryTransactionContext> context) = 0;
5962
virtual TSharedPtr<ISentryTransaction> StartTransactionWithContextAndTimestamp(TSharedPtr<ISentryTransactionContext> context, int64 timestamp) = 0;

plugin-dev/Source/Sentry/Private/Null/NullSentrySubsystem.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ class FNullSentrySubsystem : public ISentrySubsystem
3333
virtual void SetLevel(ESentryLevel level) override {}
3434
virtual void StartSession() override {}
3535
virtual void EndSession() override {}
36+
virtual void GiveUserConsent() override {}
37+
virtual void RevokeUserConsent() override {}
38+
virtual EUserConsent GetUserConsent() const override { return EUserConsent::Unknown; }
3639
virtual TSharedPtr<ISentryTransaction> StartTransaction(const FString& name, const FString& operation) override { return nullptr; }
3740
virtual TSharedPtr<ISentryTransaction> StartTransactionWithContext(TSharedPtr<ISentryTransactionContext> context) override { return nullptr; }
3841
virtual TSharedPtr<ISentryTransaction> StartTransactionWithContextAndTimestamp(TSharedPtr<ISentryTransactionContext> context, int64 timestamp) override { return nullptr; }

0 commit comments

Comments
 (0)