Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

add accent color support in share extension

ammarahm-ed44056a189b5d
diff --git a/apps/mobile/share/index.js b/apps/mobile/share/index.js
index a70eed804..48471af1e 100644
--- a/apps/mobile/share/index.js
+++ b/apps/mobile/share/index.js
@@ -119,6 +119,8 @@ const modes = {
const NotesnookShare = ({quicknote = false}) => {
const colors = useShareStore(state => state.colors);
+ const accent = useShareStore(state => state.accent);
+
const appendNote = useShareStore(state => state.appendNote);
const [note, setNote] = useState({...defaultNote});
const [loadingIntent, setLoadingIntent] = useState(true);
@@ -166,6 +168,7 @@ const NotesnookShare = ({quicknote = false}) => {
};
useEffect(() => {
+ useShareStore.getState().setAccent();
let keyboardWillChangeFrame = Keyboard.addListener(
'keyboardWillChangeFrame',
onKeyboardWillChangeFrame
@@ -236,7 +239,7 @@ const NotesnookShare = ({quicknote = false}) => {
sleep(50).then(() => {
animate(1, 0);
sleep(500).then(r => {
- Storage.write('shareExtensionOpened',"opened");
+ Storage.write('shareExtensionOpened', 'opened');
});
});
}, []);
@@ -263,7 +266,6 @@ const NotesnookShare = ({quicknote = false}) => {
pageTheme.colors = ${theme};
setTheme();
`);
-
}, 300);
let theme = {...colors};
theme.factor = 1;
@@ -446,7 +448,7 @@ const NotesnookShare = ({quicknote = false}) => {
<Button
type="action"
icon="check"
- iconColor={colors.accent}
+ iconColor={accent.color}
onPress={onPress}
style={{
width: 50,
@@ -532,7 +534,7 @@ const NotesnookShare = ({quicknote = false}) => {
flexDirection: 'row'
}}>
<Button
- color={appendNote ? colors.nav : colors.accent}
+ color={appendNote ? colors.nav : accent.color}
onPress={() => {
useShareStore.getState().setAppendNote(null);
}}
@@ -549,7 +551,7 @@ const NotesnookShare = ({quicknote = false}) => {
/>
<Button
- color={!appendNote ? colors.nav : colors.accent}
+ color={!appendNote ? colors.nav : accent.color}
onPress={() => {
setShowSearch(true);
animate(1, 1000);
@@ -575,7 +577,7 @@ const NotesnookShare = ({quicknote = false}) => {
}}>
{!quicknote ? (
<Button
- color={colors.accent}
+ color={accent.color}
onPress={onPress}
loading={loading || loadingIntent}
icon="check"
@@ -616,7 +618,7 @@ const NotesnookShare = ({quicknote = false}) => {
width: '100%',
height: '100%',
borderRadius: 10,
- backgroundColor:'transparent'
+ backgroundColor: 'transparent'
}}
cacheMode="LOAD_DEFAULT"
domStorageEnabled={true}
@@ -658,7 +660,7 @@ const NotesnookShare = ({quicknote = false}) => {
This shared note will be appended to{' '}
<Text
style={{
- color: colors.accent,
+ color: accent.color,
fontFamily: 'OpenSans-SemiBold'
}}>
"{appendNote.title}"
@@ -681,8 +683,8 @@ const NotesnookShare = ({quicknote = false}) => {
onPress={() => changeMode(2)}
title={modes[2].title}
iconSize={18}
- iconColor={mode == 2 ? colors.accent : colors.icon}
- textColor={mode == 2 ? colors.accent : colors.icon}
+ iconColor={mode == 2 ? accent.color : colors.icon}
+ textColor={mode == 2 ? accent.color : colors.icon}
type="rounded"
style={{paddingHorizontal: 12}}
/>
@@ -693,8 +695,8 @@ const NotesnookShare = ({quicknote = false}) => {
onPress={() => changeMode(1)}
title={modes[1].title}
iconSize={18}
- iconColor={mode == 1 ? colors.accent : colors.icon}
- textColor={mode == 1 ? colors.accent : colors.icon}
+ iconColor={mode == 1 ? accent.color : colors.icon}
+ textColor={mode == 1 ? accent.color : colors.icon}
type="rounded"
style={{paddingHorizontal: 12}}
/>
diff --git a/apps/mobile/share/store.js b/apps/mobile/share/store.js
index 19620a842..b8270f775 100644
--- a/apps/mobile/share/store.js
+++ b/apps/mobile/share/store.js
@@ -1,13 +1,28 @@
-import {Appearance} from 'react-native';
+import { Appearance } from 'react-native';
import create from 'zustand';
-import {COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT} from '../src/utils/Colors';
-import {MMKV} from '../src/utils/mmkv';
+import {
+ ACCENT, COLOR_SCHEME_DARK,
+ COLOR_SCHEME_LIGHT,
+ setAccentColor
+} from '../src/utils/Colors';
+import { MMKV } from '../src/utils/mmkv';
export const useShareStore = create((set, get) => ({
colors:
Appearance.getColorScheme() === 'dark'
? COLOR_SCHEME_DARK
: COLOR_SCHEME_LIGHT,
+ accent:ACCENT,
+ setAccent: async () => {
+ let accent = await MMKV.getItem('accentColor');
+ if (accent) {
+ accent = {
+ color:accent,
+ shade:accent + "12"
+ }
+ set({accent:accent});
+ };
+ },
appendNote: null,
setAppendNote: note => {
MMKV.setItem('shareMenuAppendNote', JSON.stringify(note));