|
|
@@ -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]
|