Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
LePips committed Feb 7, 2025
1 parent 4c00aef commit f524a84
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 45 deletions.
38 changes: 18 additions & 20 deletions Shared/ViewModels/SettingsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,28 @@ final class SettingsViewModel: ViewModel {

override init() {

guard let iconName = UIApplication.shared.alternateIconName else {
currentAppIcon = PrimaryAppIcon.primary
super.init()
return
}

if let appicon = PrimaryAppIcon.createCase(iconName: iconName) {
currentAppIcon = appicon
}
if let iconName = UIApplication.shared.alternateIconName {
if let appicon = PrimaryAppIcon.createCase(iconName: iconName) {
currentAppIcon = appicon
}

if let appicon = DarkAppIcon.createCase(iconName: iconName) {
currentAppIcon = appicon
}
if let appicon = DarkAppIcon.createCase(iconName: iconName) {
currentAppIcon = appicon
}

if let appicon = InvertedDarkAppIcon.createCase(iconName: iconName) {
currentAppIcon = appicon
}
if let appicon = InvertedDarkAppIcon.createCase(iconName: iconName) {
currentAppIcon = appicon
}

if let appicon = InvertedLightAppIcon.createCase(iconName: iconName) {
currentAppIcon = appicon
}
if let appicon = InvertedLightAppIcon.createCase(iconName: iconName) {
currentAppIcon = appicon
}

if let appicon = LightAppIcon.createCase(iconName: iconName) {
currentAppIcon = appicon
if let appicon = LightAppIcon.createCase(iconName: iconName) {
currentAppIcon = appicon
}
} else {
currentAppIcon = PrimaryAppIcon.primary
}

super.init()
Expand Down
50 changes: 25 additions & 25 deletions Swiftfin tvOS/Views/AppSettingsView/AppSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ struct AppSettingsView: View {
@EnvironmentObject
private var router: AppSettingsCoordinator.Router

@ObservedObject
var viewModel = SettingsViewModel()
@StateObject
private var viewModel = SettingsViewModel()

@State
private var resetUserSettingsSelected: Bool = false
Expand All @@ -46,40 +46,40 @@ struct AppSettingsView: View {
trailing: "\(UIApplication.appVersion ?? .emptyDash) (\(UIApplication.bundleVersion ?? .emptyDash))"
)

Section(L10n.accessibility) {

// TODO: supposedly supported but not working
// ChevronButton(L10n.appIcon)
// .onSelect {
// router.route(to: \.appIconSelector, viewModel)
// }

// Disabled until tvOS can alter app appearance
// if !selectUserUseSplashscreen {
// CaseIterablePicker(
// L10n.appearance,
// selection: $appearance
// )
// }
}

Section {

Toggle(L10n.useSplashscreen, isOn: $selectUserUseSplashscreen)

if selectUserUseSplashscreen {
Picker(L10n.servers, selection: $selectUserAllServersSplashscreen) {
Menu {
Picker(L10n.servers, selection: $selectUserAllServersSplashscreen) {

Section {
Label(L10n.random, systemImage: "dice.fill")
.tag(SelectUserServerSelection.all)
}

ForEach(viewModel.servers) { server in
Text(server.name)
.tag(SelectUserServerSelection.server(id: server.id))
ForEach(viewModel.servers) { server in
Text(server.name)
.tag(SelectUserServerSelection.server(id: server.id))
}
}
} label: {
HStack {
Text(L10n.servers)
.frame(maxWidth: .infinity, alignment: .leading)

if selectUserAllServersSplashscreen == .all {
Label(L10n.random, systemImage: "dice.fill")
} else if let server = viewModel.servers.first(
where: { server in
selectUserAllServersSplashscreen == .server(id: server.id)
}
) {
Text(server.name)
}
}
}
.listRowBackground(Color.clear)
.listRowInsets(.zero)
}
} header: {
Text(L10n.splashscreen)
Expand Down

0 comments on commit f524a84

Please sign in to comment.