Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ class NotificationReceiver : BroadcastReceiver() {
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager

// 创建通知渠道(Android 8.0+)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// 渠道正常由 Flutter 侧以应用内语言创建;这里仅在缺失时兜底创建。
// 不能无条件重建:createNotificationChannel 会把渠道名覆盖为这里的
// 文案,导致英文用户在系统设置里看到中文名(#576)。
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
notificationManager.getNotificationChannel(channelId) == null) {
val soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)
val audioAttributes = AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
Expand All @@ -70,10 +74,10 @@ class NotificationReceiver : BroadcastReceiver() {

val channel = NotificationChannel(
channelId,
"记账提醒",
context.getString(R.string.notification_channel_reminder),
NotificationManager.IMPORTANCE_MAX // 使用最高重要性来显示横幅
).apply {
description = "每日记账提醒"
description = context.getString(R.string.notification_channel_reminder_description)
enableVibration(true)
enableLights(true)
setBypassDnd(true) // 允许在勿扰模式下显示
Expand All @@ -83,7 +87,7 @@ class NotificationReceiver : BroadcastReceiver() {
lockscreenVisibility = NotificationCompat.VISIBILITY_PUBLIC
}
notificationManager.createNotificationChannel(channel)
Log.d("NotificationReceiver", "通知渠道已创建/更新 - 包含声音和震动")
Log.d("NotificationReceiver", "通知渠道已创建 - 包含声音和震动")
}

// 检查通知权限
Expand Down
4 changes: 4 additions & 0 deletions android/app/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@
<string name="widget_dashboard_description">Income, trend, and recent activity in one view</string>
<string name="widget_consumption_rhythm_description">See your spending pace across the last 30 days</string>
<string name="widget_bee_trail_description">Build a daily recording habit with a honeycomb trail</string>

<!-- Notification channel fallback name (created by NotificationReceiver when missing) -->
<string name="notification_channel_reminder">Recording Reminder</string>
<string name="notification_channel_reminder_description">Daily Recording Reminder</string>
</resources>
5 changes: 5 additions & 0 deletions android/app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,9 @@
<string name="widget_dashboard_description">收支、趨勢與最近交易一屏看盡</string>
<string name="widget_consumption_rhythm_description">近 30 天消費節奏一眼看清</string>
<string name="widget_bee_trail_description">用蜂巢格養成每日記帳習慣</string>

<!-- 通知渠道兜底名(NotificationReceiver 在渠道缺失時建立),措辭與
app_zh_TW.arb 的 reminderTitle/reminderDailyTitle 一致 -->
<string name="notification_channel_reminder">記帳提醒</string>
<string name="notification_channel_reminder_description">每日記帳提醒</string>
</resources>
5 changes: 5 additions & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
<string name="widget_consumption_rhythm_description">近 30 天消费节奏一眼看清</string>
<string name="widget_bee_trail_description">用蜂巢格养成每日记账习惯</string>

<!-- 通知渠道兜底名(NotificationReceiver 在渠道缺失时创建)。正常流程
渠道由 Flutter 侧以应用内语言创建,此处仅作系统语言兜底。 -->
<string name="notification_channel_reminder">记账提醒</string>
<string name="notification_channel_reminder_description">每日记账提醒</string>

<!-- 无障碍服务相关字符串由 flavor 特定的 strings.xml 定义 -->
<!-- dev: android/app/src/dev/res/values/strings.xml -->
<!-- prod: android/app/src/prod/res/values/strings.xml -->
Expand Down
16 changes: 8 additions & 8 deletions ios/BeeCountWidget/BeeCountBehaviorWidgets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import WidgetKit
import SwiftUI
import UIKit

private enum BehaviorWidgetCopy {
/// 组件目标内共用的多语言文案 helper(按系统语言取词)。韩语不单独声明,
/// 与其他未覆盖语言一同走英文兜底(developmentRegion = en)。
enum BehaviorWidgetCopy {
static func localized(
simplifiedChinese: String,
traditionalChinese: String,
english: String,
korean: String
english: String
) -> String {
let locale = Locale.current
switch locale.languageCode {
case "en": return english
case "ko": return korean
case "zh" where locale.scriptCode == "Hant" || locale.regionCode == "TW" || locale.regionCode == "HK":
return traditionalChinese
default: return simplifiedChinese
Expand Down Expand Up @@ -79,10 +79,10 @@ private struct BehaviorWidgetEntryView: View {
struct BeeCountConsumptionRhythmWidget: Widget {
let kind = "BeeCountConsumptionRhythmWidget"
private var title: String {
BehaviorWidgetCopy.localized(simplifiedChinese: "消费节奏", traditionalChinese: "消費節奏", english: "Spending Rhythm", korean: "소비 리듬")
BehaviorWidgetCopy.localized(simplifiedChinese: "消费节奏", traditionalChinese: "消費節奏", english: "Spending Rhythm")
}
private var description: String {
BehaviorWidgetCopy.localized(simplifiedChinese: "近 30 天消费节奏一眼看清", traditionalChinese: "近 30 天消費節奏一眼看清", english: "See your spending pace across the last 30 days", korean: "최근 30일의 소비 흐름을 한눈에 확인하세요")
BehaviorWidgetCopy.localized(simplifiedChinese: "近 30 天消费节奏一眼看清", traditionalChinese: "近 30 天消費節奏一眼看清", english: "See your spending pace across the last 30 days")
}
var body: some WidgetConfiguration {
let widgetTitle = title
Expand All @@ -103,10 +103,10 @@ struct BeeCountConsumptionRhythmWidget: Widget {
struct BeeCountBeeTrailWidget: Widget {
let kind = "BeeCountBeeTrailWidget"
private var title: String {
BehaviorWidgetCopy.localized(simplifiedChinese: "记账连续蜂迹", traditionalChinese: "記帳連續蜂跡", english: "Record Bee Trail", korean: "기록 꿀벌 궤적")
BehaviorWidgetCopy.localized(simplifiedChinese: "记账连续蜂迹", traditionalChinese: "記帳連續蜂跡", english: "Record Bee Trail")
}
private var description: String {
BehaviorWidgetCopy.localized(simplifiedChinese: "用蜂巢格养成每日记账习惯", traditionalChinese: "用蜂巢格養成每日記帳習慣", english: "Build a daily recording habit with a honeycomb trail", korean: "벌집 칸으로 매일 기록하는 습관을 만들어 보세요")
BehaviorWidgetCopy.localized(simplifiedChinese: "用蜂巢格养成每日记账习惯", traditionalChinese: "用蜂巢格養成每日記帳習慣", english: "Build a daily recording habit with a honeycomb trail")
}
var body: some WidgetConfiguration {
let widgetTitle = title
Expand Down
13 changes: 10 additions & 3 deletions ios/BeeCountWidget/BeeCountBudgetWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ struct BeeCountBudgetWidgetEntryView : View {
Image(systemName: "creditcard.fill")
.font(.system(size: 32))
.foregroundColor(.white)
Text("预算")
Text(BehaviorWidgetCopy.localized(
simplifiedChinese: "预算", traditionalChinese: "預算",
english: "Budget"))
.font(.system(size: 16, weight: .semibold))
.foregroundColor(.white)
}
Expand All @@ -111,8 +113,13 @@ struct BeeCountBudgetWidget: Widget {
BeeCountBudgetWidgetEntryView(entry: entry)
}
}
.configurationDisplayName("预算进度")
.description("预算进度实时掌握")
.configurationDisplayName(BehaviorWidgetCopy.localized(
simplifiedChinese: "预算进度", traditionalChinese: "預算進度",
english: "Budget"))
.description(BehaviorWidgetCopy.localized(
simplifiedChinese: "预算进度实时掌握",
traditionalChinese: "預算進度即時掌握",
english: "Track budget progress at a glance"))
.supportedFamilies([.systemSmall, .systemMedium])
.contentMarginsDisabled() // Remove default padding/margins in iOS 17+
}
Expand Down
13 changes: 10 additions & 3 deletions ios/BeeCountWidget/BeeCountDashboardWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ struct BeeCountDashboardWidgetEntryView : View {
Image(systemName: "square.grid.2x2.fill")
.font(.system(size: 32))
.foregroundColor(.white)
Text("综合仪表盘")
Text(BehaviorWidgetCopy.localized(
simplifiedChinese: "综合仪表盘", traditionalChinese: "綜合儀表盤",
english: "Dashboard"))
.font(.system(size: 16, weight: .semibold))
.foregroundColor(.white)
}
Expand All @@ -119,8 +121,13 @@ struct BeeCountDashboardWidget: Widget {
BeeCountDashboardWidgetEntryView(entry: entry)
}
}
.configurationDisplayName("综合仪表盘")
.description("收支、趋势与最近交易一屏看尽")
.configurationDisplayName(BehaviorWidgetCopy.localized(
simplifiedChinese: "综合仪表盘", traditionalChinese: "綜合儀表盤",
english: "Dashboard"))
.description(BehaviorWidgetCopy.localized(
simplifiedChinese: "收支、趋势与最近交易一屏看尽",
traditionalChinese: "收支、趨勢與最近交易一屏看盡",
english: "Income, trend, and recent activity in one view"))
.supportedFamilies([.systemLarge])
.contentMarginsDisabled() // Remove default padding/margins in iOS 17+
}
Expand Down
13 changes: 10 additions & 3 deletions ios/BeeCountWidget/BeeCountNetWorthWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ struct BeeCountNetWorthWidgetEntryView : View {
Image(systemName: "chart.pie.fill")
.font(.system(size: 32))
.foregroundColor(.white)
Text("净资产")
Text(BehaviorWidgetCopy.localized(
simplifiedChinese: "净资产", traditionalChinese: "淨資產",
english: "Net Worth"))
.font(.system(size: 16, weight: .semibold))
.foregroundColor(.white)
}
Expand All @@ -114,8 +116,13 @@ struct BeeCountNetWorthWidget: Widget {
BeeCountNetWorthWidgetEntryView(entry: entry)
}
}
.configurationDisplayName("净资产")
.description("总资产、总负债与净值趋势")
.configurationDisplayName(BehaviorWidgetCopy.localized(
simplifiedChinese: "净资产", traditionalChinese: "淨資產",
english: "Net Worth"))
.description(BehaviorWidgetCopy.localized(
simplifiedChinese: "总资产、总负债与净值趋势",
traditionalChinese: "總資產、總負債與淨值趨勢",
english: "Assets, liabilities, and net-worth trend"))
.supportedFamilies([.systemSmall, .systemMedium, .systemLarge])
.contentMarginsDisabled() // Remove default padding/margins in iOS 17+
}
Expand Down
13 changes: 10 additions & 3 deletions ios/BeeCountWidget/BeeCountQuickAddWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ struct BeeCountQuickAddWidgetEntryView : View {
Image(systemName: "plus.circle.fill")
.font(.system(size: 32))
.foregroundColor(.white)
Text("快速记账")
Text(BehaviorWidgetCopy.localized(
simplifiedChinese: "快速记账", traditionalChinese: "快速記帳",
english: "Quick Add"))
.font(.system(size: 16, weight: .semibold))
.foregroundColor(.white)
}
Expand All @@ -114,8 +116,13 @@ struct BeeCountQuickAddWidget: Widget {
BeeCountQuickAddWidgetEntryView(entry: entry)
}
}
.configurationDisplayName("快速记账")
.description("常用分类一键速记")
.configurationDisplayName(BehaviorWidgetCopy.localized(
simplifiedChinese: "快速记账", traditionalChinese: "快速記帳",
english: "Quick Add"))
.description(BehaviorWidgetCopy.localized(
simplifiedChinese: "常用分类一键速记",
traditionalChinese: "常用分類一鍵速記",
english: "One-tap entry for your top categories"))
.supportedFamilies([.systemSmall, .systemMedium])
.contentMarginsDisabled() // Remove default padding/margins in iOS 17+
}
Expand Down
13 changes: 10 additions & 3 deletions ios/BeeCountWidget/BeeCountRecentWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ struct BeeCountRecentWidgetEntryView : View {
Image(systemName: "clock.fill")
.font(.system(size: 32))
.foregroundColor(.white)
Text("最近交易")
Text(BehaviorWidgetCopy.localized(
simplifiedChinese: "最近交易", traditionalChinese: "最近交易",
english: "Recent"))
.font(.system(size: 16, weight: .semibold))
.foregroundColor(.white)
}
Expand All @@ -112,8 +114,13 @@ struct BeeCountRecentWidget: Widget {
BeeCountRecentWidgetEntryView(entry: entry)
}
}
.configurationDisplayName("最近交易")
.description("快速查看最近几笔账单")
.configurationDisplayName(BehaviorWidgetCopy.localized(
simplifiedChinese: "最近交易", traditionalChinese: "最近交易",
english: "Recent"))
.description(BehaviorWidgetCopy.localized(
simplifiedChinese: "快速查看最近几笔账单",
traditionalChinese: "快速查看最近幾筆帳單",
english: "A quick look at your latest transactions"))
.supportedFamilies([.systemMedium, .systemLarge])
.contentMarginsDisabled() // Remove default padding/margins in iOS 17+
}
Expand Down
13 changes: 10 additions & 3 deletions ios/BeeCountWidget/BeeCountWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ struct BeeCountWidgetEntryView : View {
Image(systemName: "chart.bar.fill")
.font(.system(size: 32))
.foregroundColor(.white)
Text("蜜蜂记账")
Text(BehaviorWidgetCopy.localized(
simplifiedChinese: "蜜蜂记账", traditionalChinese: "蜜蜂記帳",
english: "BeeCount"))
.font(.system(size: 16, weight: .semibold))
.foregroundColor(.white)
}
Expand All @@ -149,8 +151,13 @@ struct BeeCountWidget: Widget {
BeeCountWidgetEntryView(entry: entry)
}
}
.configurationDisplayName("蜜蜂记账")
.description("显示今日和本月的收支情况")
.configurationDisplayName(BehaviorWidgetCopy.localized(
simplifiedChinese: "蜜蜂记账", traditionalChinese: "蜜蜂記帳",
english: "BeeCount"))
.description(BehaviorWidgetCopy.localized(
simplifiedChinese: "显示今日和本月的收支情况",
traditionalChinese: "查看今日和本月的收支情況",
english: "Today's and this month's income & expenses"))
.supportedFamilies([.systemSmall, .systemMedium])
.contentMarginsDisabled() // Remove default padding/margins in iOS 17+
}
Expand Down
16 changes: 16 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
BCEA08F1000000000000C0F1 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = BCEA08F0000000000000B0F1 /* InfoPlist.strings */; };
BCEA09F1000000000000C0F1 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = BCEA09F0000000000000B0F1 /* Localizable.strings */; };
C77A0A7A5CF41755AA72984A /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC45D84F7DFDF5967AFB7665 /* Pods_RunnerTests.framework */; };
EF1FAB659C35D9BE1FC671E2 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B88E76BEDC512A92BA874CF /* Pods_Runner.framework */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -100,6 +101,9 @@
BCEA0801000000000000A0E1 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
BCEA0802000000000000A0E2 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
BCEA0803000000000000A0E3 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
BCEA0901000000000000A0F1 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
BCEA0902000000000000A0F2 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
BCEA0903000000000000A0F3 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };
C02F58CFE77A00B3EEF442B2 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
F07A48A37F0A331BF0674437 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
FC45D84F7DFDF5967AFB7665 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -228,6 +232,7 @@
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C147021CF9000F007C117D /* Info.plist */,
BCEA08F0000000000000B0F1 /* InfoPlist.strings */,
BCEA09F0000000000000B0F1 /* Localizable.strings */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
Expand Down Expand Up @@ -385,6 +390,7 @@
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
BCEA08F1000000000000C0F1 /* InfoPlist.strings in Resources */,
BCEA09F1000000000000C0F1 /* Localizable.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -572,6 +578,16 @@
name = InfoPlist.strings;
sourceTree = "<group>";
};
BCEA09F0000000000000B0F1 /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
BCEA0901000000000000A0F1 /* en */,
BCEA0902000000000000A0F2 /* zh-Hans */,
BCEA0903000000000000A0F3 /* zh-Hant */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
Expand Down
Loading
Loading