mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
update to latest MMKV
This commit is contained in:
@@ -58,7 +58,7 @@ const App = () => {
|
|||||||
s = defaultState.settings;
|
s = defaultState.settings;
|
||||||
s = JSON.stringify(s);
|
s = JSON.stringify(s);
|
||||||
s.fontScale = 1;
|
s.fontScale = 1;
|
||||||
await MMKV.setString('settings', s);
|
await MMKV.setStringAsync('settings', s);
|
||||||
dispatch({type: ACTIONS.SETTINGS, s});
|
dispatch({type: ACTIONS.SETTINGS, s});
|
||||||
} else {
|
} else {
|
||||||
s = JSON.parse(s);
|
s = JSON.parse(s);
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ PODS:
|
|||||||
- React-jsinspector (0.61.5)
|
- React-jsinspector (0.61.5)
|
||||||
- react-native-aes (1.3.6):
|
- react-native-aes (1.3.6):
|
||||||
- React
|
- React
|
||||||
- react-native-fast-storage (0.1.4):
|
- react-native-mmkv-storage (0.1.5):
|
||||||
- MMKV (= 1.0.23)
|
- MMKV (= 1.0.23)
|
||||||
- React
|
- React
|
||||||
- react-native-orientation (3.1.3):
|
- react-native-orientation (3.1.3):
|
||||||
@@ -259,7 +259,7 @@ DEPENDENCIES:
|
|||||||
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
|
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
|
||||||
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
|
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
|
||||||
- react-native-aes (from `../node_modules/react-native-aes-crypto`)
|
- react-native-aes (from `../node_modules/react-native-aes-crypto`)
|
||||||
- react-native-fast-storage (from `../node_modules/react-native-fast-storage`)
|
- react-native-mmkv-storage (from `../node_modules/react-native-mmkv-storage`)
|
||||||
- react-native-orientation (from `../node_modules/react-native-orientation`)
|
- react-native-orientation (from `../node_modules/react-native-orientation`)
|
||||||
- react-native-webview (from `../node_modules/react-native-webview`)
|
- react-native-webview (from `../node_modules/react-native-webview`)
|
||||||
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
|
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
|
||||||
@@ -317,8 +317,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: "../node_modules/react-native/ReactCommon/jsinspector"
|
:path: "../node_modules/react-native/ReactCommon/jsinspector"
|
||||||
react-native-aes:
|
react-native-aes:
|
||||||
:path: "../node_modules/react-native-aes-crypto"
|
:path: "../node_modules/react-native-aes-crypto"
|
||||||
react-native-fast-storage:
|
react-native-mmkv-storage:
|
||||||
:path: "../node_modules/react-native-fast-storage"
|
:path: "../node_modules/react-native-mmkv-storage"
|
||||||
react-native-orientation:
|
react-native-orientation:
|
||||||
:path: "../node_modules/react-native-orientation"
|
:path: "../node_modules/react-native-orientation"
|
||||||
react-native-webview:
|
react-native-webview:
|
||||||
@@ -376,7 +376,7 @@ SPEC CHECKSUMS:
|
|||||||
React-jsiexecutor: d5525f9ed5f782fdbacb64b9b01a43a9323d2386
|
React-jsiexecutor: d5525f9ed5f782fdbacb64b9b01a43a9323d2386
|
||||||
React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0
|
React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0
|
||||||
react-native-aes: 22ea989d641f53ea7722fe6b146349ed66e6455d
|
react-native-aes: 22ea989d641f53ea7722fe6b146349ed66e6455d
|
||||||
react-native-fast-storage: bc274e68f7d87ffe777a1d20479544b7cd429b1d
|
react-native-mmkv-storage: fe0db5290c1321b4be87765a88c6fd302ccd541e
|
||||||
react-native-orientation: f1caf84d65f1a4fd4511a18f2b924e634ad7a628
|
react-native-orientation: f1caf84d65f1a4fd4511a18f2b924e634ad7a628
|
||||||
react-native-webview: 2aadbfef6b9eaa9e89b306ae3e31e6e870a6306d
|
react-native-webview: 2aadbfef6b9eaa9e89b306ae3e31e6e870a6306d
|
||||||
React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
|
React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
|
||||||
|
|||||||
@@ -189,14 +189,14 @@ export async function getColorScheme() {
|
|||||||
let t = await MMKV.getString('theme');
|
let t = await MMKV.getString('theme');
|
||||||
|
|
||||||
if (typeof accentColor !== 'string') {
|
if (typeof accentColor !== 'string') {
|
||||||
MMKV.setString('accentColor', '#0560FF');
|
MMKV.setStringAsync('accentColor', '#0560FF');
|
||||||
setAccentColor('#0560FF');
|
setAccentColor('#0560FF');
|
||||||
} else {
|
} else {
|
||||||
setAccentColor(accentColor);
|
setAccentColor(accentColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof t !== 'string') {
|
if (typeof t !== 'string') {
|
||||||
MMKV.setString('theme', JSON.stringify({night: false}));
|
MMKV.setStringAsync('theme', JSON.stringify({night: false}));
|
||||||
setColorScheme(COLOR_SCHEME_LIGHT);
|
setColorScheme(COLOR_SCHEME_LIGHT);
|
||||||
} else {
|
} else {
|
||||||
let themeToSet = JSON.parse(t);
|
let themeToSet = JSON.parse(t);
|
||||||
|
|||||||
@@ -283,10 +283,10 @@ export const ActionSheetComponent = ({
|
|||||||
icon: 'theme-light-dark',
|
icon: 'theme-light-dark',
|
||||||
func: () => {
|
func: () => {
|
||||||
if (!colors.night) {
|
if (!colors.night) {
|
||||||
MMKV.setString('theme', JSON.stringify({night: true}));
|
MMKV.setStringAsync('theme', JSON.stringify({night: true}));
|
||||||
changeColorScheme(COLOR_SCHEME_DARK);
|
changeColorScheme(COLOR_SCHEME_DARK);
|
||||||
} else {
|
} else {
|
||||||
MMKV.setString('theme', JSON.stringify({night: false}));
|
MMKV.setStringAsync('theme', JSON.stringify({night: false}));
|
||||||
changeColorScheme(COLOR_SCHEME_LIGHT);
|
changeColorScheme(COLOR_SCHEME_LIGHT);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -326,13 +326,13 @@ export const EditorMenu = ({updateProps = () => {}, timestamp}) => {
|
|||||||
icon: 'moon',
|
icon: 'moon',
|
||||||
func: () => {
|
func: () => {
|
||||||
if (!colors.night) {
|
if (!colors.night) {
|
||||||
MMKV.setString(
|
MMKV.setStringAsync(
|
||||||
'theme',
|
'theme',
|
||||||
JSON.stringify(COLOR_SCHEME_DARK),
|
JSON.stringify(COLOR_SCHEME_DARK),
|
||||||
);
|
);
|
||||||
changeColorScheme(COLOR_SCHEME_DARK);
|
changeColorScheme(COLOR_SCHEME_DARK);
|
||||||
} else {
|
} else {
|
||||||
MMKV.setString(
|
MMKV.setStringAsync(
|
||||||
'theme',
|
'theme',
|
||||||
JSON.stringify(COLOR_SCHEME_LIGHT),
|
JSON.stringify(COLOR_SCHEME_LIGHT),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -93,10 +93,10 @@ export const Menu = ({
|
|||||||
icon: 'theme-light-dark',
|
icon: 'theme-light-dark',
|
||||||
func: () => {
|
func: () => {
|
||||||
if (!colors.night) {
|
if (!colors.night) {
|
||||||
MMKV.setString('theme', JSON.stringify({night: true}));
|
MMKV.setStringAsync('theme', JSON.stringify({night: true}));
|
||||||
changeColorScheme(COLOR_SCHEME_DARK);
|
changeColorScheme(COLOR_SCHEME_DARK);
|
||||||
} else {
|
} else {
|
||||||
MMKV.setString('theme', JSON.stringify({night: false}));
|
MMKV.setStringAsync('theme', JSON.stringify({night: false}));
|
||||||
|
|
||||||
changeColorScheme(COLOR_SCHEME_LIGHT);
|
changeColorScheme(COLOR_SCHEME_LIGHT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ var Aes = NativeModules.Aes;
|
|||||||
async function read(key, isArray = false) {
|
async function read(key, isArray = false) {
|
||||||
let data;
|
let data;
|
||||||
if (isArray) {
|
if (isArray) {
|
||||||
data = await MMKV.getArray(key);
|
data = await MMKV.getArrayAsync(key);
|
||||||
} else {
|
} else {
|
||||||
data = await MMKV.getMap(key);
|
data = await MMKV.getMapAsync(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return isArray ? data.slice() : data;
|
return isArray ? data.slice() : data;
|
||||||
@@ -16,9 +16,9 @@ async function read(key, isArray = false) {
|
|||||||
|
|
||||||
async function write(key, data) {
|
async function write(key, data) {
|
||||||
if (data.length !== undefined) {
|
if (data.length !== undefined) {
|
||||||
return await MMKV.setArray(key, data.slice());
|
return await MMKV.setArrayAsync(key, data.slice());
|
||||||
} else {
|
} else {
|
||||||
return await MMKV.setMap(key, data);
|
return await MMKV.setMapAsync(key, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ async function readMulti(keys) {
|
|||||||
if (keys.length <= 0) {
|
if (keys.length <= 0) {
|
||||||
return [];
|
return [];
|
||||||
} else {
|
} else {
|
||||||
let data = await MMKV.getMultipleItems(keys.slice());
|
let data = await MMKV.getMultipleItemsAsync(keys.slice());
|
||||||
return !data ? undefined : data;
|
return !data ? undefined : data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export const db = new Storage(StorageInterface);
|
|||||||
export async function setSetting(settings, name, value) {
|
export async function setSetting(settings, name, value) {
|
||||||
let s = {...settings};
|
let s = {...settings};
|
||||||
s[name] = value;
|
s[name] = value;
|
||||||
await MMKV.setString('settings', JSON.stringify(s));
|
await MMKV.setStringAsync('settings', JSON.stringify(s));
|
||||||
|
|
||||||
updateEvent({type: ACTIONS.SETTINGS, settings: s});
|
updateEvent({type: ACTIONS.SETTINGS, settings: s});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ const AppearanceSettings = ({navigation}) => {
|
|||||||
onPress={() => {
|
onPress={() => {
|
||||||
changeAccentColor(item);
|
changeAccentColor(item);
|
||||||
|
|
||||||
MMKV.setString('accentColor', item);
|
MMKV.setStringAsync('accentColor', item);
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
@@ -127,10 +127,10 @@ const AppearanceSettings = ({navigation}) => {
|
|||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (!colors.night) {
|
if (!colors.night) {
|
||||||
MMKV.setString('theme', JSON.stringify({night: true}));
|
MMKV.setStringAsync('theme', JSON.stringify({night: true}));
|
||||||
changeColorScheme(COLOR_SCHEME_DARK);
|
changeColorScheme(COLOR_SCHEME_DARK);
|
||||||
} else {
|
} else {
|
||||||
MMKV.setString('theme', JSON.stringify({night: false}));
|
MMKV.setStringAsync('theme', JSON.stringify({night: false}));
|
||||||
|
|
||||||
changeColorScheme(COLOR_SCHEME_LIGHT);
|
changeColorScheme(COLOR_SCHEME_LIGHT);
|
||||||
}
|
}
|
||||||
@@ -165,10 +165,10 @@ const AppearanceSettings = ({navigation}) => {
|
|||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (!colors.night) {
|
if (!colors.night) {
|
||||||
MMKV.setString('theme', JSON.stringify({night: true}));
|
MMKV.setStringAsync('theme', JSON.stringify({night: true}));
|
||||||
changeColorScheme(COLOR_SCHEME_DARK);
|
changeColorScheme(COLOR_SCHEME_DARK);
|
||||||
} else {
|
} else {
|
||||||
MMKV.setString('theme', JSON.stringify({night: false}));
|
MMKV.setStringAsync('theme', JSON.stringify({night: false}));
|
||||||
|
|
||||||
changeColorScheme(COLOR_SCHEME_LIGHT);
|
changeColorScheme(COLOR_SCHEME_LIGHT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ export const Settings = ({navigation}) => {
|
|||||||
onPress={() => {
|
onPress={() => {
|
||||||
changeAccentColor(item);
|
changeAccentColor(item);
|
||||||
|
|
||||||
MMKV.setString('accentColor', item);
|
MMKV.setStringAsync('accentColor', item);
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
@@ -349,10 +349,10 @@ export const Settings = ({navigation}) => {
|
|||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (!colors.night) {
|
if (!colors.night) {
|
||||||
MMKV.setString('theme', JSON.stringify({night: true}));
|
MMKV.setStringAsync('theme', JSON.stringify({night: true}));
|
||||||
changeColorScheme(COLOR_SCHEME_DARK);
|
changeColorScheme(COLOR_SCHEME_DARK);
|
||||||
} else {
|
} else {
|
||||||
MMKV.setString('theme', JSON.stringify({night: false}));
|
MMKV.setStringAsync('theme', JSON.stringify({night: false}));
|
||||||
|
|
||||||
changeColorScheme(COLOR_SCHEME_LIGHT);
|
changeColorScheme(COLOR_SCHEME_LIGHT);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user