Skip to content

Commit 99cd752

Browse files
repertusnatanrolnik
authored andcommitted
Updated iOS alert object to display title and body detail (#735)
* Updated iOS alert object to display title and body detail * Updated changelog with Fix details * Updated push details page to display title and body if present in alert object. * Addressed Travis build error
1 parent 5f03db3 commit 99cd752

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
* _Contributing to this repo? Add info about your change here to be included in next release_
66
* Fix: NaN displayed when filter input is empty or negative number (#749), thanks to [Miguel Serrrano](https://github.com/miguel-s)
7+
* Fix: Addresses issue related to displaying iOS alert object containing title and body keys (#539), thanks to [Robert Martin del Campo](https://github.com/repertus)
78

89
### 1.1.0
910

src/dashboard/Push/PushDetails.react.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ const EXP_STATS_URL = 'http://docs.parseplatform.org/ios/guide/#push-experiments
3939
let getMessage = (payload) => {
4040
if(payload) {
4141
let payloadJSON = JSON.parse(payload);
42-
return payloadJSON.alert ? payloadJSON.alert : payload;
42+
if (payloadJSON.alert.body) {
43+
return payloadJSON.alert.body;
44+
} else if (payloadJSON.alert) {
45+
return payloadJSON.alert;
46+
} else {
47+
return payload;
48+
}
4349
}
4450
return '';
4551
}
@@ -461,6 +467,7 @@ export default class PushDetails extends DashboardView {
461467
let isMessageType = pushDetails.exp_type === 'message';
462468
let res = null;
463469
let prevLaunchGroup = null;
470+
let alert = getMessage(pushDetails.get('payload'));
464471

465472
if (pushDetails && pushDetails.experiment_push_id) {
466473
prevLaunchGroup = (
@@ -512,7 +519,14 @@ export default class PushDetails extends DashboardView {
512519
<div>
513520
<div className={styles.groupHeader}>
514521
<div className={styles.headerTitle}>MESSAGE SENT</div>
515-
<div className={styles.headline}>{getMessage(pushDetails.get('payload'))}</div>
522+
{
523+
(typeof alert === 'object') ?
524+
<div>
525+
<div className={styles.headline}>{alert.title}</div>
526+
<div className={styles.headline}>{alert.body}</div>
527+
</div>:
528+
<div className={styles.headline}>{alert}</div>
529+
}
516530
<div className={styles.subline}>
517531
{getSentInfo(pushDetails.get('pushTime'), pushDetails.get('expiration'))}
518532
</div>

src/dashboard/Push/PushIndex.react.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ let getPushName = (pushData) => {
137137
if (typeof payload === 'object') {
138138
if (typeof payload.alert === 'string') {
139139
return payload.alert;
140+
} else if (typeof payload.alert === 'object' && payload.alert.title !== undefined) {
141+
return payload.alert.title;
140142
}
141143
return payload.alert ? JSON.stringify(payload.alert) : JSON.stringify(payload);
142144
} else {

0 commit comments

Comments
 (0)