Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Migration to modern restoration API #1187

Merged
merged 87 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
05a26c7
feat: Enabling UIScene delegate
adrien-coye May 23, 2024
d2487bf
chore: Clean code
adrien-coye May 23, 2024
2c8d00c
feat: New type AppRouter to centralise existing routing code
adrien-coye May 23, 2024
84327bf
feat: Audited the threadding of the Router protocol, removed a hang i…
adrien-coye May 24, 2024
08b99c1
fix: PR Feedback
adrien-coye May 24, 2024
b27ad87
chore: Re enabled restauration
adrien-coye May 28, 2024
503f223
chore: PR Feedback
adrien-coye May 28, 2024
0d994e2
chore: PR Feedback
adrien-coye May 28, 2024
fe44bde
chore: PR Feedback
adrien-coye May 28, 2024
70c6caf
chore: Merge branch 'releaseAPIV3-restorationScene' into releaseAPIV3…
adrien-coye May 28, 2024
c29208f
feat: Enable scene restoration
adrien-coye May 28, 2024
a7d3135
feat: Restore MainTabViewController tab from Scene
adrien-coye May 28, 2024
1672554
feat: Dedicated logs for SceneDelegate
adrien-coye May 28, 2024
67c08ad
fix: Safer get scene delegate
adrien-coye May 29, 2024
57a2851
fix: Access or mutation of currentAccount is now thread safe thanks t…
adrien-coye May 29, 2024
92eb9dd
chore: Removed legacy state restoration code from classes we no longe…
adrien-coye May 30, 2024
e6fcb23
feat: Restoration done in router
adrien-coye May 30, 2024
dbdf911
feat: FileDetail restoration
adrien-coye May 31, 2024
86032fe
feat: Scene restoration for PreviewViewController
adrien-coye Jun 19, 2024
461f59d
feat: Scene restoration for StoreViewController
adrien-coye Jun 19, 2024
32d7a09
feat: Re-enabled FileDetailViewController
adrien-coye Jun 19, 2024
66bba50
refactor: Abstracted restoration state declaration
adrien-coye Jun 20, 2024
5989693
refactor: Clean old restoration code
adrien-coye Jun 20, 2024
fd3d8ac
chore: Better loging
adrien-coye Jun 20, 2024
998e0f6
chore: Better loging
adrien-coye Jun 20, 2024
bce32a2
chore: Predicate filter of files to restore
adrien-coye Jun 20, 2024
4edbaba
refactor: Reworked AppRouter to a state I'm fine with
adrien-coye Jun 20, 2024
a48b097
refactor: Clean old restoration code
adrien-coye Jun 20, 2024
fc0219c
fix: Reset stored state on tab change
adrien-coye Jun 20, 2024
7cac9e6
chore: PR Feedback
adrien-coye Jun 20, 2024
1e2b5bd
chore: SonarCloud feedback
adrien-coye Jun 20, 2024
5db7075
chore: Update kDrive/AppDelegate.swift
adrien-coye Jun 20, 2024
771ad2d
chore: Update kDrive/AppDelegate.swift
adrien-coye Jun 20, 2024
3101ce1
chore: Update kDrive/SceneDelegate.swift
adrien-coye Jun 20, 2024
9400555
chore: Update kDrive/SceneDelegate.swift
adrien-coye Jun 20, 2024
0449a85
chore: Update kDrive/SceneDelegate.swift
adrien-coye Jun 20, 2024
ee13626
chore: Update kDrive/SceneDelegate.swift
adrien-coye Jun 20, 2024
7131b56
docs: Apply comment conventions to current PR
adrien-coye Jun 20, 2024
2f3b2ea
fix: Restore FileList is now working
adrien-coye Jun 21, 2024
225de2b
fix: Navigating to a root view clears the restoration state
adrien-coye Jun 21, 2024
6b60ace
fix: PreviewViewController tracks the index of the image displayed
adrien-coye Jun 21, 2024
c48e751
chore: SonarCloud feedback
adrien-coye Jun 21, 2024
3ca83dc
chore: SonarCloud feedback
adrien-coye Jun 21, 2024
b210641
Merge pull request #1190 from Infomaniak/releaseAPIV3-restorationScen…
adrien-coye Jun 21, 2024
51234bc
chore: Merge branch 'releaseAPIV3' into releaseAPIV3-restorationScene
adrien-coye Jun 21, 2024
e10f338
chore: PR Feedback
adrien-coye Jun 21, 2024
4a8ab93
chore: Bump libraries
adrien-coye Jun 21, 2024
48a3d90
fix: Realm builds
adrien-coye Jun 24, 2024
562914c
chore: Removed old restoration code
adrien-coye Jun 24, 2024
baef1cc
feat: Re-enabled state restoration logic
adrien-coye Jun 24, 2024
82cbc58
feat: Use updated Core lib to serialise restoration version support
adrien-coye Jun 25, 2024
03b5e6f
test: Testing scene restoration metadata
adrien-coye Jun 25, 2024
176b5e6
test: Fix most issues with SceneDelegate migration regarding tests
adrien-coye Jun 25, 2024
6ae2202
chore: SonarCloud feedback
adrien-coye Jun 26, 2024
38a9945
chore: Merge branch 'releaseAPIV3-restorationScene' into releaseAPIV3…
adrien-coye Jun 26, 2024
4e7cc00
chore: Bump packages
adrien-coye Jun 26, 2024
6cf0ac4
fix: Conditional state restoration is now working when currentStateVe…
adrien-coye Jun 26, 2024
0e99e92
chore: Removed Storyboard Restoration ID from storyboards
adrien-coye Jun 26, 2024
81d8d78
Merge pull request #1205 from Infomaniak/releaseAPIV3-restorationScen…
adrien-coye Jun 26, 2024
ef30872
Merge pull request #1203 from Infomaniak/releaseAPIV3-restorationScen…
adrien-coye Jun 26, 2024
0988d13
feat: SceneDelegate based actions
adrien-coye Jun 26, 2024
e4ea78e
chore: Merge branch 'releaseAPIV3-restorationScene' into releaseAPIV3…
adrien-coye Jun 26, 2024
b6a0244
feat: Actions work on cold start
adrien-coye Jun 26, 2024
36073d7
chore: Merge branch 'releaseAPIV3-restorationScene' into releaseAPIV3…
adrien-coye Jun 26, 2024
ad86e92
Merge pull request #1206 from Infomaniak/releaseAPIV3-restorationScen…
adrien-coye Jun 26, 2024
68ccaf3
chore: Merge branch 'releaseAPIV3-restorationScene' into releaseAPIV3…
adrien-coye Jun 26, 2024
b55bd52
feat: Make instrumentalized builds of the main app
adrien-coye Jun 27, 2024
40f6dfe
feat: Intrumented build builds
adrien-coye Jun 27, 2024
3922aa0
refactor: Reworked Unit tests to fix the TEST flag issues
adrien-coye Jun 27, 2024
cfcd5cb
refactor: Removed extraneous teardowns from tests
adrien-coye Jun 27, 2024
ce41534
chore: Typo
adrien-coye Jun 27, 2024
71cfe79
fix: Fix most of DriveApiTests
adrien-coye Jun 27, 2024
f47a820
fix: Fix main app setting
adrien-coye Jun 27, 2024
f616449
fix: Crash in a test
adrien-coye Jun 27, 2024
dcb41ec
chore: Removed extraneous patch
adrien-coye Jun 27, 2024
598bde2
feat: Better MockingHelper to setup a specific DI context perfect for…
adrien-coye Jun 27, 2024
5c3027b
refactor: Removed extraneous check
adrien-coye Jun 28, 2024
d01ea40
fix: ITAppLaunchTest
adrien-coye Jun 28, 2024
b486803
fix: DriveApiTests
adrien-coye Jun 28, 2024
f2b5d92
chore: PR Feedback
adrien-coye Jun 28, 2024
6dbda26
chore: PR Feedback
adrien-coye Jun 28, 2024
c4ff1f0
chore: PR Feedback
adrien-coye Jun 28, 2024
10512db
chore: PR Feedback
adrien-coye Jun 28, 2024
7862784
chore: PR Feedback
adrien-coye Jun 28, 2024
d5bd037
chore: PR Feedback
adrien-coye Jun 28, 2024
1963e5b
chore: Lint Project files
adrien-coye Jun 28, 2024
ab78a7c
Merge pull request #1204 from Infomaniak/releaseAPIV3-restorationScen…
adrien-coye Jul 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions kDrive/AppDelegate+BGNSURLSession.swift
adrien-coye marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@ import kDriveCore
import UIKit

