Skip to content

Commit

Permalink
code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
lilthree committed Jan 26, 2018
1 parent c8ff3d1 commit d53a276
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Pod/Classes/SeafTaskQueue.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ - (instancetype)init {
Debug("finish task %@, %ld tasks remained.",task.name, (long)[weakSelf taskNumber]);
task.lastFinishTimestamp = [[NSDate new] timeIntervalSince1970];
if (!result) { // Task fail, add to the tail of queue for retry
strongSelf.failedCount += 1;
@synchronized (strongSelf.tasks) {
strongSelf.failedCount += 1;
if (task.retryable) {
task.retryCount += 1;
[strongSelf.tasks addObject:task];
Expand Down
3 changes: 2 additions & 1 deletion seafile/SeafAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ - (void)enterAccount:(SeafConnection *)conn
[self.tabbarController setViewControllers:vcs];
}
}
if (updated)
if (updated) {
[SeafDataTaskManager.sharedObject startLastTimeUnfinshTaskWithConnection:conn];
[self.tabbarController setSelectedIndex:TABBED_SEAFILE];
}
self.window.rootViewController = self.tabbarController;
[self.window makeKeyAndVisible];

Expand Down
13 changes: 7 additions & 6 deletions seafile/SeafSettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,13 @@ - (void)viewDidLoad
_version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
_versionCell.detailTextLabel.text = _version;
[self configureView];

SeafDataTaskManager.sharedObject.trySyncBlock = ^(id<SeafTask> _Nonnull task) {
[self performSelectorInBackground:@selector(updateSyncInfo) withObject:nil];
};
SeafDataTaskManager.sharedObject.finishBlock = ^(id<SeafTask> _Nonnull task) {
[self performSelectorInBackground:@selector(updateSyncInfo) withObject:nil];
};
}

- (void)viewDidAppear:(BOOL)animated
Expand Down Expand Up @@ -464,12 +471,6 @@ - (void)configureView
_serverCell.detailTextLabel.text = [_connection.address trimUrl];

[self updateSyncInfo];
SeafDataTaskManager.sharedObject.trySyncBlock = ^(id<SeafTask> _Nonnull task) {
[self performSelectorInBackground:@selector(updateSyncInfo) withObject:nil];
};
SeafDataTaskManager.sharedObject.finishBlock = ^(id<SeafTask> _Nonnull task) {
[self performSelectorInBackground:@selector(updateSyncInfo) withObject:nil];
};

[self.tableView reloadData];
}
Expand Down

0 comments on commit d53a276

Please sign in to comment.