mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
mobile: fix build ang bugs
This commit is contained in:
committed by
Abdullah Atta
parent
81fe67253a
commit
8b927ca94f
@@ -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"
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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> {
|
||||
|
||||
@@ -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", {
|
||||
|
||||
@@ -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]
|
||||
);
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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"),
|
||||
},
|
||||
},
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user