Disable publish and reload buttons based on network connection status

This commit is contained in:
Angelo Stavrow 2020-09-16 16:40:17 -04:00
parent 52335d5d48
commit d7a6668917
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
2 changed files with 7 additions and 3 deletions

View File

@ -34,7 +34,11 @@ struct PostEditorView: View {
}, label: {
Image(systemName: "paperplane")
})
.disabled(post.status == PostStatus.published.rawValue || !model.account.isLoggedIn)
.disabled(
post.status == PostStatus.published.rawValue ||
!model.account.isLoggedIn ||
!model.hasNetworkConnection
)
}
}
.onChange(of: post.hasNewerRemoteCopy, perform: { _ in

View File

@ -41,7 +41,7 @@ struct PostListView: View {
}, label: {
Image(systemName: "arrow.clockwise")
})
.disabled(!model.account.isLoggedIn)
.disabled(!model.account.isLoggedIn || !model.hasNetworkConnection)
}
.padding()
.frame(width: geometry.size.width)
@ -67,7 +67,7 @@ struct PostListView: View {
}, label: {
Image(systemName: "arrow.clockwise")
})
.disabled(!model.account.isLoggedIn)
.disabled(!model.account.isLoggedIn || !model.hasNetworkConnection)
}
#endif
}