extension AppDelegate {
func application(_ application: UIApplication,
handleEventsForBackgroundURLSession identifier: String,
completionHandler: @escaping () -> Void) {
Log.bgSessionManager("background session relaunched identifier:\(identifier)")
if identifier == DownloadQueue.backgroundIdentifier {
backgroundDownloadSessionManager.backgroundCompletionHandler = completionHandler
} else if identifier.hasSuffix(UploadQueue.backgroundBaseIdentifier) {
backgroundUploadSessionManager.handleEventsForBackgroundURLSession(identifier: identifier,
completionHandler: completionHandler)
} else {
completionHandler()
}
}
/* Deprecating usage of BackgroundURLSessions
func application(_ application: UIApplication,
adrien-coye marked this conversation as resolved.
Show resolved Hide resolved
handleEventsForBackgroundURLSession identifier: String,
completionHandler: @escaping () -> Void) {
Log.bgSessionManager("background session relaunched identifier:\(identifier)")
if identifier == DownloadQueue.backgroundIdentifier {
backgroundDownloadSessionManager.backgroundCompletionHandler = completionHandler
} else if identifier.hasSuffix(UploadQueue.backgroundBaseIdentifier) {
backgroundUploadSessionManager.handleEventsForBackgroundURLSession(identifier: identifier,
completionHandler: completionHandler)
} else {
completionHandler()
}
}*/
}
50 changes: 50 additions & 0 deletions kDrive/AppDelegate+Scene.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
Infomaniak kDrive - iOS App
Copyright (C) 2023 Infomaniak Network SA

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
adrien-coye marked this conversation as resolved.
Show resolved Hide resolved
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import UIKit

