diff --git a/Mail/Views/Settings/General/SettingsNotificationsInstructionsView.swift b/Mail/Views/Settings/General/SettingsNotificationsInstructionsView.swift index 8526979ea..0516a28db 100644 --- a/Mail/Views/Settings/General/SettingsNotificationsInstructionsView.swift +++ b/Mail/Views/Settings/General/SettingsNotificationsInstructionsView.swift @@ -33,7 +33,6 @@ struct SettingsNotificationsInstructionsView: View { ModalButtonsView( primaryButtonTitle: MailResourcesStrings.Localizable.alertNotificationsDisabledButton, primaryButtonAction: DeeplinkConstants.presentsNotificationSettings - ) } } diff --git a/MailCore/API/Extension/Realm+SafeWrite.swift b/MailCore/API/Extension/Realm+SafeWrite.swift deleted file mode 100644 index 11194679f..000000000 --- a/MailCore/API/Extension/Realm+SafeWrite.swift +++ /dev/null @@ -1,42 +0,0 @@ -/* - Infomaniak Mail - iOS App - Copyright (C) 2022 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 . - */ - -import Foundation -import RealmSwift - -public extension Realm { - func uncheckedSafeWrite(_ block: () throws -> Void) throws { - if isInWriteTransaction { - try block() - } else { - try write(block) - } - } - - func safeWrite(_ block: () throws -> Void) throws { - #if DEBUG || TEST - dispatchPrecondition(condition: .notOnQueue(.main)) - #endif - - if isInWriteTransaction { - try block() - } else { - try write(block) - } - } -} diff --git a/MailCore/Cache/MailboxInfosManager.swift b/MailCore/Cache/MailboxInfosManager.swift index 4325d06a4..71e85bfd1 100644 --- a/MailCore/Cache/MailboxInfosManager.swift +++ b/MailCore/Cache/MailboxInfosManager.swift @@ -18,6 +18,7 @@ import Foundation import InfomaniakCore +import InfomaniakCoreDB import Realm import RealmSwift @@ -123,7 +124,7 @@ public final class MailboxInfosManager { public func removeMailboxesFor(userId: Int) { let realm = getRealm() let userMailboxes = realm.objects(Mailbox.self).where { $0.userId == userId } - try? realm.uncheckedSafeWrite { + try? realm.safeWrite { realm.delete(userMailboxes) } } diff --git a/MailCore/Cache/MailboxManager/MailboxManager+Search.swift b/MailCore/Cache/MailboxManager/MailboxManager+Search.swift index a803b2a8c..fb492fdaf 100644 --- a/MailCore/Cache/MailboxManager/MailboxManager+Search.swift +++ b/MailCore/Cache/MailboxManager/MailboxManager+Search.swift @@ -18,6 +18,7 @@ import Foundation import InfomaniakCore +import InfomaniakCoreDB import RealmSwift // MARK: - Search @@ -35,7 +36,7 @@ public extension MailboxManager { ) let realm = getRealm() - try? realm.uncheckedSafeWrite { + try? realm.safeWrite { realm.add(searchFolder, update: .modified) } return searchFolder diff --git a/MailCore/Models/Message.swift b/MailCore/Models/Message.swift index 2b1fabae6..0720ba3fd 100644 --- a/MailCore/Models/Message.swift +++ b/MailCore/Models/Message.swift @@ -18,6 +18,7 @@ import Foundation import InfomaniakCore +import InfomaniakCoreDB import MailResources import RealmSwift diff --git a/Package.resolved b/Package.resolved index 573dc5d81..6b9b0f844 100644 --- a/Package.resolved +++ b/Package.resolved @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Infomaniak/ios-bug-tracker", "state" : { - "revision" : "7b582c8281a74762293b1522d7c1f096a44eb07e", - "version" : "4.0.0" + "revision" : "264d99bb71c48d404d32784fa4e3c271a70bed90", + "version" : "5.0.0" } }, { @@ -41,7 +41,7 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Infomaniak/ios-core", "state" : { - "revision" : "f55044d2156f39a5a2251e37bfe23f596227056e" + "revision" : "4e168afcd6bc05bfa3cd96bd8f7889f920bab788" } }, { @@ -49,8 +49,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Infomaniak/ios-core-ui", "state" : { - "revision" : "43ae7acd0252baba9c7338a20b5a0aefcc301054", - "version" : "7.1.0" + "revision" : "b190fc752289c127d17ab707444dc1b83017eaad", + "version" : "8.0.0" } }, { @@ -58,8 +58,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Infomaniak/ios-create-account", "state" : { - "revision" : "46f2ee2e1df00c84d29c30f191e578ad593f0784", - "version" : "6.0.0" + "revision" : "c194f002d7aa2929d2c2e6bfc51b8d1018ea6779", + "version" : "7.0.0" } }, { @@ -85,8 +85,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Infomaniak/ios-notifications", "state" : { - "revision" : "cb006524be443259d04a311f06add5ee034fbf35", - "version" : "5.0.0" + "revision" : "c5ae1674448eafca051700aa47a35629e347dc0a", + "version" : "6.0.0" } }, { @@ -94,8 +94,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Infomaniak/ios-version-checker", "state" : { - "revision" : "7fc0d96c297e1a868e3e430bc1195b4d0ab70131", - "version" : "4.0.0" + "revision" : "4a9f4342fef91a132676ddcdd50c4808fefd4736", + "version" : "5.0.0" } }, { diff --git a/Package.swift b/Package.swift index 69544135c..208f56a6a 100644 --- a/Package.swift +++ b/Package.swift @@ -8,12 +8,12 @@ let package = Package( .package(url: "https://github.com/Infomaniak/ios-login", .upToNextMajor(from: "6.0.0")), .package(url: "https://github.com/Infomaniak/ios-dependency-injection", .upToNextMajor(from: "2.0.0")), .package(url: "https://github.com/Infomaniak/swift-concurrency", .upToNextMajor(from: "0.0.5")), - .package(url: "https://github.com/Infomaniak/ios-core", .revision("f55044d2156f39a5a2251e37bfe23f596227056e")), - .package(url: "https://github.com/Infomaniak/ios-core-ui", .upToNextMajor(from: "7.1.0")), - .package(url: "https://github.com/Infomaniak/ios-notifications", .upToNextMajor(from: "5.0.0")), - .package(url: "https://github.com/Infomaniak/ios-create-account", .upToNextMajor(from: "6.0.0")), - .package(url: "https://github.com/Infomaniak/ios-bug-tracker", .upToNextMajor(from: "4.0.0")), - .package(url: "https://github.com/Infomaniak/ios-version-checker", .upToNextMajor(from: "4.0.0")), + .package(url: "https://github.com/Infomaniak/ios-core", .revision("4e168afcd6bc05bfa3cd96bd8f7889f920bab788")), + .package(url: "https://github.com/Infomaniak/ios-core-ui", .upToNextMajor(from: "8.0.0")), + .package(url: "https://github.com/Infomaniak/ios-notifications", .upToNextMajor(from: "6.0.0")), + .package(url: "https://github.com/Infomaniak/ios-create-account", .upToNextMajor(from: "7.0.0")), + .package(url: "https://github.com/Infomaniak/ios-bug-tracker", .upToNextMajor(from: "5.0.0")), + .package(url: "https://github.com/Infomaniak/ios-version-checker", .upToNextMajor(from: "5.0.0")), .package(url: "https://github.com/Infomaniak/swift-modal-presentation", .upToNextMajor(from: "1.0.0")), .package(url: "https://github.com/Infomaniak/SQRichTextEditor", .upToNextMajor(from: "1.1.1")), .package(url: "https://github.com/Infomaniak/SwiftSoup", .upToNextMajor(from: "1.1.0")), diff --git a/Project.swift b/Project.swift index 059cfef96..514bc8ae5 100644 --- a/Project.swift +++ b/Project.swift @@ -182,6 +182,7 @@ let project = Project(name: "Mail", .external(name: "Alamofire"), .external(name: "Atlantis"), .external(name: "InfomaniakCore"), + .external(name: "InfomaniakCoreDB"), .external(name: "InfomaniakCoreUI"), .external(name: "InfomaniakLogin"), .external(name: "InfomaniakDI"),