224 Commits
Author SHA1 Message Date
harukin-expo-dev-env 1ecd026908 feat: Implement official position metadata handling and caching
- Add `currentTrainMetadata.ts` to manage carrying forward official position metadata between train snapshots.
- Introduce `lineDisplayName.ts` for mapping line IDs to display names.
- Create `officialPositionCache.ts` for parsing and serializing official position data with cache validation.
- Enhance `officialPositionService.ts` to support persistent caching of official positions and improve resolver functionality.
- Update `requestCoordinator.ts` to allow cancellation of polling requests without disposing of the coordinator.
- Modify `trainTimeFiltering.ts` to incorporate line ID context when checking for duplicate train data.
- Refactor `useCurrentTrain.tsx` to support polling for current train data with official position enrichment.
- Add tests for new features, including persistent cache behavior and handling of ambiguous train data.
2026-09-15 13:48:21 +09:00
harukin-expo-dev-env bb21cf84b2 refactor: clean up imports and improve code structure in multiple files 2026-09-15 02:03:29 +09:00
harukin-expo-dev-env 209e147618 refactor: remove unused trainInfo state and related logic in multiple components 2026-09-15 00:51:17 +09:00
harukin-expo-dev-env ebee4bc988 fix: streamline data parsing in useBusAndTrainData 2026-09-14 01:27:41 +09:00
harukin-expo-dev-env 48c8512cd4 refactor: remove train pair data type and related state management 2026-09-14 01:11:14 +09:00
harukin-expo-dev-env 64da704dc1 feat: add train pair data and improve error handling in hooks 2026-09-14 00:50:05 +09:00
harukin-expo-dev-env 001439fb9f feat: resolve native position metadata via OfficialPosition backend 2026-09-13 16:23:39 +09:00
harukin-expo-dev-env 9f26492f80 Refactor useCurrentTrain hook into useCurrentTrainData and useCurrentTrainView
- Split the existing useCurrentTrain hook into two separate hooks: useCurrentTrainData for accessing train data and useCurrentTrainView for accessing view-related properties.
- Updated all components and hooks to use the new hooks accordingly, ensuring that the functionality remains intact.
- This change improves the separation of concerns and enhances the maintainability of the codebase.
2026-09-12 23:02:43 +09:00
harukin-expo-dev-env 94f3807d81 Refactor train data management and recording functionality
- Split the useAllTrainDiagram hook into three separate hooks: useTrainDiagram, useCustomTrainData, and useOperationLogs for better modularity and performance.
- Update components to utilize the new hooks, ensuring that all references to the old hook are replaced.
- Refactor the TrainMenu context to include a new TrainRecording context, encapsulating recording-related state and functions.
- Adjust components to use the new useTrainRecording hook for playback and recording functionalities.
- Clean up imports and state management across various components to align with the new structure.
2026-09-12 15:47:42 +09:00
harukin-expo-dev-env 30f101e2e6 feat: implement startup deep link handling and unyohub data selectors; add tests for new functionality 2026-09-04 11:07:55 +09:00
harukin-expo-dev-env 54abf94b86 feat: update splash screen image and add resize mode; enhance permission handling for crew role 2026-09-03 01:31:58 +09:00
harukin-expo-dev-env f210ca4d77 feat: Add loading states and map functionality to the menu
- Implemented StationListLoadingState component for loading messages.
- Created MenuLED component to display LED information with loading animations.
- Developed MenuMap component for interactive map features, including user location markers and station markers.
- Introduced LEDFrame component for consistent styling of LED displays.
- Enhanced LED_vision component to support embedded rendering and content readiness.
- Added menuStationSelectors for managing nearby and favorite station groups.
- Updated Menu component to integrate new loading states and map functionalities.
- Added tests for menuStationSelectors to ensure correct grouping and selection logic.
2026-09-02 21:24:41 +09:00
harukin-expo-dev-env 974c162a9e refactor: migrate from Sentry to custom telemetry for observability
- Replaced Sentry breadcrumbs and context setting with a custom telemetry implementation across various components including Apps, WebView, CarouselBox, and ndView.
- Introduced a new telemetry module to encapsulate observability logic and provide a unified API for logging events, messages, and exceptions.
- Updated documentation to reflect changes in observability architecture, consolidating Sentry initialization and telemetry usage.
- Enhanced error handling and logging in data fetching and application lifecycle management.
2026-09-01 01:11:13 +09:00
harukin-expo-dev-env 19260c8d6c revert: remove Nitro Fetch experiment 2026-08-31 11:57:25 +09:00
harukin-expo-dev-env d6a6e50eca feat: probe Nitro Fetch for current positions 2026-08-31 09:52:11 +09:00
harukin-expo-dev-env 92818bbd11 fix: make delay data refresh explicit 2026-08-30 00:55:26 +09:00
harukin-expo-dev-env f136aade56 fix: coordinate current train polling 2026-08-30 00:55:04 +09:00
harukin-expo-dev-env bcfa24f30a Refactor navigation types and improve type safety across components
- Removed usage of `any` in navigation hooks and replaced with specific types.
- Added type definitions for navigation parameters in `navigation.ts`.
- Updated components to utilize the new navigation types for better type safety.
- Enhanced `SwitchArea` component with generic type support for boolean and string values.
- Introduced type checks and parsing functions for API responses in `mockApi` to ensure data integrity.
- Created a refactoring backlog document to track future improvements and refactoring tasks.
- Removed unused functions and cleaned up code in various components for better maintainability.
2026-08-20 23:51:09 +00:00
harukin-expo-dev-env 292fb96106 feat: 新しい設定ファイルを追加し、Sentryの初期化を改善 2026-08-20 05:05:26 +00:00
harukin-expo-dev-env c2228a0e0f feat: R2CurrentTrainDBインターフェースを追加し、API呼び出しのデータ型を更新 2026-08-19 14:21:20 +00:00
harukin-expo-dev-env 3684084185 feat: APIエンドポイントを動的に設定し、現在の列車位置情報を取得するロジックを追加 2026-08-18 14:57:15 +00:00
harukin-expo-dev-env 20c18713e2 refactor: replace Date with dayjs for consistent date handling across components
- Updated FelicaHistoryPage to use dayjs for formatting scannedAt timestamps.
- Refactored ResearchToolsSettings to utilize dayjs for date formatting.
- Modified VoicepeakDebugLogSection to replace Date with dayjs for createdAt timestamps.
- Changed settings component to use dayjs for scannedAt timestamps.
- Updated ExGridSimpleView and ExGridView to use dayjs for time parsing and formatting.
- Refactored ExGridSimpleViewItem and ExGridViewItem to utilize dayjs for time formatting.
- Adjusted ListView and ListViewItem to use dayjs for time handling.
- Updated EachData to use dayjs for train time calculations.
- Refactored LED_vidion to remove redundant getServiceMinute function.
- Replaced Date with dayjs in trainRecorder for exportedAt timestamps.
- Updated appLifecycleCrashSentinel to use dayjs for timestamp handling.
- Refactored operationInfoSchedule to use dayjs for fetchedAt timestamp.
- Updated trainTimeFiltering to utilize dayjs for time comparisons.
- Refactored useWebViewRemount to handle timeouts with dayjs.
- Updated voicepeak and voicepeakDebugLog to use dayjs for timestamp handling.
- Introduced timeUtils module for consistent time parsing and formatting using dayjs.
2026-08-16 09:23:54 +00:00
harukin-expo-dev-env d03b804feb fix: APIエンドポイントを更新し、遅延情報の取得方法を改善 2026-08-13 00:39:28 +00:00
harukin-expo-dev-env 7990361d04 Merge commit '96477296fa9e6de24c10a6d83a949c25599348e9' into feature/migrate-api 2026-08-10 01:57:46 +00:00
harukin-expo-dev-env 4b5a8d44fb Merge commit 'ab71fab73b87dad991262c2e6fcbf1036020dcc8' into develop 2026-08-10 01:50:10 +00:00
harukin-expo-dev-env 5c97ff0c6b fix: お気に入り駅の並び替え機能を改善し、関連コードを整理 2026-08-09 16:18:54 +00:00
harukin-expo-dev-env 39d2be704e Refactor favorite station management and normalization
- Removed direct usage of favorite station state in multiple components (MenuPage, StationDetailView, WebView, FavoriteList, FavoriteSettings).
- Introduced utility functions for handling favorite station keys and normalization.
- Updated favorite station context to include methods for adding, removing, and toggling favorite stations.
- Implemented normalization logic to ensure consistency with the current station master.
- Added documentation for the favorite station normalization plan.
- Improved error handling and data validation for favorite stations.
2026-08-06 07:42:25 +00:00
harukin-expo-dev-env a3707f2970 feat: 運行情報をR2スナップショットへ移行 2026-07-30 15:24:23 +00:00
harukin-expo-dev-env 22ce82a799 feat: りっかちゃん音声案内基盤を拡張 2026-07-29 05:31:35 +00:00
harukin-expo-dev-env a89c896012 fix: 列車情報の時間フィルタリングロジックを改善し、再生中の基準時刻を追加 2026-07-14 10:49:31 +00:00
harukin-expo-dev-env 092590bc3d 型定義を改善し、originalStationListの使用を最適化 2026-07-12 15:35:00 +00:00
harukin-expo-dev-env 3ead0cbe10 各種機能の改善と最適化、ナビゲーションの明示的なターゲット設定を追加 2026-07-08 14:39:15 +00:00
harukin-expo-dev-env d4db82cc65 各種データの取得フラグ機能を実装、動作の最適化 2026-07-08 01:39:29 +00:00
harukin-expo-dev-env 873acde54b Tune data fetch observability after first run 2026-07-07 04:10:24 +00:00
harukin-expo-dev-env a6fa5dfadb Add data fetch observability 2026-07-07 02:47:13 +00:00
harukin-expo-dev-env 9ab877f73c Preserve operation webview and quiet noisy defaults 2026-07-04 15:48:37 +00:00
harukin-expo-dev-env bfe572ecfb インポート機能の作成、録画システムのポジション最適化 2026-06-29 16:11:42 +00:00
harukin-expo-dev-env b783157553 Add recording JSON import and export 2026-06-29 14:39:30 +00:00
harukin-expo-dev-env c44bad5f86 unyohubアイコン対応 2026-06-23 16:40:44 +00:00
harukin-expo-dev-env 3b3d5d0ed6 feat: えれサイトの列車情報をグループ化し、表示を改善 2026-06-05 12:31:54 +00:00
harukin-expo-dev-env 48a078f831 feat: add experimental diagram URL support and update related components 2026-05-19 03:06:45 +00:00
harukin-expo-dev-env 17565da7ab Refactor Elesite sorting logic and introduce new utility functions
- Moved the Elesite sorting logic to a new module `elesiteTrainOrder.ts`.
- Created utility functions to infer heading direction and sort Elesite entries by train number.
- Updated `injectJavascriptData` to utilize the new sorting logic and handle station sequences.
- Refactored `useElesite` to use the new sorting utility for improved readability and maintainability.
2026-05-15 17:21:18 +00:00
harukin-expo-dev-envandCopilot a59faa9341 feat: poll mock API server for live train positions
- positionMasters: add fetchMockTrainPositions() targeting
  /train-positions/latest on the mock API server
