Skip to content
Snippets Groups Projects
Commit 7a004c2a authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Improve UI in ContactView

parent 046063e2
Branches
Tags
2 merge requests!112Restore contacts from backup,!102Release 1.0.0
This commit is part of merge request !102. Comments created here will be created in the context of that merge request.
...@@ -26,6 +26,10 @@ public struct ContactView: View { ...@@ -26,6 +26,10 @@ public struct ContactView: View {
var importUsername: Bool var importUsername: Bool
var importEmail: Bool var importEmail: Bool
var importPhone: Bool var importPhone: Bool
var canSendRequest: Bool
var canVerifyContact: Bool
var canConfirmRequest: Bool
var canCheckAuthorization: Bool
init(state: ContactState) { init(state: ContactState) {
dbContact = state.dbContact dbContact = state.dbContact
...@@ -36,6 +40,10 @@ public struct ContactView: View { ...@@ -36,6 +40,10 @@ public struct ContactView: View {
importUsername = state.importUsername importUsername = state.importUsername
importEmail = state.importEmail importEmail = state.importEmail
importPhone = state.importPhone importPhone = state.importPhone
canSendRequest = state.xxContact != nil || state.dbContact?.marshaled != nil
canVerifyContact = state.dbContact?.marshaled != nil
canConfirmRequest = state.dbContact?.marshaled != nil
canCheckAuthorization = state.dbContact?.marshaled != nil
} }
} }
...@@ -109,6 +117,7 @@ public struct ContactView: View { ...@@ -109,6 +117,7 @@ public struct ContactView: View {
Section { Section {
ContactAuthStatusView(dbContact.authStatus) ContactAuthStatusView(dbContact.authStatus)
Button { Button {
viewStore.send(.sendRequestTapped) viewStore.send(.sendRequestTapped)
} label: { } label: {
...@@ -118,6 +127,8 @@ public struct ContactView: View { ...@@ -118,6 +127,8 @@ public struct ContactView: View {
Image(systemName: "chevron.forward") Image(systemName: "chevron.forward")
} }
} }
.disabled(!viewStore.canSendRequest)
Button { Button {
viewStore.send(.verifyContactTapped) viewStore.send(.verifyContactTapped)
} label: { } label: {
...@@ -127,6 +138,8 @@ public struct ContactView: View { ...@@ -127,6 +138,8 @@ public struct ContactView: View {
Image(systemName: "chevron.forward") Image(systemName: "chevron.forward")
} }
} }
.disabled(!viewStore.canVerifyContact)
Button { Button {
viewStore.send(.confirmRequestTapped) viewStore.send(.confirmRequestTapped)
} label: { } label: {
...@@ -136,6 +149,8 @@ public struct ContactView: View { ...@@ -136,6 +149,8 @@ public struct ContactView: View {
Image(systemName: "chevron.forward") Image(systemName: "chevron.forward")
} }
} }
.disabled(!viewStore.canConfirmRequest)
Button { Button {
viewStore.send(.checkAuthTapped) viewStore.send(.checkAuthTapped)
} label: { } label: {
...@@ -145,6 +160,7 @@ public struct ContactView: View { ...@@ -145,6 +160,7 @@ public struct ContactView: View {
Image(systemName: "chevron.forward") Image(systemName: "chevron.forward")
} }
} }
.disabled(!viewStore.canCheckAuthorization)
} header: { } header: {
Text("Auth") Text("Auth")
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment