Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: fix platform check

ammarahm-ed50c05efb48fa
diff --git a/apps/mobile/app/screens/editor/tiptap/commands.ts b/apps/mobile/app/screens/editor/tiptap/commands.ts
index e8340de6c..c9c0303d8 100644
--- a/apps/mobile/app/screens/editor/tiptap/commands.ts
+++ b/apps/mobile/app/screens/editor/tiptap/commands.ts
@@ -48,6 +48,7 @@ const fn = (fn: string) => {
const id = randId("fn_");
return {
job: `(async () => {
+ if (typeof __PLATFORM__ === "undefined") __PLATFORM__ = "${Platform.OS}";
try {
let response = true;
${fn}
diff --git a/packages/editor-mobile/src/components/editor.tsx b/packages/editor-mobile/src/components/editor.tsx
index 000d553aa..b5a663c9b 100644
--- a/packages/editor-mobile/src/components/editor.tsx
+++ b/packages/editor-mobile/src/components/editor.tsx
@@ -44,7 +44,7 @@ import Title from "./title";
import { keepLastLineInView } from "@notesnook/editor/dist/extensions/keep-in-view/keep-in-view";
function isIOSBrowser() {
- return /(iphone|applewebkit)/g.test(navigator.userAgent.toLowerCase());
+ return __PLATFORM__ !== "android";
}
const Tiptap = ({
diff --git a/packages/editor-mobile/src/utils/index.ts b/packages/editor-mobile/src/utils/index.ts
index 27d046f1b..564b12462 100644
--- a/packages/editor-mobile/src/utils/index.ts
+++ b/packages/editor-mobile/src/utils/index.ts
@@ -52,6 +52,7 @@ declare global {
}>
>;
}>;
+ var __PLATFORM__: "ios" | "android";
var readonly: boolean;
var noToolbar: boolean;
var noHeader: boolean;
@@ -95,7 +96,6 @@ declare global {
};
var editorTitle: RefObject<HTMLInputElement>;
-
/**
* Global ref to manage tags in editor.
*/
@@ -113,7 +113,7 @@ declare global {
*/
function post<T extends keyof typeof EventTypes>(
- type: typeof EventTypes[T],
+ type: (typeof EventTypes)[T],
value?: unknown
): void;
interface Window {
@@ -166,7 +166,7 @@ export function logger(
}
export function post<T extends keyof typeof EventTypes>(
- type: typeof EventTypes[T],
+ type: (typeof EventTypes)[T],
value?: unknown
): void {
if (isReactNative()) {