Skip to content

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

feat: add new feature sheet

ammarahm-edf216ac503e87
diff --git a/apps/mobile/features.ts b/apps/mobile/features.ts
new file mode 100644
index 000000000..c619d5013
--- /dev/null
+++ b/apps/mobile/features.ts
@@ -0,0 +1,12 @@
+import { FeatureType } from './src/components/sheets/new-feature';
+
+export const features: FeatureType[] = [
+ {
+ title: 'Manage attachments',
+ body: 'Now you can go to Settings to view and manage all file & image attachments from one place.'
+ },
+ {
+ title: 'Automatic system theme',
+ body: 'User on basic plan can now enable automatic system theme switching (Day/Night). Go to Settings > Appearence to enable it.'
+ }
+];
diff --git a/apps/mobile/src/components/attachments/actions.js b/apps/mobile/src/components/attachments/actions.js
index 5c353f6fb..d7793ef63 100644
--- a/apps/mobile/src/components/attachments/actions.js
+++ b/apps/mobile/src/components/attachments/actions.js
@@ -3,6 +3,7 @@ import React, { useState } from 'react';
import { View } from 'react-native';
import picker from '../../screens/editor/tiny/toolbar/picker';
import { eSendEvent, presentSheet, ToastEvent } from '../../services/event-manager';
+import PremiumService from '../../services/premium';
import { useAttachmentStore } from '../../stores/stores';
import { useThemeStore } from '../../stores/theme';
import { formatBytes } from '../../utils';
@@ -42,6 +43,14 @@ const Actions = ({ attachment, setAttachments }) => {
{
name: 'Reupload',
onPress: async () => {
+ if (PremiumService.get()) {
+ ToastEvent.show({
+ heading: 'Upgrade to pro',
+ type: 'error',
+ context: 'local'
+ });
+ return;
+ }
await picker.pick({
reupload: true,
hash: attachment.metadata.hash,
diff --git a/apps/mobile/src/components/attachments/index.js b/apps/mobile/src/components/attachments/index.js
index 9a33721ca..1f9561c65 100644
--- a/apps/mobile/src/components/attachments/index.js
+++ b/apps/mobile/src/components/attachments/index.js
@@ -98,7 +98,7 @@ export const AttachmentDialog = () => {
paragraph="Tap on an attachment to view properties"
button={{
title: 'Check all',
- type: 'accent',
+ type: 'grayAccent',
loading: loading,
onPress: async () => {
setLoading(true);
diff --git a/apps/mobile/src/components/launcher/index.js b/apps/mobile/src/components/launcher/index.js
index b68725210..841ac51c3 100644
--- a/apps/mobile/src/components/launcher/index.js
+++ b/apps/mobile/src/components/launcher/index.js
@@ -36,6 +36,7 @@ import { SvgView } from '../ui/svg';
import Heading from '../ui/typography/heading';
import Paragraph from '../ui/typography/paragraph';
import { Walkthrough } from '../walkthroughs';
+import NewFeature from '../sheets/new-feature/index';
const Launcher = () => {
const colors = useThemeStore(state => state.colors);
@@ -124,6 +125,7 @@ const Launcher = () => {
return;
}
+ if (NewFeature.present()) return;
if (await checkAppUpdateAvailable()) return;
if (await checkForRateAppRequest()) return;
if (await checkNeedsBackup()) return;
diff --git a/apps/mobile/src/components/sheets/newfeature/index.tsx b/apps/mobile/src/components/sheets/newfeature/index.tsx
new file mode 100644
index 000000000..9170e32ac
--- /dev/null
+++ b/apps/mobile/src/components/sheets/newfeature/index.tsx
@@ -0,0 +1,81 @@
+import React from 'react';
+import { View } from 'react-native';
+import { APP_VERSION } from '../../../../version';
+import { eSendEvent, presentSheet } from '../../../services/event-manager';
+import SettingsService from '../../../services/settings';
+import { useThemeStore } from '../../../stores/theme';
+import { eCloseProgressDialog } from '../../../utils/events';
+import { SIZE } from '../../../utils/size';
+import { Button } from '../../ui/button';
+import Seperator from '../../ui/seperator';
+import Heading from '../../ui/typography/heading';
+import Paragraph from '../../ui/typography/paragraph';
+import { features } from '../../../../features';
+export type FeatureType = {
+ title: string;
+ body: string;
+};
+
+const NewFeature = ({ features }: { features: FeatureType[] }) => {
+ const colors = useThemeStore(state => state.colors);
+
+ return (
+ <View
+ style={{
+ alignItems: 'center',
+ paddingHorizontal: 12,
+ paddingTop: 12
+ }}
+ >
+ <Heading color={colors.icon} size={SIZE.md}>
+ New Version Highlights 🎉
+ </Heading>
+
+ <Seperator />
+
+ {features?.map(item => (
+ <View
+ key={item.title}
+ style={{
+ backgroundColor: colors.nav,
+ padding: 12,
+ borderRadius: 10,
+ width: '100%',
+ marginBottom: 10
+ }}
+ >
+ <Heading size={SIZE.lg}>{item.title}</Heading>
+ <Paragraph>{item.body}</Paragraph>
+ </View>
+ ))}
+ <Seperator />
+
+ <Button
+ title="Got it"
+ type="accent"
+ width={250}
+ style={{
+ borderRadius: 100
+ }}
+ onPress={() => {
+ eSendEvent(eCloseProgressDialog);
+ }}
+ />
+ </View>
+ );
+};
+
+NewFeature.present = () => {
+ const { version, introCompleted } = SettingsService.get();
+ if (!introCompleted) return;
+ if (version && version === APP_VERSION) return false;
+ SettingsService.set({
+ version: APP_VERSION
+ });
+ presentSheet({
+ component: <NewFeature features={features} />
+ });
+ return true;
+};
+
+export default NewFeature;
diff --git a/apps/mobile/src/screens/home/index.js b/apps/mobile/src/screens/home/index.js
index c89d7295b..b804ec776 100755
--- a/apps/mobile/src/screens/home/index.js
+++ b/apps/mobile/src/screens/home/index.js
@@ -6,7 +6,7 @@ import SelectionHeader from '../../components/selection-header';
import List from '../../components/list';
import { useNoteStore } from '../../stores/stores';
import { DDS } from '../../services/device-detection';
-import { eSendEvent } from '../../services/event-manager';
+import { eSendEvent, presentSheet } from '../../services/event-manager';
import Navigation from '../../services/navigation';
import SearchService from '../../services/search';
import { editing, InteractionManager } from '../../utils';
@@ -14,6 +14,10 @@ import { db } from '../../utils/database';
import { eOnLoadNote } from '../../utils/events';
import { tabBarRef } from '../../utils/global-refs';
import { getNote } from '../editor/Functions';
+import { presentDialog } from '../../components/dialog/functions';
+import Paragraph from '../../components/ui/typography/paragraph';
+import Heading from '../../components/ui/typography/heading';
+import NewFeature from '../../components/sheets/new-feature';
export const Home = ({ navigation }) => {
const notes = useNoteStore(state => state.notes);
diff --git a/apps/mobile/src/screens/settings/usersection.js b/apps/mobile/src/screens/settings/usersection.js
index fa8975908..56abe4f4a 100644
--- a/apps/mobile/src/screens/settings/usersection.js
+++ b/apps/mobile/src/screens/settings/usersection.js
@@ -8,11 +8,11 @@ import { Button } from '../../components/ui/button';
import Seperator from '../../components/ui/seperator';
import Heading from '../../components/ui/typography/heading';
import Paragraph from '../../components/ui/typography/paragraph';
-import { useThemeStore } from '../../stores/theme';
-import { useUserStore } from '../../stores/stores';
import { eSendEvent, presentSheet, ToastEvent } from '../../services/event-manager';
import PremiumService from '../../services/premium';
import Sync from '../../services/sync';
+import { useUserStore } from '../../stores/stores';
+import { useThemeStore } from '../../stores/theme';
import {
SUBSCRIPTION_PROVIDER,
SUBSCRIPTION_STATUS,
@@ -21,7 +21,6 @@ import {
import {
eCloseProgressDialog,
eOpenAttachmentsDialog,
- eOpenLoginDialog,
eOpenPremiumDialog,
eOpenRecoveryKeyDialog
} from '../../utils/events';
diff --git a/apps/mobile/src/services/premium.js b/apps/mobile/src/services/premium.js
index f44eb3c1a..47fc3758e 100644
--- a/apps/mobile/src/services/premium.js
+++ b/apps/mobile/src/services/premium.js
@@ -68,7 +68,7 @@ async function getProducts() {
}
function get() {
- if (__DEV__) return true;
+ //if (__DEV__) return true;
return SUBSCRIPTION_STATUS.BASIC !== premiumStatus;
}
diff --git a/apps/mobile/src/stores/interfaces.ts b/apps/mobile/src/stores/interfaces.ts
index ade77f2e0..3a620d986 100644
--- a/apps/mobile/src/stores/interfaces.ts
+++ b/apps/mobile/src/stores/interfaces.ts
@@ -87,6 +87,7 @@ export type Settings = {
lastRecoveryEmailTime?: number;
lastVerificationEmailTime?: number;
sessionExpired: boolean;
+ version: number | null;
};
type Dimensions = {
diff --git a/apps/mobile/src/stores/stores.ts b/apps/mobile/src/stores/stores.ts
index 76a051282..5d29d216c 100644
--- a/apps/mobile/src/stores/stores.ts
+++ b/apps/mobile/src/stores/stores.ts
@@ -256,7 +256,8 @@ export const useSettingStore = create<SettingStore>((set, get) => ({
dark: false
},
showBackupCompleteSheet: true,
- sessionExpired: false
+ sessionExpired: false,
+ version: null
},
sheetKeyboardHandler: true,
fullscreen: false,
diff --git a/apps/mobile/tsconfig.json b/apps/mobile/tsconfig.json
index 168e1039d..a60448295 100644
--- a/apps/mobile/tsconfig.json
+++ b/apps/mobile/tsconfig.json
@@ -16,12 +16,5 @@
"maxNodeModuleJsDepth": 20,
"downlevelIteration": true
},
- "exclude": [
- "node_modules",
- "babel.config.js",
- "metro.config.js",
- "jest.config.js",
- "android",
- "ios"
- ]
+ "exclude": ["babel.config.js", "metro.config.js", "jest.config.js", "android", "ios"]
}