feature:基本功能

This commit is contained in:
吕新雨
2026-01-29 19:09:36 +08:00
parent c1a433a469
commit 0dd84b1873
47 changed files with 2978 additions and 219 deletions

View File

@@ -1,7 +1,10 @@
{
"common": {
"ok": "OK",
"cancel": "Cancel"
"cancel": "Cancel",
"error": "Error",
"openLinkError": "Cannot open link",
"back": "Back"
},
"onboarding": {
"title": "Welcome",
@@ -33,7 +36,39 @@
"like": "Like",
"dislike": "Dislike",
"favorites": "Favorites",
"settings": "Settings"
"settings": "Settings",
"theme": "Theme",
"profile": "Me"
},
"theme": {
"title": "Theme",
"scenery": "Scenery",
"color": "Color"
},
"profile": {
"title": "Me",
"favorites": "My Likes",
"widget": "Widget",
"dailyReminder": "Daily Reminder",
"privacy": "Privacy Policy",
"terms": "Terms of Use",
"language": "Language",
"todoTitle": "Notice",
"todoDesc": "This feature is a placeholder for this iteration."
},
"dailyReminder": {
"title": "Daily Reminder",
"timesUnit": "times",
"pushLabel": "Push Reminder",
"ok": "Ok",
"minus": "Decrease",
"plus": "Increase"
},
"widget": {
"lockScreen": "Lock Screen Widget",
"homeScreen": "Home Screen Widget",
"previewDate": "Thu, Jan 29",
"previewQuote": "Im proud of who I am, even while becoming who I want to be."
},
"favorites": {
"title": "Favorites",
@@ -45,6 +80,12 @@
"version": "Version",
"widgetTitle": "iOS Widget",
"widgetDesc": "Put gentle reminders on your home screen: long-press → tap “+” → search “Mindfulness” → add a size you like."
},
"consent": {
"title": "You Are Perfect.",
"subtitle": "Everything Will Be Better.",
"agree": "Agree & Continue",
"privacy": "Privacy Policy",
"terms": "Terms of Use"
}
}

View File

@@ -1,7 +1,8 @@
{
"common": {
"ok": "Aceptar",
"cancel": "Cancelar"
"cancel": "Cancelar",
"back": "Volver"
},
"onboarding": {
"title": "Bienvenida",
@@ -33,7 +34,39 @@
"like": "Me gusta",
"dislike": "No me gusta",
"favorites": "Favoritos",
"settings": "Ajustes"
"settings": "Ajustes",
"theme": "Tema",
"profile": "Yo"
},
"theme": {
"title": "Tema",
"scenery": "Paisaje",
"color": "Color"
},
"profile": {
"title": "Yo",
"favorites": "Mis Me gusta",
"widget": "Widget",
"dailyReminder": "Recordatorio diario",
"privacy": "Política de Privacidad",
"terms": "Términos de Uso",
"language": "Idioma",
"todoTitle": "Aviso",
"todoDesc": "Esta función es un marcador de posición en esta versión."
},
"dailyReminder": {
"title": "Recordatorio diario",
"timesUnit": "veces",
"pushLabel": "Recordatorio Push",
"ok": "Ok",
"minus": "Disminuir",
"plus": "Aumentar"
},
"widget": {
"lockScreen": "Widget de pantalla de bloqueo",
"homeScreen": "Widget de pantalla de inicio",
"previewDate": "Jue, 29 ene",
"previewQuote": "Estoy orgullosa de quien soy, incluso mientras me convierto en quien quiero ser."
},
"favorites": {
"title": "Favoritos",
@@ -45,6 +78,11 @@
"version": "Versión",
"widgetTitle": "Widget de iOS",
"widgetDesc": "Pon recordatorios en tu pantalla: mantén pulsado → “+” → busca “Mindfulness” → añade el tamaño."
},
"consent": {
"agree": "Aceptar y Continuar",
"privacy": "Política de Privacidad",
"terms": "Términos de Uso"
}
}

View File

