restart searching whenever connection failed
Change-Id: I56bacb9953a07054da08546b982a1379de8e6642
This commit is contained in:
parent
03b7dde22c
commit
8f44dc9a04
@ -8,11 +8,11 @@
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "iosremote/Communication/CommunicationManager.m"
|
||||
timestampString = "397932312.890248"
|
||||
timestampString = "398102600.954242"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "77"
|
||||
endingLineNumber = "77"
|
||||
startingLineNumber = "78"
|
||||
endingLineNumber = "78"
|
||||
landmarkName = "-connectionStatusHandler:"
|
||||
landmarkType = "5">
|
||||
</FileBreakpoint>
|
||||
|
@ -71,6 +71,7 @@
|
||||
otherButtonTitles:NSLocalizedString(@"Help", nil), nil];
|
||||
[message show];
|
||||
});
|
||||
[(server_list_vc *)self.delegate startSearching];
|
||||
} else {
|
||||
[[self.delegate navigationController] popToRootViewControllerAnimated:YES];
|
||||
BasePresentationViewController *bpvc = [[(MainSplitViewController *)[self.delegate presentingViewController] viewControllers] objectAtIndex:1];
|
||||
|
@ -14,4 +14,5 @@
|
||||
|
||||
@property (strong, nonatomic) IBOutlet UITableView *serverTable;
|
||||
|
||||
- (void) startSearching;
|
||||
@end
|
||||
|
@ -24,8 +24,8 @@
|
||||
@property (nonatomic, strong) id slideShowPreviewStartObserver;
|
||||
@property (nonatomic, strong) id pinValidationObserver;
|
||||
@property (atomic, strong) NSIndexPath *lastSpinningCellIndex;
|
||||
|
||||
@property (nonatomic, strong) NSNetServiceBrowser *serviceBrowser;
|
||||
|
||||
@property (nonatomic, strong) NSTimer *searchLabelTimer;
|
||||
@property (nonatomic, strong) NSTimer *searchTimeoutTimer;
|
||||
@property (nonatomic, strong) NSString *searchStateText;
|
||||
@ -46,6 +46,13 @@
|
||||
@synthesize serviceBrowser = _serviceBrowser;
|
||||
|
||||
#pragma mark - helper
|
||||
- (void) startSearching
|
||||
{
|
||||
[self.comManager.autoDiscoveryServers removeAllObjects];
|
||||
[self.serviceBrowser searchForServicesOfType:@"_impressremote._tcp" inDomain:@"local"];
|
||||
[self.serviceBrowser scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
|
||||
}
|
||||
|
||||
- (void) setSearchStateText:(NSString *)searchStateText
|
||||
{
|
||||
_searchStateText = searchStateText;
|
||||
@ -75,6 +82,9 @@
|
||||
-(void) netService:(NSNetService *)sender didNotResolve:(NSDictionary *)errorDict
|
||||
{
|
||||
NSLog(@"Failed to resolve");
|
||||
[self.comManager.autoDiscoveryServers removeAllObjects];
|
||||
[self startSearching];
|
||||
|
||||
UIAlertView *message = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Failed to reach your computer", nil)
|
||||
message:NSLocalizedString(@"Please consider restart LibreOffice Impress on your computer.", nil)
|
||||
delegate:self
|
||||
@ -140,7 +150,6 @@
|
||||
- (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didNotSearch:(NSDictionary *)errorDict
|
||||
{
|
||||
NSLog(@"search error");
|
||||
// [self.serviceBrowser searchForServicesOfType:@"_impressRemote._tcp" inDomain:@"local"];
|
||||
}
|
||||
|
||||
- (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser
|
||||
@ -158,6 +167,9 @@
|
||||
if(!moreComing)
|
||||
{
|
||||
[self.tableView reloadData];
|
||||
[self.serviceBrowser stop];
|
||||
[self.searchTimeoutTimer invalidate];
|
||||
[self.searchLabelTimer invalidate];
|
||||
}
|
||||
}
|
||||
|
||||
@ -245,8 +257,7 @@
|
||||
[self.serverTable reloadData];
|
||||
self.serviceBrowser = [[NSNetServiceBrowser alloc] init];
|
||||
[self.serviceBrowser setDelegate:self];
|
||||
[self.serviceBrowser searchForServicesOfType:@"_impressremote._tcp" inDomain:@"local"];
|
||||
[self.serviceBrowser scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
|
||||
[self startSearching];
|
||||
[super viewDidAppear:animated];
|
||||
}
|
||||
|
||||
@ -299,8 +310,7 @@
|
||||
if ([self.comManager.autoDiscoveryServers count] == 0 && indexPath.section == 0){
|
||||
// No discovered server and not searching => in a "click to refresh" state, so we restart searching process
|
||||
if (self.comManager.searchState == WAITING){
|
||||
[self.serviceBrowser searchForServicesOfType:@"_impressremote._tcp" inDomain:@"local"];
|
||||
[self.serviceBrowser scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
|
||||
[self startSearching];
|
||||
}
|
||||
// Return when browser is still searching...
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user