make sure multiple default notes are not created

This commit is contained in:
ammarahm-ed
2021-04-06 13:37:32 +05:00
parent eb4bf5fa3f
commit 24d29d83e9
2 changed files with 5 additions and 2 deletions

View File

@@ -51,7 +51,7 @@ const App = () => {
await MMKV.setItem(
'askForRating',
JSON.stringify({
timestamp: Date.now() + (86400000 * 2),
timestamp: Date.now() + 86400000 * 2,
}),
);
}
@@ -104,6 +104,8 @@ const App = () => {
async function loadDefaultNotes() {
try {
const isCreated = await MMKV.getItem('defaultNoteCreated');
if (isCreated) return;
const notes = await http.get(
'https://app.notesnook.com/notes/index.json',
);
@@ -117,6 +119,7 @@ const App = () => {
content: {type: 'tiny', data: content},
});
}
await MMKV.setItem('defaultNoteCreated', 'yes');
} catch (e) {
console.log(e);
}

View File

@@ -245,7 +245,7 @@ const SplashScreen = () => {
width={isNext ? null : '100%'}
onPress={async () => {
if (isNext) {
carouselRef.current?.snapToNext();
carouselRef.current?.snapToItem(currentIndex + 1,true,true);
currentIndex++;
if (currentIndex === 4) {
setIsNext(false);