Переглянути джерело

순서 변경 관련 오류 수정
장치 제어시 로딩창 출력하도록 수

KaRam Kim 8 роки тому
батько
коміт
a4625314e0

+ 8 - 1
OneCable/Classes/CommonUI/CommandClassControlView.m

@@ -55,7 +55,8 @@
 - (void)updateLayout {
     
 }
-
+//todo : 로딩화면 띄우기
+//예외처리 하기
 - (NSDictionary *)parameterForNodeCommand {
     NSDictionary *parameter = nil;
     if (_device) {
@@ -181,6 +182,12 @@
 {
     NSLog(@"Message : %@", message);
     NSLog(@"Message : %@", result);
+    if (result.isSuccess) {
+        ThingsViewController *vc = [JDFacade facade].mainViewController.tvc;
+        if (vc && [vc isKindOfClass:[ThingsViewController class]]) {
+            [vc requestDeviceControl];
+        }
+    }
 }
 
 @end

+ 1 - 1
OneCable/Classes/ViewControllers/MainScreens/LoginViewController.m

@@ -376,7 +376,7 @@ ID / PW Input Box Text Color
     }
 
     if ([_txtPasswd.text isEmptyString]) {
-        _txtPasswd.text = @"09767955";
+        _txtPasswd.text = @"12345678a";
 
     }
 #endif

+ 3 - 0
OneCable/Classes/ViewControllers/ThingsScreens/ThingsViewController.h

@@ -53,6 +53,9 @@
 
 - (IBAction)btnOptionTouched:(id)sender;
 - (void)requestPollingCommandStatusOfDeviceInBackground:(DeviceModel *)device;
+
+-(void)requestDeviceControl;
+
 - (void)releaseDevicesTimer;
 
 @end

+ 20 - 28
OneCable/Classes/ViewControllers/ThingsScreens/ThingsViewController.m

@@ -361,6 +361,16 @@
     }
 }
 
+-(void)requestDeviceControl
+{
+    [_collectionView reloadData];
+    
+    ThingsDetailViewController *vc = (ThingsDetailViewController *)[JDFacade facade].currentViewController;
+    if ([vc isKindOfClass:[ThingsDetailViewController class]]) {
+        [vc.tableView reloadData];
+    }
+}
+
 - (NSInteger)elapsedSecondsFromNow:(DeviceModel *)runningDevice {
     NSInteger seconds = 0;
     if (runningDevice.requestTime && ![runningDevice.requestTime isEmptyString]) {
@@ -879,41 +889,23 @@
 
 - (void)moveItemIfNeeded
 {
+    // TODO : 버그 수정
     NSIndexPath *atIndexPath = _dragIndexPath;
     NSIndexPath *toIndexPath = [_collectionView indexPathForItemAtPoint:_cellFakeView.center];
-    
-    if (toIndexPath == nil || [atIndexPath isEqual:toIndexPath]) {
-        return;
+    if (toIndexPath != nil && ![atIndexPath isEqual:toIndexPath]) {
+        [_collectionView performBatchUpdates:^{
+            
+            [_collectionView moveItemAtIndexPath:atIndexPath toIndexPath:toIndexPath];
+            [self updateDataSource:atIndexPath toIndexPath:toIndexPath];
+            
+        } completion:nil];
     }
     
-    //can move
-//    if ([self.datasource respondsToSelector:@selector(collectionView:itemAtIndexPath:canMoveToIndexPath:)]) {
-//        if (![self.datasource collectionView:self.collectionView itemAtIndexPath:atIndexPath canMoveToIndexPath:toIndexPath]) {
-//            return;
-//        }
-//    }
-//    
-//    //will move
-//    if ([self.datasource respondsToSelector:@selector(collectionView:itemAtIndexPath:willMoveToIndexPath:)]) {
-//        [self.datasource collectionView:self.collectionView itemAtIndexPath:atIndexPath willMoveToIndexPath:toIndexPath];
-//    }
-    
-    //move
-
-    [_collectionView performBatchUpdates:^{
-        //update cell indexPath
-//        _dragIndexPath = toIndexPath;
-        [_collectionView moveItemAtIndexPath:atIndexPath toIndexPath:toIndexPath];
-        _moveCell.hidden = NO;
-        //did move
-//        if ([_collectionView.datasource respondsToSelector:@selector(collectionView:itemAtIndexPath:didMoveToIndexPath:)]) {
-//            [_collectionView.datasource collectionView:self.collectionView itemAtIndexPath:atIndexPath didMoveToIndexPath:toIndexPath];
-//        }
-        [self updateDataSource:atIndexPath toIndexPath:toIndexPath];
 
-    } completion:nil];
+
     
     
+    _moveCell.hidden = NO;
     [_cellFakeView removeFromSuperview];
      _dragIndexPath = nil;
 //    [_cellInfo]