@@ -39,10 +39,7 @@ import { Directions } from 'lib/Constants';
39
39
import { Promise } from 'parse' ;
40
40
41
41
const PARSE_SERVER_SUPPORTS_AB_TESTING = false ;
42
-
43
42
const PARSE_SERVER_SUPPORTS_PUSH_RICH_MEDIA = false ;
44
-
45
- const PARSE_SERVER_SUPPORTS_SCHEDULE_PUSH = true ;
46
43
const PARSE_SERVER_SUPPORTS_SCHEDULE_PUSH_EXPIRATION = false ;
47
44
const PARSE_SERVER_SUPPORTS_SCHEDULE_PUSH_TIMEZONE = false ;
48
45
@@ -170,7 +167,7 @@ export default class PushNew extends DashboardView {
170
167
options ) . then ( ( ) => {
171
168
this . setState ( { pushAudiencesFetched :true } ) ;
172
169
} ) ;
173
-
170
+
174
171
let { xhr, promise} = this . context . currentApp . isLocalizationAvailable ( ) ;
175
172
this . xhrs . push ( xhr ) ;
176
173
promise . then ( ( { available } ) => {
@@ -213,39 +210,27 @@ export default class PushNew extends DashboardView {
213
210
if ( ! ! changes . increment_badge ) {
214
211
payload . badge = "Increment" ;
215
212
}
216
-
217
- if ( changes . push_time_type === 'now' ) {
218
- Parse . Push . send ( {
219
- where : changes . target || new Parse . Query ( Parse . Installation ) ,
220
- data : payload ,
221
- } , {
222
- useMasterKey : true ,
223
- } ) . then ( ( { error } ) => {
224
- //navigate to push index page and clear cache once push store is created
225
- if ( error ) {
226
- promise . reject ( { error } ) ;
213
+ Parse . Push . send ( {
214
+ where : changes . target || new Parse . Query ( Parse . Installation ) ,
215
+ data : payload ,
216
+ } , {
217
+ useMasterKey : true ,
218
+ } ) . then ( ( { error } ) => {
219
+ //navigate to push index page and clear cache once push store is created
220
+ if ( error ) {
221
+ promise . reject ( { error } ) ;
222
+ } else {
223
+ //TODO: global success message banner for passing successful creation - store should also be cleared
224
+ const PARSE_SERVER_SUPPORTS_PUSH_INDEX = false ;
225
+ if ( PARSE_SERVER_SUPPORTS_PUSH_INDEX ) {
226
+ history . push ( this . context . generatePath ( 'push/activity' ) ) ;
227
227
} else {
228
- //TODO: global success message banner for passing successful creation - store should also be cleared
229
- const PARSE_SERVER_SUPPORTS_PUSH_INDEX = false ;
230
- if ( PARSE_SERVER_SUPPORTS_PUSH_INDEX ) {
231
- history . push ( this . context . generatePath ( 'push/activity' ) ) ;
232
- } else {
233
- promise . resolve ( ) ;
234
- }
235
- }
236
- } , ( error ) => {
237
- promise . reject ( error ) ;
238
- } ) ;
239
- } else {
240
- if ( changes . push_time_type === 'time' && changes . push_time !== null ) {
241
- let schedulePromise = this . context . currentApp . schedulePush ( changes ) ;
242
- schedulePromise . then ( pushStatus => {
243
228
promise . resolve ( ) ;
244
- } , ( error ) => {
245
- promise . reject ( error ) ;
246
- } ) ;
229
+ }
247
230
}
248
- }
231
+ } , ( error ) => {
232
+ promise . reject ( error ) ;
233
+ } ) ;
249
234
return promise ;
250
235
}
251
236
@@ -720,7 +705,7 @@ export default class PushNew extends DashboardView {
720
705
721
706
const richmediaFieldsDescription = PARSE_SERVER_SUPPORTS_PUSH_RICH_MEDIA ?
722
707
'We can send images and videos directly to your app.' :
723
- "If your push hasn't been send with rich media, it won't get setup by your dev." ;
708
+ 'Rich media is not currently supported.' ;
724
709
725
710
const richmediaTimeFields = PARSE_SERVER_SUPPORTS_PUSH_RICH_MEDIA ? < Fieldset
726
711
legend = { richmediaFieldsLegend }
@@ -731,18 +716,21 @@ export default class PushNew extends DashboardView {
731
716
{ PARSE_SERVER_SUPPORTS_PUSH_RICH_MEDIA ? this . renderRichMediaContent ( fields , setField ) : null }
732
717
</ Fieldset > : null ;
733
718
734
- const timeFieldsLegend = PARSE_SERVER_SUPPORTS_SCHEDULE_PUSH ?
719
+ let features = this . context . currentApp . serverInfo . features ;
720
+ let hasScheduledPush = features . push . scheduledPush ;
721
+
722
+ const timeFieldsLegend = hasScheduledPush ?
735
723
'Choose a delivery time' :
736
724
'Choose exiry' ;
737
725
738
- const timeFieldsDescription = PARSE_SERVER_SUPPORTS_SCHEDULE_PUSH ?
739
- 'We can send the campaign immediately, or any time in the next weeks .' :
740
- "If your push hasn't been send by this time, it won't get sent." ;
726
+ const timeFieldsDescription = hasScheduledPush ?
727
+ 'We can send the campaign immediately, or any time in the future .' :
728
+ 'Push schedule is not currently supported.' ;
741
729
742
- const deliveryTimeFields = PARSE_SERVER_SUPPORTS_SCHEDULE_PUSH ? < Fieldset
730
+ const deliveryTimeFields = hasScheduledPush ? < Fieldset
743
731
legend = { timeFieldsLegend }
744
732
description = { timeFieldsDescription } >
745
- { PARSE_SERVER_SUPPORTS_SCHEDULE_PUSH ? this . renderDeliveryContent ( fields , setField ) : null }
733
+ { hasScheduledPush ? this . renderDeliveryContent ( fields , setField ) : null }
746
734
{ PARSE_SERVER_SUPPORTS_SCHEDULE_PUSH_EXPIRATION ?
747
735
< Field
748
736
label = { < Label text = 'Should this notification expire?' /> }
@@ -943,7 +931,7 @@ export default class PushNew extends DashboardView {
943
931
) ;
944
932
}
945
933
let timeNote = null ;
946
- if ( changes . push_time_type === 'time' && changes . push_time !== null || changes . push_time_type === 'now' ) {
934
+ if ( changes . push_time_type === 'time' && changes . push_time !== null || changes . push_time_type === 'now' ) {
947
935
timeNote = (
948
936
< span >
949
937
It will be sent < strong > { changes . push_time_type === 'now' ? 'immediately' : String ( changes . push_time ) } </ strong > .
0 commit comments