Skip to content

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

minor fixes in announcement ui

ammarahm-ed902623512687
diff --git a/apps/mobile/src/components/Announcements/announcement.js b/apps/mobile/src/components/Announcements/announcement.js
index 41086ca04..378597431 100644
--- a/apps/mobile/src/components/Announcements/announcement.js
+++ b/apps/mobile/src/components/Announcements/announcement.js
@@ -17,43 +17,42 @@ export const Announcement = ({color}) => {
<View
style={{
backgroundColor: colors.bg,
- width: '100%',
- paddingHorizontal: 12
+ width: '100%'
}}>
<View
style={{
paddingVertical: 12,
width: '100%',
borderRadius: 10,
- overflow: 'hidden',
+ overflow: 'hidden'
}}>
- <Button
- type="errorShade"
- icon="close"
- height={null}
- onPress={() => {
- remove(announcement.id);
- }}
- iconSize={22}
- style={{
- borderRadius: 100,
- paddingHorizontal: 0,
- position:'absolute',
- top:10,
- right:10
- }}
- />
+ <Button
+ type="errorShade"
+ icon="close"
+ height={null}
+ onPress={() => {
+ remove(announcement.id);
+ }}
+ iconSize={22}
+ style={{
+ borderRadius: 100,
+ paddingHorizontal: 0,
+ position: 'absolute',
+ top: 10,
+ right: 10
+ }}
+ />
<View>
<FlatList
style={{
width: '100%',
- marginTop:15
+ marginTop: 15
}}
data={announcement?.body.filter(item =>
allowedOnPlatform(item.platform)
)}
renderItem={({item, index}) =>
- renderItem({item: item, index: index, color: colors[color]})
+ renderItem({item: item, index: index, color: colors[color],inline:true})
}
/>
</View>
diff --git a/apps/mobile/src/components/Announcements/cta.js b/apps/mobile/src/components/Announcements/cta.js
index 80a00d689..f7836ec67 100644
--- a/apps/mobile/src/components/Announcements/cta.js
+++ b/apps/mobile/src/components/Announcements/cta.js
@@ -10,7 +10,7 @@ import { SettingsBackupAndRestore } from '../../views/Settings';
import { Button } from '../Button';
import { allowedOnPlatform, getStyle } from './functions';
-export const Cta = ({actions, style = {}, color}) => {
+export const Cta = ({actions, style = {}, color,inline}) => {
const [state] = useTracked();
const colors = state.colors;
let buttons =
@@ -19,8 +19,10 @@ export const Cta = ({actions, style = {}, color}) => {
) || [];
const onPress = async item => {
- eSendEvent(eCloseAnnouncementDialog);
- await sleep(500);
+ if (!inline) {
+ eSendEvent(eCloseAnnouncementDialog);
+ await sleep(500);
+ }
if (item.type === 'link') {
try {
await openLinkInBrowser(item.data, colors);
diff --git a/apps/mobile/src/components/Announcements/functions.js b/apps/mobile/src/components/Announcements/functions.js
index 27d0a86df..7ad010b12 100644
--- a/apps/mobile/src/components/Announcements/functions.js
+++ b/apps/mobile/src/components/Announcements/functions.js
@@ -54,8 +54,8 @@ const renderItems = {
callToActions: Cta
};
-export const renderItem = ({item, index, color}) => {
+export const renderItem = ({item, index, color,inline}) => {
const Item = renderItems[item.type];
- return <Item key={item.text || item.src || item.type} {...item} index={index} color={color} />;
+ return <Item key={item.text || item.src || item.type} {...item} index={index} color={color} inline={inline} />;
};
diff --git a/apps/mobile/src/components/Announcements/index.js b/apps/mobile/src/components/Announcements/index.js
index 31ce90d54..4ccf4c705 100644
--- a/apps/mobile/src/components/Announcements/index.js
+++ b/apps/mobile/src/components/Announcements/index.js
@@ -8,7 +8,7 @@ import {
eOpenAnnouncementDialog
} from '../../utils/Events';
import BaseDialog from '../Dialog/base-dialog';
-import {renderItem} from "./functions";
+import {renderItem} from './functions';
export const AnnouncementDialog = () => {
const [state] = useTracked();
@@ -33,9 +33,11 @@ export const AnnouncementDialog = () => {
};
const close = () => {
- remove(info.id);
- setInfo(null);
- setVisible(false);
+ if (visible) {
+ remove(info.id);
+ setInfo(null);
+ setVisible(false);
+ }
};
return (