mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
mobile: add file size limits
This commit is contained in:
@@ -35,8 +35,7 @@ import PremiumService from "../../../services/premium";
|
||||
import { eCloseSheet } from "../../../utils/events";
|
||||
import { editorController, editorState } from "./utils";
|
||||
import { isImage } from "@notesnook/core/utils/filename";
|
||||
const FILE_SIZE_LIMIT = 500 * 1024 * 1024;
|
||||
const IMAGE_SIZE_LIMIT = 50 * 1024 * 1024;
|
||||
import { FILE_SIZE_LIMIT, IMAGE_SIZE_LIMIT } from "../../../utils/constants";
|
||||
|
||||
const showEncryptionSheet = (file) => {
|
||||
presentSheet({
|
||||
|
||||
@@ -21,6 +21,8 @@ import { Platform } from "react-native";
|
||||
import { Monographs } from "../screens/notes/monographs";
|
||||
|
||||
export const IOS_APPGROUPID = "group.org.streetwriters.notesnook";
|
||||
export const FILE_SIZE_LIMIT = 500 * 1024 * 1024;
|
||||
export const IMAGE_SIZE_LIMIT = 50 * 1024 * 1024;
|
||||
|
||||
export const STORE_LINK =
|
||||
Platform.OS === "ios"
|
||||
|
||||
@@ -63,5 +63,7 @@
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>appGroupId</key>
|
||||
<string>group.org.streetwriters.notesnook</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -151,5 +151,7 @@
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
<key>appGroupId</key>
|
||||
<string>group.org.streetwriters.notesnook</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -52,6 +52,7 @@ import { Search } from "./search";
|
||||
import { initDatabase, useShareStore } from "./store";
|
||||
import { isImage } from "@notesnook/core/utils/filename";
|
||||
import { NoteBundle } from "../app/utils/note-bundle";
|
||||
import { FILE_SIZE_LIMIT, IMAGE_SIZE_LIMIT } from "../app/utils/constants";
|
||||
|
||||
const getLinkPreview = (url) => {
|
||||
return getPreviewData(url, 5000);
|
||||
@@ -280,6 +281,12 @@ const ShareView = ({ quicknote = false }) => {
|
||||
} else {
|
||||
const user = await db.user.getUser();
|
||||
if (user && user.subscription.type !== 0) {
|
||||
if (
|
||||
(isImage(item.type) && item.size > IMAGE_SIZE_LIMIT) ||
|
||||
(!isImage(item.type) && item.size > FILE_SIZE_LIMIT)
|
||||
)
|
||||
continue;
|
||||
|
||||
setRawFiles((files) => {
|
||||
const index = files.findIndex((file) => file.name === item.name);
|
||||
if (index === -1) {
|
||||
|
||||
Reference in New Issue
Block a user