@@ -1,7 +1,8 @@
{
"common": {
"ok": "OK",
"cancel": "Cancelar"
"cancel": "Cancelar",
"back": "Voltar"
},
"onboarding": {
"title": "Bem-vinda",
@@ -33,7 +34,39 @@
"like": "Curtir",
"dislike": "Não curtir",
"favorites": "Favoritos",
"settings": "Configurações"
"settings": "Configurações",
"theme": "Tema",
"profile": "Eu"
},
"theme": {
"title": "Tema",
"scenery": "Paisagem",
"color": "Cor"
},
"profile": {
"title": "Eu",
"favorites": "Minhas curtidas",
"widget": "Widget",
"dailyReminder": "Lembrete diário",
"privacy": "Política de Privacidade",
"terms": "Termos de Uso",
"language": "Idioma",
"todoTitle": "Aviso",
"todoDesc": "Este recurso é um placeholder nesta versão."
},
"dailyReminder": {
"title": "Lembrete diário",
"timesUnit": "vezes",
"pushLabel": "Lembrete Push",
"ok": "Ok",
"minus": "Diminuir",
"plus": "Aumentar"
},
"widget": {
"lockScreen": "Widget da tela bloqueada",
"homeScreen": "Widget da tela inicial",
"previewDate": "Qui, 29 jan",
"previewQuote": "Tenho orgulho de quem eu sou, mesmo enquanto me torno quem eu quero ser."
},
"favorites": {
"title": "Favoritos",
@@ -45,6 +78,11 @@
"version": "Versão",
"widgetTitle": "Widget do iOS",
"widgetDesc": "Coloque lembretes na tela inicial: pressione e segure → “+” → procure “Mindfulness” → adicione o tamanho."
},
"consent": {
"agree": "Concordar e Continuar",
"privacy": "Política de Privacidade",
"terms": "Termos de Uso"
}
}

View File

@@ -1,7 +1,10 @@
{
"common": {
"ok": "确定",
"cancel": "取消"
"cancel": "取消",
"error": "错误",
"openLinkError": "无法打开链接",
"back": "返回"
},
"onboarding": {
"title": "欢迎",
@@ -33,7 +36,39 @@
"like": "点赞",
"dislike": "讨厌",
"favorites": "收藏",
"settings": "设置"
"settings": "设置",
"theme": "主题",
"profile": "我的"
},
"theme": {
"title": "主题",
"scenery": "风景",
"color": "颜色"
},
"profile": {
"title": "我的",
"favorites": "我的喜欢",
"widget": "小组件",
"dailyReminder": "每日提醒",
"privacy": "隐私政策",
"terms": "使用条款",
"language": "语言",
"todoTitle": "提示",
"todoDesc": "该功能本期先占位,后续迭代补齐。"
},
"dailyReminder": {
"title": "每日提醒",
"timesUnit": "次",
"pushLabel": "推送提醒",
"ok": "确定",
"minus": "减少次数",
"plus": "增加次数"
},
"widget": {
"lockScreen": "锁屏小组件",
"homeScreen": "桌面小组件",
"previewDate": "1月29日周四 · 已至腊月十一",
"previewQuote": "我也对现在的自己感到满意,即使我仍在努力成为想成为的人。"
},
"favorites": {
"title": "收藏夹",
@@ -45,6 +80,12 @@
"version": "版本",
"widgetTitle": "iOS 小组件",
"widgetDesc": "把温柔提醒放到桌面上:长按主屏幕 → 点“+” → 搜索“正念” → 添加你喜欢的尺寸。"
},
"consent": {
"title": "你本就完美。",
"subtitle": "一切都会变好。",
"agree": "同意并继续",
"privacy": "隐私协议",
"terms": "用户使用协议"
}
}

View File

