marinofaggiana 5 years ago
parent
commit
c8c167c135

+ 1 - 1
iOSClient/CCGlobal.h

@@ -81,7 +81,7 @@
 
 // Database Realm
 #define k_databaseDefault                               @"nextcloud.realm"
-#define k_databaseSchemaVersion                         85
+#define k_databaseSchemaVersion                         86
 
 // Intro selector
 #define k_intro_login                                   0

+ 1 - 0
iOSClient/Database/NCDatabase.swift

@@ -232,6 +232,7 @@ class tableDirectEditingCreators: Object {
 class tableDirectEditingEditors: Object {
     
     @objc dynamic var account = ""
+    @objc dynamic var editor = ""
     let mimetypes = List<String>()
     @objc dynamic var name = ""
     let optionalMimetypes = List<String>()

+ 5 - 0
iOSClient/Database/NCManageDatabase.swift

@@ -1081,6 +1081,11 @@ class NCManageDatabase: NSObject {
                         addObject.mimetypes.append(mimeType)
                     }
                     addObject.name = editor.name
+                    if editor.name.lowercased() == "onlyoffice" {
+                        addObject.editor = "onlyoffice"
+                    } else if editor.name.lowercased() == "nextcloud text" {
+                        addObject.editor = "text"
+                    }
                     for mimeType in editor.optionalMimetypes {
                         addObject.optionalMimetypes.append(mimeType)
                     }

+ 3 - 3
iOSClient/Main/CCDetail.m

@@ -216,18 +216,18 @@
             return;
         }
         
-        // Nextcloud Text - RichWorkspace
+        // DirectEditinf: Nextcloud Text - OnlyOffice
         if ([[NCUtility sharedInstance] isDirectEditing:self.metadataDetail] != nil && appDelegate.reachability.isReachable) {
             
             NSString *editor = [[NCUtility sharedInstance] isDirectEditing:self.metadataDetail];
-            if ([editor.lowercaseString isEqualToString:@"nextcloud text"]) {
+            if ([editor.lowercaseString isEqualToString:k_editor_text] || [editor.lowercaseString isEqualToString:k_editor_onlyoffice]) {
             
                 if([self.metadataDetail.url isEqualToString:@""]) {
                     
                     [[NCUtility sharedInstance] startActivityIndicatorWithView:self.view bottom:0];
                     
                     NSString *fileNamePath = [CCUtility returnFileNamePathFromFileName:self.metadataDetail.fileName serverUrl:self.metadataDetail.serverUrl activeUrl:appDelegate.activeUrl];
-                    [[NCCommunication sharedInstance] NCTextOpenFileWithUrlString:appDelegate.activeUrl fileNamePath:fileNamePath editor: @"text" account:self.metadataDetail.account completionHandler:^(NSString *account, NSString *url, NSInteger errorCode, NSString *errorMessage) {
+                    [[NCCommunication sharedInstance] NCTextOpenFileWithUrlString:appDelegate.activeUrl fileNamePath:fileNamePath editor:editor account:self.metadataDetail.account completionHandler:^(NSString *account, NSString *url, NSInteger errorCode, NSString *errorMessage) {
                         
                         if (errorCode == 0 && [account isEqualToString:appDelegate.activeAccount]) {
                             

+ 2 - 2
iOSClient/Utility/NCUtility.swift

@@ -398,12 +398,12 @@ class NCUtility: NSObject {
         for result: tableDirectEditingEditors in results {
             for mimetype in result.mimetypes {
                 if mimetype == metadata.contentType {
-                    return result.name
+                    return result.editor
                 }
             }
             for mimetype in result.optionalMimetypes {
                 if mimetype == metadata.contentType {
-                    return result.name
+                    return result.editor
                 }
             }
         }