|
@@ -831,18 +831,23 @@
|
|
#pragma mark ===== Setting Favorite =====
|
|
#pragma mark ===== Setting Favorite =====
|
|
#pragma --------------------------------------------------------------------------------------------
|
|
#pragma --------------------------------------------------------------------------------------------
|
|
|
|
|
|
-- (void)settingFavorite:(NSString *)fileName favorite:(BOOL)favorite completion:(void (^)(NSString *message, NSInteger errorCode))completion
|
|
|
|
|
|
+- (void)settingFavorite:(NSString *)fileName account:(NSString *)account favorite:(BOOL)favorite completion:(void (^)(NSString *account, NSString *message, NSInteger errorCode))completion
|
|
{
|
|
{
|
|
|
|
+ tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
|
|
|
|
+ if (tableAccount == nil) {
|
|
|
|
+ completion(account, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
|
|
|
|
+ }
|
|
|
|
+
|
|
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
|
|
|
|
- [communication setCredentialsWithUser:_activeUser andUserID:_activeUserID andPassword:_activePassword];
|
|
|
|
|
|
+ [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
|
|
[communication setUserAgent:[CCUtility getUserAgent]];
|
|
[communication setUserAgent:[CCUtility getUserAgent]];
|
|
|
|
|
|
- NSString *server = [_activeUrl stringByAppendingString:k_dav];
|
|
|
|
|
|
+ NSString *server = [tableAccount.url stringByAppendingString:k_dav];
|
|
|
|
|
|
[communication settingFavoriteServer:server andFileOrFolderPath:fileName favorite:favorite withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer, NSString *token) {
|
|
[communication settingFavoriteServer:server andFileOrFolderPath:fileName favorite:favorite withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer, NSString *token) {
|
|
|
|
|
|
- completion(nil, 0);
|
|
|
|
|
|
+ completion(account, nil, 0);
|
|
|
|
|
|
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer) {
|
|
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer) {
|
|
|
|
|
|
@@ -862,7 +867,7 @@
|
|
if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
[[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
[[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
|
|
|
- completion(message, errorCode);
|
|
|
|
|
|
+ completion(account, message, errorCode);
|
|
}];
|
|
}];
|
|
}
|
|
}
|
|
|
|
|