Skip to content

Commit

Permalink
Merge pull request #30 from GoodRequest/feature/hide-unused-settings
Browse files Browse the repository at this point in the history
feature: Hide unused settings
  • Loading branch information
plajdo authored Mar 25, 2024
2 parents 52d7562 + 69ad632 commit 4b91840
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Sources/AppDebugMode/Providers/AppDebugModeProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public final class AppDebugModeProvider {
public extension AppDebugModeProvider {

func setup(
serversCollections: [ApiServerCollection],
serversCollections: [ApiServerCollection] = [],
onServerChange: (() -> Void)? = nil,
cacheManager: Any? = nil,
firebaseMessaging: AnyObject? = nil
Expand Down
41 changes: 25 additions & 16 deletions Sources/AppDebugMode/Views/AppDebugView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,42 +27,51 @@ struct AppDebugView: View {
// MARK: - Init

init(serversCollections: [ApiServerCollection]) {
self.screens = [
Screen(
self.screens = []

if !AppDebugModeProvider.shared.serversCollections.isEmpty {
self.screens.append(Screen(
title: "Server settings",
image: Image(systemName: "server.rack"),
destination: AnyView(ServersCollectionsView(
viewModel: ServersCollectionsViewModel(
serversCollections: serversCollections
)
))
),
Screen(
title: "User profiles",
image: Image(systemName: "person.2"),
destination: AnyView(UserProfilesPickerView())
)
]

))
}

self.screens.append(Screen(
title: "User profiles",
image: Image(systemName: "person.2"),
destination: AnyView(UserProfilesPickerView())
))

if let pushNotificationsProvider = AppDebugModeProvider.shared.pushNotificationsProvider {
self.screens.append(Screen(
title: "Push notifications",
image: Image(systemName: "bell.badge"),
destination: AnyView(PushNotificationsSettingsView(pushNotificationsProvider: pushNotificationsProvider))
))
}
self.screens.append(contentsOf: [
Screen(

if !CacheProvider.shared.userDefaultValues.isEmpty {
self.screens.append(Screen(
title: "User defaults",
image: Image(systemName: "externaldrive"),
destination: AnyView(UserDefaultsSettingsView())
),
Screen(
))
}

if !CacheProvider.shared.keychainValues.isEmpty {
self.screens.append(Screen(
title: "Keychain settings",
image: Image(systemName: "key"),
destination: AnyView(KeychainSettingsView())
),
))
}

self.screens.append(contentsOf: [
Screen(
title: "App directory",
image: Image(systemName: "folder"),
Expand Down

0 comments on commit 4b91840

Please sign in to comment.