Skip to content

Commit 6009c98

Browse files
Merge pull request #3727 from nextcloud/editors
Editors - fix detect onlyoffice
2 parents b264869 + 72a2cff commit 6009c98

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

Nextcloud.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5946,7 +5946,7 @@
59465946
CLANG_WARN_UNREACHABLE_CODE = YES;
59475947
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
59485948
COPY_PHASE_STRIP = NO;
5949-
CURRENT_PROJECT_VERSION = 6;
5949+
CURRENT_PROJECT_VERSION = 7;
59505950
DEBUG_INFORMATION_FORMAT = dwarf;
59515951
DEVELOPMENT_TEAM = NKUJUXUJ3B;
59525952
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -6012,7 +6012,7 @@
60126012
CLANG_WARN_UNREACHABLE_CODE = YES;
60136013
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
60146014
COPY_PHASE_STRIP = NO;
6015-
CURRENT_PROJECT_VERSION = 6;
6015+
CURRENT_PROJECT_VERSION = 7;
60166016
DEVELOPMENT_TEAM = NKUJUXUJ3B;
60176017
ENABLE_STRICT_OBJC_MSGSEND = YES;
60186018
ENABLE_TESTABILITY = YES;

iOSClient/Data/NCManageDatabase+Metadata.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ extension tableMetadata {
262262
return false
263263
}
264264
let utility = NCUtility()
265-
let directEditingEditors = utility.editorsDirectEditing(account: account, contentType: contentType)
265+
let directEditingEditors = utility.editorsDirectEditing(account: account, contentType: contentType).map { $0.lowercased() }
266266
let richDocumentEditor = utility.isTypeFileRichDocument(self)
267267
let capabilities = NCNetworking.shared.capabilities[account]
268268

@@ -272,7 +272,7 @@ extension tableMetadata {
272272
directEditingEditors.isEmpty {
273273
// RichDocument: Collabora
274274
return true
275-
} else if directEditingEditors.contains("Nextcloud Text") || directEditingEditors.contains("onlyoffice") {
275+
} else if directEditingEditors.contains("nextcloud text") || directEditingEditors.contains("onlyoffice") {
276276
// DirectEditing: Nextcloud Text - OnlyOffice
277277
return true
278278
}
@@ -292,10 +292,12 @@ extension tableMetadata {
292292
}
293293

294294
var isAvailableDirectEditingEditorView: Bool {
295-
guard (classFile == NKTypeClassFile.document.rawValue) && NextcloudKit.shared.isNetworkReachable() else { return false }
296-
let editors = NCUtility().editorsDirectEditing(account: account, contentType: contentType)
295+
guard (classFile == NKTypeClassFile.document.rawValue) && NextcloudKit.shared.isNetworkReachable() else {
296+
return false
297+
}
298+
let editors = NCUtility().editorsDirectEditing(account: account, contentType: contentType).map { $0.lowercased() }
297299

298-
if editors.contains("Nextcloud Text") || editors.contains("ONLYOFFICE") {
300+
if editors.contains("nextcloud text") || editors.contains("onlyoffice") {
299301
return true
300302
}
301303
return false

iOSClient/Viewer/NCViewer.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ class NCViewer: NSObject {
132132
var options = NKRequestOptions()
133133
var editor = ""
134134
var editorViewController = ""
135-
let editors = utility.editorsDirectEditing(account: metadata.account, contentType: metadata.contentType)
136-
if editors.contains("Nextcloud Text") {
135+
let editors = utility.editorsDirectEditing(account: metadata.account, contentType: metadata.contentType).map { $0.lowercased() }
136+
if editors.contains("nextcloud text") {
137137
editor = "text"
138-
editorViewController = "Nextcloud Text"
138+
editorViewController = "nextcloud text"
139139
options = NKRequestOptions(customUserAgent: utility.getCustomUserAgentNCText())
140-
} else if editors.contains("ONLYOFFICE") {
140+
} else if editors.contains("onlyoffice") {
141141
editor = "onlyoffice"
142142
editorViewController = "onlyoffice"
143143
options = NKRequestOptions(customUserAgent: utility.getCustomUserAgentOnlyOffice())

iOSClient/Viewer/NCViewerNextcloudText/NCViewerNextcloudText.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class NCViewerNextcloudText: UIViewController, WKNavigationDelegate, WKScriptMes
6565

6666
navigationItem.rightBarButtonItems = items
6767
navigationItem.leftBarButtonItems = nil
68-
if editor == "Nextcloud Text" {
68+
if editor == "nextcloud text" {
6969
navigationItem.hidesBackButton = true
7070
}
7171

@@ -93,7 +93,7 @@ class NCViewerNextcloudText: UIViewController, WKNavigationDelegate, WKScriptMes
9393

9494
if editor == "onlyoffice" {
9595
webView.customUserAgent = utility.getCustomUserAgentOnlyOffice()
96-
} else if editor == "Nextcloud Text" {
96+
} else if editor == "nextcloud text" {
9797
webView.customUserAgent = utility.getCustomUserAgentNCText()
9898
} // else: use default
9999

0 commit comments

Comments
 (0)