mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Add login screen return key actions, made home screen header smaller.
This commit is contained in:
@@ -27,11 +27,11 @@ struct LoginScreen: View {
|
|||||||
.textFieldStyle(.roundedBorder)
|
.textFieldStyle(.roundedBorder)
|
||||||
.disableAutocorrection(true)
|
.disableAutocorrection(true)
|
||||||
.autocapitalization(.none)
|
.autocapitalization(.none)
|
||||||
SecureField("Enter a password", text: $context.password)
|
SecureField("Password", text: $context.password)
|
||||||
.textFieldStyle(.roundedBorder)
|
.textFieldStyle(.roundedBorder)
|
||||||
|
|
||||||
Button { context.send(viewAction: .login) } label: {
|
Button("Login") {
|
||||||
Text("Login")
|
context.send(viewAction: .login)
|
||||||
}
|
}
|
||||||
.buttonStyle(.borderedProminent)
|
.buttonStyle(.borderedProminent)
|
||||||
.padding(.horizontal, 50)
|
.padding(.horizontal, 50)
|
||||||
@@ -39,6 +39,9 @@ struct LoginScreen: View {
|
|||||||
.padding(.horizontal, 8.0)
|
.padding(.horizontal, 8.0)
|
||||||
.navigationTitle("Login")
|
.navigationTitle("Login")
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
.onSubmit {
|
||||||
|
context.send(viewAction: .login)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.navigationViewStyle(StackNavigationViewStyle())
|
.navigationViewStyle(StackNavigationViewStyle())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,22 +26,6 @@ struct HomeScreen: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationView {
|
NavigationView {
|
||||||
VStack(spacing: 16.0) {
|
VStack(spacing: 16.0) {
|
||||||
HStack {
|
|
||||||
if let avatar = context.viewState.userAvatar {
|
|
||||||
Image(uiImage: avatar)
|
|
||||||
.resizable()
|
|
||||||
.scaledToFill()
|
|
||||||
.frame(width: 40, height: 40, alignment: .center)
|
|
||||||
.mask(Circle())
|
|
||||||
} else {
|
|
||||||
let _ = context.send(viewAction: .loadUserAvatar)
|
|
||||||
}
|
|
||||||
Text("Hello, \(context.viewState.userDisplayName)!")
|
|
||||||
.font(.subheadline)
|
|
||||||
.fontWeight(.bold)
|
|
||||||
}
|
|
||||||
.padding(.vertical, 32.0)
|
|
||||||
|
|
||||||
if context.viewState.isLoadingRooms {
|
if context.viewState.isLoadingRooms {
|
||||||
VStack {
|
VStack {
|
||||||
Text("Loading rooms")
|
Text("Loading rooms")
|
||||||
@@ -81,14 +65,30 @@ struct HomeScreen: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.headerProminence(.increased)
|
|
||||||
.listStyle(.plain)
|
.listStyle(.plain)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
.ignoresSafeArea(.all, edges: .bottom)
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
.toolbar {
|
.toolbar {
|
||||||
|
ToolbarItem(placement: .navigationBarLeading) {
|
||||||
|
HStack {
|
||||||
|
if let avatar = context.viewState.userAvatar {
|
||||||
|
Image(uiImage: avatar)
|
||||||
|
.resizable()
|
||||||
|
.scaledToFill()
|
||||||
|
.frame(width: 40, height: 40, alignment: .center)
|
||||||
|
.mask(Circle())
|
||||||
|
} else {
|
||||||
|
let _ = context.send(viewAction: .loadUserAvatar)
|
||||||
|
}
|
||||||
|
Text("Hello, \(context.viewState.userDisplayName)!")
|
||||||
|
.font(.subheadline)
|
||||||
|
.fontWeight(.bold)
|
||||||
|
}
|
||||||
|
}
|
||||||
ToolbarItem(placement: .navigationBarTrailing) {
|
ToolbarItem(placement: .navigationBarTrailing) {
|
||||||
Button("Logout") {
|
Button("Logout") {
|
||||||
context.send(viewAction: .logout)
|
context.send(viewAction: .logout)
|
||||||
|
|||||||
Reference in New Issue
Block a user