From b3729589f5e758f986cc4494b13a2de862808d0f Mon Sep 17 00:00:00 2001 From: Michael-128 Date: Sat, 14 Sep 2024 10:40:14 +0200 Subject: [PATCH] Disable Category Path Auto-Fill if Automatic Torrent Management is Enabled #29 --- qBitControl/TorrentView/TorrentAddView.swift | 2 +- qBitControl/TorrentView/TorrentAddViewModel.swift | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/qBitControl/TorrentView/TorrentAddView.swift b/qBitControl/TorrentView/TorrentAddView.swift index e3538b3..e4aae47 100644 --- a/qBitControl/TorrentView/TorrentAddView.swift +++ b/qBitControl/TorrentView/TorrentAddView.swift @@ -110,7 +110,7 @@ struct TorrentAddView: View { Text(category.name).tag(category.name) } }.onChange(of: viewModel.category) { category in - viewModel.savePath = category.savePath + if !viewModel.autoTmmEnabled { viewModel.savePath = category.savePath } } Picker("Tags", selection: $viewModel.tags) { diff --git a/qBitControl/TorrentView/TorrentAddViewModel.swift b/qBitControl/TorrentView/TorrentAddViewModel.swift index e7227b0..4a98a3a 100644 --- a/qBitControl/TorrentView/TorrentAddViewModel.swift +++ b/qBitControl/TorrentView/TorrentAddViewModel.swift @@ -20,6 +20,7 @@ class TorrentAddViewModel: ObservableObject { @Published var savePath = "" @Published var defaultSavePath = "" + @Published var autoTmmEnabled = false @Published var cookie = "" @Published var category: Category = defaultCategory @@ -112,8 +113,12 @@ class TorrentAddViewModel: ObservableObject { func getSavePath() { qBittorrent.getPreferences(completionHandler: { preferences in DispatchQueue.main.async { - self.savePath = preferences.save_path ?? "" - self.defaultSavePath = preferences.save_path ?? "" + self.autoTmmEnabled = preferences.auto_tmm_enabled ?? false + + if !self.autoTmmEnabled { + self.savePath = preferences.save_path ?? "" + self.defaultSavePath = preferences.save_path ?? "" + } } }) }