- useTrainMenu: when mockApiFeatureEnabled and not recording/playing,
  poll /train-positions/latest every 15s and update mockTrainPositions
  (same interval as live mode); on mode switch updates immediately
- useCurrentTrain:
  - playing: use local recording data (no network call)
  - mock ON idle: fetch from mock API server (15s poll driven by useTrainMenu)
  - mock OFF: fetch from real backend as before
- Recording still forces mock OFF so real API data is captured

Co-authored-by: Copilot <[email protected]>
2026-05-03 18:01:12 +00:00
harukin-expo-dev-envandCopilot a4416de1bc feat: integrate position-masters API into mock system
- Add lib/mockApi/positionMasters.ts
  - fetchPositionMasters() from jr-shikoku-backend-mock-api-v1.haruk.in
  - buildPosLookup() / lookupPos() helpers
  - serializePosLookupForJs() for baking into injected scripts
- webviewXhrInterceptor: accept positionMasters in MockApiConfig,
  bake _POS_LOOKUP into injected JS, enrich Pos from PosNum on serve
- useTrainMenu: fetch position masters on mock-enable (and at startup
  if already enabled); expose positionMasters + lookupPosText()
- useCurrentTrain: fill Pos via lookupPosText when mapping mock data
- mockApi/index.ts: re-export positionMasters types and helpers