@@ -1,7 +1,8 @@
{
"common": {
"ok": "確定",
"cancel": "取消"
"cancel": "取消",
"back": "返回"
},
"onboarding": {
"title": "歡迎",
@@ -33,7 +34,39 @@
"like": "喜歡",
"dislike": "不喜歡",
"favorites": "收藏",
"settings": "設定"
"settings": "設定",
"theme": "主題",
"profile": "我的"
},
"theme": {
"title": "主題",
"scenery": "風景",
"color": "顏色"
},
"profile": {
"title": "我的",
"favorites": "我的喜歡",
"widget": "小工具",
"dailyReminder": "每日提醒",
"privacy": "隱私政策",
"terms": "使用條款",
"language": "語言",
"todoTitle": "提示",
"todoDesc": "此功能本期先占位,後續迭代補齊。"
},
"dailyReminder": {
"title": "每日提醒",
"timesUnit": "次",
"pushLabel": "推送提醒",
"ok": "確定",
"minus": "減少次數",
"plus": "增加次數"
},
"widget": {
"lockScreen": "鎖屏小工具",
"homeScreen": "桌面小工具",
"previewDate": "1月29日週四 · 已至臘月十一",
"previewQuote": "我也對現在的自己感到滿意,即使我仍在努力成為想成為的人。"
},
"favorites": {
"title": "收藏夾",
@@ -45,6 +78,11 @@
"version": "版本",
"widgetTitle": "iOS 小工具",
"widgetDesc": "把溫柔提醒放到桌面上:長按主畫面 → 點「+」 → 搜尋「正念」 → 添加你喜歡的尺寸。"
},
"consent": {
"agree": "同意並繼續",
"privacy": "隱私協議",
"terms": "用戶使用協議"
}
}

View File

@@ -7,10 +7,24 @@ const KEY_ONBOARDING_COMPLETED = 'onboarding.completed';
const KEY_PUSH_PROMPT_STATE = 'push.promptState';
const KEY_CONTENT_REACTIONS = 'content.reactions';
const KEY_FAVORITES_ITEMS = 'favorites.items';
const KEY_CONSENT_ACCEPTED = 'consent.accepted';
const KEY_USER_PROFILE = 'user.profile';
const KEY_UI_THEME_MODE = 'ui.theme.mode';
const KEY_DAILY_REMINDER_SETTINGS = 'dailyReminder.settings';
export type PushPromptState = 'enabled' | 'skipped' | 'unknown';
export type Reaction = 'like' | 'dislike';
export type ReactionsMap = Record<string, Reaction>;
export type ThemeMode = 'scenery' | 'color';
export type UserProfile = {
name?: string;
intents?: string[];
};
export type DailyReminderSettings = {
timesPerDay: number;
pushEnabled: boolean;
};
async function getJson<T>(key: string, fallback: T): Promise<T> {
const raw = await AsyncStorage.getItem(key);
@@ -65,3 +79,50 @@ export async function addFavorite(contentId: string): Promise<void> {
await setJson(KEY_FAVORITES_ITEMS, [...list, contentId]);
}
export async function getConsentAccepted(): Promise<boolean> {
const raw = await AsyncStorage.getItem(KEY_CONSENT_ACCEPTED);
return raw === 'true';
}
export async function setConsentAccepted(accepted: boolean): Promise<void> {
await AsyncStorage.setItem(KEY_CONSENT_ACCEPTED, accepted ? 'true' : 'false');
}
export async function getThemeMode(): Promise<ThemeMode> {
const raw = await AsyncStorage.getItem(KEY_UI_THEME_MODE);
if (raw === 'scenery' || raw === 'color') return raw;
return 'scenery';
}
export async function setThemeMode(mode: ThemeMode): Promise<void> {
await AsyncStorage.setItem(KEY_UI_THEME_MODE, mode);
}
export async function getUserProfile(): Promise<UserProfile> {
return await getJson<UserProfile>(KEY_USER_PROFILE, {});
}
export async function setUserProfile(profile: UserProfile): Promise<void> {
const current = await getUserProfile();
await setJson(KEY_USER_PROFILE, { ...current, ...profile });
}
export async function getDailyReminderSettings(): Promise<DailyReminderSettings> {
const s = await getJson<DailyReminderSettings>(KEY_DAILY_REMINDER_SETTINGS, {
timesPerDay: 3,
pushEnabled: false,
});
const timesPerDay = Number.isFinite(s.timesPerDay) ? s.timesPerDay : 3;
return {
timesPerDay: Math.min(10, Math.max(1, Math.round(timesPerDay))),
pushEnabled: Boolean(s.pushEnabled),
};
}
export async function setDailyReminderSettings(settings: DailyReminderSettings): Promise<void> {
const timesPerDay = Math.min(10, Math.max(1, Math.round(settings.timesPerDay)));
await setJson(KEY_DAILY_REMINDER_SETTINGS, {
timesPerDay,
pushEnabled: Boolean(settings.pushEnabled),
});
}