Skip to content

Commit c55fe90

Browse files
NMC - Updated the localisations files, updated the plus menu with NMC customisation and the fixes
1 parent b95625a commit c55fe90

67 files changed

Lines changed: 795 additions & 820 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Brand/NCBrand.swift

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ final class NCBrandOptions: @unchecked Sendable {
7272
var privacy: String = "https://static.magentacloud.de/privacy/datenschutzhinweise_app.htm"
7373
var sourceCode: String = "https://github.com/nextcloud/ios"
7474
var mobileconfig: String = "/remote.php/dav/provisioning/apple-provisioning.mobileconfig"
75-
var appStoreUrl: String = "https://apps.apple.com/in/app/nextcloud/id1125420102"
75+
var appStoreUrlNC: String = "https://apps.apple.com/in/app/nextcloud/id1125420102"
76+
var appStoreUrl: String = "https://apps.apple.com/de/app/id312838242"
7677

7778
// Auto Upload default folder
7879
// var folderDefaultAutoUpload: String = Locale.current.language.languageCode?.identifier == "de" ? "Kamera-Medien" : "Camera-Media"
@@ -81,8 +82,6 @@ final class NCBrandOptions: @unchecked Sendable {
8182

8283

8384
// Capabilities Group
84-
// var capabilitiesGroup: String = "group.it.twsweb.Crypto-Cloud"
85-
// var capabilitiesGroupApps: String = "group.com.nextcloud.apps"
8685
//#if DEBUG
8786
// QA :
8887
@objc public var capabilitiesGroup: String = "group.com.t-systems.pu-ds.magentacloud.qa"
@@ -92,9 +91,7 @@ final class NCBrandOptions: @unchecked Sendable {
9291
// @objc public var capabilitiesGroup: String = "group.de.telekom.Mediencenter"
9392
// @objc public var capabilitiesGroupApps: String = "group.de.telekom.Mediencenter"
9493
//#endif
95-
96-
//#endif
97-
94+
9895
// BRAND ONLY
9996
// Set use_login_web_personalized to true for prod and false for configurable path
10097
var use_login_web_personalized: Bool = true // Don't touch me !!
@@ -103,17 +100,17 @@ final class NCBrandOptions: @unchecked Sendable {
103100
var use_AppConfig: Bool = false // Don't touch me !!
104101

105102
// Use server theming color
106-
var use_themingColor: Bool = false
103+
var use_themingColor: Bool = true
107104

108-
var disable_intro: Bool = true
109-
var disable_request_login_url: Bool = true
110-
var disable_multiaccount: Bool = true
105+
var disable_intro: Bool = false
106+
var disable_request_login_url: Bool = false
107+
var disable_multiaccount: Bool = false
111108
var disable_more_external_site: Bool = false
112109
var disable_openin_file: Bool = false // Don't touch me !!
113-
var disable_crash_service: Bool = true
110+
var disable_crash_service: Bool = false
114111
var disable_log: Bool = false
115-
var disable_mobileconfig: Bool = false
116-
var disable_show_more_nextcloud_apps_in_settings: Bool = true
112+
var disable_mobileconfig: Bool = false
113+
var disable_show_more_nextcloud_apps_in_settings: Bool = true
117114
var doNotAskPasscodeAtStartup: Bool = false
118115
var disable_source_code_in_settings: Bool = false
119116
var enforce_passcode_lock = false
@@ -172,7 +169,7 @@ final class NCBrandOptions: @unchecked Sendable {
172169
}
173170

174171
if pushNotificationServerProxy.isEmpty,
175-
brand == "Nextcloud" {
172+
brand == "Nextcloud" || brand == "MagentaCLOUD" {
176173
pushNotificationServerProxy = "https://push-notifications.nextcloud.com"
177174
// DEBUG SERVER PUSH
178175
// pushNotificationServerProxy = "https://c0004.customerpush.nextcloud.com"
@@ -195,8 +192,6 @@ final class NCBrandColor: @unchecked Sendable {
195192
// This is rewrited from customet theme, default is Nextcloud color
196193
let customer: UIColor = UIColor(red: 226.0/255.0, green: 0.0/255.0, blue: 116.0/255.0, alpha: 1.0)
197194
var customerText: UIColor = UIColor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 1.0)
198-
// let customer: UIColor = UIColor(red: 226.0/255.0, green: 0.0/255.0, blue: 116.0/255.0, alpha: 1.0) // Nextcloud : #0082C9
199-
// var customerText: UIColor = .white
200195

201196
var brand: UIColor // don't touch me
202197
var brandElement: UIColor // don't touch me

Nextcloud.xcodeproj/project.pbxproj

Lines changed: 69 additions & 11 deletions
Large diffs are not rendered by default.

iOSClient/AudioRecorder/NCAudioRecorderViewController.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,13 @@ class NCAudioRecorderViewController: UIViewController, NCAudioRecorderDelegate {
6969
if recording.state == .record {
7070
recording.stop()
7171
voiceRecordHUD.update(0.0)
72-
dismiss(animated: true) {
73-
self.uploadMetadata()
72+
dismiss(animated: true) { [self] in
73+
guard let navigationController = UIStoryboard(name: "NCCreateFormUploadVoiceNote", bundle: nil).instantiateInitialViewController() as? UINavigationController,
74+
let viewController = navigationController.topViewController as? NCCreateFormUploadVoiceNote else { return }
75+
navigationController.modalPresentationStyle = .formSheet
76+
viewController.setup(serverUrl: controller.currentServerUrl(), fileNamePath: NSTemporaryDirectory() + self.fileName, fileName: self.fileName)
77+
viewController.controller = controller
78+
UIApplication.shared.firstWindow?.rootViewController?.present(navigationController, animated: true)
7479
}
7580
} else {
7681
do {

iOSClient/Extensions/UIAlertController+Extension.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ extension UIAlertController {
155155
let textCheck = FileNameValidator.checkFileName(folderName, account: session.account, capabilities: capabilities)
156156
let alreadyExists = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView == %@", session.account, serverUrl, folderName)) != nil
157157

158-
okAction.isEnabled = !text.isEmpty && textCheck?.error == nil && alreadyExists == false
158+
okAction.isEnabled = !folderName.isEmpty && textCheck?.error == nil && alreadyExists == false
159159

160160
var message = ""
161161
var messageColor = UIColor.label
@@ -258,6 +258,7 @@ extension UIAlertController {
258258
let oldExtension = fileName.fileExtension
259259

260260
let text = alertController.textFields?.first?.text?.trimmingCharacters(in: .whitespaces) ?? ""
261+
let trimmedInitial = text.trimmingCharacters(in: .whitespaces)
261262
let textCheck = FileNameValidator.checkFileName(text, account: account, capabilities: capabilities)
262263
var message = textCheck?.error.localizedDescription ?? ""
263264
var messageColor = UIColor.red
@@ -286,12 +287,13 @@ extension UIAlertController {
286287
object: alertController.textFields?.first,
287288
queue: .main) { _ in
288289
guard let text = alertController.textFields?.first?.text else { return }
290+
let trimmedText = text.trimmingCharacters(in: .whitespaces)
289291
let newExtension = text.fileExtension
290292

291293
let textCheck = FileNameValidator.checkFileName(text, account: account, capabilities: capabilities)
292294
let isFileHidden = FileNameValidator.isFileHidden(text)
293295

294-
okAction.isEnabled = !text.isEmpty && textCheck?.error == nil
296+
okAction.isEnabled = !trimmedText.isEmpty && textCheck?.error == nil
295297

296298
message = ""
297299
messageColor = UIColor.label

iOSClient/GUI/Lucid Banner/UploadBannerView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ struct UploadBannerView: View {
8484
.foregroundStyle(state.payload.imageColor)
8585

8686
if let p = state.payload.progress {
87-
Text("\(Int(p * 100))%")
87+
Text("\(Int(p * 100)) %")
8888
.cappedFont(.body, maxDynamicType: .accessibility2)
8989
.monospacedDigit()
9090
.foregroundStyle(state.payload.textColor)

iOSClient/Login/NCLogin.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate {
191191
override func viewDidAppear(_ animated: Bool) {
192192
super.viewDidAppear(animated)
193193

194+
// Re-evaluate in-app messages after viewDidAppear
195+
MoEngageAnalytics.shared.displayInAppNotificationSafely(reason: "viewDidAppear")
196+
194197
if self.shareAccounts != nil,
195198
let windowScene = view.window?.windowScene {
196199
let title = String(format: NSLocalizedString("_apps_nextcloud_detect_", comment: ""), NCBrandOptions.shared.brand)

iOSClient/Login/NCLoginWeb.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,11 @@ class NCLoginWeb: UIViewController {
154154
override func viewDidAppear(_ animated: Bool) {
155155
super.viewDidAppear(animated)
156156

157+
// Re-evaluate in-app messages after viewDidAppear
158+
MoEngageAnalytics.shared.displayInAppNotificationSafely(reason: "viewDidAppear")
159+
157160
// Stop timer error network
158-
appDelegate.timerErrorNetworking?.invalidate()
161+
// appDelegate.timerErrorNetworking?.invalidate()
159162

160163
if let account = NCManageDatabase.shared.getActiveTableAccount(), NCPreferences().getPassword(account: account.account).isEmpty {
161164

@@ -176,7 +179,7 @@ class NCLoginWeb: UIViewController {
176179
super.viewDidDisappear(animated)
177180

178181
// Start timer error network
179-
appDelegate.startTimerErrorNetworking()
182+
// appDelegate.startTimerErrorNetworking()
180183
}
181184

182185
func loadWebPage(webView: WKWebView, url: URL) {
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
//
2+
// NCCreateDocument.swift
3+
// Nextcloud
4+
//
5+
// Created by Marino Faggiana on 22/06/24.
6+
// Copyright © 2024 Marino Faggiana. All rights reserved.
7+
//
8+
// Author Marino Faggiana <marino.faggiana@nextcloud.com>
9+
//
10+
// This program is free software: you can redistribute it and/or modify
11+
// it under the terms of the GNU General Public License as published by
12+
// the Free Software Foundation, either version 3 of the License, or
13+
// (at your option) any later version.
14+
//
15+
// This program is distributed in the hope that it will be useful,
16+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
// GNU General Public License for more details.
19+
//
20+
// You should have received a copy of the GNU General Public License
21+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
//
23+
24+
import Foundation
25+
import UIKit
26+
import NextcloudKit
27+
28+
class NCCreateDocument: NSObject {
29+
let utility = NCUtility()
30+
let database = NCManageDatabase.shared
31+
let global = NCGlobal.shared
32+
// var fileNameExtension = ""
33+
34+
@MainActor
35+
func createDocument(controller: NCMainTabBarController, fileNamePath: String, fileName: String, fileNameExtension: String = "", editorId: String, creatorId: String? = nil, templateId: String, account: String) async {
36+
let session = NCSession.shared.getSession(account: account)
37+
guard let viewController = controller.currentViewController() else {
38+
return
39+
}
40+
var UUID = NSUUID().uuidString
41+
UUID = "TEMP" + UUID.replacingOccurrences(of: "-", with: "")
42+
var options = NKRequestOptions()
43+
let serverUrl = controller.currentServerUrl()
44+
45+
if let creatorId, editorId == "text" || editorId == "onlyoffice" {
46+
if editorId == "onlyoffice" {
47+
options = NKRequestOptions(customUserAgent: NCUtility().getCustomUserAgentOnlyOffice())
48+
} else if editorId == "text" {
49+
options = NKRequestOptions(customUserAgent: NCUtility().getCustomUserAgentNCText())
50+
}
51+
let results = await NextcloudKit.shared.textCreateFileAsync(fileNamePath: fileNamePath, editorId: editorId, creatorId: creatorId, templateId: templateId, account: account, options: options) { task in
52+
Task {
53+
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: account,
54+
path: fileNamePath,
55+
name: "textCreateFile")
56+
await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task)
57+
}
58+
}
59+
guard results.error == .success, let url = results.url else {
60+
return NCContentPresenter().showError(error: results.error)
61+
}
62+
63+
var result = await NKTypeIdentifiers.shared.getInternalType(fileName: fileName, mimeType: "", directory: false, account: session.account)
64+
65+
controller.dismiss(animated: true, completion: {
66+
67+
Task {
68+
let metadata = await NCManageDatabaseCreateMetadata().createMetadataAsync(
69+
fileName: fileName,
70+
ocId: UUID,
71+
serverUrl: serverUrl,
72+
url: url,
73+
session: session,
74+
sceneIdentifier: controller.sceneIdentifier)
75+
if let vc = await NCViewer().getViewerController(metadata: metadata, delegate: viewController) {
76+
viewController.navigationController?.pushViewController(vc, animated: true)
77+
}
78+
}
79+
})
80+
81+
} else if editorId == "collabora" {
82+
83+
let results = await NextcloudKit.shared.createRichdocumentsAsync(path: fileNamePath, templateId: templateId, account: account) { task in
84+
Task {
85+
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: account,
86+
path: fileNamePath,
87+
name: "CreateRichdocuments")
88+
await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task)
89+
}
90+
}
91+
guard results.error == .success, let url = results.url else {
92+
return NCContentPresenter().showError(error: results.error)
93+
}
94+
95+
controller.dismiss(animated: true, completion: {
96+
97+
Task {
98+
let createFileName = (fileName as NSString).deletingPathExtension + "." + fileNameExtension
99+
let metadata = await NCManageDatabaseCreateMetadata().createMetadataAsync(
100+
fileName: createFileName,
101+
ocId: UUID,
102+
serverUrl: serverUrl,
103+
url: url,
104+
session: session,
105+
sceneIdentifier: controller.sceneIdentifier)
106+
AnalyticsHelper.shared.trackCreateFile(metadata: metadata)
107+
if let vc = await NCViewer().getViewerController(metadata: metadata, delegate: viewController) {
108+
viewController.navigationController?.pushViewController(vc, animated: true)
109+
}
110+
}
111+
})
112+
113+
}
114+
}
115+
116+
func getTemplate(editorId: String, templateId: String, account: String) async -> (templates: [NKEditorTemplate], selectedTemplate: NKEditorTemplate, ext: String) {
117+
var templates: [NKEditorTemplate] = []
118+
var selectedTemplate = NKEditorTemplate()
119+
var ext: String = ""
120+
121+
if editorId == "text" || editorId == "onlyoffice" {
122+
var options = NKRequestOptions()
123+
if editorId == "onlyoffice" {
124+
options = NKRequestOptions(customUserAgent: NCUtility().getCustomUserAgentOnlyOffice())
125+
} else if editorId == "text" {
126+
options = NKRequestOptions(customUserAgent: NCUtility().getCustomUserAgentNCText())
127+
}
128+
129+
let results = await NextcloudKit.shared.textGetListOfTemplatesAsync(account: account, options: options) { task in
130+
Task {
131+
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: account,
132+
name: "textGetListOfTemplates")
133+
await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task)
134+
}
135+
}
136+
if results.error == .success, let resultTemplates = results.templates {
137+
for template in resultTemplates {
138+
var temp = NKEditorTemplate()
139+
temp.identifier = template.identifier
140+
temp.ext = template.ext
141+
temp.name = template.name
142+
temp.preview = template.preview
143+
templates.append(temp)
144+
// default: template empty
145+
if temp.preview.isEmpty {
146+
selectedTemplate = temp
147+
ext = template.ext
148+
}
149+
}
150+
}
151+
152+
if templates.isEmpty {
153+
var temp = NKEditorTemplate()
154+
temp.identifier = ""
155+
if editorId == "text" {
156+
temp.ext = "md"
157+
} else if editorId == "onlyoffice" && templateId == "document" {
158+
temp.ext = "docx"
159+
} else if editorId == "onlyoffice" && templateId == "spreadsheet" {
160+
temp.ext = "xlsx"
161+
} else if editorId == "onlyoffice" && templateId == "presentation" {
162+
temp.ext = "pptx"
163+
}
164+
temp.name = "Empty"
165+
temp.preview = ""
166+
templates.append(temp)
167+
selectedTemplate = temp
168+
ext = temp.ext
169+
}
170+
}
171+
172+
if editorId == "collabora" {
173+
let results = await NextcloudKit.shared.getTemplatesRichdocumentsAsync(typeTemplate: templateId, account: account) { task in
174+
Task {
175+
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: account,
176+
path: templateId,
177+
name: "getTemplatesRichdocuments")
178+
await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task)
179+
}
180+
}
181+
if results.error == .success {
182+
for template in results.templates! {
183+
var temp = NKEditorTemplate()
184+
temp.identifier = "\(template.templateId)"
185+
temp.ext = template.ext
186+
temp.name = template.name
187+
temp.preview = template.preview
188+
templates.append(temp)
189+
// default: template empty
190+
if temp.preview.isEmpty {
191+
selectedTemplate = temp
192+
ext = temp.ext
193+
}
194+
}
195+
}
196+
}
197+
198+
return (templates, selectedTemplate, ext)
199+
}
200+
}

0 commit comments

Comments
 (0)