Skip to content

Commit

Permalink
Fix game more info flow and (untested) db migration
Browse files Browse the repository at this point in the history
  • Loading branch information
proskd committed Nov 11, 2024
1 parent 90e5a64 commit 5eaafc4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ public final class GameImporter: GameImporting, ObservableObject {
/// Path to the BIOS directory
public var biosPath: URL { get { Paths.biosesPath }}

public var databaseService: GameImporterDatabaseServicing {
return gameImporterDatabaseService
}

/// Path to the conflicts directory
public let conflictPath: URL = URL.documentsPath.appendingPathComponent("Conflicts/", isDirectory: true)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ import PVRealm
import Perception
import SwiftUI

protocol GameImporterDatabaseServicing {
public protocol GameImporterDatabaseServicing {
func setOpenVGDB(_ vgdb: OpenVGDB)
func setRomsPath(url:URL)
func importGameIntoDatabase(queueItem: ImportQueueItem) async throws
func importBIOSIntoDatabase(queueItem: ImportQueueItem) async throws
func getUpdatedGameInfo(for game: PVGame, forceRefresh: Bool) -> PVGame
func getArtwork(forGame game: PVGame) async -> PVGame
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1010,8 +1010,9 @@ public final class PVGameLibraryViewController: GCEventViewController, UITextFie
self.hud.hide(animated:true, afterDelay: 1.0)
Task.detached(priority: .utility) {
do {
//TODO: fix this
//try await self.gameImporter.importFiles(atPaths: paths)
//unclear if this would actually work...
self.gameImporter.addImports(forPaths: paths)
self.gameImporter.startProcessing()
} catch {
ELOG("Error: \(error.localizedDescription)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ public final class PVGameMoreInfoViewController: PVGameMoreInfoViewControllerBas
Task { [weak self] in
guard let self = self else { return }
//TODO: fix this
//self.game = GameImporter.shared.lookupInfo(for: game, overwrite: false)
self.game = GameImporter.shared.databaseService.getUpdatedGameInfo(for: game, forceRefresh: false)
}
}
}
Expand Down

0 comments on commit 5eaafc4

Please sign in to comment.