-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User Status fixes #1652
Closed
Closed
User Status fixes #1652
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Looks like you need git commit --amend and move Changelog-Changed to the
commit body so that it is not in the title.
You should try creating commits without the -m argument. It can be more
than one line.
Reviewed-by: William Casarin ***@***.***>
…On Wed, Oct 25, 2023 at 07:35:23PM -0600, ericholguin wrote:
Closes: #1652
---
damus/Components/Status/UserStatusSheet.swift | 206 +++++++++---------
1 file changed, 104 insertions(+), 102 deletions(-)
diff --git a/damus/Components/Status/UserStatusSheet.swift b/damus/Components/Status/UserStatusSheet.swift
index 10620e1b7..8acbfa77b 100644
--- a/damus/Components/Status/UserStatusSheet.swift
+++ b/damus/Components/Status/UserStatusSheet.swift
@@ -46,7 +46,7 @@ enum StatusDuration: CustomStringConvertible, CaseIterable {
}
let formatter = DateComponentsFormatter()
- formatter.unitsStyle = .abbreviated
+ formatter.unitsStyle = .full
formatter.allowedUnits = [.minute, .hour, .day, .weekOfMonth]
return formatter.string(from: timeInterval) ?? "\(timeInterval) seconds"
}
@@ -64,10 +64,9 @@ struct UserStatusSheet: View {
@State var duration: StatusDuration = .never
@State var show_link: Bool = false
-
- @focusstate var focusedTextField : Fields?
@ObservedObject var status: UserStatusModel
+ @Environment(\.colorScheme) var colorScheme
@Environment(\.dismiss) var dismiss
var status_binding: Binding<String> {
@@ -95,116 +94,119 @@ struct UserStatusSheet: View {
}
var body: some View {
- VStack {
- HStack {
- Button(action: {
- dismiss()
- }, label: {
- Text("Cancel", comment: "Cancel button text for dismissing profile status settings view.")
+ // This is needed to prevent the view from being moved when the keyboard is shown
+ GeometryReader { geometry in
+ VStack {
+ HStack {
+ Button(action: {
+ dismiss()
+ }, label: {
+ Text("Cancel", comment: "Cancel button text for dismissing profile status settings view.")
+ .padding(10)
+ })
+ .buttonStyle(NeutralButtonStyle())
+
+ Spacer()
+
+ Button(action: {
+ guard let status = self.status.general,
+ let kp = keypair.to_full(),
+ let ev = make_user_status_note(status: status, keypair: kp, expiry: duration.expiration)
+ else {
+ return
+ }
+
+ postbox.send(ev)
+
+ dismiss()
+ }, label: {
+ Text("Share", comment: "Save button text for saving profile status settings.")
+ })
+ .buttonStyle(GradientButtonStyle(padding: 10))
+ }
+ .padding(5)
+
+ Divider()
+
+ ZStack(alignment: .top) {
+ ProfilePicView(pubkey: keypair.pubkey, size: 120.0, highlight: .custom(DamusColors.white, 3.0), profiles: damus_state.profiles, disable_animation: damus_state.settings.disable_animation)
+ .padding(.top, 30)
+
+ VStack(spacing: 0) {
+ HStack {
+ TextField(NSLocalizedString("Staying humble...", comment: "Placeholder as an example of what the user could set as their profile status."), text: status_binding, axis: .vertical)
+ .autocorrectionDisabled(true)
+ .textInputAutocapitalization(.never)
+ .lineLimit(3)
+ .frame(width: 175)
+
+ }
.padding(10)
- })
- .buttonStyle(NeutralButtonStyle())
-
- Spacer()
-
- Button(action: {
- guard let status = self.status.general,
- let kp = keypair.to_full(),
- let ev = make_user_status_note(status: status, keypair: kp, expiry: duration.expiration)
- else {
- return
+ .background(colorScheme == .light ? .white : DamusColors.neutral3)
+ .cornerRadius(15)
+ .shadow(color: colorScheme == .light ? DamusColors.neutral3 : .clear, radius: 15)
+
+ Circle()
+ .fill(colorScheme == .light ? .white : DamusColors.neutral3)
+ .frame(width: 12, height: 12)
+ .padding(.trailing, 140)
+
+ Circle()
+ .fill(colorScheme == .light ? .white : DamusColors.neutral3)
+ .frame(width: 7, height: 7)
+ .padding(.trailing, 120)
+
}
-
- postbox.send(ev)
-
- dismiss()
- }, label: {
- Text("Share", comment: "Save button text for saving profile status settings.")
- })
- .buttonStyle(GradientButtonStyle(padding: 10))
- }
- .padding()
-
- Divider()
-
- ZStack {
- ProfilePicView(pubkey: keypair.pubkey, size: 120.0, highlight: .custom(DamusColors.white, 3.0), profiles: damus_state.profiles, disable_animation: damus_state.settings.disable_animation)
- .padding(.top, 130)
-
- VStack(spacing: 0) {
+ .padding(.leading, 60)
+ }
+
+ VStack {
HStack {
- TextField(NSLocalizedString("Staying humble...", comment: "Placeholder as an example of what the user could set as their profile status."), text: status_binding, axis: .vertical)
- .focused($focusedTextField, equals: Fields.status)
- .task {
- self.focusedTextField = .status
- }
- .autocorrectionDisabled(true)
- .textInputAutocapitalization(.never)
- .lineLimit(3)
- .frame(width: 175)
+ Image("link")
+ .foregroundColor(DamusColors.neutral3)
+
+ TextField(text: url_binding, label: {
+ Text("Add an external link", comment: "Placeholder as an example of what the user could set so that the link is opened when the status is tapped.")
+ })
+ .autocorrectionDisabled(true)
}
.padding(10)
- .background(DamusColors.adaptableWhite)
- .cornerRadius(15)
- .shadow(color: DamusColors.neutral3, radius: 15)
-
- Circle()
- .fill(DamusColors.adaptableWhite)
- .frame(width: 12, height: 12)
- .padding(.trailing, 140)
-
- Circle()
- .fill(DamusColors.adaptableWhite)
- .frame(width: 7, height: 7)
- .padding(.trailing, 120)
-
+ .cornerRadius(12)
+ .overlay(
+ RoundedRectangle(cornerRadius: 12)
+ .stroke(DamusColors.neutral3, lineWidth: 1)
+ )
}
- .padding(.leading, 60)
- }
-
- VStack {
+ .padding()
+
+ Toggle(isOn: $status.playing_enabled, label: {
+ Text("Broadcast music playing on Apple Music", comment: "Toggle to enable or disable broadcasting what music is being played on Apple Music in their profile status.")
+ })
+ .tint(DamusColors.purple)
+ .padding(.horizontal)
+
HStack {
- Image("link")
- .foregroundColor(DamusColors.neutral3)
-
- TextField(text: url_binding, label: {
- Text("Add an external link", comment: "Placeholder as an example of what the user could set so that the link is opened when the status is tapped.")
- })
- .focused($focusedTextField, equals: Fields.link)
- }
- .padding(10)
- .cornerRadius(12)
- .overlay(
- RoundedRectangle(cornerRadius: 12)
- .stroke(DamusColors.neutral3, lineWidth: 1)
- )
- }
- .padding()
-
- Toggle(isOn: $status.playing_enabled, label: {
- Text("Broadcast music playing on Apple Music", comment: "Toggle to enable or disable broadcasting what music is being played on Apple Music in their profile status.")
- })
- .tint(DamusColors.purple)
- .padding(.horizontal)
-
- HStack {
- Text("Clear status", comment: "Label to prompt user to select an expiration time for the profile status to clear.")
-
- Spacer()
-
- Picker(NSLocalizedString("Duration", comment: "Label for profile status expiration duration picker."), selection: $duration) {
- ForEach(StatusDuration.allCases, id: \.self) { d in
- Text(verbatim: d.description)
- .tag(d)
+ Text("Clear status", comment: "Label to prompt user to select an expiration time for the profile status to clear.")
+
+ Spacer()
+
+ Picker(NSLocalizedString("Duration", comment: "Label for profile status expiration duration picker."), selection: $duration) {
+ ForEach(StatusDuration.allCases, id: \.self) { d in
+ Text(verbatim: d.description)
+ .tag(d)
+ }
}
}
- .pickerStyle(.segmented)
+ .padding()
+
+ Spacer()
+
}
- .padding()
-
- Spacer()
+ .padding(.top)
+ .background(DamusColors.adaptableWhite.edgesIgnoringSafeArea(.all))
}
- .padding(.top)
+ .dismissKeyboardOnTap()
+ .ignoresSafeArea(.keyboard, edges: .bottom)
}
}
|
Changelog-Changed: segmented picker to menu picker in user status view Changelog-Added: tap to dismiss keyboard on user status view
ericholguin
force-pushed
the
status-fixes
branch
from
October 27, 2023 01:20
e89f943
to
207fb82
Compare
Ah okay. Fixed. Thanks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the user status view so it is more useable for smaller screen devices.
Improvements include: