Skip to content
Snippets Groups Projects

Restore contacts from backup

Merged Dariusz Rybicki requested to merge feature/restore-contacts-from-backup into development
1 file
+ 16
0
Compare changes
  • Side-by-side
  • Inline
@@ -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")
}
}
Loading