Page MenuHomeMusing Studio

No OneTemporary

diff --git a/Shared/Account/AccountLoginView.swift b/Shared/Account/AccountLoginView.swift
index 774028e..4e1e2c5 100644
--- a/Shared/Account/AccountLoginView.swift
+++ b/Shared/Account/AccountLoginView.swift
@@ -1,83 +1,86 @@
import SwiftUI
struct AccountLoginView: View {
@EnvironmentObject var model: WriteFreelyModel
@State private var alertMessage: String = ""
@State private var username: String = ""
@State private var password: String = ""
@State private var server: String = ""
var body: some View {
VStack {
+ Text("Log in to publish and share your posts.")
+ .font(.caption)
+ .foregroundColor(.secondary)
HStack {
Image(systemName: "person.circle")
.foregroundColor(.gray)
#if os(iOS)
TextField("Username", text: $username)
.autocapitalization(.none)
.disableAutocorrection(true)
.textFieldStyle(RoundedBorderTextFieldStyle())
#else
TextField("Username", text: $username)
#endif
}
HStack {
Image(systemName: "lock.circle")
.foregroundColor(.gray)
#if os(iOS)
SecureField("Password", text: $password)
.autocapitalization(.none)
.disableAutocorrection(true)
.textFieldStyle(RoundedBorderTextFieldStyle())
#else
SecureField("Password", text: $password)
#endif
}
HStack {
Image(systemName: "link.circle")
.foregroundColor(.gray)
#if os(iOS)
TextField("Server URL", text: $server)
.keyboardType(.URL)
.autocapitalization(.none)
.disableAutocorrection(true)
.textFieldStyle(RoundedBorderTextFieldStyle())
#else
TextField("Server URL", text: $server)
#endif
}
Spacer()
if model.isLoggingIn {
ProgressView("Logging in...")
.padding()
} else {
Button(action: {
model.login(
to: URL(string: server)!,
as: username, password: password
)
}, label: {
- Text("Login")
+ Text("Log In")
})
.disabled(
model.account.isLoggedIn || (username.isEmpty || password.isEmpty || server.isEmpty)
)
.padding()
}
}
.alert(isPresented: $model.isPresentingLoginErrorAlert) {
Alert(
title: Text("Error Logging In"),
message: Text(model.loginErrorMessage ?? "An unknown error occurred while trying to login."),
dismissButton: .default(Text("OK"))
)
}
}
}
struct AccountLoginView_Previews: PreviewProvider {
static var previews: some View {
AccountLoginView()
.environmentObject(WriteFreelyModel())
}
}
diff --git a/Shared/Account/AccountLogoutView.swift b/Shared/Account/AccountLogoutView.swift
index a90412c..0b2bd82 100644
--- a/Shared/Account/AccountLogoutView.swift
+++ b/Shared/Account/AccountLogoutView.swift
@@ -1,30 +1,30 @@
import SwiftUI
struct AccountLogoutView: View {
@EnvironmentObject var model: WriteFreelyModel
var body: some View {
VStack {
Spacer()
VStack {
Text("Logged in as \(model.account.username)")
Text("on \(model.account.server)")
}
Spacer()
Button(action: logoutHandler, label: {
- Text("Logout")
+ Text("Log Out")
})
}
}
func logoutHandler() {
model.logout()
}
}
struct AccountLogoutView_Previews: PreviewProvider {
static var previews: some View {
AccountLogoutView()
.environmentObject(WriteFreelyModel())
}
}
diff --git a/Shared/Account/AccountView.swift b/Shared/Account/AccountView.swift
index 64f23a5..4ff4527 100644
--- a/Shared/Account/AccountView.swift
+++ b/Shared/Account/AccountView.swift
@@ -1,26 +1,26 @@
import SwiftUI
struct AccountView: View {
@EnvironmentObject var model: WriteFreelyModel
var body: some View {
if model.account.isLoggedIn {
HStack {
Spacer()
AccountLogoutView()
Spacer()
}
.padding()
} else {
AccountLoginView()
- .padding()
+ .padding(.top)
}
}
}
struct AccountLogin_Previews: PreviewProvider {
static var previews: some View {
AccountView()
.environmentObject(WriteFreelyModel())
}
}

File Metadata

Mime Type
text/x-diff
Expires
Thu, Mar 12, 7:55 PM (1 d, 4 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3653661

Event Timeline