Skip to content

Commit

Permalink
Merge pull request #1116 from Infomaniak/app-must-be-updated
Browse files Browse the repository at this point in the history
feat: Add UpdateRequiredView
  • Loading branch information
PhilippeWeidmann authored Feb 14, 2024
2 parents ff48f9c + d44013f commit e3b586e
Show file tree
Hide file tree
Showing 13 changed files with 248 additions and 27 deletions.
60 changes: 39 additions & 21 deletions .package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/ProxymanApp/atlantis",
"state" : {
"revision" : "131d757cf8e6e368ad338728379174f7cfff9326",
"version" : "1.23.0"
"revision" : "5145a7041ec71421d09653db87dcc80c81792004",
"version" : "1.24.0"
}
},
{
"identity" : "cocoalumberjack",
"kind" : "remoteSourceControl",
"location" : "https://github.com/CocoaLumberjack/CocoaLumberjack",
"state" : {
"revision" : "363ed23d19a931809ea834a7d722da830353806a",
"version" : "3.8.2"
"revision" : "af4973721172dd7850a42a58a9ffcec0ec82e5a9",
"version" : "3.8.4"
}
},
{
Expand Down Expand Up @@ -117,6 +117,15 @@
"version" : "6.0.1"
}
},
{
"identity" : "ios-version-checker",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Infomaniak/ios-version-checker",
"state" : {
"revision" : "7f8a2fe8dd13e7b5fe3272d1ee64233b3524339a",
"version" : "1.1.1"
}
},
{
"identity" : "kingfisher",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -194,26 +203,26 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/realm/realm-core.git",
"state" : {
"revision" : "7227d6a447821c28895daa099b6c7cd4c99d461b",
"version" : "13.25.1"
"revision" : "a5e87a39cffdcc591f3203c11cfca68100d0b9a6",
"version" : "13.26.0"
}
},
{
"identity" : "realm-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/realm/realm-swift",
"state" : {
"revision" : "836cc4b8619886f979f8961c3f592a82b0741591",
"version" : "10.45.3"
"revision" : "eafdd3720a8cc750bdd38bf776082d2c8cf743fc",
"version" : "10.46.0"
}
},
{
"identity" : "sentry-cocoa",
"kind" : "remoteSourceControl",
"location" : "https://github.com/getsentry/sentry-cocoa",
"state" : {
"revision" : "3b9a8e69ca296bd8cd0e317ad7a448e5daf4a342",
"version" : "8.18.0"
"revision" : "b847a202a517a90763e8fd0656d8028aeee7b78d",
"version" : "8.20.0"
}
},
{
Expand Down Expand Up @@ -257,8 +266,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "d029d9d39c87bed85b1c50adee7c41795261a192",
"version" : "1.0.6"
"revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb",
"version" : "1.1.0"
}
},
{
Expand All @@ -273,37 +282,37 @@
{
"identity" : "swift-log",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log.git",
"location" : "https://github.com/apple/swift-log",
"state" : {
"revision" : "532d8b529501fb73a2455b179e0bbb6d49b652ed",
"version" : "1.5.3"
"revision" : "e97a6fcb1ab07462881ac165fdbb37f067e205d5",
"version" : "1.5.4"
}
},
{
"identity" : "swift-nio",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio.git",
"state" : {
"revision" : "702cd7c56d5d44eeba73fdf83918339b26dc855c",
"version" : "2.62.0"
"revision" : "635b2589494c97e48c62514bc8b37ced762e0a62",
"version" : "2.63.0"
}
},
{
"identity" : "swift-nio-ssl",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-ssl.git",
"state" : {
"revision" : "320bd978cceb8e88c125dcbb774943a92f6286e9",
"version" : "2.25.0"
"revision" : "7c381eb6083542b124a6c18fae742f55001dc2b5",
"version" : "2.26.0"
}
},
{
"identity" : "swift-nio-transport-services",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-transport-services.git",
"state" : {
"revision" : "ebf8b9c365a6ce043bf6e6326a04b15589bd285e",
"version" : "1.20.0"
"revision" : "6cbe0ed2b394f21ab0d46b9f0c50c6be964968ce",
"version" : "1.20.1"
}
},
{
Expand All @@ -315,6 +324,15 @@
"version" : "1.0.2"
}
},
{
"identity" : "swift-system",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system.git",
"state" : {
"revision" : "025bcb1165deab2e20d4eaba79967ce73013f496",
"version" : "1.2.1"
}
},
{
"identity" : "swiftregex",
"kind" : "remoteSourceControl",
Expand Down
6 changes: 4 additions & 2 deletions Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ let project = Project(name: "kDrive",
.package(url: "https://github.com/Cocoanetics/Kvitto", .upToNextMajor(from: "1.0.0")),
.package(url: "https://github.com/raspu/Highlightr", .upToNextMajor(from: "2.1.0")),
.package(url: "https://github.com/bmoliveira/MarkdownKit", .upToNextMajor(from: "1.7.0")),
.package(url: "https://github.com/matomo-org/matomo-sdk-ios", .upToNextMajor(from: "7.5.1"))
.package(url: "https://github.com/matomo-org/matomo-sdk-ios", .upToNextMajor(from: "7.5.1")),
.package(url: "https://github.com/Infomaniak/ios-version-checker", .upToNextMajor(from: "1.1.1")),
],
targets: [
Target(name: "kDrive",
Expand Down Expand Up @@ -168,7 +169,8 @@ let project = Project(name: "kDrive",
.package(product: "CocoaLumberjackSwift"),
.package(product: "MaterialOutlinedTextField"),
.package(product: "SwiftRegex"),
.package(product: "Sentry")
.package(product: "Sentry"),
.package(product: "VersionChecker")
]),
Target(name: "kDriveFileProvider",
platform: .iOS,
Expand Down
1 change: 1 addition & 0 deletions Tuist/ProjectDescriptionHelpers/ExtensionTarget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public extension Target {
infoPlist: .file(path: "\(name)/Info.plist"),
sources: [
"\(name)/**",
"kDrive/UI/Controller/DriveUpdateRequiredViewController.swift",
"kDrive/UI/Controller/FloatingPanelSelectOptionViewController.swift",
"kDrive/UI/Controller/Create File/FloatingPanelUtils.swift",
"kDrive/UI/Controller/Files/Categories/**",
Expand Down
12 changes: 12 additions & 0 deletions kDrive/AppDelegate+Launch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ extension AppDelegate {
askUserToRemovePicturesIfNecessary()
case .onboarding:
showOnboarding()
case .updateRequired:
showUpdateRequired()
}
}

Expand Down Expand Up @@ -102,6 +104,16 @@ extension AppDelegate {
}
}

private func showUpdateRequired() {
guard let window else {
SentryDebug.captureNoWindow()
return
}

window.rootViewController = DriveUpdateRequiredViewController()
window.makeKeyAndVisible()
}

// MARK: Misc

private func requestAppStoreReview() {
Expand Down
9 changes: 8 additions & 1 deletion kDrive/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import os.log
import StoreKit
import UIKit
import UserNotifications
import VersionChecker

@main
final class AppDelegate: UIResponder, UIApplicationDelegate, AccountManagerDelegate {
Expand Down Expand Up @@ -205,12 +206,18 @@ final class AppDelegate: UIResponder, UIApplicationDelegate, AccountManagerDeleg
UserDefaults.shared.numberOfConnections += 1
refreshCacheScanLibraryAndUpload(preload: false, isSwitching: false)
uploadEditedFiles()
case .onboarding: break
case .onboarding, .updateRequired: break
// NOOP
}

// Remove all notifications on App Opening
UNUserNotificationCenter.current().removeAllDeliveredNotifications()

Task {
if try await VersionChecker.standard.checkAppVersionStatus() == .updateIsRequired {
prepareRootViewController(currentState: .updateRequired)
}
}
}

/// Set global tint color
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"images" : [
{
"filename" : "update-required-light.svg",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "update-required-dark.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e3b586e

Please sign in to comment.