diff --git a/lib/core/databases/sqflite_setup.dart b/lib/core/databases/sqflite_setup.dart index 1cf1ae13..c9c69e10 100644 --- a/lib/core/databases/sqflite_setup.dart +++ b/lib/core/databases/sqflite_setup.dart @@ -4,6 +4,7 @@ import 'package:dairy_app/core/logger/logger.dart'; import 'package:path_provider/path_provider.dart'; import 'package:sqflite/sqflite.dart'; import 'package:path/path.dart'; +import 'welcome_note.dart'; final log = printer("SQLTableSetup"); @@ -60,29 +61,17 @@ class DBProvider { ${NoteDependencies.ASSET_PATH} TEXT ) """); + log.i("All create queries executed successfully"); log.i("Inserting welcome note"); - //as soon as the tables are created, insert a welcome note - - String body = - """[{"insert":"Welcome to DiaryVault!\\n\\nKey Features:\\n\\n-Rich text editor with support for images and videos.\\n\\n-Your data is securely preserved on your Google Drive / Dropbox account, ensuring complete ownership and privacy\\r.\\n\\n-Sync data between multiple devices.\\r\\n\\n-Fingerprint login on supported devices.\\r\\n\\n-Multiple Themes.\\n\\n\\nHappy notemaking!\\nThe DiaryVault team.\\n\\n"}]"""; - Map notemap = { - Notes.ID: "f773a170-6447-11ee-9a76-c314b6be99a3", - Notes.CREATED_AT: DateTime.now().millisecondsSinceEpoch, - Notes.TITLE: "Welcome to DiaryVault", - Notes.BODY: body, - Notes.HASH: "welcome_note_hash", - Notes.LAST_MODIFIED: DateTime.now().millisecondsSinceEpoch, - Notes.PLAIN_TEXT: "Read me to get started!", - Notes.DELETED: 0, - Notes.AUTHOR_ID: "guest_user_id", - }; - await db.insert(Notes.TABLE_NAME, notemap); - - log.i("All create queries executed successfully"); + // As soon as the tables are created, insert a welcome note + // Check if there are no records in the notes table before inserting the initial data + final count = Sqflite.firstIntValue( + await db.rawQuery('SELECT COUNT(*) FROM ${Notes.TABLE_NAME}')); + if (count == 0) { + await db.insert(Notes.TABLE_NAME, welcomeNote); + } log.i("Welcome Note inserted into table: ${Notes.TABLE_NAME}"); - // print note - await db.query(Notes.TABLE_NAME).then((value) => log.i(value)); } catch (e) { log.e(e); rethrow; diff --git a/lib/core/databases/welcome_note.dart b/lib/core/databases/welcome_note.dart new file mode 100644 index 00000000..deed1d70 --- /dev/null +++ b/lib/core/databases/welcome_note.dart @@ -0,0 +1,12 @@ +final welcomeNote = { + "id": "f773a170-6447-11ee-9a76-c314b6be99a3", + "created_at": 1696597075215, + "title": "Welcome to DiaryVault", + "body": + "[{\"insert\":\"Welcome to DiaryVault\"},{\"insert\":\": \",\"attributes\":{\"color\":\"#FF8E24AA\"}},{\"insert\":\"Your Personal Journaling Companion\"},{\"insert\":\"\\n\\n\",\"attributes\":{\"header\":2}},{\"insert\":\"We're \"},{\"insert\":\"delighted\",\"attributes\":{\"bold\":true,\"color\":\"#FF00ACC1\"}},{\"insert\":\" \",\"attributes\":{\"bold\":true}},{\"insert\":\"to have you onboard., and we're \"},{\"insert\":\"excited \",\"attributes\":{\"italic\":true,\"color\":\"#FF03A9F4\"}},{\"insert\":\"to be your trusted partner in capturing your thoughts, memories and moments 📝\",\"attributes\":{\"color\":\"#FFFFFFFF\"}},{\"insert\":\"\\n\\nExpress Yourself with Rich Text:\"},{\"insert\":\"\\n\",\"attributes\":{\"header\":3}},{\"insert\":\"Our powerful rich text editor allows you to \"},{\"insert\":\"craft your entries \",\"attributes\":{\"bold\":true}},{\"insert\":\"just the way you envision them. Add \"},{\"insert\":\"images \",\"attributes\":{\"italic\":true,\"color\":\"#FF039BE5\",\"bold\":true}},{\"insert\":\"and \",\"attributes\":{\"color\":\"#FFFFFFFF\"}},{\"insert\":\"videos \",\"attributes\":{\"italic\":true,\"color\":\"#FF039BE5\",\"bold\":true}},{\"insert\":\"📸\",\"attributes\":{\"color\":\"#FF039BE5\"}},{\"insert\":\" \",\"attributes\":{\"italic\":true,\"color\":\"#FF039BE5\",\"bold\":true}},{\"insert\":\"to give life to your words and relive your memories.\",\"attributes\":{\"color\":\"#FFFFFFFF\"}},{\"insert\":\"\\n\\nYour Data, Your Control:\"},{\"insert\":\"\\n\",\"attributes\":{\"header\":3}},{\"insert\":\"Your privacy 🔏 matters to us. With DiaryVault your journal entries are securely stored in your own \"},{\"insert\":\"Google Drive \",\"attributes\":{\"color\":\"#FF00897B\",\"bold\":true}},{\"insert\":\"or \",\"attributes\":{\"color\":\"#FFFFFFFF\"}},{\"insert\":\"Dropbox \",\"attributes\":{\"color\":\"#FF00897B\",\"bold\":true}},{\"insert\":\"account\",\"attributes\":{\"color\":\"#FFFFFFFF\"}},{\"insert\":\". \",\"attributes\":{\"color\":\"#FF00897B\",\"bold\":true}},{\"insert\":\"You retain complete ownership and over your data. \",\"attributes\":{\"color\":\"#FFFFFFFF\"}},{\"insert\":\"\\n\\nOffline First Experience:\"},{\"insert\":\"\\n\",\"attributes\":{\"header\":2}},{\"insert\":\"You can utilize the app to the fullist even when you're offline. The app requires internet connection only during the signup process and cloud backup. \\n\\nSay Goodbye to Lost Notes:\"},{\"insert\":\"\\n\",\"attributes\":{\"header\":3}},{\"insert\":\"We've got your back. DiaryVault automatically saves your notes, so you don't have to worry about losing your precious thoughts. Write freely and we'll ensure your words are safe 💜.\\n\\nSeemless Cross-Device Sync: \"},{\"insert\":\"\\n\",\"attributes\":{\"header\":3}},{\"insert\":\"Whether you're using DiaryVault on one phone or multiple devices. Your data is always kept in sync 🔃. You can fully restore your data on a new device.\\n \\nQuick and Secure Access:\"},{\"insert\":\"\\n\",\"attributes\":{\"header\":3}},{\"insert\":\"DiaryVault ensures the safety and security of your notes with \"},{\"insert\":\"fingerprint \",\"attributes\":{\"color\":\"#FF2962FF\",\"bold\":true}},{\"insert\":\"and \",\"attributes\":{\"color\":\"#FFFFFFFF\"}},{\"insert\":\"PIN\",\"attributes\":{\"color\":\"#FF2962FF\",\"bold\":true}},{\"insert\":\" based authentication 🔐, providing you with peace of mind and safeguarding your personal thoughts from prying eyes\\n\\nExport your Notes:\"},{\"insert\":\"\\n\",\"attributes\":{\"header\":3}},{\"insert\":\"DiaryVault allows you to export your entries in the form of \"},{\"insert\":\"text files \",\"attributes\":{\"color\":\"#FF00ACC1\",\"bold\":true}},{\"insert\":\"and\",\"attributes\":{\"color\":\"#FFFFFFFF\"}},{\"insert\":\" PDF\",\"attributes\":{\"color\":\"#FF00ACC1\",\"bold\":true}},{\"insert\":\". Share your thoughts easily with your friends or keep an offline copy for yourself.\\n\\nNever Miss a Day with Daily Reminders:\"},{\"insert\":\"\\n\",\"attributes\":{\"header\":3}},{\"insert\":\"You can setup daily reminder \"},{\"insert\":\"notifications\",\"attributes\":{\"bold\":true,\"color\":\"#FFD500F9\"}},{\"insert\":\" to ensure you never miss a day of journaling. Stay commited to your writing routine effortlessly 🔔✍️.\\n\\nPersonalize Your Experience:\"},{\"insert\":\"\\n\",\"attributes\":{\"header\":3}},{\"insert\":\"Explore multiple themes, fonts, pen-colors to make your journal uniquely yours 🎠..\\n\\nListen to Your Notes:\"},{\"insert\":\"\\n\",\"attributes\":{\"header\":3}},{\"insert\":\"DiaryVault offers Text-to-speech, enabling you to transform your written words into spoken ones. Sit back, relax and let your words come to life as you listen to your journals 🔊.\\n\\nYour Ad-free and Free of Cost Writing Journey:\"},{\"insert\":\"\\n\",\"attributes\":{\"header\":3}},{\"insert\":\"We're dedicated to providing you with a precious writing journey that's entirely ad-free and free of cost. Our focus is on preserving the sanctity of your writing experience, ensuring no interruptions or hidden fees 💎🚫✍️.\\n\\n\"},{\"insert\":\"Happy Journaling 🎉\",\"attributes\":{\"italic\":true}},{\"insert\":\"\\nThe DiaryVault Team\\n\\n\"},{\"insert\":{\"image\":\"https://imgur.com/PumJ9nC.png\"}},{\"insert\":\"\\n\\n\\n\\n\"}]", + "hash": "29d508083d4238085e2c114b2148c995cbce9d78", + "last_modified": 1696705796903, + "plain_text": "Open this note to get started", + "deleted": 0, + "author_id": "guest_user_id" +}; diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 00000000..15de9b7b --- /dev/null +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,42 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + +import device_info_plus +import file_selector_macos +import firebase_auth +import firebase_core +import flutter_secure_storage_macos +import flutter_tts +import flutter_web_auth_2 +import package_info_plus +import pasteboard +import path_provider_foundation +import share_plus +import shared_preferences_foundation +import simple_accordion +import sqflite +import url_launcher_macos +import window_to_front + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) + FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) + FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) + FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) + FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) + FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin")) + FlutterWebAuth2Plugin.register(with: registry.registrar(forPlugin: "FlutterWebAuth2Plugin")) + FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) + PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin")) + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) + SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) + SimpleAccordionPlugin.register(with: registry.registrar(forPlugin: "SimpleAccordionPlugin")) + SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) + WindowToFrontPlugin.register(with: registry.registrar(forPlugin: "WindowToFrontPlugin")) +} diff --git a/macos/Flutter/ephemeral/Flutter-Generated.xcconfig b/macos/Flutter/ephemeral/Flutter-Generated.xcconfig new file mode 100644 index 00000000..426ca2a1 --- /dev/null +++ b/macos/Flutter/ephemeral/Flutter-Generated.xcconfig @@ -0,0 +1,11 @@ +// This is a generated file; do not edit or check into version control. +FLUTTER_ROOT=/Users/sanketh.bk/sdk/flutter3 +FLUTTER_APPLICATION_PATH=/Users/sanketh.bk/my_projects/flutter/apps in production/dairy_app +COCOAPODS_PARALLEL_CODE_SIGN=true +FLUTTER_BUILD_DIR=build +FLUTTER_BUILD_NAME=2.1.1 +FLUTTER_BUILD_NUMBER=7 +DART_OBFUSCATION=false +TRACK_WIDGET_CREATION=true +TREE_SHAKE_ICONS=false +PACKAGE_CONFIG=.dart_tool/package_config.json