diff options
| -rw-r--r-- | ios/MullvadVPN/StorePaymentManager/StoreTransactionLog.swift | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ios/MullvadVPN/StorePaymentManager/StoreTransactionLog.swift b/ios/MullvadVPN/StorePaymentManager/StoreTransactionLog.swift index f678b39131..8d380bdc44 100644 --- a/ios/MullvadVPN/StorePaymentManager/StoreTransactionLog.swift +++ b/ios/MullvadVPN/StorePaymentManager/StoreTransactionLog.swift @@ -137,9 +137,25 @@ final class StoreTransactionLog { } /// Write a list of transaction identifiers on disk. + /// /// Transaction identifiers are stored as one per line. + /// Always ensures to exclude the transaction log file from backups after writing contents on disk. /// - Parameter serializedString: serialized transaction log private func persistInner(serializedString: String) throws { try serializedString.write(to: fileURL, atomically: true, encoding: .utf8) + excludeFromBackups() + } + + /// Exclude transaction log file from backups. + private func excludeFromBackups() { + do { + var resourceValues = URLResourceValues() + resourceValues.isExcludedFromBackup = true + + var mutableFileURL = fileURL + try mutableFileURL.setResourceValues(resourceValues) + } catch { + logger.error(error: error, message: "Failed to exclude transaction log from backups.") + } } } |