Co-authored-by: Copilot <[email protected]>
2026-05-03 17:46:13 +00:00
harukin-expo-dev-envandCopilot 77f15345e5 fix: crash on playback start + support multiple recordings
Crash fix (React Hooks violation):
- PlaybackTimeline.tsx: move ALL hooks (useRef for PanResponder, useCallback)
  to before the early return; use seekRef/totalRef to share values into
  PanResponder handlers without stale closure issues

Multiple recordings support:
- trainRecorder.ts: redesign to id-based multi-recording system
  - RecordingMeta type for lightweight list (no snapshots)
  - TrainRecording now includes id field
  - saveRecording/loadRecordingById/deleteRecordingById/loadRecordingList
  - migrateOldRecording() migrates old single MOCK_RECORDING key on first launch
- constants/storage.ts: add MOCK_RECORDINGS_INDEX + MOCK_RECORDING_DATA_PREFIX keys
- useTrainMenu: savedRecording → recordingList (RecordingMeta[]) + activeRecording (TrainRecording|null)
  - startPlayback(id) loads full recording on demand
  - deleteRecording(id) deletes by id and refreshes list
  - stopPlayback clears activeRecording
- DataSourceSettings: recording list UI
  - shows all recordings with date/time, snapshot count, duration
  - ▶ play and 削除 buttons per row
  - recording/playing status indicator

Co-authored-by: Copilot <[email protected]>
2026-05-02 00:52:30 +00:00
harukin-expo-dev-envandCopilot 43dcaab643 feat: add playback timeline UI with pause/resume/seek controls
- useTrainMenu: add playbackPaused state, pausePlayback/resumePlayback/seekToSnapshot
  - playback loop now respects playbackPaused (no timer when paused)
  - seekToSnapshot pauses playback and immediately applies snapshot data
  - expose playbackIndex, playbackPaused + new functions in context value
- PlaybackTimeline.tsx: new component shown when recorderState === 'playing'
  - absolute positioned bar at top of map screen (zIndex 2000)
  - prev/play-pause/next frame buttons + skip-to-start/end
  - time display (HH:mm:ss) + snapshot counter (n/total) + total duration
  - PanResponder-based scrubber track with filled progress bar and draggable thumb
- Apps.tsx: render <PlaybackTimeline /> alongside FixedPositionBox
- Remove MockApiToggle.tsx (no longer used since settings-only toggle)

Co-authored-by: Copilot <[email protected]>
2026-05-02 00:42:56 +00:00
harukin-expo-dev-envandCopilot 597151e875 feat: add train position record & playback feature
Implements snapshot-based recording and playback of live train
position data for mock API debugging (admin-only).

Recording:
- startRecording() disables mock mode and begins capturing live
  train snapshots every ~15s (via getCurrentTrain polling)
- Each snapshot stores { t: elapsed_ms, trains: TrainEntry[] }
- stopRecording() saves completed recording to AsyncStorage

Playback:
- startPlayback() enables mock mode and loops through snapshots
  at their original recorded timing using useEffect+setTimeout
- stopPlayback() returns to idle

Storage:
- Single slot in AsyncStorage (MOCK_RECORDING key)
- Loaded on app start in useTrainMenu
- deleteRecording() removes it

New files:
- lib/mockApi/trainRecorder.ts — TrainRecording/TrainSnapshot types
  + save/load/delete AsyncStorage helpers

Modified files:
- constants/storage.ts — add MOCK_RECORDING key
- stateBox/useTrainMenu.tsx — recorder state + all controls
- stateBox/useCurrentTrain.tsx — call addTrainSnapshot after live fetch
- components/Settings/DataSourceSettings.tsx — record/play UI with
  status dot, snapshot count, and action buttons

Co-authored-by: Copilot <[email protected]>
2026-05-02 00:31:55 +00:00
harukin-expo-dev-envandCopilot b3bb7fef72 feat: apply mock data to currentTrain (app-side train positions)
When MOCK_API_FEATURE_ENABLED is on, getCurrentTrain() now returns
mock data instead of fetching from the n8n webhook or fallback API.

- App.tsx: move TrainMenuProvider before CurrentTrainProvider so
  useTrainMenu() is available inside CurrentTrainProvider
- useCurrentTrain: import useTrainMenu + MOCK_TRAIN_POSITIONS;
  getCurrentTrain() short-circuits to mock data when mockApiFeatureEnabled;
  added useEffect on mockApiFeatureEnabled to reload immediately on toggle

Co-authored-by: Copilot <[email protected]>
2026-05-01 12:40:30 +00:00
harukin-expo-dev-envandCopilot 1176234c08 refactor: remove map-screen MOCK switch; settings toggle controls mock directly
The separate runtime MOCK switch on the map screen is removed.
Now the admin-only settings toggle (MOCK_API_FEATURE_ENABLED) is the
single control point — turning it on activates mock mode immediately,
turning it off deactivates it.

- useTrainMenu: remove mockApiEnabled/setMockApiEnabled state;
  mockApiConfig now derives from mockApiFeatureEnabled alone
- WebView: use mockApiFeatureEnabled for key prop (triggers reload)
- Apps.tsx: remove MockApiToggle import and JSX usage

Co-authored-by: Copilot <[email protected]>
2026-05-01 12:35:36 +00:00
harukin-expo-dev-envandCopilot c6aecd151c fix: Tokyo UX stripped when mock is active
Two bugs caused the Tokyo UX to be stripped/broken when mock mode was ON:

1. **Double callback firing**: the interceptor's `setTimeout` called both
   `onreadystatechange.call(self)` AND `dispatchEvent(new Event('readystatechange'))`.
   Since `dispatchEvent` already fires `onXxx` property handlers via the DOM event
   model, the page's callback fired twice, causing a second DOM re-render that could
   overwrite Tokyo UX modifications. Fixed by relying on `dispatchEvent` only (with
   `ProgressEvent` for load events), with a direct-call fallback only for environments
   that lack `dispatchEvent`.

2. **No double-injection guard**: if `injectedJavaScriptBeforeContentLoaded` caused
   the interceptor to run more than once (e.g., `onPageStarted` fires multiple times
   on Android), `_origOpen` would capture the already-patched version, leading to
   unexpected behaviour. Fixed by adding `if (window.__jrsMockActive) return;` at the
   top of the interceptor IIFE.

3. **Belt-and-suspenders injection**: the interceptor is now also prepended to
   `injectedJavaScript` (Tokyo UX script) via the restored `mockApiConfig` parameter
   on `injectJavascriptData`. The `__jrsMockActive` guard ensures it's a no-op when
   `injectedJavaScriptBeforeContentLoaded` already ran it, but guarantees the
   interceptor is active on platforms where IJBCL is unreliable — before
   `MoveDisplayStation` triggers the first train-data poll via `onLoadEnd`.

Co-authored-by: Copilot <[email protected]>
2026-05-01 11:40:11 +00:00