mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-11 22:55:55 +05:45
* Renamed applicationSupport directory type to persistence * Only deleting the old diagnostics file when the new diagnostics file does not exist yet * Implemented PR feedback * Changed testing-only check from assertion to #if DEBUG * Implemented migration + deleting LargeItemCache files from the Documents directory for Etags + DeviceCache caching * Fixed compile issue after rebase * Fixed test compilation after rebase * Updated test * Refactored logica to the specific classes that actually store the data, removing the logic from the large item cache * Fix compilation issue * Moved comment * Implemented PR feedback * Implemented most PR feedback * Implemented PR feedback * Simplified ETagManager's old Documents directory removal by just doing it on init if needed * Simplified old documents directory removal in EtagManager * Also deleting old files from documents if we're clearing caches * Fixed swiftlint warning * Simplified directory cleanup between tests * Updated FileRepository to keep using the existing directory in order to avoid duplicate cache files or having to migrate them right now * Fixed tests not compiling * Added additional test assertions that check whether new cache directory was created * Add locking to DeviceCache migration logic to be safe * Handle multiple concurrent reads across threads only actually migrating the data once * PR feedback tweak
41 lines
1.3 KiB
Swift
41 lines
1.3 KiB
Swift
//
|
|
// Copyright RevenueCat Inc. All Rights Reserved.
|
|
//
|
|
// Licensed under the MIT License (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://opensource.org/licenses/MIT
|
|
//
|
|
// FileRepositoryStrings.swift
|
|
//
|
|
// Created by Jacob Zivan Rakidzich on 8/14/25.
|
|
|
|
import Foundation
|
|
|
|
enum FileRepositoryStrings {
|
|
|
|
case failedToSaveCachedFile(URL, Error)
|
|
case failedToFetchFileFromRemoteSource(URL, Error)
|
|
case failedToCreateCacheDirectory(URL)
|
|
case failedToCreateTemporaryFile(URL)
|
|
|
|
}
|
|
|
|
extension FileRepositoryStrings: LogMessage {
|
|
var description: String {
|
|
switch self {
|
|
case .failedToSaveCachedFile(let url, let error):
|
|
return "Failed to save file to \(url.absoluteString): \(error)"
|
|
case .failedToFetchFileFromRemoteSource(let url, let error):
|
|
return "Failed to download file from \(url.absoluteString): \(error)"
|
|
case .failedToCreateCacheDirectory(let url):
|
|
return "Failed to create cache directory for \(url.absoluteString)"
|
|
case .failedToCreateTemporaryFile(let url):
|
|
return "Failed to create a temporary file for \(url.absoluteString)"
|
|
}
|
|
}
|
|
|
|
var category: String { return "file_repository" }
|
|
}
|