Replace publisher with delegate in HistoryListViewModel

This commit is contained in:
QuentinArguillere 2024-09-10 17:55:11 +02:00
parent 502747d72e
commit 8bfcb185d7

View file

@ -28,7 +28,7 @@ class HistoryListViewModel: ObservableObject {
var callLogsTmp: [HistoryModel] = []
var callLogsAddressToDelete = ""
var callLogSubscription: AnyCancellable?
var callLogCoreDelegate: CoreDelegate?
@Published var missedCallsCount: Int = 0
@ -59,7 +59,7 @@ class HistoryListViewModel: ObservableObject {
self.callLogsTmp = callLogsTmpBis
}
self.callLogSubscription = core.publisher?.onCallLogUpdated?.postOnCoreQueue { (_: (_: Core, _: CallLog)) in
self.callLogCoreDelegate = CoreDelegateStub(onCallLogUpdated: { (_: Core, _: CallLog) in
let account = core.defaultAccount
let logs = account?.callLogs != nil ? account!.callLogs : core.callLogs
@ -81,7 +81,8 @@ class HistoryListViewModel: ObservableObject {
}
self.updateMissedCallsCount()
}
})
core.addDelegate(delegate: self.callLogCoreDelegate!)
}
}