extension AppDelegate {
/** iOS 13 or later
UIKit uses this delegate when it is about to create and vend a new UIScene instance to the application.
Use this function to select a configuration to create the new scene with.
You can define the scene configuration in code here, or define it in the Info.plist.

The application delegate may modify the provided UISceneConfiguration within this function.
If the UISceneConfiguration instance that returns from this function does not have a systemType
that matches the connectingSession's, UIKit asserts.
*/
func application(_ application: UIApplication,
configurationForConnecting connectingSceneSession: UISceneSession,
options: UIScene.ConnectionOptions) -> UISceneConfiguration {
print("•• application configurationForConnecting:\(connectingSceneSession)")
return connectingSceneSession.configuration
}

/** iOS 13 or later
The system calls this delegate when it removes one or more representations from the -[UIApplication openSessions] set
due to a user interaction or a request from the app itself. If the system discards sessions while the app isn't running,
it calls this function shortly after the app’s next launch.

Use this function to:
Release any resources that were specific to the discarded scenes, as they will NOT return.
Remove any state or data associated with this session, as it will not return (such as, unsaved draft of a document).
*/
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
print("•• application didDiscardSceneSessions:\(sceneSessions)")
}
}
43 changes: 43 additions & 0 deletions kDrive/AppDelegate+StateRestoration.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
Infomaniak kDrive - iOS App
Copyright (C) 2023 Infomaniak Network SA

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import UIKit

extension AppDelegate {
// For non-scene-based versions of this app on iOS 13.1 and earlier.
func application(_ application: UIApplication, shouldSaveApplicationState coder: NSCoder) -> Bool {
return appRestorationService.shouldSaveApplicationState(coder: coder)
}

// For non-scene-based versions of this app on iOS 13.1 and earlier.
func application(_ application: UIApplication, shouldRestoreApplicationState coder: NSCoder) -> Bool {
return appRestorationService.shouldRestoreApplicationState(coder: coder)
}

@available(iOS 13.2, *)
// For non-scene-based versions of this app on iOS 13.2 and later.
func application(_ application: UIApplication, shouldSaveSecureApplicationState coder: NSCoder) -> Bool {
return appRestorationService.shouldSaveApplicationState(coder: coder)
}

@available(iOS 13.2, *)
// For non-scene-based versions of this app on iOS 13.2 and later.
func application(_ application: UIApplication, shouldRestoreSecureApplicationState coder: NSCoder) -> Bool {
return appRestorationService.shouldRestoreApplicationState(coder: coder)
}
}
Loading
Loading