mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 11:47:54 +01:00
mobile: restrict attachment upload by logged out users
This commit is contained in:
@@ -59,6 +59,7 @@ export type Settings = {
|
||||
fontScale: number;
|
||||
markdownShortcuts: boolean;
|
||||
features: Record<any, any>;
|
||||
loggedIn: boolean;
|
||||
};
|
||||
|
||||
export type EditorProps = {
|
||||
|
||||
@@ -165,6 +165,7 @@ export const useEditorEvents = (
|
||||
state.timeFormat
|
||||
]);
|
||||
const handleBack = useRef<NativeEventSubscription>();
|
||||
const loggedIn = useUserStore((state) => !!state.user);
|
||||
const { fontScale } = useWindowDimensions();
|
||||
|
||||
const doubleSpacedLines = useSettingStore(
|
||||
@@ -224,7 +225,8 @@ export const useEditorEvents = (
|
||||
timeFormat: db.settings?.getTimeFormat(),
|
||||
fontScale,
|
||||
markdownShortcuts,
|
||||
features
|
||||
features,
|
||||
loggedIn
|
||||
});
|
||||
}, [
|
||||
fullscreen,
|
||||
@@ -242,7 +244,8 @@ export const useEditorEvents = (
|
||||
timeFormat,
|
||||
loading,
|
||||
fontScale,
|
||||
markdownShortcuts
|
||||
markdownShortcuts,
|
||||
loggedIn
|
||||
]);
|
||||
|
||||
const onBackPress = useCallback(async () => {
|
||||
@@ -556,9 +559,17 @@ export const useEditorEvents = (
|
||||
if (editor.state.current?.isFocused) {
|
||||
editor.state.current.isFocused = true;
|
||||
}
|
||||
PaywallSheet.present(
|
||||
await isFeatureAvailable(editorMessage.value.feature)
|
||||
);
|
||||
if (editorMessage.value.feature === "insertAttachment") {
|
||||
ToastManager.show({
|
||||
type: "info",
|
||||
message: strings.loginRequired()
|
||||
});
|
||||
} else {
|
||||
PaywallSheet.present(
|
||||
await isFeatureAvailable(editorMessage.value.feature)
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
case EditorEvents.monograph:
|
||||
publishNote();
|
||||
|
||||
@@ -113,7 +113,8 @@ const Tiptap = ({
|
||||
claims: {
|
||||
callout: !!settings.features?.callout?.isAllowed,
|
||||
outlineList: !!settings.features?.outlineList?.isAllowed,
|
||||
taskList: !!settings.features?.taskList?.isAllowed
|
||||
taskList: !!settings.features?.taskList?.isAllowed,
|
||||
insertAttachment: settings.loggedIn
|
||||
},
|
||||
onPermissionDenied: (claim) => {
|
||||
post(
|
||||
|
||||
@@ -34,7 +34,8 @@ const initialState = {
|
||||
fontFamily: "sans-serif",
|
||||
fontSize: 16,
|
||||
timeFormat: "12-hour",
|
||||
dateFormat: "DD-MM-YYYY"
|
||||
dateFormat: "DD-MM-YYYY",
|
||||
loggedIn: false
|
||||
};
|
||||
|
||||
global.settingsController = {
|
||||
|
||||
@@ -53,6 +53,7 @@ export type Settings = {
|
||||
fontScale: number;
|
||||
markdownShortcuts: boolean;
|
||||
features: Record<any, any>;
|
||||
loggedIn: boolean;
|
||||
};
|
||||
|
||||
/* eslint-disable no-var */
|
||||
|
||||
Reference in New Issue
Block a user