Skip to content

Commit fceea8f

Browse files
Version 6.4.0 (#3352)
1 parent 715040e commit fceea8f

File tree

254 files changed

+2251
-1136
lines changed

Some content is hidden

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

254 files changed

+2251
-1136
lines changed

Brand/Intro/NCIntroViewController.swift

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol
3737
private let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
3838
private let titles = [NSLocalizedString("_intro_1_title_", comment: ""), NSLocalizedString("_intro_2_title_", comment: ""), NSLocalizedString("_intro_3_title_", comment: ""), NSLocalizedString("_intro_4_title_", comment: "")]
3939
private let images = [UIImage(named: "intro1"), UIImage(named: "intro2"), UIImage(named: "intro3"), UIImage(named: "intro4")]
40-
private var timerAutoScroll: Timer?
40+
private var timer: Timer?
4141
private var textColor: UIColor = .white
4242
private var textColorOpponent: UIColor = .black
4343

@@ -96,7 +96,6 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol
9696
pageControl.numberOfPages = self.titles.count
9797

9898
view.backgroundColor = NCBrandColor.shared.customer
99-
timerAutoScroll = Timer.scheduledTimer(timeInterval: 5, target: self, selector: (#selector(NCIntroViewController.autoScroll)), userInfo: nil, repeats: true)
10099

101100
NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeUser), object: nil, queue: nil) { notification in
102101
if let userInfo = notification.userInfo,
@@ -125,6 +124,15 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol
125124
}
126125
}
127126
}
127+
128+
NotificationCenter.default.addObserver(forName: UIApplication.didEnterBackgroundNotification, object: nil, queue: nil) { _ in
129+
self.timer?.invalidate()
130+
self.timer = nil
131+
}
132+
133+
NotificationCenter.default.addObserver(forName: UIApplication.didBecomeActiveNotification, object: nil, queue: nil) { _ in
134+
self.timer = Timer.scheduledTimer(timeInterval: 4, target: self, selector: (#selector(NCIntroViewController.autoScroll)), userInfo: nil, repeats: true)
135+
}
128136
}
129137

130138
override var preferredStatusBarStyle: UIStatusBarStyle {
@@ -137,7 +145,8 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol
137145

138146
override func viewWillDisappear(_ animated: Bool) {
139147
super.viewWillDisappear(animated)
140-
timerAutoScroll?.invalidate()
148+
timer?.invalidate()
149+
timer = nil
141150
}
142151

143152
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
@@ -180,12 +189,13 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol
180189
}
181190

182191
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
183-
timerAutoScroll = Timer.scheduledTimer(timeInterval: 5, target: self, selector: (#selector(NCIntroViewController.autoScroll)), userInfo: nil, repeats: true)
192+
timer = Timer.scheduledTimer(timeInterval: 5, target: self, selector: (#selector(NCIntroViewController.autoScroll)), userInfo: nil, repeats: true)
184193
pageControl.currentPage = Int(scrollView.contentOffset.x) / Int(scrollView.frame.width)
185194
}
186195

187196
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
188-
timerAutoScroll?.invalidate()
197+
timer?.invalidate()
198+
timer = nil
189199
}
190200

191201
@IBAction func login(_ sender: Any) {

File Provider Extension/FileProviderExtension.swift

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,15 @@ class FileProviderExtension: NSFileProviderExtension {
254254
selector: "",
255255
status: NCGlobal.shared.metadataStatusUploading)
256256

257-
if let task = NKBackground(nkCommonInstance: NextcloudKit.shared.nkCommonInstance).upload(serverUrlFileName: serverUrlFileName,
257+
let (task, error) = NKBackground(nkCommonInstance: NextcloudKit.shared.nkCommonInstance).upload(serverUrlFileName: serverUrlFileName,
258258
fileNameLocalPath: url.path,
259259
dateCreationFile: nil,
260260
dateModificationFile: nil,
261261
overwrite: true,
262262
account: metadata.account,
263-
sessionIdentifier: NCNetworking.shared.sessionUploadBackgroundExt) {
263+
sessionIdentifier: NCNetworking.shared.sessionUploadBackgroundExt)
264+
265+
if let task, error == .success {
264266
self.database.setMetadataSession(ocId: metadata.ocId,
265267
sessionTaskIdentifier: task.taskIdentifier,
266268
status: NCGlobal.shared.metadataStatusUploading)
@@ -292,7 +294,7 @@ class FileProviderExtension: NSFileProviderExtension {
292294
return completionHandler(nil, NSFileProviderError(.noSuchItem))
293295
}
294296
var size = 0 as Int64
295-
var error: NSError?
297+
var errorCoordinator: NSError?
296298
_ = fileURL.startAccessingSecurityScopedResource()
297299
// typefile directory ? (NOT PERMITTED)
298300
do {
@@ -309,7 +311,7 @@ class FileProviderExtension: NSFileProviderExtension {
309311
let fileName = self.utilityFileSystem.createFileName(fileURL.lastPathComponent, serverUrl: tableDirectory.serverUrl, account: fileProviderData.shared.session.account)
310312
let ocIdTransfer = NSUUID().uuidString.lowercased()
311313

312-
NSFileCoordinator().coordinate(readingItemAt: fileURL, options: .withoutChanges, error: &error) { url in
314+
NSFileCoordinator().coordinate(readingItemAt: fileURL, options: .withoutChanges, error: &errorCoordinator) { url in
313315
self.providerUtility.copyFile(url.path, toPath: self.utilityFileSystem.getDirectoryProviderStorageOcId(ocIdTransfer, fileNameView: fileName))
314316
}
315317

@@ -333,13 +335,14 @@ class FileProviderExtension: NSFileProviderExtension {
333335
let serverUrlFileName = tableDirectory.serverUrl + "/" + fileName
334336
let fileNameLocalPath = self.utilityFileSystem.getDirectoryProviderStorageOcId(ocIdTransfer, fileNameView: fileName)
335337

336-
if let task = NKBackground(nkCommonInstance: NextcloudKit.shared.nkCommonInstance).upload(serverUrlFileName: serverUrlFileName,
337-
fileNameLocalPath: fileNameLocalPath,
338-
dateCreationFile: nil,
339-
dateModificationFile: nil,
340-
overwrite: true,
341-
account: metadataForUpload.account,
342-
sessionIdentifier: metadataForUpload.session) {
338+
let (task, error) = NKBackground(nkCommonInstance: NextcloudKit.shared.nkCommonInstance).upload(serverUrlFileName: serverUrlFileName,
339+
fileNameLocalPath: fileNameLocalPath,
340+
dateCreationFile: nil,
341+
dateModificationFile: nil,
342+
overwrite: true,
343+
account: metadataForUpload.account,
344+
sessionIdentifier: metadataForUpload.session)
345+
if let task, error == .success {
343346
self.database.setMetadataSession(ocId: metadataForUpload.ocId,
344347
sessionTaskIdentifier: task.taskIdentifier,
345348
status: NCGlobal.shared.metadataStatusUploading)

0 commit comments

Comments
 (0)