Commit 9c1f5b80 authored by yuweih's avatar yuweih Committed by Commit Bot

[CRD iOS] Don't attempt to connect to an offline host

Previously when the user clicks on an offline host, the client will still
attempts to connect to it, then it crashes.

This CL prevents the client from attempting to connect to an offline host.
When the offline host is selected, the client will just show a snack bar
message and do nothing else.

Review-Url: https://codereview.chromium.org/2914233003
Cr-Commit-Position: refs/heads/master@{#476455}
parent 3b3d3bc4
...@@ -203,6 +203,13 @@ static CGFloat kHostInset = 5.f; ...@@ -203,6 +203,13 @@ static CGFloat kHostInset = 5.f;
- (void)didSelectCell:(HostCollectionViewCell*)cell - (void)didSelectCell:(HostCollectionViewCell*)cell
completion:(void (^)())completionBlock { completion:(void (^)())completionBlock {
if (![cell.hostInfo isOnline]) {
MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init];
message.text = @"Host is offline.";
[MDCSnackbarManager showMessage:message];
return;
}
_client = [[RemotingClient alloc] init]; _client = [[RemotingClient alloc] init];
[_remotingService.authentication [_remotingService.authentication
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment