Dev #35
@@ -2,24 +2,22 @@ name: Build and Release APK
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
tags:
|
||||||
|
- 'v*'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
ANDROID_HOME: ${{ runner.tool_cache }}/android-sdk
|
ANDROID_HOME: ${{ runner.tool_cache }}/android-sdk
|
||||||
ANDROID_SDK_ROOT: ${{ runner.tool_cache }}/android-sdk
|
ANDROID_SDK_ROOT: ${{ runner.tool_cache }}/android-sdk
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
|
||||||
apk-path: ${{ steps.upload-apk.outputs.path }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up Node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
@@ -43,7 +41,6 @@ jobs:
|
|||||||
unzip -q /tmp/cmdtools.zip -d "$ANDROID_HOME/cmdline-tools"
|
unzip -q /tmp/cmdtools.zip -d "$ANDROID_HOME/cmdline-tools"
|
||||||
mv "$ANDROID_HOME/cmdline-tools/cmdline-tools" "$ANDROID_HOME/cmdline-tools/latest"
|
mv "$ANDROID_HOME/cmdline-tools/cmdline-tools" "$ANDROID_HOME/cmdline-tools/latest"
|
||||||
fi
|
fi
|
||||||
# Accept all licenses by writing known license hashes
|
|
||||||
mkdir -p "$ANDROID_HOME/licenses"
|
mkdir -p "$ANDROID_HOME/licenses"
|
||||||
echo "8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
|
echo "8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
|
||||||
echo "d56f5187479451eabf01fb78af6dfcb131a6481e" >> "$ANDROID_HOME/licenses/android-sdk-license"
|
echo "d56f5187479451eabf01fb78af6dfcb131a6481e" >> "$ANDROID_HOME/licenses/android-sdk-license"
|
||||||
@@ -78,63 +75,47 @@ jobs:
|
|||||||
cd carry-your-live/android
|
cd carry-your-live/android
|
||||||
./gradlew assembleRelease
|
./gradlew assembleRelease
|
||||||
|
|
||||||
- name: Upload APK
|
- name: Find APK
|
||||||
id: upload-apk
|
id: find-apk
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: carry-your-live-release
|
|
||||||
path: carry-your-live/android/app/build/outputs/release/app-release.apk
|
|
||||||
|
|
||||||
release:
|
|
||||||
needs: build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Download APK artifact
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: carry-your-live-release
|
|
||||||
path: .
|
|
||||||
|
|
||||||
- name: Compute next version
|
|
||||||
id: version
|
|
||||||
run: |
|
run: |
|
||||||
latest=$(git tag --list 'v[0-9]*' --sort=-v:refname | head -n 1)
|
APK_PATH=$(find carry-your-live/android/app/build/outputs -name "*.apk" -type f | head -n 1)
|
||||||
if [ -z "$latest" ]; then
|
echo "apk_path=$APK_PATH" >> "$GITHUB_OUTPUT"
|
||||||
next="v1.0.0"
|
echo "Found APK at: $APK_PATH"
|
||||||
else
|
|
||||||
latest=${latest#v}
|
|
||||||
IFS='.' read -r major minor patch <<< "$latest"
|
|
||||||
next="v${major}.${minor}.$((patch + 1))"
|
|
||||||
fi
|
|
||||||
echo "next=${next}" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Build changelog
|
- name: Create Gitea Release and Upload APK
|
||||||
id: changelog
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
prev_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
TAG_NAME="${GITHUB_REF#refs/tags/}"
|
||||||
if [ -z "$prev_tag" ]; then
|
REPO_OWNER="${GITHUB_REPOSITORY%/*}"
|
||||||
log=$(git log --oneline --no-merges main | head -n 40)
|
REPO_NAME="${GITHUB_REPOSITORY#*/}"
|
||||||
else
|
APK_PATH="${{ steps.find-apk.outputs.apk_path }}"
|
||||||
log=$(git log --oneline --no-merges "$prev_tag"..main | head -n 40)
|
APK_NAME="carry-your-live-${TAG_NAME}.apk"
|
||||||
|
|
||||||
|
# Create release using Gitea API
|
||||||
|
RESPONSE=$(curl -s -X POST "https://techmos.gitea.org/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/releases" \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{
|
||||||
|
\"tag_name\": \"${TAG_NAME}\",
|
||||||
|
\"name\": \"${TAG_NAME}\",
|
||||||
|
\"body\": \"Automated release for ${TAG_NAME}\",
|
||||||
|
\"draft\": false,
|
||||||
|
\"prerelease\": false
|
||||||
|
}")
|
||||||
|
|
||||||
|
RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id')
|
||||||
|
|
||||||
|
if [ "$RELEASE_ID" = "null" ] || [ -z "$RELEASE_ID" ]; then
|
||||||
|
echo "Release might already exist, fetching existing release..."
|
||||||
|
RELEASE_ID=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
"https://techmos.gitea.org/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/releases/tags/${TAG_NAME}" | jq -r '.id')
|
||||||
fi
|
fi
|
||||||
{
|
|
||||||
echo "body<<EOF"
|
# Upload APK as attachment
|
||||||
echo "## What's new in this release"
|
curl -s -X POST "https://techmos.gitea.org/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/releases/${RELEASE_ID}/assets" \
|
||||||
echo ""
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
echo "$log" | sed 's/^/- /'
|
-F "attachment=@${APK_PATH};filename=${APK_NAME}"
|
||||||
echo "EOF"
|
|
||||||
} >> "$GITHUB_OUTPUT"
|
echo "APK uploaded to release ${TAG_NAME}"
|
||||||
|
|
||||||
- name: Create release
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
tag_name: ${{ steps.version.outputs.next }}
|
|
||||||
name: ${{ steps.version.outputs.next }}
|
|
||||||
body: ${{ steps.changelog.outputs.body }}
|
|
||||||
files: ./app-release.apk
|
|
||||||
generate_release_notes: false
|
|
||||||
@@ -74,7 +74,9 @@ export default function SettingsScreen() {
|
|||||||
loadSettingsFromServer,
|
loadSettingsFromServer,
|
||||||
} = useSettings();
|
} = useSettings();
|
||||||
const categories = useCategories();
|
const categories = useCategories();
|
||||||
const [picker, setPicker] = useState<null | 'category' | 'sort' | 'reminder' | 'todoAhead'>(null);
|
const [picker, setPicker] = useState<
|
||||||
|
null | 'category' | 'sort' | 'reminder' | 'todoAhead' | 'themeMode'
|
||||||
|
>(null);
|
||||||
const [reminderTagPicker, setReminderTagPicker] = useState<Category | null>(null);
|
const [reminderTagPicker, setReminderTagPicker] = useState<Category | null>(null);
|
||||||
const [editingCategory, setEditingCategory] = useState<Category | null | 'new'>(null);
|
const [editingCategory, setEditingCategory] = useState<Category | null | 'new'>(null);
|
||||||
const [syncVisible, setSyncVisible] = useState(false);
|
const [syncVisible, setSyncVisible] = useState(false);
|
||||||
@@ -245,7 +247,7 @@ export default function SettingsScreen() {
|
|||||||
rightElement={
|
rightElement={
|
||||||
<Switch
|
<Switch
|
||||||
value={notifications}
|
value={notifications}
|
||||||
onValueChange={async (value) => {
|
onValueChange={async value => {
|
||||||
setNotifications(value);
|
setNotifications(value);
|
||||||
if (!value) {
|
if (!value) {
|
||||||
const { cancelAllReminders } = await import('@/services/notifications');
|
const { cancelAllReminders } = await import('@/services/notifications');
|
||||||
@@ -358,6 +360,15 @@ export default function SettingsScreen() {
|
|||||||
onPress={openCustomAccent}
|
onPress={openCustomAccent}
|
||||||
showChevron
|
showChevron
|
||||||
/>
|
/>
|
||||||
|
<Text style={[styles.sectionHint, { color: theme.textFaint }]}>Theme</Text>
|
||||||
|
<ListItem
|
||||||
|
title="Theme Mode"
|
||||||
|
subtitle={
|
||||||
|
themeMode === 'system' ? 'System default' : themeMode === 'dark' ? 'Dark' : 'Light'
|
||||||
|
}
|
||||||
|
onPress={() => setPicker('themeMode')}
|
||||||
|
showChevron
|
||||||
|
/>
|
||||||
<Text style={[styles.sectionTitle, { color: theme.textMuted }]}>Data</Text>
|
<Text style={[styles.sectionTitle, { color: theme.textMuted }]}>Data</Text>
|
||||||
<SyncStatus />
|
<SyncStatus />
|
||||||
<ListItem
|
<ListItem
|
||||||
@@ -366,6 +377,32 @@ export default function SettingsScreen() {
|
|||||||
onPress={() => setSyncVisible(true)}
|
onPress={() => setSyncVisible(true)}
|
||||||
showChevron
|
showChevron
|
||||||
/>
|
/>
|
||||||
|
<ListItem
|
||||||
|
title="Sync Settings to Server"
|
||||||
|
subtitle="Push local settings to backend"
|
||||||
|
onPress={async () => {
|
||||||
|
try {
|
||||||
|
await syncSettingsToServer();
|
||||||
|
Alert.alert('Success', 'Settings synced to server');
|
||||||
|
} catch {
|
||||||
|
Alert.alert('Error', 'Failed to sync settings');
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
showChevron
|
||||||
|
/>
|
||||||
|
<ListItem
|
||||||
|
title="Load Settings from Server"
|
||||||
|
subtitle="Pull settings from backend"
|
||||||
|
onPress={async () => {
|
||||||
|
try {
|
||||||
|
await loadSettingsFromServer();
|
||||||
|
Alert.alert('Success', 'Settings loaded from server');
|
||||||
|
} catch {
|
||||||
|
Alert.alert('Error', 'Failed to load settings');
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
showChevron
|
||||||
|
/>
|
||||||
<ListItem
|
<ListItem
|
||||||
title="Friends"
|
title="Friends"
|
||||||
subtitle="Manage friends and requests"
|
subtitle="Manage friends and requests"
|
||||||
@@ -444,6 +481,15 @@ export default function SettingsScreen() {
|
|||||||
onClose={() => setPicker(null)}
|
onClose={() => setPicker(null)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<OptionPickerModal
|
||||||
|
visible={picker === 'themeMode'}
|
||||||
|
title="Theme Mode"
|
||||||
|
options={THEME_MODE_OPTIONS}
|
||||||
|
selectedValue={themeMode}
|
||||||
|
onSelect={value => setThemeMode(value as ThemeMode)}
|
||||||
|
onClose={() => setPicker(null)}
|
||||||
|
/>
|
||||||
|
|
||||||
<CategoryEditorModal
|
<CategoryEditorModal
|
||||||
visible={editorVisible}
|
visible={editorVisible}
|
||||||
category={editorCategory}
|
category={editorCategory}
|
||||||
@@ -551,6 +597,12 @@ const AHEAD_OPTIONS: { value: string; label: string }[] = Array.from({ length: 2
|
|||||||
label: i === 0 ? 'Only today' : `${i} day${i === 1 ? '' : 's'}`,
|
label: i === 0 ? 'Only today' : `${i} day${i === 1 ? '' : 's'}`,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const THEME_MODE_OPTIONS: { value: ThemeMode; label: string }[] = [
|
||||||
|
{ value: 'light', label: 'Light' },
|
||||||
|
{ value: 'dark', label: 'Dark' },
|
||||||
|
{ value: 'system', label: 'System default' },
|
||||||
|
];
|
||||||
|
|
||||||
function formatSyncTime(timestamp: number): string {
|
function formatSyncTime(timestamp: number): string {
|
||||||
const seconds = Math.floor((Date.now() - timestamp) / 1000);
|
const seconds = Math.floor((Date.now() - timestamp) / 1000);
|
||||||
if (seconds < 60) return 'just now';
|
if (seconds < 60) return 'just now';
|
||||||
|
|||||||
@@ -285,4 +285,4 @@ export async function rescheduleAllReminders(
|
|||||||
export function useNotificationSettings() {
|
export function useNotificationSettings() {
|
||||||
const { notifications, reminderPreference } = useSettings();
|
const { notifications, reminderPreference } = useSettings();
|
||||||
return { notificationsEnabled: notifications, globalReminderPreference: reminderPreference };
|
return { notificationsEnabled: notifications, globalReminderPreference: reminderPreference };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
import React, { createContext, useCallback, useContext, useEffect, useMemo, useState, ReactNode } from 'react';
|
import React, {
|
||||||
|
createContext,
|
||||||
|
useCallback,
|
||||||
|
useContext,
|
||||||
|
useEffect,
|
||||||
|
useMemo,
|
||||||
|
useState,
|
||||||
|
ReactNode,
|
||||||
|
} from 'react';
|
||||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||||
import { DEFAULT_API_BASE_URL, API_URL_KEY } from '@/services/auth';
|
import { DEFAULT_API_BASE_URL, API_URL_KEY } from '@/services/auth';
|
||||||
import { Platform } from 'react-native';
|
import { Platform } from 'react-native';
|
||||||
@@ -110,10 +118,15 @@ function accentTextColor(accent: string): string {
|
|||||||
return luminance > 0.5 ? '#111111' : '#FFFFFF';
|
return luminance > 0.5 ? '#111111' : '#FFFFFF';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function colors(accent: string = DEFAULT_ACCENT, mode: ThemeMode = 'dark', opacity: number = 1): ThemeColors {
|
export function colors(
|
||||||
|
accent: string = DEFAULT_ACCENT,
|
||||||
|
mode: ThemeMode = 'dark',
|
||||||
|
opacity: number = 1
|
||||||
|
): ThemeColors {
|
||||||
const softAccent = desaturate(accent, 0.35);
|
const softAccent = desaturate(accent, 0.35);
|
||||||
const accentWithOpacity = opacity < 1 ? `${opacity.toString(16).padStart(2, '0')}${accent.slice(1)}` : accent;
|
const accentWithOpacity =
|
||||||
|
opacity < 1 ? `${opacity.toString(16).padStart(2, '0')}${accent.slice(1)}` : accent;
|
||||||
|
|
||||||
if (mode === 'light') {
|
if (mode === 'light') {
|
||||||
return {
|
return {
|
||||||
background: '#FFFFFF',
|
background: '#FFFFFF',
|
||||||
@@ -144,7 +157,7 @@ export function colors(accent: string = DEFAULT_ACCENT, mode: ThemeMode = 'dark'
|
|||||||
info: '#1E88E5',
|
info: '#1E88E5',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// dark mode
|
// dark mode
|
||||||
return {
|
return {
|
||||||
background: '#121212',
|
background: '#121212',
|
||||||
@@ -289,34 +302,52 @@ export function SettingsProvider({ children }: { children: ReactNode }) {
|
|||||||
STORAGE_KEYS.reminderPreference,
|
STORAGE_KEYS.reminderPreference,
|
||||||
'15'
|
'15'
|
||||||
);
|
);
|
||||||
const [tagReminderPreferences, setTagReminderPreferences] = useStoredSetting<TagReminderPreferences>(
|
const [tagReminderPreferences, setTagReminderPreferences] =
|
||||||
STORAGE_KEYS.tagReminderPreferences,
|
useStoredSetting<TagReminderPreferences>(STORAGE_KEYS.tagReminderPreferences, {});
|
||||||
{}
|
|
||||||
);
|
|
||||||
const [apiUrl, setApiUrl] = useStoredSetting<string>(API_URL_KEY, DEFAULT_API_BASE_URL);
|
const [apiUrl, setApiUrl] = useStoredSetting<string>(API_URL_KEY, DEFAULT_API_BASE_URL);
|
||||||
const [accentColor, setAccentColor] = useStoredSetting<string>(STORAGE_KEYS.accentColor, DEFAULT_ACCENT);
|
const [accentColor, setAccentColor] = useStoredSetting<string>(
|
||||||
const [accentOpacity, setAccentOpacity] = useStoredSetting<number>(STORAGE_KEYS.accentOpacity, DEFAULT_ACCENT_OPACITY);
|
STORAGE_KEYS.accentColor,
|
||||||
const [todoAheadDays, setTodoAheadDays] = useStoredSetting<number>(STORAGE_KEYS.todoAheadDays, DEFAULT_TODO_AHEAD_DAYS);
|
DEFAULT_ACCENT
|
||||||
const [showCompleted, setShowCompleted] = useStoredSetting<boolean>(STORAGE_KEYS.showCompleted, false);
|
);
|
||||||
const [deleteBySwipe, setDeleteBySwipe] = useStoredSetting<boolean>(STORAGE_KEYS.deleteBySwipe, false);
|
const [accentOpacity, setAccentOpacity] = useStoredSetting<number>(
|
||||||
|
STORAGE_KEYS.accentOpacity,
|
||||||
|
DEFAULT_ACCENT_OPACITY
|
||||||
|
);
|
||||||
|
const [todoAheadDays, setTodoAheadDays] = useStoredSetting<number>(
|
||||||
|
STORAGE_KEYS.todoAheadDays,
|
||||||
|
DEFAULT_TODO_AHEAD_DAYS
|
||||||
|
);
|
||||||
|
const [showCompleted, setShowCompleted] = useStoredSetting<boolean>(
|
||||||
|
STORAGE_KEYS.showCompleted,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
const [deleteBySwipe, setDeleteBySwipe] = useStoredSetting<boolean>(
|
||||||
|
STORAGE_KEYS.deleteBySwipe,
|
||||||
|
false
|
||||||
|
);
|
||||||
const [themeMode, setThemeMode, themeModeLoaded] = useStoredSetting<ThemeMode>(
|
const [themeMode, setThemeMode, themeModeLoaded] = useStoredSetting<ThemeMode>(
|
||||||
STORAGE_KEYS.themeMode,
|
STORAGE_KEYS.themeMode,
|
||||||
'system'
|
'system'
|
||||||
);
|
);
|
||||||
|
|
||||||
const effectiveMode = themeMode === 'system'
|
const effectiveMode: 'light' | 'dark' =
|
||||||
? (Platform.OS === 'web' ? 'dark' : 'dark') // Will be updated by useColorScheme in real app
|
themeMode === 'system'
|
||||||
: themeMode;
|
? 'dark' // Will be updated by useColorScheme in real app
|
||||||
|
: themeMode;
|
||||||
|
|
||||||
const theme = useMemo(() => colors(accentColor, effectiveMode, accentOpacity), [accentColor, effectiveMode, accentOpacity]);
|
const theme = useMemo(
|
||||||
|
() => colors(accentColor, effectiveMode, accentOpacity),
|
||||||
|
[accentColor, effectiveMode, accentOpacity]
|
||||||
|
);
|
||||||
|
|
||||||
const syncSettingsToServer = useCallback(async () => {
|
const syncSettingsToServer = useCallback(async () => {
|
||||||
const { getAuthToken } = await import('@/services/auth');
|
const { getAuthToken } = await import('@/services/auth');
|
||||||
const token = await getAuthToken();
|
const token = await getAuthToken();
|
||||||
if (!token) return;
|
if (!token) return;
|
||||||
|
|
||||||
|
const isDark = effectiveMode === 'dark';
|
||||||
const settings = {
|
const settings = {
|
||||||
darkMode: effectiveMode === 'dark' || (themeMode === 'system' && effectiveMode === 'dark'),
|
darkMode: isDark,
|
||||||
defaultCategoryId,
|
defaultCategoryId,
|
||||||
sortOrder: sortBy,
|
sortOrder: sortBy,
|
||||||
reminderPreference,
|
reminderPreference,
|
||||||
@@ -325,13 +356,23 @@ export function SettingsProvider({ children }: { children: ReactNode }) {
|
|||||||
deleteBySwipe,
|
deleteBySwipe,
|
||||||
};
|
};
|
||||||
await pushServerSettings(apiUrl, token, settings);
|
await pushServerSettings(apiUrl, token, settings);
|
||||||
}, [apiUrl, effectiveMode, themeMode, defaultCategoryId, sortBy, reminderPreference, todoAheadDays, showCompleted, deleteBySwipe]);
|
}, [
|
||||||
|
apiUrl,
|
||||||
|
effectiveMode,
|
||||||
|
themeMode,
|
||||||
|
defaultCategoryId,
|
||||||
|
sortBy,
|
||||||
|
reminderPreference,
|
||||||
|
todoAheadDays,
|
||||||
|
showCompleted,
|
||||||
|
deleteBySwipe,
|
||||||
|
]);
|
||||||
|
|
||||||
const loadSettingsFromServer = useCallback(async () => {
|
const loadSettingsFromServer = useCallback(async () => {
|
||||||
const { getAuthToken } = await import('@/services/auth');
|
const { getAuthToken } = await import('@/services/auth');
|
||||||
const token = await getAuthToken();
|
const token = await getAuthToken();
|
||||||
if (!token) return;
|
if (!token) return;
|
||||||
|
|
||||||
const serverSettings = await fetchServerSettings(apiUrl, token);
|
const serverSettings = await fetchServerSettings(apiUrl, token);
|
||||||
if (!serverSettings) return;
|
if (!serverSettings) return;
|
||||||
|
|
||||||
@@ -344,7 +385,16 @@ export function SettingsProvider({ children }: { children: ReactNode }) {
|
|||||||
if (serverSettings.todoAheadDays !== undefined) setTodoAheadDays(serverSettings.todoAheadDays);
|
if (serverSettings.todoAheadDays !== undefined) setTodoAheadDays(serverSettings.todoAheadDays);
|
||||||
if (serverSettings.showCompleted !== undefined) setShowCompleted(serverSettings.showCompleted);
|
if (serverSettings.showCompleted !== undefined) setShowCompleted(serverSettings.showCompleted);
|
||||||
if (serverSettings.deleteBySwipe !== undefined) setDeleteBySwipe(serverSettings.deleteBySwipe);
|
if (serverSettings.deleteBySwipe !== undefined) setDeleteBySwipe(serverSettings.deleteBySwipe);
|
||||||
}, [apiUrl, setThemeMode, setDefaultCategoryId, setSortBy, setReminderPreference, setTodoAheadDays, setShowCompleted, setDeleteBySwipe]);
|
}, [
|
||||||
|
apiUrl,
|
||||||
|
setThemeMode,
|
||||||
|
setDefaultCategoryId,
|
||||||
|
setSortBy,
|
||||||
|
setReminderPreference,
|
||||||
|
setTodoAheadDays,
|
||||||
|
setShowCompleted,
|
||||||
|
setDeleteBySwipe,
|
||||||
|
]);
|
||||||
|
|
||||||
const value = useMemo<SettingsContextType>(
|
const value = useMemo<SettingsContextType>(
|
||||||
() => ({
|
() => ({
|
||||||
@@ -407,11 +457,7 @@ export function SettingsProvider({ children }: { children: ReactNode }) {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return <SettingsContext.Provider value={value}>{children}</SettingsContext.Provider>;
|
||||||
<SettingsContext.Provider value={value}>
|
|
||||||
{children}
|
|
||||||
</SettingsContext.Provider>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useSettings() {
|
export function useSettings() {
|
||||||
@@ -422,4 +468,4 @@ export function useSettings() {
|
|||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
export * from './theme/tokens';
|
export * from './theme/tokens';
|
||||||
|
|||||||
Reference in New Issue
Block a user