feat(phase4): Quick Edit, Contents API commit flow, editor workspace
- portable UTF-8 base64 helpers (Hermes-safe), used for file round-trips - endpoints: updateFileContents, createFileContents, createPull - hooks: useCommitFile (invalidates repo cache), useCreatePull - FileEdit screen: native monospace editor, dirty/discard, branch picker, commit-to-new-branch, protected-branch handling, post-commit PR creation; stale-SHA 409 surfaces as a conflict message - settings: editor URL template; repo overview 'Open in editor' (no token) - tests: base64 round-trips (accents/emoji), editor URL expansion
This commit is contained in:
1 parent
ddd834b7ac
commit
c9dd49446a
18 files changed
+733
-29
No files matched your search
@@ -6,6 +6,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { Screen } from '@/components/layout/screen';
|
||||
import { AppText } from '@/components/ui/app-text';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { Field } from '@/components/ui/field';
|
||||
import { ListItem } from '@/components/ui/list-item';
|
||||
import { SegmentedControl } from '@/components/ui/segmented';
|
||||
import { queryClient } from '@/core/api/query-client';
|
||||
@@ -39,6 +40,8 @@ export function SettingsScreen(_props: Props) {
|
||||
const setLanguage = useSettingsStore((s) => s.setLanguage);
|
||||
const setBiometricsEnabled = useSettingsStore((s) => s.setBiometricsEnabled);
|
||||
const setNotificationPollSeconds = useSettingsStore((s) => s.setNotificationPollSeconds);
|
||||
const editorUrlTemplate = useSettingsStore((s) => s.editorUrlTemplate);
|
||||
const setEditorUrlTemplate = useSettingsStore((s) => s.setEditorUrlTemplate);
|
||||
|
||||
const [support, setSupport] = useState<BiometricSupport | null>(null);
|
||||
|
||||
@@ -146,6 +149,22 @@ export function SettingsScreen(_props: Props) {
|
||||
</Card>
|
||||
</Section>
|
||||
|
||||
{/* Editor integration */}
|
||||
<Section title={t('settings.editor')}>
|
||||
<Card style={styles.card}>
|
||||
<Field
|
||||
label={t('settings.editorUrlTemplate')}
|
||||
value={editorUrlTemplate}
|
||||
onChangeText={setEditorUrlTemplate}
|
||||
placeholder={t('settings.editorUrlPlaceholder')}
|
||||
helper={t('settings.editorUrlHelp')}
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
mono
|
||||
/>
|
||||
</Card>
|
||||
</Section>
|
||||
|
||||
{/* Data */}
|
||||
<Section title={t('settings.data')}>
|
||||
<Card padded={false} variant="flat">
|
||||
|
||||
@@ -20,10 +20,17 @@ export interface SettingsState {
|
||||
biometricsEnabled: boolean;
|
||||
/** Background polling interval for the notifications inbox, in seconds. 0 = only manual/foreground refresh. */
|
||||
notificationPollSeconds: number;
|
||||
/**
|
||||
* Optional editor/IDE URL template for the "Open in editor" action.
|
||||
* Placeholders: {owner} {repo} {path} {cloneUrl}. Empty hides the action.
|
||||
* Opened in the system browser/app only — the API token is never appended.
|
||||
*/
|
||||
editorUrlTemplate: string;
|
||||
setThemePreference: (preference: ThemePreference) => void;
|
||||
setLanguage: (language: LanguagePreference) => void;
|
||||
setBiometricsEnabled: (enabled: boolean) => void;
|
||||
setNotificationPollSeconds: (seconds: number) => void;
|
||||
setEditorUrlTemplate: (template: string) => void;
|
||||
}
|
||||
|
||||
export const useSettingsStore = create<SettingsState>()(
|
||||
@@ -33,10 +40,12 @@ export const useSettingsStore = create<SettingsState>()(
|
||||
language: 'system',
|
||||
biometricsEnabled: false,
|
||||
notificationPollSeconds: 60,
|
||||
editorUrlTemplate: '',
|
||||
setThemePreference: (themePreference) => set({ themePreference }),
|
||||
setLanguage: (language) => set({ language }),
|
||||
setBiometricsEnabled: (biometricsEnabled) => set({ biometricsEnabled }),
|
||||
setNotificationPollSeconds: (notificationPollSeconds) => set({ notificationPollSeconds }),
|
||||
setEditorUrlTemplate: (editorUrlTemplate) => set({ editorUrlTemplate }),
|
||||
}),
|
||||
{
|
||||
name: 'gitea-native:settings:v1',
|
||||
@@ -46,6 +55,7 @@ export const useSettingsStore = create<SettingsState>()(
|
||||
language: state.language,
|
||||
biometricsEnabled: state.biometricsEnabled,
|
||||
notificationPollSeconds: state.notificationPollSeconds,
|
||||
editorUrlTemplate: state.editorUrlTemplate,
|
||||
}),
|
||||
},
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user