diff --git a/Submodules/LibTorrent-Swift b/Submodules/LibTorrent-Swift index 17f03417..f0fdd3e2 160000 --- a/Submodules/LibTorrent-Swift +++ b/Submodules/LibTorrent-Swift @@ -1 +1 @@ -Subproject commit 17f034170492be931c8b3a3e48cd8a4c7b855b10 +Subproject commit f0fdd3e2f7cc2f04c6f8ef7d805fd28569bbfb0f diff --git a/iTorrent/Screens/TorrentDetails/TorrentDetailsViewModel.swift b/iTorrent/Screens/TorrentDetails/TorrentDetailsViewModel.swift index 258c1489..e5252fe3 100644 --- a/iTorrent/Screens/TorrentDetails/TorrentDetailsViewModel.swift +++ b/iTorrent/Screens/TorrentDetails/TorrentDetailsViewModel.swift @@ -25,7 +25,7 @@ class TorrentDetailsViewModel: BaseViewModelWith { override func prepare(with model: TorrentHandle) { torrentHandle = model - title = model.name + title = torrentHandle.snapshot.name dataUpdate() reload() @@ -246,7 +246,7 @@ private extension TorrentDetailsViewModel { leechersModel.detail = "\(torrentHandle.snapshot.numberOfLeechers)(\(torrentHandle.snapshot.numberOfTotalLeechers))" downloadPath2Model.detail = torrentHandle.snapshot.downloadPath?.path() ?? "" - downloadPathModel.value = torrentHandle.snapshot.storage.name + downloadPathModel.value = torrentHandle.storage.name filesModel.isEnabled = torrentHandle.snapshot.friendlyState != .storageError && torrentHandle.snapshot.hasMetadata } diff --git a/iTorrent/Screens/TorrentList/TorrentListViewController.swift b/iTorrent/Screens/TorrentList/TorrentListViewController.swift index cfea88bf..a2aceae2 100644 --- a/iTorrent/Screens/TorrentList/TorrentListViewController.swift +++ b/iTorrent/Screens/TorrentList/TorrentListViewController.swift @@ -269,8 +269,8 @@ private extension TorrentListViewController { collectionView.$selectedIndexPaths.uiSink { [unowned self] indexPaths in let torrentHandles = indexPaths.compactMap { (viewModel.sections[$0.section].items[$0.item] as? TorrentListItemViewModel)?.torrentHandle } - playButton.isEnabled = torrentHandles.contains(where: { $0.isPaused }) - pauseButton.isEnabled = torrentHandles.contains(where: { !$0.isPaused }) + playButton.isEnabled = torrentHandles.contains(where: { $0.snapshot.isPaused }) + pauseButton.isEnabled = torrentHandles.contains(where: { !$0.snapshot.isPaused }) rehashButton.isEnabled = !torrentHandles.isEmpty deleteButton.isEnabled = !torrentHandles.isEmpty } diff --git a/iTorrent/Screens/TorrentList/TorrentListViewModel.swift b/iTorrent/Screens/TorrentList/TorrentListViewModel.swift index f0850678..101dfd03 100644 --- a/iTorrent/Screens/TorrentList/TorrentListViewModel.swift +++ b/iTorrent/Screens/TorrentList/TorrentListViewModel.swift @@ -227,7 +227,7 @@ private extension TorrentListViewModel { private extension Array where Element == TorrentHandle { func sorted(by type: TorrentListViewModel.Sort, reverced: Bool) -> [Element] { - let res = filter(\.isValid).sorted { first, second in + let res = filter(\.snapshot.isValid).sorted { first, second in switch type { case .alphabetically: return first.snapshot.name.localizedCaseInsensitiveCompare(second.snapshot.name) == .orderedAscending diff --git a/iTorrent/Services/TorrentService/Extensions/TorrentHandle+Extension.swift b/iTorrent/Services/TorrentService/Extensions/TorrentHandle+Extension.swift index 3db6c844..21a60bb3 100644 --- a/iTorrent/Services/TorrentService/Extensions/TorrentHandle+Extension.swift +++ b/iTorrent/Services/TorrentService/Extensions/TorrentHandle+Extension.swift @@ -121,7 +121,7 @@ extension TorrentHandle.State { } // MARK: - Storage -extension TorrentHandle.Snapshot { +extension TorrentHandle { var storage: StorageModel? { guard let storageUUID else { return nil } return TorrentService.shared.storages[storageUUID] diff --git a/iTorrent/Services/TorrentService/TorrentService.swift b/iTorrent/Services/TorrentService/TorrentService.swift index 6c7f3207..76ef1e24 100644 --- a/iTorrent/Services/TorrentService/TorrentService.swift +++ b/iTorrent/Services/TorrentService/TorrentService.swift @@ -81,7 +81,7 @@ extension TorrentService { func refreshStorage(_ storage: StorageModel) -> Bool { guard storage.resolveSequrityScopes() else { return false } - let handles = torrents.values.filter { $0.snapshot.storageUUID == storage.uuid } + let handles = torrents.values.filter { $0.storageUUID == storage.uuid } handles.forEach { $0.reload() } return true }