Replace 'lastUpdated' with 'lastUpdate'

This commit is contained in:
Davide 2024-10-28 17:14:49 +01:00
parent 0d383ec792
commit 639dee55ee
No known key found for this signature in database
GPG Key ID: A48836171C759F5E
6 changed files with 19 additions and 17 deletions

View File

@ -41,7 +41,7 @@
"kind" : "remoteSourceControl",
"location" : "git@github.com:passepartoutvpn/passepartoutkit-source",
"state" : {
"revision" : "69b2ed730986d684195a39b592155b3384f3d857"
"revision" : "efbf2e135b04e9c0f67b5d2b517c5e13a75c50f6"
}
},
{

View File

@ -28,7 +28,7 @@ let package = Package(
],
dependencies: [
// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", from: "0.9.0"),
.package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "69b2ed730986d684195a39b592155b3384f3d857"),
.package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "efbf2e135b04e9c0f67b5d2b517c5e13a75c50f6"),
// .package(path: "../../../passepartoutkit-source"),
.package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", from: "0.9.1"),
// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", revision: "031863a1cd683962a7dfe68e20b91fa820a1ecce"),

View File

@ -46,7 +46,7 @@ actor CDProviderRepositoryV3: NSObject, ProviderRepository {
private let providersSubject: CurrentValueSubject<[ProviderMetadata], Never>
private let lastUpdatedSubject: CurrentValueSubject<[ProviderID: Date], Never>
private let lastUpdateSubject: CurrentValueSubject<[ProviderID: Date], Never>
private let providersController: NSFetchedResultsController<CDProviderV3>
@ -54,7 +54,7 @@ actor CDProviderRepositoryV3: NSObject, ProviderRepository {
self.context = context
self.backgroundContext = backgroundContext
providersSubject = CurrentValueSubject([])
lastUpdatedSubject = CurrentValueSubject([:])
lastUpdateSubject = CurrentValueSubject([:])
let request = CDProviderV3.fetchRequest()
request.sortDescriptors = [
@ -83,8 +83,8 @@ actor CDProviderRepositoryV3: NSObject, ProviderRepository {
.eraseToAnyPublisher()
}
nonisolated var lastUpdatedPublisher: AnyPublisher<[ProviderID: Date], Never> {
lastUpdatedSubject
nonisolated var lastUpdatePublisher: AnyPublisher<[ProviderID: Date], Never> {
lastUpdateSubject
.removeDuplicates()
.eraseToAnyPublisher()
}
@ -131,7 +131,7 @@ actor CDProviderRepositoryV3: NSObject, ProviderRepository {
providerRequest.predicate = predicate
let providers = try providerRequest.execute()
if let provider = providers.first {
provider.lastUpdate = infrastructure.lastUpdated
provider.lastUpdate = infrastructure.lastUpdate
}
// delete all provider entities
@ -174,6 +174,6 @@ extension CDProviderRepositoryV3: NSFetchedResultsControllerDelegate {
}
let mapper = DomainMapper()
providersSubject.send(entities.compactMap(mapper.provider(from:)))
lastUpdatedSubject.send(mapper.lastUpdated(from: entities))
lastUpdateSubject.send(mapper.lastUpdate(from: entities))
}
}

View File

@ -88,7 +88,7 @@ struct DomainMapper {
)
}
func lastUpdated(from entities: [CDProviderV3]) -> [ProviderID: Date] {
func lastUpdate(from entities: [CDProviderV3]) -> [ProviderID: Date] {
entities.reduce(into: [:]) {
guard let id = $1.providerId,
let lastUpdate = $1.lastUpdate else {

View File

@ -61,7 +61,7 @@ struct ReportIssueButton {
guard let id = installedProfile?.firstProviderModuleWithMetadata?.1.id else {
return nil
}
let lastUpdate = providerManager.lastUpdated(for: id)
let lastUpdate = providerManager.lastUpdate(for: id)
return (id, lastUpdate)
}
}

View File

@ -124,23 +124,25 @@ private extension ProviderContentModifier {
}
var supportedProviders: [ProviderMetadata] {
providerManager.providers.filter {
$0.supports(Entity.Configuration.self)
}
providerManager
.providers
.filter {
$0.supports(Entity.Configuration.self)
}
}
var lastUpdated: Date? {
var lastUpdate: Date? {
guard let providerId else {
return nil
}
return providerManager.lastUpdated(for: providerId)
return providerManager.lastUpdate(for: providerId)
}
var lastUpdatedString: String? {
guard let lastUpdated else {
guard let lastUpdate else {
return providerManager.isLoading ? Strings.Providers.LastUpdated.loading : nil
}
return Strings.Providers.lastUpdated(lastUpdated.timestamp)
return Strings.Providers.lastUpdated(lastUpdate.timestamp)
}
}