-
Notifications
You must be signed in to change notification settings - Fork 2
Code organization improvements #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alexandarZ
wants to merge
2
commits into
brills:main
Choose a base branch
from
alexandarZ:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # SatHunter guide for contributors | ||
|
|
||
| This project started as a personal effort by NE6NE. | ||
|
|
||
| All kinds of contributions are welcome. Please report issues on GitHub, or even better, create | ||
| Pull Requests to fix them! | ||
|
|
||
| The author is not an App developer by trade, not do they have any design talent. If you identified any | ||
| room for improvement in UI / UX please create an issue or PR. You may define the aesthetic taste of | ||
| this App. | ||
|
|
||
| ## Building SatHunter on your machine | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| Before working on app you need to install Google Protocol buffers. Open terminal and type: | ||
|
|
||
| ``` | ||
| brew install protobuf | ||
| brew install swift-protobuf | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+141 KB
...roj/project.xcworkspace/xcuserdata/azdravkovic.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| // | ||
| // AppTheme.swift | ||
| // SatHunter | ||
| // | ||
| // Created by Aleksandar Zdravković on 8/11/24. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| import SwiftUI | ||
|
|
||
| enum AppTheme: String, CaseIterable, Identifiable { | ||
| case system = "System" | ||
| case light = "Light" | ||
| case dark = "Dark" | ||
| case lowContrast = "Low Contrast" | ||
|
|
||
| var id: String { self.rawValue } | ||
| } | ||
|
|
||
| class ThemeManager: ObservableObject { | ||
| @Published var selectedTheme: AppTheme = .system { | ||
| didSet { | ||
| saveTheme() | ||
| } | ||
| } | ||
|
|
||
| init() { | ||
| loadTheme() | ||
| } | ||
|
|
||
| func applyTheme() -> ColorScheme? { | ||
| switch selectedTheme { | ||
| case .system: | ||
| return getSystemColorScheme() | ||
| case .light: | ||
| return .light | ||
| case .dark: | ||
| return .dark | ||
| case .lowContrast: | ||
| return .light // Apply a low contrast custom theme | ||
| } | ||
| } | ||
|
|
||
| private func getSystemColorScheme() -> ColorScheme { | ||
| #if os(iOS) | ||
| // For iOS, using UIKit | ||
| let userInterfaceStyle = UITraitCollection.current.userInterfaceStyle | ||
| return userInterfaceStyle == .dark ? .dark : .light | ||
| #elseif os(macOS) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just curious -- is this supposed to be the way to support both macOS and iOS? |
||
| // For macOS, using AppKit | ||
| let appearanceName = NSApp.effectiveAppearance.name | ||
| return appearanceName == .darkAqua ? .dark : .light | ||
| #else | ||
| // Default to light for unsupported platforms | ||
| return .light | ||
| #endif | ||
| } | ||
|
|
||
|
|
||
| private func saveTheme() { | ||
| UserDefaults.standard.set(selectedTheme.rawValue, forKey: "selectedTheme") | ||
| } | ||
|
|
||
| private func loadTheme() { | ||
| if let savedTheme = UserDefaults.standard.string(forKey: "selectedTheme"), | ||
| let theme = AppTheme(rawValue: savedTheme) { | ||
| selectedTheme = theme | ||
| } | ||
| } | ||
| } | ||
|
|
||
| struct LowContrastModifier: ViewModifier { | ||
| func body(content: Content) -> some View { | ||
| content | ||
| .foregroundColor(.red) | ||
| .background(Color(white: 0.95)) | ||
| } | ||
| } | ||
|
|
||
| extension View { | ||
| func applyLowContrast() -> some View { | ||
| self.modifier(LowContrastModifier()) | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update the Changelog / Release note about this?