Skip to content

Commit

Permalink
fix bug: tools category switches don't show on two columns mode(#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacklandrin committed Jan 19, 2023
1 parent 24a6082 commit f46335d
Show file tree
Hide file tree
Showing 18 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions Localization/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,4 @@
"Turn off" = "ist ausschaltet";
"Turn on" = "ist einschaltet";
"Running" = "ausführt";
"TOOLS" = "WERKZEUG";
1 change: 1 addition & 0 deletions Localization/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,4 @@
"Turn off" = "Turn off";
"Turn on" = "Turn on";
"Running" = "Running";
"TOOLS" = "TOOLS";
1 change: 1 addition & 0 deletions Localization/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,4 @@ Creado por Jacklandrin el día 14/12/2021.
"Turn off" = "Apagar";
"Turn on" = "Encender";
"Running" = "Procesando";
"TOOLS" = "HERRAMIENTAS";
1 change: 1 addition & 0 deletions Localization/fil.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,4 @@
"Turn off" = "Patayin";
"Turn on" = "I-on";
"Running" = "patakbuhin";
"TOOLS" = "MGA TOOL";
1 change: 1 addition & 0 deletions Localization/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,4 @@
"Turn off" = "Éteindre";
"Turn on" = "Allumer";
"Running" = "en cours";
"TOOLS" = "OUTILS";
1 change: 1 addition & 0 deletions Localization/hr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,4 @@
"Turn off" = "Isključiti";
"Turn on" = "Upaliti";
"Running" = "Pokreni";
"TOOLS" = "ALATI";
1 change: 1 addition & 0 deletions Localization/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,4 @@
"Turn off" = "Spegnere";
"Turn on" = "Accendere";
"Running" = "Esegui";
"TOOLS" = "UTENSILI";
1 change: 1 addition & 0 deletions Localization/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,4 @@
"Turn off" = "消す";
"Turn on" = "オンにする";
"Running" = "実行している";
"TOOLS" = "ツール";
1 change: 1 addition & 0 deletions Localization/ko.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,4 @@
"Turn off" = "끄다";
"Turn on" = "켜다";
"Running" = "진행 중";
"TOOLS" = "도구";
1 change: 1 addition & 0 deletions Localization/nl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,4 @@
"Turn off" = "Uitschakelen";
"Turn on" = "Inschakelen";
"Running" = "Uitvoeren";
"TOOLS" = "HULPMIDDELEN";
1 change: 1 addition & 0 deletions Localization/pl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,4 @@
"Turn off" = "Wyłączyć";
"Turn on" = "Włączyć coś";
"Running" = "Uruchom";
"TOOLS" = "NARZĘDZIA";
1 change: 1 addition & 0 deletions Localization/ru.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,4 @@
"Turn off" = "Выключать";
"Turn on" = "Включи";
"Running" = "Запустить";
"TOOLS" = "ИНСТРУМЕНТЫ";
1 change: 1 addition & 0 deletions Localization/so.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,4 @@
"Turn off" = "Dami";
"Turn on" = "Daar";
"Running" = "socda";
"TOOLS" = "QALAB";
1 change: 1 addition & 0 deletions Localization/tr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,4 @@
"Turn off" = "Kapat";
"Turn on" = "Açmak";
"Running" = "Çalıştır";
"TOOLS" = "ALETLER";
1 change: 1 addition & 0 deletions Localization/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,4 @@
"Turn off" = "开启";
"Turn on" = "关闭";
"Running" = "执行中";
"TOOLS" = "工具";
24 changes: 24 additions & 0 deletions OnlySwitch/View/OnlySwitchList/OnlySwitchListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,29 @@ struct OnlySwitchListView: View {
}
}

if switchVM.toolItemList.count > 0 {
HStack {
Rectangle().frame(height: 1)
.foregroundColor(.gray)
Text("TOOLS".localized())
Rectangle().frame(height: 1)
.foregroundColor(.gray)
}.frame(height:30)
.opacity(0.7)
.shadow(radius: 1)

LazyVGrid(columns: columns, spacing: 0) {
ForEach(switchVM.toolItemList.indices, id:\.self) { index in
HStack {
if let item = switchVM.toolItemList[index] {
SwitchBarView().environmentObject(item)
.frame(height:Layout.singleSwitchHeight)
}
}
}
}
}

if switchVM.shortcutsList.count > 0 {
HStack {
Rectangle().frame(height: 1)
Expand Down Expand Up @@ -337,6 +360,7 @@ struct OnlySwitchListView: View {
totalHeight += categoryHeight(count: switchVM.audioItemList.count)
totalHeight += categoryHeight(count: switchVM.cleanupItemList.count)
totalHeight += categoryHeight(count: switchVM.shortcutsList.count)
totalHeight += categoryHeight(count: switchVM.toolItemList.count)
totalHeight -= 30.0
}

Expand Down
2 changes: 2 additions & 0 deletions OnlySwitch/View/OnlySwitchList/SwitchListModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ struct SwitchListModel {

var cleanupItemList = Array<SwitchBarVM>() //for two columns

var toolItemList = Array<SwitchBarVM>() //for two columns

var sortMode = false
}
5 changes: 5 additions & 0 deletions OnlySwitch/View/OnlySwitchList/SwitchListVM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ class SwitchListVM: ObservableObject, CurrentScreen {
return model.cleanupItemList
}

var toolItemList:[SwitchBarVM] {
return model.toolItemList
}

var sortMode:Bool {
return model.sortMode
}
Expand Down Expand Up @@ -108,6 +112,7 @@ class SwitchListVM: ObservableObject, CurrentScreen {
self.model.uncategoryItemList = self.switchList.filter{ $0.category == .none && !$0.isHidden }
self.model.audioItemList = self.switchList.filter{ $0.category == .audio && !$0.isHidden }
self.model.cleanupItemList = self.switchList.filter{ $0.category == .cleanup && !$0.isHidden }
self.model.toolItemList = self.switchList.filter{ $0.category == .tool && !$0.isHidden }

print("refresh")
}
Expand Down

0 comments on commit f46335d

Please sign in to comment.