Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 265e8e36d2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const found = calendars.find((c) => c.title === CALENDAR_TITLE); | ||
| // Match by either the current locale's title or the legacy zh title so we | ||
| // can clean up stale calendars after a language switch. | ||
| const candidates = new Set([t("calSync.title"), "掌上吾理-我的课表"]); |
There was a problem hiding this comment.
Include the English calendar title when cleaning up
When a user syncs the calendar while the app is in English, the calendar is created as iWUT - My timetable; after switching back to Chinese/system-Chinese, this lookup only matches the current Chinese title plus the legacy Chinese title, so the English calendar is not deleted and a second calendar with duplicate events is created. Include every localized app-calendar title in this candidate set, not just the current locale and the old Chinese title.
Useful? React with 👍 / 👎.
| getSystemLanguageTag(): string | null; | ||
| } | ||
|
|
||
| const LocaleModule = requireNativeModule<LocaleNativeModule>("LocaleSwitcher"); |
There was a problem hiding this comment.
Defer the locale native module lookup
In environments where LocaleSwitcher is not linked, such as Expo Go/Jest/web builds, importing @/lib/i18n/bootstrap at app startup imports this module and requireNativeModule throws immediately, before the try/catch in getSystemLanguageTag or the .catch() around setApplicationLocales can run. Since the new code explicitly intends to tolerate an unavailable native module, use an optional/lazy lookup so RN-side translations can still start without the native module.
Useful? React with 👍 / 👎.
No description provided.