diff --git a/apps/mobile/src/components/ActionSheetComponent/BouncingView.js b/apps/mobile/src/components/ActionSheetComponent/BouncingView.js
index d5828495a..d2cddfc81 100644
--- a/apps/mobile/src/components/ActionSheetComponent/BouncingView.js
+++ b/apps/mobile/src/components/ActionSheetComponent/BouncingView.js
@@ -1,30 +1,40 @@
-import React, { useEffect } from 'react';
-import Animated, { Easing, timing } from 'react-native-reanimated';
+import React, {useEffect} from 'react';
+import Animated, {Easing, timing} from 'react-native-reanimated';
+
+export const BouncingView = ({
+ children,
+ style,
+ duration = 600,
+ animated = true
+}) => {
+ const scale = Animated.useValue(!animated ? 1 : 0.9);
-export const BouncingView = ({children,style,duration=600}) => {
- const scale = Animated.useValue(0.9);
-
useEffect(() => {
+ if (!animated) return;
scale.setValue(0.9);
timing(scale, {
toValue: 1,
- duration:duration,
+ duration: duration,
easing: Easing.elastic(1)
}).start();
return () => {
+ if (!animated) return;
scale.setValue(0.9);
- }
- },[])
+ };
+ }, []);
return (
+ style={[
+ {
+ transform: [
+ {
+ scale: !animated ? 1 : scale
+ }
+ ]
+ },
+ style
+ ]}>
{children}
);
diff --git a/apps/mobile/src/components/Announcements/body.js b/apps/mobile/src/components/Announcements/body.js
new file mode 100644
index 000000000..3fef67f8d
--- /dev/null
+++ b/apps/mobile/src/components/Announcements/body.js
@@ -0,0 +1,20 @@
+import React from 'react';
+import { useTracked } from '../../provider';
+import Paragraph from '../Typography/Paragraph';
+import { getStyle } from './functions';
+
+
+export const Body = ({text, style = {}}) => {
+ const [state] = useTracked();
+ const colors = state.colors;
+
+ return (
+
+ {text}
+
+ );
+};
\ No newline at end of file
diff --git a/apps/mobile/src/components/Announcements/cta.js b/apps/mobile/src/components/Announcements/cta.js
new file mode 100644
index 000000000..599bb8f0e
--- /dev/null
+++ b/apps/mobile/src/components/Announcements/cta.js
@@ -0,0 +1,31 @@
+import React from 'react';
+import { View } from 'react-native';
+import { useTracked } from '../../provider';
+import { Button } from '../Button';
+import { getStyle } from './functions';
+
+export const Cta = ({actions, style = {}}) => {
+ const [state] = useTracked();
+ const colors = state.colors;
+ return (
+
+ {actions.map((item, index) => (
+
+ );
+};
diff --git a/apps/mobile/src/components/Announcements/description.js b/apps/mobile/src/components/Announcements/description.js
new file mode 100644
index 000000000..867bfc221
--- /dev/null
+++ b/apps/mobile/src/components/Announcements/description.js
@@ -0,0 +1,21 @@
+import React from 'react';
+import { useTracked } from '../../provider';
+import { SIZE } from '../../utils/SizeUtils';
+import Paragraph from '../Typography/Paragraph';
+import { getStyle } from './functions';
+
+
+export const Description = ({text, style = {}}) => {
+ const [state] = useTracked();
+ const colors = state.colors;
+ return (
+
+ {text}
+
+ );
+};
diff --git a/apps/mobile/src/components/Announcements/functions.js b/apps/mobile/src/components/Announcements/functions.js
new file mode 100644
index 000000000..59d80b5b8
--- /dev/null
+++ b/apps/mobile/src/components/Announcements/functions.js
@@ -0,0 +1,14 @@
+export const margins = {
+ 0: 0,
+ 1: 12,
+ 2: 20
+};
+
+export const getStyle = style => {
+ if (!style) return {};
+ return {
+ marginTop: margins[style.marginTop] || 0,
+ marginBottom: margins[style.marginBottom] || 0,
+ textAlign: style.textAlign || 'left'
+ };
+};
diff --git a/apps/mobile/src/components/Announcements/index.js b/apps/mobile/src/components/Announcements/index.js
new file mode 100644
index 000000000..3eb42c37c
--- /dev/null
+++ b/apps/mobile/src/components/Announcements/index.js
@@ -0,0 +1,163 @@
+import React, {useEffect, useState} from 'react';
+import {FlatList, View} from 'react-native';
+import {useTracked} from '../../provider';
+import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
+import {
+ eCloseAnnouncementDialog,
+ eOpenAnnouncementDialog
+} from '../../utils/Events';
+import BaseDialog from '../Dialog/base-dialog';
+import {Body} from './body';
+import {Description} from './description';
+import {Photo} from './photo';
+import {SubHeading} from './subheading';
+import {List} from './list';
+import {Title} from './title';
+import {Cta} from './cta';
+import {allowedPlatforms} from '../../provider/stores';
+import {ProFeatures} from '../ResultDialog/pro-features';
+
+const announcement_dialog_info = {
+ body: [
+ {
+ type: 'image',
+ src: 'https://media.istockphoto.com/vectors/flash-sale-promotional-labels-templates-set-special-offer-text-design-vector-id1195558677?s=170667a',
+ caption: 'an image of a bear',
+ style: {}
+ },
+ {
+ type: 'title',
+ text: "Don't miss out on this one!",
+ style: {
+ textAlign: 'center',
+ marginTop: 1
+ }
+ },
+ {
+ type: 'description',
+ text: "It's 50% off on Notesnook Pro today. Grab the offer now before it's too late.",
+ style: {
+ textAlign: 'center',
+ marginBottom: 1
+ }
+ },
+ {
+ type: 'features'
+ }
+ // {
+ // type: 'subheading',
+ // text: 'New image tool'
+ // },
+ // {
+ // type: 'body',
+ // text: 'But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer.'
+ // },
+ // {
+ // type: 'list',
+ // items: [
+ // {
+ // text: 'Lorem ipsum dolor sit amet'
+ // },
+ // {
+ // text: 'Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium'
+ // }
+ // ]
+ // }
+ ],
+ callToActions: [
+ {
+ text: 'Get 50% Off for One Year',
+ action: 'none',
+ platforms: ['mobile']
+ }
+ ]
+};
+
+const Features = () => {
+ return (
+
+
+
+ );
+};
+
+const renderItems = {
+ title: Title,
+ description: Description,
+ body: Body,
+ cta: Cta,
+ image: Photo,
+ list: List,
+ subheading: SubHeading,
+ features: Features
+};
+
+const renderItem = ({item, index}) => {
+ const Item = renderItems[item.type];
+
+ return ;
+};
+
+export const Announcement = () => {
+ const [state] = useTracked();
+ const colors = state.colors;
+ const [visible, setVisible] = useState(true);
+
+ useEffect(() => {
+ eSubscribeEvent(eOpenAnnouncementDialog, open);
+ eSubscribeEvent(eCloseAnnouncementDialog, close);
+ return () => {
+ eUnSubscribeEvent(eOpenAnnouncementDialog, open);
+ eUnSubscribeEvent(eCloseAnnouncementDialog, close);
+ };
+ }, [visible]);
+
+ const open = () => {
+ setVisible(true);
+ };
+
+ const close = () => {
+ setVisible(false);
+ };
+
+ return (
+
+
+
+
+
+ item.platforms.some(
+ platform => allowedPlatforms.indexOf(platform) > -1
+ )
+ )}
+ />
+
+
+
+ );
+};
diff --git a/apps/mobile/src/components/Announcements/list.js b/apps/mobile/src/components/Announcements/list.js
new file mode 100644
index 000000000..796f7d7eb
--- /dev/null
+++ b/apps/mobile/src/components/Announcements/list.js
@@ -0,0 +1,40 @@
+import React from 'react';
+import { View } from 'react-native';
+import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
+import { useTracked } from '../../provider';
+import Paragraph from '../Typography/Paragraph';
+import { getStyle } from './functions';
+
+export const List = ({items, listType, style = {}}) => {
+ const [state] = useTracked();
+ const colors = state.colors;
+
+ return (
+
+ {items.map((item, index) => (
+
+ {listType === 'ordered' ? (
+
+ {index + 1}.
+
+ ) : (
+
+ )}
+ {item.text}
+
+ ))}
+
+ );
+};
diff --git a/apps/mobile/src/components/Announcements/photo.js b/apps/mobile/src/components/Announcements/photo.js
new file mode 100644
index 000000000..b1d444f27
--- /dev/null
+++ b/apps/mobile/src/components/Announcements/photo.js
@@ -0,0 +1,19 @@
+import React from 'react';
+import { Image } from 'react-native';
+import { getStyle } from './functions';
+
+
+export const Photo = ({src, style = {}}) => {
+ return (
+
+ );
+};
\ No newline at end of file
diff --git a/apps/mobile/src/components/Announcements/subheading.js b/apps/mobile/src/components/Announcements/subheading.js
new file mode 100644
index 000000000..c7bbae4fb
--- /dev/null
+++ b/apps/mobile/src/components/Announcements/subheading.js
@@ -0,0 +1,23 @@
+import React from 'react';
+import { useTracked } from '../../provider';
+import { SIZE } from '../../utils/SizeUtils';
+import Heading from '../Typography/Heading';
+import { getStyle } from './functions';
+
+
+export const SubHeading = ({text, style = {}}) => {
+ const [state] = useTracked();
+ const colors = state.colors;
+
+ return (
+
+ {text}
+
+ );
+};
diff --git a/apps/mobile/src/components/Announcements/title.js b/apps/mobile/src/components/Announcements/title.js
new file mode 100644
index 000000000..56285c64e
--- /dev/null
+++ b/apps/mobile/src/components/Announcements/title.js
@@ -0,0 +1,21 @@
+
+import React from 'react';
+import { useTracked } from '../../provider';
+import Heading from '../Typography/Heading';
+import { getStyle } from './functions';
+
+export const Title = ({text, style = {}}) => {
+ const [state] = useTracked();
+ const colors = state.colors;
+
+ return (
+
+ {text}
+
+ );
+ };
\ No newline at end of file
diff --git a/apps/mobile/src/components/Dialog/BaseDialog.js b/apps/mobile/src/components/Dialog/BaseDialog.js
index 46bd7f0ff..e16a9f599 100644
--- a/apps/mobile/src/components/Dialog/BaseDialog.js
+++ b/apps/mobile/src/components/Dialog/BaseDialog.js
@@ -22,9 +22,9 @@ const BaseDialog = ({
transparent,
centered = true,
bottom = false,
- background = null
+ background = null,
+ animated = true
}) => {
- const [state, dispatch] = useTracked();
const floating = useIsFloatingKeyboard();
return (
@@ -53,6 +53,7 @@ const BaseDialog = ({
behavior="padding">
+
>
);
}
diff --git a/apps/mobile/src/components/ResultDialog/ProFeatures.js b/apps/mobile/src/components/ResultDialog/ProFeatures.js
index 0a443cd1a..3eaa94a77 100644
--- a/apps/mobile/src/components/ResultDialog/ProFeatures.js
+++ b/apps/mobile/src/components/ResultDialog/ProFeatures.js
@@ -3,7 +3,11 @@ import {View} from 'react-native';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {useTracked} from '../../provider';
import {eSendEvent} from '../../services/EventManager';
-import {eCloseProgressDialog, eCloseResultDialog, eOpenPremiumDialog} from '../../utils/Events';
+import {
+ eCloseProgressDialog,
+ eCloseResultDialog,
+ eOpenPremiumDialog
+} from '../../utils/Events';
import {SIZE} from '../../utils/SizeUtils';
import {sleep} from '../../utils/TimeUtils';
import Paragraph from '../Typography/Paragraph';
@@ -47,7 +51,7 @@ export const ProFeatures = ({count = 6}) => {
marginBottom: 10,
alignItems: 'center',
borderRadius: 5,
- justifyContent:'flex-start'
+ justifyContent: 'flex-start'
}}>
diff --git a/apps/mobile/src/components/SimpleList/announcement.js b/apps/mobile/src/components/SimpleList/announcement.js
index 910ff9756..a20b1b6b2 100644
--- a/apps/mobile/src/components/SimpleList/announcement.js
+++ b/apps/mobile/src/components/SimpleList/announcement.js
@@ -1,18 +1,18 @@
import React from 'react';
-import {View} from 'react-native';
-import {useTracked} from '../../provider';
+import { View } from 'react-native';
+import { useTracked } from '../../provider';
import {
allowedPlatforms,
useMessageStore,
useSelectionStore
} from '../../provider/stores';
-import {eSendEvent, presentSheet} from '../../services/EventManager';
-import {hexToRGBA, RGB_Linear_Shade} from '../../utils/ColorUtils';
-import {eOpenPremiumDialog, eOpenProgressDialog} from '../../utils/Events';
-import {openLinkInBrowser} from '../../utils/functions';
-import {SIZE} from '../../utils/SizeUtils';
-import {SettingsBackupAndRestore} from '../../views/Settings';
-import {Button} from '../Button';
+import { eSendEvent, presentSheet } from '../../services/EventManager';
+import { hexToRGBA, RGB_Linear_Shade } from '../../utils/ColorUtils';
+import { eOpenPremiumDialog } from '../../utils/Events';
+import { openLinkInBrowser } from '../../utils/functions';
+import { SIZE } from '../../utils/SizeUtils';
+import { SettingsBackupAndRestore } from '../../views/Settings';
+import { Button } from '../Button';
import Seperator from '../Seperator';
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
diff --git a/apps/mobile/src/utils/Events.js b/apps/mobile/src/utils/Events.js
index 57e0e2e1d..5e04d5459 100644
--- a/apps/mobile/src/utils/Events.js
+++ b/apps/mobile/src/utils/Events.js
@@ -134,4 +134,7 @@ export const eCloseTagsDialog = '569';
export const eOpenAttachmentsDialog = '600';
export const eCloseAttachmentDialog = '601';
-export const eOpenTrialEndingDialog = '602';
\ No newline at end of file
+export const eOpenTrialEndingDialog = '602';
+
+export const eOpenAnnouncementDialog = '603';
+export const eCloseAnnouncementDialog = '604'
\ No newline at end of file