mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
make sure multiple default notes are not created
This commit is contained in:
@@ -51,7 +51,7 @@ const App = () => {
|
|||||||
await MMKV.setItem(
|
await MMKV.setItem(
|
||||||
'askForRating',
|
'askForRating',
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
timestamp: Date.now() + (86400000 * 2),
|
timestamp: Date.now() + 86400000 * 2,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -104,6 +104,8 @@ const App = () => {
|
|||||||
|
|
||||||
async function loadDefaultNotes() {
|
async function loadDefaultNotes() {
|
||||||
try {
|
try {
|
||||||
|
const isCreated = await MMKV.getItem('defaultNoteCreated');
|
||||||
|
if (isCreated) return;
|
||||||
const notes = await http.get(
|
const notes = await http.get(
|
||||||
'https://app.notesnook.com/notes/index.json',
|
'https://app.notesnook.com/notes/index.json',
|
||||||
);
|
);
|
||||||
@@ -117,6 +119,7 @@ const App = () => {
|
|||||||
content: {type: 'tiny', data: content},
|
content: {type: 'tiny', data: content},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
await MMKV.setItem('defaultNoteCreated', 'yes');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ const SplashScreen = () => {
|
|||||||
width={isNext ? null : '100%'}
|
width={isNext ? null : '100%'}
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
if (isNext) {
|
if (isNext) {
|
||||||
carouselRef.current?.snapToNext();
|
carouselRef.current?.snapToItem(currentIndex + 1,true,true);
|
||||||
currentIndex++;
|
currentIndex++;
|
||||||
if (currentIndex === 4) {
|
if (currentIndex === 4) {
|
||||||
setIsNext(false);
|
setIsNext(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user