Skip to content

Commit 33c92c7

Browse files
committed
Improved Alerts actions readability
1 parent 186e138 commit 33c92c7

16 files changed

Lines changed: 45 additions & 24 deletions

iTorrent.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
7CCDB3342ED3469B001E857B /* cacert.pem in Resources */ = {isa = PBXBuildFile; fileRef = 7CCDB3322ED34680001E857B /* cacert.pem */; };
8383
7CCDB3372ED5B4B6001E857B /* UIImage+IOSRelatedIcons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CCDB3362ED5B4A8001E857B /* UIImage+IOSRelatedIcons.swift */; };
8484
7CCDB3392ED5DF56001E857B /* DocumentPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CCDB3382ED5DF55001E857B /* DocumentPickerViewController.swift */; };
85+
7CCDB33B2ED5F4B4001E857B /* UIAlertController+PrimaryAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CCDB33A2ED5F4AC001E857B /* UIAlertController+PrimaryAction.swift */; };
8586
7CDC7BBE2C516ADD00B51EFB /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = 7CDC7BBD2C516ADD00B51EFB /* FirebaseCrashlytics */; };
8687
7CE25BA72C24A848007B2FD7 /* CircularAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CE25BA62C24A848007B2FD7 /* CircularAnimation.swift */; };
8788
7CF6DA332C0F112B0033D03F /* OpenSSL in Frameworks */ = {isa = PBXBuildFile; productRef = 7CF6DA322C0F112B0033D03F /* OpenSSL */; };
@@ -335,6 +336,7 @@
335336
7CCDB3322ED34680001E857B /* cacert.pem */ = {isa = PBXFileReference; lastKnownFileType = text; path = cacert.pem; sourceTree = "<group>"; };
336337
7CCDB3362ED5B4A8001E857B /* UIImage+IOSRelatedIcons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+IOSRelatedIcons.swift"; sourceTree = "<group>"; };
337338
7CCDB3382ED5DF55001E857B /* DocumentPickerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentPickerViewController.swift; sourceTree = "<group>"; };
339+
7CCDB33A2ED5F4AC001E857B /* UIAlertController+PrimaryAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIAlertController+PrimaryAction.swift"; sourceTree = "<group>"; };
338340
7CE25BA62C24A848007B2FD7 /* CircularAnimation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircularAnimation.swift; sourceTree = "<group>"; };
339341
7CF6DA342C0F3DB90033D03F /* BCHostingConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BCHostingConfiguration.swift; sourceTree = "<group>"; };
340342
7CF6DA362C0F6D150033D03F /* InfoPlist.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = InfoPlist.xcstrings; sourceTree = "<group>"; };
@@ -677,6 +679,7 @@
677679
7C95B7B52C385B8E000EC50F /* UIKit */ = {
678680
isa = PBXGroup;
679681
children = (
682+
7CCDB33A2ED5F4AC001E857B /* UIAlertController+PrimaryAction.swift */,
680683
7CCDB3382ED5DF55001E857B /* DocumentPickerViewController.swift */,
681684
7CC634762E09ED83007E3EED /* UILabel+Marquee.swift */,
682685
7CB831182D194840005F3F42 /* UIApplication+KeySceneWindow.swift */,
@@ -1818,6 +1821,7 @@
18181821
D1B99D942BEE631B00F51514 /* Tier.swift in Sources */,
18191822
D1A226A02AEEEFCC00669D6D /* SceneDelegate.swift in Sources */,
18201823
D11BE5442AFB901E00780C1B /* PRSwitchView.swift in Sources */,
1824+
7CCDB33B2ED5F4B4001E857B /* UIAlertController+PrimaryAction.swift in Sources */,
18211825
D173D9E32BC0327D00E4F9EB /* BackgroundService.swift in Sources */,
18221826
7CB58D842CE662BB00929205 /* TagsView.swift in Sources */,
18231827
D1352D382BBD73CD00104E7B /* ColoredProgressBarView.swift in Sources */,

iTorrent/Screens/Preferences/InitialSetup/CellularToggle/CellularToggleSetupViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CellularToggleSetupViewModel: BaseViewModelWith<CellularToggleSetupViewMod
2626

2727
func allowCellularAction() {
2828
alert(title: %"initialSetup.cellular.allowCheck.title", style: .actionSheet, actions: [
29-
.init(title: %"common.cancel", style: .cancel),
29+
.init(title: %"common.cancel", style: .cancel, isPrimary: true),
3030
.init(title: %"initialSetup.cellular.allowCheck.confirm", style: .destructive, action: { [unowned self] in
3131
PreferencesStorage.shared.isCellularEnabled = true
3232
completion()

iTorrent/Screens/Preferences/Patreon/PatreonPreferencesViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ extension PatreonPreferencesViewModel {
8787
}
8888
} else {
8989
alert(title: %"patreon.action.unlink.title",style: .actionSheet, actions: [
90-
.init(title: %"common.cancel", style: .cancel),
90+
.init(title: %"common.cancel", style: .cancel, isPrimary: true),
9191
.init(title: %"patreon.action.unlink.button", style: .destructive) { [unowned self] in
9292
try? patreonService.signOut()
9393
accountState.value = .none

iTorrent/Screens/Preferences/Storage/StoragePreferencesView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ struct StoragePreferencesView<VM: StoragePreferencesViewModel>: MvvmSwiftUIViewP
121121
}.swipeActions {
122122
Button {
123123
viewModel.alert(title: %"preferences.storage.remove.title", message: %"preferences.storage.remove.message", actions: [
124-
.init(title: %"common.cancel", style: .cancel),
124+
.init(title: %"common.cancel", style: .cancel, isPrimary: true),
125125
.init(title: %"common.remove", style: .destructive, action: {
126126
withAnimation {
127127
viewModel.preferences.storageScopes[scope.uuid] = nil
@@ -153,7 +153,7 @@ struct StoragePreferencesView<VM: StoragePreferencesViewModel>: MvvmSwiftUIViewP
153153

154154
guard url.isDirectory else {
155155
return viewModel.alert(title: %"common.error", message: %"preferences.storage.add.error.notDirectory", actions: [
156-
.init(title: %"common.close", style: .cancel)
156+
.init(title: %"common.close", style: .cancel, isPrimary: true)
157157
])
158158
}
159159

iTorrent/Screens/Preferences/TrackersList/TrackersListPreferencesView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TrackersListPreferencesViewModel: BaseViewModel, ObservableObject, @unchec
4242

4343
Task {
4444
guard !self.trackersListService.trackerSources.value.keys.contains(where: { $0 == .remote(url) }) else {
45-
self.alert(title: %"preferences.trackers.exists.title", actions: [.init(title: %"common.ok", style: .cancel)])
45+
self.alert(title: %"preferences.trackers.exists.title", actions: [.init(title: %"common.ok", style: .cancel, isPrimary: true)])
4646
return
4747
}
4848
try await self.trackersListService.addTrackersSource(url, title: results[0])
@@ -102,7 +102,7 @@ struct TrackersListPreferencesView<VM: TrackersListPreferencesViewModel>: MvvmSw
102102
.swipeActions {
103103
Button {
104104
viewModel.alert(title: %"preferences.trackers.remove.title", message: %"preferences.trackers.remove.message", actions: [
105-
.init(title: %"common.cancel", style: .cancel),
105+
.init(title: %"common.cancel", style: .cancel, isPrimary: true),
106106
.init(title: %"common.remove", style: .destructive, action: {
107107
withAnimation {
108108
viewModel.trackersListService.trackerSources.value[state.source] = nil

iTorrent/Screens/Rss/List/RssListViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ extension RssListViewModel {
4242
}
4343

4444
alert(title: %"rsslist.remove.title", message: %"rsslist.remove.message", actions: [
45-
.init(title: %"common.cancel", style: .cancel),
45+
.init(title: %"common.cancel", style: .cancel, isPrimary: true),
4646
.init(title: %"common.delete", style: .destructive, action: { [rssProvider] in
4747
rssProvider.removeFeeds(items)
4848
})

iTorrent/Screens/TorrentAdd/TorrentAddViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ extension TorrentAddViewModel {
173173
else { return false }
174174

175175
let alert = UIAlertController(title: %"addTorrent.exists", message: %"addTorrent.\(torrentFile.infoHashes.best.hex)_exists", preferredStyle: .alert)
176-
alert.addAction(.init(title: %"common.close", style: .cancel))
176+
alert.addAction(.init(title: %"common.close", style: .cancel), isPrimary: true)
177177
navigationContext.present(alert, animated: true)
178178
return true
179179
}

iTorrent/Screens/TorrentDetails/TorrentDetailsViewModel.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ extension TorrentDetailsViewModel {
153153

154154
alert(title: %"details.rehash.title", message: %"details.rehash.message", actions: [
155155
.init(title: %"common.cancel", style: .cancel),
156-
.init(title: %"details.rehash.action", style: .destructive, action: { [unowned self] in
156+
.init(title: %"details.rehash.action", style: .destructive, isPrimary: true, action: { [unowned self] in
157157
torrentHandle.rehash()
158158
}),
159159
])
@@ -163,11 +163,11 @@ extension TorrentDetailsViewModel {
163163
guard let storage = torrentHandle.storage else { return }
164164
alert(title: %"details.refreshStorage.title", message: %"details.refreshStorage.message", actions: [
165165
.init(title: %"common.cancel", style: .cancel),
166-
.init(title: %"common.continue", style: .default, action: { [self] in
166+
.init(title: %"common.continue", style: .default, isPrimary: true, action: { [self] in
167167
DispatchQueue.global(qos: .userInitiated).async { [self] in
168168
guard !torrentService.refreshStorage(storage) else { return }
169169
alert(title: %"common.error", message: %"details.refreshStorage.fail.message", actions: [
170-
.init(title: %"common.close", style: .cancel)
170+
.init(title: %"common.close", style: .cancel, isPrimary: true)
171171
])
172172
}
173173
})
@@ -182,7 +182,7 @@ extension TorrentDetailsViewModel {
182182
.init(title: %"torrent.remove.action.keepData", style: .default, action: { [unowned self] in
183183
TorrentService.shared.removeTorrent(by: torrentHandle.snapshot.infoHashes, deleteFiles: false)
184184
}),
185-
.init(title: %"common.cancel", style: .cancel),
185+
.init(title: %"common.cancel", style: .cancel, isPrimary: true),
186186
])
187187
}
188188

0 commit comments

Comments
 (0)