-
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
Fix button hidden behind software keyboard in create account view #2773
Open
danieldaquino
wants to merge
1
commit into
damus-io:master
Choose a base branch
from
danieldaquino:#2771
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
This commit fixes an issue where the "next" button is hidden behind the software keyboard in the account creation view, where it is very hard to press. The fix was done by dynamically shrinking the profile picture size when keyboard appears in smartphone screens, so that there is enough space for all content to appear. Changelog-Fixed: Fixed issue where the "next" button would appear hidden and hard to click on the create account view Closes: damus-io#2771 Signed-off-by: Daniel D’Aquino <[email protected]>
On Wed, Dec 18, 2024 at 05:37:07PM GMT, Daniel D’Aquino wrote:
This commit fixes an issue where the "next" button is hidden behind the
software keyboard in the account creation view, where it is very hard to
press.
The fix was done by dynamically shrinking the profile picture size when
keyboard appears in smartphone screens, so that there is enough space
for all content to appear.
Changelog-Fixed: Fixed issue where the "next" button would appear hidden and hard to click on the create account view
Closes: #2771
Signed-off-by: Daniel D’Aquino ***@***.***>
Closes: #2773
---
damus/Views/CreateAccountView.swift | 25 ++++++++++++--------
damus/Views/Profile/EditPictureControl.swift | 18 ++++++++++++--
2 files changed, 31 insertions(+), 12 deletions(-)
lgtm!
…
diff --git a/damus/Views/CreateAccountView.swift b/damus/Views/CreateAccountView.swift
index e91c322fd..1a68924c6 100644
--- a/damus/Views/CreateAccountView.swift
+++ b/damus/Views/CreateAccountView.swift
@@ -6,11 +6,14 @@
//
import SwiftUI
+import Combine
-struct CreateAccountView: View {
+struct CreateAccountView: View, KeyboardReadable {
@StateObject var account: CreateAccountModel = CreateAccountModel()
@StateObject var profileUploadObserver = ImageUploadingObserver()
var nav: NavigationCoordinator
+ @State var keyboardVisible: Bool = false
+ let maxViewportHeightForAdaptiveContentSize: CGFloat = 975 // 956px height = iPhone 16 Pro Max
func SignupForm<FormContent: ***@***.*** content: () -> FormContent) -> some View {
return VStack(alignment: .leading, spacing: 10.0, content: content)
@@ -26,15 +29,12 @@ struct CreateAccountView: View {
ZStack(alignment: .top) {
VStack {
Spacer()
+
VStack(alignment: .center) {
-
- EditPictureControl(uploader: .nostrBuild, keypair: account.keypair, pubkey: account.pubkey, size: 75, setup: true, image_url: $account.profile_image , uploadObserver: profileUploadObserver, callback: uploadedProfilePicture)
+ let screenHeight = UIScreen.main.bounds.height
+
+ EditPictureControl(uploader: .nostrBuild, keypair: account.keypair, pubkey: account.pubkey, size: keyboardVisible && screenHeight < maxViewportHeightForAdaptiveContentSize ? 25 : 75, setup: true, image_url: $account.profile_image , uploadObserver: profileUploadObserver, callback: uploadedProfilePicture)
.shadow(radius: 2)
- .padding(.top, 100)
-
- Text("Add Photo", comment: "Label to indicate user can add a photo.")
- .bold()
- .foregroundColor(DamusColors.neutral6)
}
SignupForm {
@@ -42,13 +42,13 @@ struct CreateAccountView: View {
.foregroundColor(DamusColors.neutral6)
FormTextInput(NSLocalizedString("Satoshi Nakamoto", comment: "Name of Bitcoin creator(s)."), text: $account.name)
.textInputAutocapitalization(.words)
-
+
FormLabel(NSLocalizedString("Bio", comment: "Label to prompt bio entry for user to describe themself."), optional: true)
.foregroundColor(DamusColors.neutral6)
FormTextInput(NSLocalizedString("Absolute legend.", comment: "Example Bio"), text: $account.about)
}
.padding(.top, 25)
-
+
Button(action: {
nav.push(route: Route.SaveKeys(account: account))
}) {
@@ -72,6 +72,11 @@ struct CreateAccountView: View {
}
.background(DamusBackground(maxHeight: UIScreen.main.bounds.size.height/2), alignment: .top)
.dismissKeyboardOnTap()
+ .onReceive(keyboardPublisher) { visible in
+ withAnimation {
+ self.keyboardVisible = visible
+ }
+ }
.navigationBarTitleDisplayMode(.inline)
.navigationBarBackButtonHidden(true)
.navigationBarItems(leading: BackNav())
diff --git a/damus/Views/Profile/EditPictureControl.swift b/damus/Views/Profile/EditPictureControl.swift
index f65b9b00e..91f54990b 100644
--- a/damus/Views/Profile/EditPictureControl.swift
+++ b/damus/Views/Profile/EditPictureControl.swift
@@ -72,14 +72,14 @@ struct EditPictureControl: View {
view.framePreloadCount = 3
}
.scaledToFill()
- .frame(width: (size ?? 25) + 10, height: (size ?? 25) + 10)
+ .frame(width: (size ?? 25) + 30, height: (size ?? 25) + 30)
.kfClickable()
.foregroundColor(DamusColors.white)
.clipShape(Circle())
.overlay(Circle().stroke(.white, lineWidth: 4))
} else {
if setup ?? false {
- Image(systemName: "person")
+ Image(systemName: "person.fill")
.resizable()
.scaledToFit()
.frame(width: size, height: size)
@@ -90,6 +90,20 @@ struct EditPictureControl: View {
Circle()
.fill(PinkGradient, strokeBorder: .white, lineWidth: 4)
}
+ .overlay(
+ Image(systemName: "plus.circle.fill")
+ .resizable()
+ .frame(
+ width: max((size ?? 30)/3, 20),
+ height: max((size ?? 30)/3, 20)
+ )
+ .background(.damusDeepPurple)
+ .clipShape(Circle())
+ .padding(.leading, -10)
+ .padding(.top, -10)
+ .foregroundStyle(.white)
+ .shadow(color: .black.opacity(0.2), radius: 4)
+ , alignment: .bottomTrailing)
} else {
Image("camera")
|
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.
Summary
This commit fixes an issue where the "next" button is hidden behind the software keyboard in the account creation view, where it is very hard to press.
The fix was done by dynamically shrinking the profile picture size when keyboard appears in smartphone screens, so that there is enough space for all content to appear.
Closes: #2771
Checklist
Closes:
orFixes:
tags in the commit messages wherever applicable, or made sure those are not needed. See Submitting patchesTest report
Devices:
iOS: 18.1
Damus:
fbe2225554e9baa2de8ca6f6dae847fbc1e2220c
Setup:
Steps:
EditPictureControl
to make sure they still work as expected.Results:
Accompanying pictures from the test
Other notes