mobile: fix build ang bugs

This commit is contained in:
Ammar Ahmed
2023-12-12 13:50:02 +05:00
committed by Abdullah Atta
parent 54cf77e6e5
commit 2d1ceef943
9 changed files with 41 additions and 37 deletions

View File

@@ -36,11 +36,11 @@ database.host(
SSE_HOST: "https://events.streetwriters.co",
SUBSCRIPTIONS_HOST: "https://subscriptions.streetwriters.co",
ISSUES_HOST: "https://issues.streetwriters.co"
// API_HOST: "http://192.168.43.108:5264",
// AUTH_HOST: "http://192.168.43.108:8264",
// SSE_HOST: "http://192.168.43.108:7264",
// SUBSCRIPTIONS_HOST: "http://192.168.43.108:9264",
// ISSUES_HOST: "http://192.168.43.108:2624"
// API_HOST: "http://192.168.43.5:5264",
// AUTH_HOST: "http://192.168.43.5:8264",
// SSE_HOST: "http://192.168.43.5:7264",
// SUBSCRIPTIONS_HOST: "http://192.168.43.5:9264",
// ISSUES_HOST: "http://192.168.43.5:2624"
}
: {
API_HOST: "https://api.notesnook.com",
@@ -61,18 +61,15 @@ database.setup({
},
batchSize: 500,
sqliteOptions: {
dialect: {
createDriver: () =>
new RNSqliteDriver({ async: true, dbName: "test.db" }),
dialect: (name) => ({
createDriver: () => {
return new RNSqliteDriver({ async: true, dbName: name });
},
createAdapter: () => new SqliteAdapter(),
createIntrospector: (db) => new SqliteIntrospector(db),
createQueryCompiler: () => new SqliteQueryCompiler()
}
// journalMode: "MEMORY",
// synchronous: "normal",
// pageSize: 8192,
// cacheSize: -16000,
// lockingMode: "exclusive"
}),
tempStore: "memory"
}
});

View File

@@ -45,15 +45,15 @@ export class RNSqliteDriver implements Driver {
}
async beginTransaction(connection: DatabaseConnection): Promise<void> {
await connection.executeQuery(CompiledQuery.raw("begin"));
await connection.executeQuery(CompiledQuery.raw("BEGIN TRANSACTION"));
}
async commitTransaction(connection: DatabaseConnection): Promise<void> {
await connection.executeQuery(CompiledQuery.raw("commit"));
await connection.executeQuery(CompiledQuery.raw("COMMIT"));
}
async rollbackTransaction(connection: DatabaseConnection): Promise<void> {
await connection.executeQuery(CompiledQuery.raw("rollback"));
await connection.executeQuery(CompiledQuery.raw("ROLLBACK"));
}
async releaseConnection(): Promise<void> {

View File

@@ -17,9 +17,11 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { getFormattedDate } from "@notesnook/common";
import { useThemeColors } from "@notesnook/theme";
import KeepAwake from "@sayem314/react-native-keep-awake";
import React, { useEffect, useRef, useState } from "react";
import { Modal, SafeAreaView, Text, View } from "react-native";
import { SafeAreaView, Text, View } from "react-native";
import Animated from "react-native-reanimated";
import { db } from "../../common/database";
import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets";
@@ -33,7 +35,7 @@ import {
} from "../../services/event-manager";
import Navigation from "../../services/navigation";
import Sync from "../../services/sync";
import { useThemeColors } from "@notesnook/theme";
import { useSettingStore } from "../../stores/use-setting-store";
import { eOnLoadNote, eShowMergeDialog } from "../../utils/events";
import { SIZE } from "../../utils/size";
import { sleep } from "../../utils/time";
@@ -45,8 +47,6 @@ import { Button } from "../ui/button";
import { IconButton } from "../ui/icon-button";
import Seperator from "../ui/seperator";
import Paragraph from "../ui/typography/paragraph";
import { useSettingStore } from "../../stores/use-setting-store";
import { getFormattedDate } from "@notesnook/common";
const MergeConflicts = () => {
const { colors } = useThemeColors();
@@ -62,7 +62,7 @@ const MergeConflicts = () => {
const applyChanges = async () => {
let _content = keep;
let note = db.notes.note(_content.noteId).data;
let note = await db.notes.note(_content.noteId);
await db.notes.add({
id: note.id,
conflicted: false,
@@ -100,7 +100,7 @@ const MergeConflicts = () => {
};
const show = async (item) => {
let noteContent = await db.content.raw(item.contentId);
let noteContent = await db.content.get(item.contentId);
content.current = { ...noteContent };
if (__DEV__) {
if (!noteContent.conflicted) {
@@ -320,7 +320,7 @@ const MergeConflicts = () => {
readonly
editorId=":conflictPrimary"
onLoad={async () => {
const note = db.notes.note(content.current?.noteId)?.data;
const note = await db.notes.note(content.current?.noteId);
if (!note) return;
await sleep(300);
eSendEvent(eOnLoadNote + ":conflictPrimary", {
@@ -357,7 +357,7 @@ const MergeConflicts = () => {
readonly
editorId=":conflictSecondary"
onLoad={async () => {
const note = db.notes.note(content.current?.noteId)?.data;
const note = await db.notes.note(content.current?.noteId);
if (!note) return;
await sleep(300);
eSendEvent(eOnLoadNote + ":conflictSecondary", {

View File

@@ -136,7 +136,7 @@ const MoveNoteSheet = ({
const renderNotebook = useCallback(
({ item, index }: { item: string | number; index: number }) => (
<NotebookItem items={notebooks} id={item as string} index={index} />
<NotebookItem items={notebooks} id={index} index={index} />
),
[notebooks]
);

View File

@@ -52,8 +52,10 @@ export const NotebookItem = ({
parent?: NotebookParentProp;
items?: VirtualizedGrouping<Notebook>;
}) => {
const expanded = useNotebookExpandedStore((state) => state.expanded[id]);
const { nestedNotebooks, notebook: item } = useNotebook(id, items, expanded);
const { nestedNotebooks, notebook: item } = useNotebook(id, items, true);
const expanded = useNotebookExpandedStore((state) =>
item?.id ? state.expanded[item?.id] : false
);
const { totalNotes: totalNotes, getTotalNotes } = useTotalNotes("notebook");
const focusedRouteId = useNavigationStore((state) => state.focusedRouteId);
const { colors } = useThemeColors("sheet");
@@ -240,8 +242,8 @@ export const NotebookItem = ({
? null
: nestedNotebooks?.ids.map((id, index) => (
<NotebookItem
key={item?.id + "_" + id}
id={id}
key={item?.id + "_" + index}
id={index}
index={index}
currentLevel={currentLevel + 1}
items={nestedNotebooks}

View File

@@ -16,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { GroupHeader, Notebook, VirtualizedGrouping } from "@notesnook/core";
import { Notebook, VirtualizedGrouping } from "@notesnook/core";
import { useThemeColors } from "@notesnook/theme";
import React, {
createContext,
@@ -149,7 +149,7 @@ export const NotebookSheet = () => {
}) => (
<NotebookItem
items={notebooks}
id={item as string}
id={index}
index={index}
totalNotes={totalNotes}
/>
@@ -588,7 +588,7 @@ const NotebookItem = ({
: item &&
nestedNotebooks?.ids.map((id, index) => (
<NotebookItem
key={item.id + "_" + id}
key={item.id + "_" + index}
id={index}
index={index}
totalNotes={nestedNotebookNotesCount}

View File

@@ -44,7 +44,10 @@ export const MenuItem = React.memo(
item.func();
} else {
if (useNavigationStore.getState().currentRoute !== item.name) {
Navigation.push(item.name, { canGoBack: false, beta: item.isBeta });
Navigation.navigate(item.name, {
canGoBack: false,
beta: item.isBeta
});
}
}
if (item.close) {

View File

@@ -364,17 +364,18 @@ async function scheduleNotification(
}
});
}
await notifee.createTriggerNotification(
{
id: trigger.id,
title: title,
body: description,
title: !title ? undefined : title,
body: !description ? undefined : description,
data: {
type: "reminder",
payload: payload || "",
dateModified: reminder.dateModified + ""
},
subtitle: description,
subtitle: !description ? undefined : description,
android: {
channelId: await getChannelId(priority),
smallIcon: "ic_stat_name",

View File

@@ -100,6 +100,7 @@ module.exports = (env) => {
"react-native-blob-util": path.join(__dirname, "../node_modules/react-native-blob-util"),
"@mdi/js": path.join(__dirname, "../node_modules/@mdi/js/mdi.js"),
"katex": path.join(__dirname, "../node_modules/katex"),
"tinycolor2": path.join(__dirname, "../node_modules/tinycolor2"),
},
},
/**