UI refinements

This commit is contained in:
Justin Mazzocchi 2020-09-10 18:59:43 -07:00
parent 7d0feaac54
commit 921e84c08b
No known key found for this signature in database
GPG key ID: E223E6937AAFB01C
4 changed files with 20 additions and 19 deletions

View file

@ -4,13 +4,13 @@
"apns-default-message" = "New notification"; "apns-default-message" = "New notification";
"add-identity.instance-url" = "Instance URL"; "add-identity.instance-url" = "Instance URL";
"add-identity.log-in" = "Log in"; "add-identity.log-in" = "Log in";
"add-identity.browse-anonymously" = "Browse anonymously"; "add-identity.browse" = "Browse";
"add-identity.unable-to-connect-to-instance" = "Unable to connect to instance"; "add-identity.unable-to-connect-to-instance" = "Unable to connect to instance";
"secondary-navigation.manage-accounts" = "Manage Accounts"; "secondary-navigation.manage-accounts" = "Manage Accounts";
"secondary-navigation.lists" = "Lists"; "secondary-navigation.lists" = "Lists";
"secondary-navigation.preferences" = "Preferences"; "secondary-navigation.preferences" = "Preferences";
"identities.accounts" = "Accounts"; "identities.accounts" = "Accounts";
"identities.browsing-anonymously" = "Browsing Anonymously"; "identities.browsing" = "Browsing";
"lists.new-list-title" = "New List Title"; "lists.new-list-title" = "New List Title";
"preferences" = "Preferences"; "preferences" = "Preferences";
"preferences.posting-reading" = "Posting and Reading"; "preferences.posting-reading" = "Posting and Reading";

View file

@ -55,7 +55,7 @@ public extension AddIdentityViewModel {
addIdentity(authenticated: true) addIdentity(authenticated: true)
} }
func browseAnonymouslyTapped() { func browseTapped() {
addIdentity(authenticated: false) addIdentity(authenticated: false)
} }

View file

@ -15,21 +15,7 @@ struct AddIdentityView: View {
.autocapitalization(.none) .autocapitalization(.none)
.disableAutocorrection(true) .disableAutocorrection(true)
.keyboardType(.URL) .keyboardType(.URL)
Group { if let instance = viewModel.instance {
if viewModel.loading {
ProgressView()
} else {
Button("add-identity.log-in",
action: viewModel.logInTapped)
if viewModel.isPublicTimelineAvailable {
Button("add-identity.browse-anonymously", action: viewModel.browseAnonymouslyTapped)
}
}
}
.frame(maxWidth: .infinity, alignment: .center)
}
if let instance = viewModel.instance {
Section {
VStack(alignment: .center) { VStack(alignment: .center) {
KFImage(instance.thumbnail) KFImage(instance.thumbnail)
.placeholder { .placeholder {
@ -37,15 +23,30 @@ struct AddIdentityView: View {
} }
.resizable() .resizable()
.aspectRatio(16 / 9, contentMode: .fill) .aspectRatio(16 / 9, contentMode: .fill)
.background(Color.blue)
Spacer()
Text(instance.title) Text(instance.title)
.font(.headline) .font(.headline)
Text(instance.uri) Text(instance.uri)
.font(.subheadline) .font(.subheadline)
.foregroundColor(.secondary) .foregroundColor(.secondary)
Spacer()
} }
.frame(maxWidth: .infinity, alignment: .center) .frame(maxWidth: .infinity, alignment: .center)
.listRowInsets(EdgeInsets()) .listRowInsets(EdgeInsets())
} }
Group {
if viewModel.loading {
ProgressView()
} else {
Button("add-identity.log-in",
action: viewModel.logInTapped)
if viewModel.isPublicTimelineAvailable {
Button("add-identity.browse", action: viewModel.browseTapped)
}
}
}
.frame(maxWidth: .infinity, alignment: .center)
} }
} }
.animation(.default) .animation(.default)

View file

@ -20,7 +20,7 @@ struct IdentitiesView: View {
}) })
} }
section(title: "identities.accounts", identities: viewModel.authenticated) section(title: "identities.accounts", identities: viewModel.authenticated)
section(title: "identities.browsing-anonymously", identities: viewModel.unauthenticated) section(title: "identities.browsing", identities: viewModel.unauthenticated)
} }
.toolbar { .toolbar {
ToolbarItem(placement: ToolbarItemPlacement.navigationBarTrailing) { ToolbarItem(placement: ToolbarItemPlacement.navigationBarTrailing) {