Skip to content

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

update to latest MMKV

ammarahm-edad11f93fdaa6
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index f4009dc4d..c017cdf22 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -58,7 +58,7 @@ const App = () => {
s = defaultState.settings;
s = JSON.stringify(s);
s.fontScale = 1;
- await MMKV.setString('settings', s);
+ await MMKV.setStringAsync('settings', s);
dispatch({type: ACTIONS.SETTINGS, s});
} else {
s = JSON.parse(s);
diff --git a/apps/mobile/ios/Podfile.lock b/apps/mobile/ios/Podfile.lock
index 80609ded6..937e9e94a 100644
--- a/apps/mobile/ios/Podfile.lock
+++ b/apps/mobile/ios/Podfile.lock
@@ -185,7 +185,7 @@ PODS:
- React-jsinspector (0.61.5)
- react-native-aes (1.3.6):
- React
- - react-native-fast-storage (0.1.4):
+ - react-native-mmkv-storage (0.1.5):
- MMKV (= 1.0.23)
- React
- react-native-orientation (3.1.3):
@@ -259,7 +259,7 @@ DEPENDENCIES:
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- 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-webview (from `../node_modules/react-native-webview`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
@@ -317,8 +317,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/jsinspector"
react-native-aes:
:path: "../node_modules/react-native-aes-crypto"
- react-native-fast-storage:
- :path: "../node_modules/react-native-fast-storage"
+ react-native-mmkv-storage:
+ :path: "../node_modules/react-native-mmkv-storage"
react-native-orientation:
:path: "../node_modules/react-native-orientation"
react-native-webview:
@@ -376,7 +376,7 @@ SPEC CHECKSUMS:
React-jsiexecutor: d5525f9ed5f782fdbacb64b9b01a43a9323d2386
React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0
react-native-aes: 22ea989d641f53ea7722fe6b146349ed66e6455d
- react-native-fast-storage: bc274e68f7d87ffe777a1d20479544b7cd429b1d
+ react-native-mmkv-storage: fe0db5290c1321b4be87765a88c6fd302ccd541e
react-native-orientation: f1caf84d65f1a4fd4511a18f2b924e634ad7a628
react-native-webview: 2aadbfef6b9eaa9e89b306ae3e31e6e870a6306d
React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
diff --git a/apps/mobile/src/common/common.js b/apps/mobile/src/common/common.js
index d2c02e84a..19cb35a1e 100755
--- a/apps/mobile/src/common/common.js
+++ b/apps/mobile/src/common/common.js
@@ -189,14 +189,14 @@ export async function getColorScheme() {
let t = await MMKV.getString('theme');
if (typeof accentColor !== 'string') {
- MMKV.setString('accentColor', '#0560FF');
+ MMKV.setStringAsync('accentColor', '#0560FF');
setAccentColor('#0560FF');
} else {
setAccentColor(accentColor);
}
if (typeof t !== 'string') {
- MMKV.setString('theme', JSON.stringify({night: false}));
+ MMKV.setStringAsync('theme', JSON.stringify({night: false}));
setColorScheme(COLOR_SCHEME_LIGHT);
} else {
let themeToSet = JSON.parse(t);
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js
index 1a42f3907..496e14e04 100644
--- a/apps/mobile/src/components/ActionSheetComponent/index.js
+++ b/apps/mobile/src/components/ActionSheetComponent/index.js
@@ -283,10 +283,10 @@ export const ActionSheetComponent = ({
icon: 'theme-light-dark',
func: () => {
if (!colors.night) {
- MMKV.setString('theme', JSON.stringify({night: true}));
+ MMKV.setStringAsync('theme', JSON.stringify({night: true}));
changeColorScheme(COLOR_SCHEME_DARK);
} else {
- MMKV.setString('theme', JSON.stringify({night: false}));
+ MMKV.setStringAsync('theme', JSON.stringify({night: false}));
changeColorScheme(COLOR_SCHEME_LIGHT);
}
},
diff --git a/apps/mobile/src/components/EditorMenu/index.js b/apps/mobile/src/components/EditorMenu/index.js
index a689e6cd4..873385ff0 100644
--- a/apps/mobile/src/components/EditorMenu/index.js
+++ b/apps/mobile/src/components/EditorMenu/index.js
@@ -326,13 +326,13 @@ export const EditorMenu = ({updateProps = () => {}, timestamp}) => {
icon: 'moon',
func: () => {
if (!colors.night) {
- MMKV.setString(
+ MMKV.setStringAsync(
'theme',
JSON.stringify(COLOR_SCHEME_DARK),
);
changeColorScheme(COLOR_SCHEME_DARK);
} else {
- MMKV.setString(
+ MMKV.setStringAsync(
'theme',
JSON.stringify(COLOR_SCHEME_LIGHT),
);
diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.js
index 24fdfe981..4bf2a2168 100644
--- a/apps/mobile/src/components/Menu/index.js
+++ b/apps/mobile/src/components/Menu/index.js
@@ -93,10 +93,10 @@ export const Menu = ({
icon: 'theme-light-dark',
func: () => {
if (!colors.night) {
- MMKV.setString('theme', JSON.stringify({night: true}));
+ MMKV.setStringAsync('theme', JSON.stringify({night: true}));
changeColorScheme(COLOR_SCHEME_DARK);
} else {
- MMKV.setString('theme', JSON.stringify({night: false}));
+ MMKV.setStringAsync('theme', JSON.stringify({night: false}));
changeColorScheme(COLOR_SCHEME_LIGHT);
}
diff --git a/apps/mobile/src/utils/storage.js b/apps/mobile/src/utils/storage.js
index f32fa926d..eb3584335 100644
--- a/apps/mobile/src/utils/storage.js
+++ b/apps/mobile/src/utils/storage.js
@@ -6,9 +6,9 @@ var Aes = NativeModules.Aes;
async function read(key, isArray = false) {
let data;
if (isArray) {
- data = await MMKV.getArray(key);
+ data = await MMKV.getArrayAsync(key);
} else {
- data = await MMKV.getMap(key);
+ data = await MMKV.getMapAsync(key);
}
return isArray ? data.slice() : data;
@@ -16,9 +16,9 @@ async function read(key, isArray = false) {
async function write(key, data) {
if (data.length !== undefined) {
- return await MMKV.setArray(key, data.slice());
+ return await MMKV.setArrayAsync(key, data.slice());
} 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) {
return [];
} else {
- let data = await MMKV.getMultipleItems(keys.slice());
+ let data = await MMKV.getMultipleItemsAsync(keys.slice());
return !data ? undefined : data;
}
}
diff --git a/apps/mobile/src/utils/utils.js b/apps/mobile/src/utils/utils.js
index 9637cff28..ce89c9b0c 100755
--- a/apps/mobile/src/utils/utils.js
+++ b/apps/mobile/src/utils/utils.js
@@ -20,7 +20,7 @@ export const db = new Storage(StorageInterface);
export async function setSetting(settings, name, value) {
let s = {...settings};
s[name] = value;
- await MMKV.setString('settings', JSON.stringify(s));
+ await MMKV.setStringAsync('settings', JSON.stringify(s));
updateEvent({type: ACTIONS.SETTINGS, settings: s});
}
diff --git a/apps/mobile/src/views/AppearanceSettings/index.js b/apps/mobile/src/views/AppearanceSettings/index.js
index a2c6bd1a1..586f5bc0e 100644
--- a/apps/mobile/src/views/AppearanceSettings/index.js
+++ b/apps/mobile/src/views/AppearanceSettings/index.js
@@ -99,7 +99,7 @@ const AppearanceSettings = ({navigation}) => {
onPress={() => {
changeAccentColor(item);
- MMKV.setString('accentColor', item);
+ MMKV.setStringAsync('accentColor', item);
}}
style={{
flexDirection: 'row',
@@ -127,10 +127,10 @@ const AppearanceSettings = ({navigation}) => {
<TouchableOpacity
onPress={() => {
if (!colors.night) {
- MMKV.setString('theme', JSON.stringify({night: true}));
+ MMKV.setStringAsync('theme', JSON.stringify({night: true}));
changeColorScheme(COLOR_SCHEME_DARK);
} else {
- MMKV.setString('theme', JSON.stringify({night: false}));
+ MMKV.setStringAsync('theme', JSON.stringify({night: false}));
changeColorScheme(COLOR_SCHEME_LIGHT);
}
@@ -165,10 +165,10 @@ const AppearanceSettings = ({navigation}) => {
<TouchableOpacity
onPress={() => {
if (!colors.night) {
- MMKV.setString('theme', JSON.stringify({night: true}));
+ MMKV.setStringAsync('theme', JSON.stringify({night: true}));
changeColorScheme(COLOR_SCHEME_DARK);
} else {
- MMKV.setString('theme', JSON.stringify({night: false}));
+ MMKV.setStringAsync('theme', JSON.stringify({night: false}));
changeColorScheme(COLOR_SCHEME_LIGHT);
}
diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js
index 4da3eb40f..93f53460c 100644
--- a/apps/mobile/src/views/Settings/index.js
+++ b/apps/mobile/src/views/Settings/index.js
@@ -321,7 +321,7 @@ export const Settings = ({navigation}) => {
onPress={() => {
changeAccentColor(item);
- MMKV.setString('accentColor', item);
+ MMKV.setStringAsync('accentColor', item);
}}
style={{
flexDirection: 'row',
@@ -349,10 +349,10 @@ export const Settings = ({navigation}) => {
<TouchableOpacity
onPress={() => {
if (!colors.night) {
- MMKV.setString('theme', JSON.stringify({night: true}));
+ MMKV.setStringAsync('theme', JSON.stringify({night: true}));
changeColorScheme(COLOR_SCHEME_DARK);
} else {
- MMKV.setString('theme', JSON.stringify({night: false}));
+ MMKV.setStringAsync('theme', JSON.stringify({night: false}));
changeColorScheme(COLOR_SCHEME_LIGHT);
}