Skip to content

Commit 17e70b2

Browse files
Update AGENTS and CLAUDE guidelines; enhance localization and settings functionality
- Added a new guideline in AGENTS.md to discourage committing changes directly, encouraging user involvement instead. - Updated CLAUDE.md to include the latest general guidelines from AGENTS.md. - Expanded localization support in Localizable.strings for both English and Nepali, adding new keys related to settings and modules. - Enhanced SettingsView to improve user experience with a segmented picker for navigating different settings tabs. - Introduced new properties in AppModel for better handling of app version and module states. - Improved RadioMiniPlayer functionality by adding stop button and updating playback state handling. - Added new localized strings for various settings and modules, ensuring consistency across the app.
1 parent bc7d9df commit 17e70b2

10 files changed

Lines changed: 557 additions & 255 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## General Guidelines
22

33
- Always prefer clean and scalable code rather than quick hack and all.
4-
-
4+
- Don't commit changes, ask user to do it.
55

66

CLAUDE.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
@AGENTS.md
1+
## General Guidelines
2+
3+
- Always prefer clean and scalable code rather than quick hack and all.
4+
- Don't commit changes, ask user to do it.
5+
- The ui/ux should be really

Sources/SajiloApp/Core/Foundation/AppLanguage.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,20 @@ enum L10n {
3232
static let languageEnglish = LocalizedStringResource("language.english", bundle: .sajiloResources)
3333
static let languageNepali = LocalizedStringResource("language.nepali", bundle: .sajiloResources)
3434
static let settings = LocalizedStringResource("screen.settings", bundle: .sajiloResources)
35+
static let settingsTabDisplay = LocalizedStringResource("settings.tab-display", bundle: .sajiloResources)
36+
static let settingsTabModules = LocalizedStringResource("settings.tab-modules", bundle: .sajiloResources)
37+
static let settingsTabSystem = LocalizedStringResource("settings.tab-system", bundle: .sajiloResources)
38+
static let settingsAppearance = LocalizedStringResource("settings.appearance", bundle: .sajiloResources)
39+
static let settingsStartup = LocalizedStringResource("settings.startup", bundle: .sajiloResources)
40+
static let moduleWeatherNote = LocalizedStringResource("settings.module-weather-note", bundle: .sajiloResources)
41+
static let moduleForexNote = LocalizedStringResource("settings.module-forex-note", bundle: .sajiloResources)
42+
static let moduleNewsNote = LocalizedStringResource("settings.module-news-note", bundle: .sajiloResources)
43+
static let moduleBazarNote = LocalizedStringResource("settings.module-bazar-note", bundle: .sajiloResources)
44+
static let moduleRashifalNote = LocalizedStringResource("settings.module-rashifal-note", bundle: .sajiloResources)
45+
static let moduleRadioNote = LocalizedStringResource("settings.module-radio-note", bundle: .sajiloResources)
46+
static let settingsCurrencies = LocalizedStringResource("settings.currencies", bundle: .sajiloResources)
47+
static let settingsCurrenciesHint = LocalizedStringResource("settings.currencies-hint", bundle: .sajiloResources)
48+
static let settingsNothingEnabled = LocalizedStringResource("settings.nothing-enabled", bundle: .sajiloResources)
3549
static let backup = LocalizedStringResource("settings.backup", bundle: .sajiloResources)
3650
static let exportData = LocalizedStringResource("settings.export-data", bundle: .sajiloResources)
3751
static let importData = LocalizedStringResource("settings.import-data", bundle: .sajiloResources)
@@ -45,6 +59,7 @@ enum L10n {
4559
static let weather = LocalizedStringResource("feature.weather", bundle: .sajiloResources)
4660
static let forex = LocalizedStringResource("feature.forex", bundle: .sajiloResources)
4761
static let display = LocalizedStringResource("settings.display", bundle: .sajiloResources)
62+
static let settingsFormat = LocalizedStringResource("settings.format", bundle: .sajiloResources)
4863
static let numerals = LocalizedStringResource("settings.numerals", bundle: .sajiloResources)
4964
static let news = LocalizedStringResource("screen.news", bundle: .sajiloResources)
5065
static let bazar = LocalizedStringResource("screen.bazar", bundle: .sajiloResources)

Sources/SajiloApp/Features/AppModel.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,21 @@ final class AppModel {
340340

341341
var cards: [DashboardCard] { [weatherCard, forexCard] }
342342

343+
/// Whether anything beyond the calendar is switched on, so Settings can say
344+
/// plainly that the popover will show the calendar alone.
345+
var isAnyModuleEnabled: Bool {
346+
isWeatherEnabled || isForexEnabled || isNewsEnabled
347+
|| isBazarEnabled || isRashifalEnabled || isRadioEnabled
348+
}
349+
350+
/// Shown beside Check for Updates, so a bug report can name a version.
351+
var appVersionText: String {
352+
let info = Bundle.main.infoDictionary
353+
let short = info?["CFBundleShortVersionString"] as? String ?? ""
354+
let build = info?["CFBundleVersion"] as? String
355+
return build.map { "\(short) (\($0))" } ?? short
356+
}
357+
343358
/// Whichever favourite leads the list; the card has room for one.
344359
var headlineRate: ForexRate? {
345360
guard let forex else { return nil }

Sources/SajiloApp/Features/Dashboard/DashboardView.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,14 @@ struct DashboardView: View {
7676
.modifier(RouteLayer(isActive: route == .tools, edge: 1, reduceMotion: reduceMotion))
7777
}
7878

79-
if let station = model.radioPlayer.currentStation, model.radioPlayer.isPlaying {
79+
if let station = model.radioPlayer.currentStation {
8080
RadioMiniPlayer(
8181
station: station,
82+
isPlaying: model.radioPlayer.isPlaying,
8283
isResolving: model.radioPlayer.isResolving,
8384
openRadio: { navigate(to: .radio) },
84-
togglePlayback: { Task { await model.radioPlayer.toggle(station) } }
85+
togglePlayback: { Task { await model.radioPlayer.toggle(station) } },
86+
stop: { model.radioPlayer.stop() }
8587
)
8688
}
8789

Sources/SajiloApp/Features/Radio/RadioView.swift

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,15 @@ private struct NowPlayingCard: View {
161161
/// leaving the Radio screen never makes audio feel detached from the app.
162162
struct RadioMiniPlayer: View {
163163
let station: RadioStation
164+
let isPlaying: Bool
164165
let isResolving: Bool
165166
let openRadio: () -> Void
166167
let togglePlayback: () -> Void
168+
let stop: () -> Void
167169

168170
var body: some View {
169171
HStack(spacing: Theme.Space.s) {
170-
EqualizerView(isPlaying: true)
172+
EqualizerView(isPlaying: isPlaying)
171173

172174
Button(action: openRadio) {
173175
VStack(alignment: .leading, spacing: 1) {
@@ -186,11 +188,17 @@ struct RadioMiniPlayer: View {
186188
.accessibilityHint("Opens radio")
187189

188190
Button(action: togglePlayback) {
189-
Image(systemName: isResolving ? "arrow.clockwise" : "pause.fill")
191+
Image(systemName: isResolving ? "arrow.clockwise" : (isPlaying ? "pause.fill" : "play.fill"))
190192
}
191193
.buttonStyle(IconButtonStyle())
192194
.disabled(isResolving)
193-
.accessibilityLabel("Pause radio")
195+
.accessibilityLabel(isPlaying ? "Pause radio" : "Play radio")
196+
197+
Button(action: stop) {
198+
Image(systemName: "stop.fill")
199+
}
200+
.buttonStyle(IconButtonStyle())
201+
.accessibilityLabel("Stop radio")
194202
}
195203
.padding(.horizontal, Theme.Space.m)
196204
.padding(.vertical, Theme.Space.xs)

0 commit comments

Comments
 (0)