feat(memoir): persist chapter reading prefs globally

Share font size, font family, and background across all memoir chapters via MemoirReadingSettingsProvider and SecureStore (same app-settings pattern). Add parse/merge helpers and unit tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Kevin
2026-05-15 17:23:02 +08:00
parent c4d2a38b09
commit 6f41574bda
7 changed files with 322 additions and 24 deletions

View File

@@ -9,6 +9,10 @@ import React from 'react';
import { Platform, StyleSheet, Text, View } from 'react-native';
import Markdown from 'react-native-markdown-display';
import type {
MemoirReadingFontFamily,
MemoirReadingFontSize,
} from '@/core/settings/memoir-reading-settings';
import type { ImageAsset } from './types';
const PLACEHOLDER_RE = /\{\{\{\{IMAGE:(.*?)\}\}\}\}|\{\{IMAGE:(.*?)\}\}/g;
@@ -197,8 +201,8 @@ export interface MarkdownRendererProps {
markdown: string;
renderedAssets: ImageAsset[];
coverImageUrl: string | null;
fontSize: 'small' | 'default' | 'large';
fontFamily: 'serif' | 'sans';
fontSize: MemoirReadingFontSize;
fontFamily: MemoirReadingFontFamily;
backgroundColor: string;
contentWidth: number;
/** 多故事分段时仅首段下沉首字 */