Skip to content

Commit

Permalink
refactor: Use safeWrite() from CoreDB
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-coye committed Apr 25, 2024
1 parent 684e796 commit abfd365
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 44 deletions.
42 changes: 0 additions & 42 deletions MailCore/API/Extension/Realm+SafeWrite.swift

This file was deleted.

3 changes: 2 additions & 1 deletion MailCore/Cache/MailboxInfosManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import Foundation
import InfomaniakCore
import InfomaniakCoreDB
import Realm
import RealmSwift

Expand Down Expand Up @@ -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)
}
}
Expand Down
3 changes: 2 additions & 1 deletion MailCore/Cache/MailboxManager/MailboxManager+Search.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import Foundation
import InfomaniakCore
import InfomaniakCoreDB
import RealmSwift

// MARK: - Search
Expand All @@ -35,7 +36,7 @@ public extension MailboxManager {
)

let realm = getRealm()
try? realm.uncheckedSafeWrite {
try? realm.safeWrite {
realm.add(searchFolder, update: .modified)
}
return searchFolder
Expand Down

0 comments on commit abfd365

Please sign in to comment.