Skip to content

[IMPROVEMENT] Close announcement banner#2064

Merged
diegolmello merged 8 commits intoRocketChat:developfrom
EzequielDeOliveira:newBanner
May 8, 2020
Merged

[IMPROVEMENT] Close announcement banner#2064
diegolmello merged 8 commits intoRocketChat:developfrom
EzequielDeOliveira:newBanner

Conversation

@EzequielDeOliveira
Copy link
Copy Markdown
Contributor

@RocketChat/ReactNative

This PR adds a feature to close the banner on top of Room View.

20200425_162343

When someone change the room's announcement, The banner return to the top.

20200425_162427

@djorkaeffalexandre djorkaeffalexandre changed the title [NEW] Possibility to close the banner [IMPROVEMENT] Close announcement banner Apr 27, 2020
buttonBackground: '#414852',
buttonText: '#ffffff'
buttonText: '#ffffff',
bannerIcon: '#6d6d72'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of create a new color, I think you can use auxiliaryText, as on other places, or change all places that describe a cross icon to use a new color declared here.

Comment on lines +822 to +824
const db = database.active;
const subCollection = db.collections.get('subscriptions');
const newRoom = await subCollection.find(rid);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to fetch this from database, this.state.room is a database reference, you can use this directly.

Comment on lines +125 to +129
if (subscription.announcement) {
if (subscription.announcement !== sub.announcement) {
s.bannerClosed = false;
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need some logic like this on findSubscriptionsRooms, try the follow steps and you'll able to see an error:

  • Close the banner
  • Close the app
  • Change the announcement on other client (Web/Desktop)
  • Open the app again
  • Banner isn't showed

onPress={closeBanner}
>
<CustomIcon
style={styles.icon}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed.

paddingVertical: 12,
paddingHorizontal: 15,
alignItems: 'center'
display: 'flex',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed.

width: 22,
height: 22
},
textContainer: {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to have the same margin on Left and Right side.
paint

Comment on lines +73 to +76
icon: {
width: 22,
height: 22
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed.

@EzequielDeOliveira
Copy link
Copy Markdown
Contributor Author

The requested changes are ready.

Copy link
Copy Markdown
Contributor

@djorkaeffalexandre djorkaeffalexandre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.