refact some code

This commit is contained in:
pengfei.zhou
2020-04-03 10:19:13 +08:00
committed by osborn
parent 00f5fb3918
commit ca6a3284f2
9 changed files with 55 additions and 60 deletions

View File

@@ -95,20 +95,20 @@ - (void)sendDevCommand:(NSString *)command {
}
- (void)onOpenEvent {
ShowToast(@"dev kit connected", DoricBottom);
ShowToast(@"dev kit connected", DoricGravityBottom);
}
- (void)onEOFEvent {
ShowToast(@"dev kit eof exception", DoricBottom);
ShowToast(@"dev kit eof exception", DoricGravityBottom);
}
- (void)onConnectExceptionEvent {
ShowToast(@"dev kit connection exception", DoricBottom);
ShowToast(@"dev kit connection exception", DoricGravityBottom);
}
- (void)onStartDebugEvent:(NSNotification *)notification {
NSString *contextId = notification.object;
ShowToast(contextId, DoricBottom);
ShowToast(contextId, DoricGravityBottom);
for (NSValue *value in [[DoricContextManager instance] aliveContexts]) {
DoricContext *context = value.nonretainedObjectValue;
BOOL result = [context.contextId compare:contextId] == NSOrderedSame;

View File

@@ -53,7 +53,7 @@ - (void)viewDidLoad {
NSString *result = @"127.0.0.1";
[DoricJSRemoteExecutor configIp:result];
[[DoricDev instance] connectDevKit:[NSString stringWithFormat:@"ws://%@:7777", result]];
ShowToast([NSString stringWithFormat:@"Connected to %@", result], DoricBottom);
ShowToast([NSString stringWithFormat:@"Connected to %@", result], DoricGravityBottom);
} else {
[self.navigationController pushViewController:[QRScanViewController new] animated:NO];
}

View File

@@ -106,7 +106,7 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:
NSLog(@"Scan result is %@", result);
[[DoricDev instance] connectDevKit:[NSString stringWithFormat:@"ws://%@:7777", result]];
[DoricJSRemoteExecutor configIp:result];
ShowToast([NSString stringWithFormat:@"Connected to %@", result], DoricBottom);
ShowToast([NSString stringWithFormat:@"Connected to %@", result], DoricGravityBottom);
[self.navigationController popViewControllerAnimated:NO];
}
}