diff --git a/Samples/iOS-Swift/iOS-Swift-UITests/UserFeedbackUITests.swift b/Samples/iOS-Swift/iOS-Swift-UITests/UserFeedbackUITests.swift
index 4ca524f2ee9..a5f1eb50b69 100644
--- a/Samples/iOS-Swift/iOS-Swift-UITests/UserFeedbackUITests.swift
+++ b/Samples/iOS-Swift/iOS-Swift-UITests/UserFeedbackUITests.swift
@@ -97,6 +97,17 @@ class UserFeedbackUITests: BaseUITest {
XCTAssertFalse(app.staticTexts["Thy name (Required)"].exists)
}
+ func testPrefilledUserInformation() throws {
+ launchApp(args: ["--io.sentry.feedback.use-sentry-user"], env: [
+ "--io.sentry.user.name": "ui test user",
+ "--io.sentry.user.email": "ui-testing@sentry.io"
+ ])
+
+ widgetButton.tap()
+ XCTAssertEqual(try XCTUnwrap(nameField.value as? String), "ui test user")
+ XCTAssertEqual(try XCTUnwrap(emailField.value as? String), "ui-testing@sentry.io")
+ }
+
// MARK: Tests validating happy path / successful submission
func testSubmitFullyFilledForm() throws {
diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme b/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme
index 75721f0cd2a..090c3ca5e59 100644
--- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme
+++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme
@@ -73,6 +73,10 @@
argument = "--disable-file-io-tracing"
isEnabled = "NO">
+
+
@@ -236,6 +240,11 @@
value = ""
isEnabled = "NO">
+
+
+
+@class SentryClient;
+@class SentryUser;
+
+NS_ASSUME_NONNULL_BEGIN
+
+SentryUser *_Nullable sentry_getCurrentUser(void);
+
+NS_ASSUME_NONNULL_END
diff --git a/Sources/Sentry/SentryUserAccess.m b/Sources/Sentry/SentryUserAccess.m
new file mode 100644
index 00000000000..5f6d1a9ec1d
--- /dev/null
+++ b/Sources/Sentry/SentryUserAccess.m
@@ -0,0 +1,6 @@
+#import "SentryUserAccess.h"
+#import "SentryHub.h"
+#import "SentrySDK+Private.h"
+#import "SentryScope+Private.h"
+
+SentryUser *_Nullable sentry_getCurrentUser(void) { return SentrySDK.currentHub.scope.userObject; }
diff --git a/Sources/Sentry/include/SentryPrivate.h b/Sources/Sentry/include/SentryPrivate.h
index 28d51908195..27c7ad8d640 100644
--- a/Sources/Sentry/include/SentryPrivate.h
+++ b/Sources/Sentry/include/SentryPrivate.h
@@ -1,9 +1,11 @@
-// Sentry internal headers that are needed for swift code
+// Sentry internal headers that are needed for swift code; you cannot import headers that depend on
+// public interfaces here
#import "NSLocale+Sentry.h"
#import "SentryDispatchQueueWrapper.h"
#import "SentryNSDataUtils.h"
#import "SentryRandom.h"
#import "SentryTime.h"
+#import "SentryUserAccess.h"
// Headers that also import SentryDefines should be at the end of this list
// otherwise it wont compile
diff --git a/Sources/Swift/Integrations/UserFeedback/SentryUserFeedbackForm.swift b/Sources/Swift/Integrations/UserFeedback/SentryUserFeedbackForm.swift
index b49555afcef..6557176ddf2 100644
--- a/Sources/Swift/Integrations/UserFeedback/SentryUserFeedbackForm.swift
+++ b/Sources/Swift/Integrations/UserFeedback/SentryUserFeedbackForm.swift
@@ -261,6 +261,10 @@ class SentryUserFeedbackForm: UIViewController {
field.accessibilityLabel = config.formConfig.nameTextFieldAccessibilityLabel
field.accessibilityIdentifier = "io.sentry.feedback.form.name"
field.delegate = self
+ field.autocapitalizationType = .words
+ if config.useSentryUser {
+ field.text = sentry_getCurrentUser()?.name
+ }
return field
}()
@@ -277,6 +281,10 @@ class SentryUserFeedbackForm: UIViewController {
field.accessibilityIdentifier = "io.sentry.feedback.form.email"
field.delegate = self
field.keyboardType = .emailAddress
+ field.autocapitalizationType = .none
+ if config.useSentryUser {
+ field.text = sentry_getCurrentUser()?.email
+ }
return field
}()