Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous items #1219

Merged
merged 4 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 23 additions & 20 deletions BookPlayer/Coordinators/DataInitializerCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class DataInitializerCoordinator: BPLogger {
|| error.code == NSMigrationMissingMappingModelError || error.code == NSMigrationManagerSourceStoreError
|| error.code == NSMigrationManagerDestinationStoreError || error.code == NSEntityMigrationPolicyError
|| error.code == NSValidationMultipleErrorsError || error.code == NSValidationMissingMandatoryPropertyError
|| error.code == NSPersistentStoreIncompatibleSchemaError
{
Self.logger.warning("Failed to perform migration, attempting recovery with the loading library sequence")
await MainActor.run {
Expand All @@ -79,26 +80,28 @@ class DataInitializerCoordinator: BPLogger {
Additional Info
\(error.userInfo)
"""
alertPresenter.showAlert(BPAlertContent(
title: "error_title".localized,
message: errorDescription,
style: .alert,
actionItems: [
BPActionItem(
title: "ok_button".localized,
handler: {
fatalError("Unresolved error \(error.domain) (\(error.code)): \(error.localizedDescription)")
}
),
.init(
title: "Reset and recover database",
style: .destructive,
handler: {
self.recoverLibraryFromFailedMigration()
}
)
]
))
alertPresenter.showAlert(
BPAlertContent(
title: "error_title".localized,
message: errorDescription,
style: .alert,
actionItems: [
BPActionItem(
title: "ok_button".localized,
handler: {
fatalError("Unresolved error \(error.domain) (\(error.code)): \(error.localizedDescription)")
}
),
.init(
title: "Reset and recover database",
style: .destructive,
handler: {
self.recoverLibraryFromFailedMigration()
}
),
]
)
)
}
}
}
Expand Down
56 changes: 0 additions & 56 deletions BookPlayer/Generated/AutoMockable.generated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,62 +12,6 @@ import AppKit
import Combine
import BookPlayerKit
@testable import BookPlayer
class KeychainServiceProtocolMock: KeychainServiceProtocol {
//MARK: - setAccessToken

var setAccessTokenThrowableError: Error?
var setAccessTokenCallsCount = 0
var setAccessTokenCalled: Bool {
return setAccessTokenCallsCount > 0
}
var setAccessTokenReceivedToken: String?
var setAccessTokenReceivedInvocations: [String] = []
var setAccessTokenClosure: ((String) throws -> Void)?
func setAccessToken(_ token: String) throws {
if let error = setAccessTokenThrowableError {
throw error
}
setAccessTokenCallsCount += 1
setAccessTokenReceivedToken = token
setAccessTokenReceivedInvocations.append(token)
try setAccessTokenClosure?(token)
}
//MARK: - getAccessToken

var getAccessTokenThrowableError: Error?
var getAccessTokenCallsCount = 0
var getAccessTokenCalled: Bool {
return getAccessTokenCallsCount > 0
}
var getAccessTokenReturnValue: String?
var getAccessTokenClosure: (() throws -> String?)?
func getAccessToken() throws -> String? {
if let error = getAccessTokenThrowableError {
throw error
}
getAccessTokenCallsCount += 1
if let getAccessTokenClosure = getAccessTokenClosure {
return try getAccessTokenClosure()
} else {
return getAccessTokenReturnValue
}
}
//MARK: - removeAccessToken

var removeAccessTokenThrowableError: Error?
var removeAccessTokenCallsCount = 0
var removeAccessTokenCalled: Bool {
return removeAccessTokenCallsCount > 0
}
var removeAccessTokenClosure: (() throws -> Void)?
func removeAccessToken() throws {
if let error = removeAccessTokenThrowableError {
throw error
}
removeAccessTokenCallsCount += 1
try removeAccessTokenClosure?()
}
}
class LibraryServiceProtocolMock: LibraryServiceProtocol {
var metadataUpdatePublisher: AnyPublisher<[String: Any], Never> {
get { return underlyingMetadataUpdatePublisher }
Expand Down
4 changes: 2 additions & 2 deletions BookPlayer/sk-SK.lproj/AppShortcuts.strings
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"Turn on the sleep timer in ${applicationName}" = "Zapnúť časovač spánku v ${applicationName}";
"Enable the sleep timer in ${applicationName}" = "Povoliť časovač spánku v ${applicationName}";
"Rewind in ${applicationName}" = "Pretočiť späť v ${applicationName}";
"Jump back in ${applicationName}" = "Skočiť späť do ${applicationName}";
"Jump back in ${applicationName}" = "Skočiť späť v ${applicationName}";
"Skip back in ${applicationName}" = "Preskočiť späť v ${applicationName}";
"Go back in ${applicationName}" = "Vráťte sa do ${applicationName}";
"Go back in ${applicationName}" = "Vrátiť späť v ${applicationName}";
"Fast forward in ${applicationName}" = "Rýchly posun dopredu v ${applicationName}";
"Skip forward in ${applicationName}" = "Preskočiť vpred v ${applicationName}";
"Jump forward in ${applicationName}" = "Skočiť vpred v ${applicationName}";
Loading