diff --git a/app/assets/javascripts/Components/AttachedFilesPopover/AttachedFilesButton.tsx b/app/assets/javascripts/Components/AttachedFilesPopover/AttachedFilesButton.tsx index ca55425fd..78799a23f 100644 --- a/app/assets/javascripts/Components/AttachedFilesPopover/AttachedFilesButton.tsx +++ b/app/assets/javascripts/Components/AttachedFilesPopover/AttachedFilesButton.tsx @@ -72,7 +72,7 @@ export const AttachedFilesButton: FunctionComponent = observer( }, [application, note]) const toggleAttachedFilesMenu = useCallback(async () => { - if (!appState.features.isEntitledToFiles) { + if (!appState.features.hasFiles) { premiumModal.activate('Files') return } @@ -99,7 +99,7 @@ export const AttachedFilesButton: FunctionComponent = observer( setOpen(newOpenState) } - }, [appState.features.isEntitledToFiles, onClickPreprocessing, open, premiumModal]) + }, [appState.features.hasFiles, onClickPreprocessing, open, premiumModal]) const deleteFile = async (file: SNFile) => { const shouldDelete = await confirmDialog({ @@ -294,6 +294,10 @@ export const AttachedFilesButton: FunctionComponent = observer( setIsDraggingFiles(false) + if (!appState.features.hasFiles) { + return + } + if (event.dataTransfer?.items.length) { Array.from(event.dataTransfer.items).forEach(async (item) => { const fileOrHandle = StreamingFileReader.available() @@ -321,7 +325,7 @@ export const AttachedFilesButton: FunctionComponent = observer( dragCounter.current = 0 } }, - [appState.files, attachFileToNote, currentTab], + [appState.files, appState.features.hasFiles, attachFileToNote, currentTab], ) useEffect(() => { diff --git a/app/assets/javascripts/Components/Files/FilePreviewInfoPanel.tsx b/app/assets/javascripts/Components/Files/FilePreviewInfoPanel.tsx index 2c6a1da76..b106e9acc 100644 --- a/app/assets/javascripts/Components/Files/FilePreviewInfoPanel.tsx +++ b/app/assets/javascripts/Components/Files/FilePreviewInfoPanel.tsx @@ -18,7 +18,10 @@ export const FilePreviewInfoPanel: FunctionComponent = ({ file }) => { Type: {file.mimeType}
- Size: {formatSizeToReadableString(file.decryptedSize)} + Decrypted Size: {formatSizeToReadableString(file.decryptedSize)} +
+
+ Encrypted Size: {formatSizeToReadableString(file.encryptedSize)}
Created: {file.created_at.toLocaleString()} diff --git a/app/assets/javascripts/Components/NoteView/NoteView.tsx b/app/assets/javascripts/Components/NoteView/NoteView.tsx index 1f2dc9c77..dd09f1a56 100644 --- a/app/assets/javascripts/Components/NoteView/NoteView.tsx +++ b/app/assets/javascripts/Components/NoteView/NoteView.tsx @@ -947,15 +947,13 @@ export class NoteView extends PureComponent { {this.state.noteStatus?.desc &&
{this.state.noteStatus.desc}
}
- {this.appState.features.isFilesEnabled && ( -
- -
- )} +
+ +
= ({ tags, }) => { const flags = flagsForNote(note) + const hasFiles = application.items.getFilesForNote(note).length > 0 const showModifiedDate = sortedBy === CollectionSort.UpdatedAt const editorForNote = application.componentManager.editorForNote(note) const editorName = editorForNote?.name ?? PLAIN_EDITOR_NAME @@ -132,6 +133,11 @@ export const NotesListItem: FunctionComponent = ({ )} + {hasFiles && ( + + + + )}
) diff --git a/app/assets/javascripts/Components/Preferences/Panes/Account/index.tsx b/app/assets/javascripts/Components/Preferences/Panes/Account/index.tsx index 0f9f8fefe..bed91f9a0 100644 --- a/app/assets/javascripts/Components/Preferences/Panes/Account/index.tsx +++ b/app/assets/javascripts/Components/Preferences/Panes/Account/index.tsx @@ -25,7 +25,7 @@ export const AccountPreferences = observer(({ application, appState }: Props) => )} - {application.hasAccount() && appState.features.isEntitledToFiles && } + {application.hasAccount() && appState.features.hasFiles && } )) diff --git a/app/assets/javascripts/Components/PremiumFeaturesModal/index.tsx b/app/assets/javascripts/Components/PremiumFeaturesModal/index.tsx index ae1be2c8f..e9a03f6e0 100644 --- a/app/assets/javascripts/Components/PremiumFeaturesModal/index.tsx +++ b/app/assets/javascripts/Components/PremiumFeaturesModal/index.tsx @@ -48,10 +48,10 @@ export const PremiumFeaturesModal: FunctionalComponent = ({
-
Enable Premium Features
+
Enable Advanced Features
- In order to use {featureName} and other premium features, please + In order to use {featureName} and other advanced features, please purchase a subscription or upgrade your current plan.
diff --git a/app/assets/javascripts/UIModels/AppState/FeaturesState.ts b/app/assets/javascripts/UIModels/AppState/FeaturesState.ts index 8bcb2475e..f8b06bf2f 100644 --- a/app/assets/javascripts/UIModels/AppState/FeaturesState.ts +++ b/app/assets/javascripts/UIModels/AppState/FeaturesState.ts @@ -1,27 +1,23 @@ import { WebApplication } from '@/UIModels/Application' -import { isDev } from '@/Utils' import { ApplicationEvent, FeatureIdentifier, FeatureStatus } from '@standardnotes/snjs' -import { action, computed, makeObservable, observable, runInAction, when } from 'mobx' +import { action, makeObservable, observable, runInAction, when } from 'mobx' export class FeaturesState { hasFolders: boolean hasSmartViews: boolean - hasFilesBeta: boolean + hasFiles: boolean premiumAlertFeatureName: string | undefined constructor(private application: WebApplication, appObservers: (() => void)[]) { - this.hasFolders = this.hasNativeFolders() - this.hasSmartViews = this.hasNativeSmartViews() - this.hasFilesBeta = this.isEntitledToFilesBeta() + this.hasFolders = this.isEntitledToFolders() + this.hasSmartViews = this.isEntitledToSmartViews() + this.hasFiles = this.isEntitledToFiles() this.premiumAlertFeatureName = undefined makeObservable(this, { hasFolders: observable, hasSmartViews: observable, - - hasFilesBeta: observable, - isFilesEnabled: computed, - isEntitledToFiles: computed, + hasFiles: observable, premiumAlertFeatureName: observable, showPremiumAlert: action, @@ -37,9 +33,9 @@ export class FeaturesState { case ApplicationEvent.FeaturesUpdated: case ApplicationEvent.Launched: runInAction(() => { - this.hasFolders = this.hasNativeFolders() - this.hasSmartViews = this.hasNativeSmartViews() - this.hasFilesBeta = this.isEntitledToFilesBeta() + this.hasFolders = this.isEntitledToFolders() + this.hasSmartViews = this.isEntitledToSmartViews() + this.hasFiles = this.isEntitledToFiles() }) } }), @@ -55,32 +51,21 @@ export class FeaturesState { this.premiumAlertFeatureName = undefined } - get isFilesEnabled(): boolean { - return this.hasFilesBeta || window.enabledUnfinishedFeatures || isDev + private isEntitledToFiles(): boolean { + const status = this.application.features.getFeatureStatus(FeatureIdentifier.Files) + + return status === FeatureStatus.Entitled } - get isEntitledToFiles(): boolean { - return this.hasFilesBeta - } - - private hasNativeFolders(): boolean { + private isEntitledToFolders(): boolean { const status = this.application.features.getFeatureStatus(FeatureIdentifier.TagNesting) return status === FeatureStatus.Entitled } - private hasNativeSmartViews(): boolean { + private isEntitledToSmartViews(): boolean { const status = this.application.features.getFeatureStatus(FeatureIdentifier.SmartFilters) return status === FeatureStatus.Entitled } - - private isEntitledToFilesBeta(): boolean { - if (isDev && this.application.hasAccount()) { - return true - } - - const status = this.application.features.getFeatureStatus(FeatureIdentifier.FilesBeta) - return status === FeatureStatus.Entitled - } }