Fix inApp notification handler (#1749)
This commit is contained in:
parent
e3e2456ecd
commit
a2af6b5fd6
2 changed files with 33 additions and 7 deletions
|
|
@ -227,7 +227,7 @@ export default class Entry extends PureComponent {
|
|||
navigator: this.props.navigator,
|
||||
};
|
||||
|
||||
return wrapWithContextProvider(ChannelScreen, true)(props);
|
||||
return wrapWithContextProvider(ChannelScreen, false)(props);
|
||||
};
|
||||
|
||||
render() {
|
||||
|
|
|
|||
|
|
@ -92,8 +92,28 @@ export default class Notification extends PureComponent {
|
|||
return icon;
|
||||
};
|
||||
|
||||
getNotificationTitle = (titleText) => {
|
||||
getNotificationTitle = (notification) => {
|
||||
const {channel} = this.props;
|
||||
const {message, data} = notification;
|
||||
|
||||
if (data.version === 'v2') {
|
||||
if (data.channel_name) {
|
||||
return (
|
||||
<Text
|
||||
numberOfLines={1}
|
||||
ellipsizeMode='tail'
|
||||
style={style.title}
|
||||
>
|
||||
{data.channel_name}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
const msg = message.split(':');
|
||||
const titleText = msg.shift();
|
||||
|
||||
let title = (
|
||||
<Text
|
||||
|
|
@ -165,14 +185,20 @@ export default class Notification extends PureComponent {
|
|||
|
||||
render() {
|
||||
const {deviceWidth, notification} = this.props;
|
||||
const {message} = notification;
|
||||
const {data, message} = notification;
|
||||
|
||||
if (message) {
|
||||
const msg = message.split(':');
|
||||
const titleText = msg.shift();
|
||||
const messageText = msg.join('').trim();
|
||||
let messageText;
|
||||
if (data.version !== 'v2') {
|
||||
const msg = message.split(':');
|
||||
messageText = msg.join('').trim();
|
||||
} else if (Platform.OS === 'ios') {
|
||||
messageText = message.body || message;
|
||||
} else {
|
||||
messageText = message;
|
||||
}
|
||||
|
||||
const title = this.getNotificationTitle(titleText);
|
||||
const title = this.getNotificationTitle(notification);
|
||||
const icon = this.getNotificationIcon();
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in a new issue