muba-posting 4.1.27 → 4.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Posting.js CHANGED
@@ -65,6 +65,8 @@ export default class Posting extends React.Component {
65
65
  countryPhone: '',
66
66
  businessId: this.props.businessId,
67
67
  picturesUploaded: 0,
68
+ images: [],
69
+ params: null,
68
70
  postingAd: {
69
71
  transaction: null,
70
72
  adType: null,
@@ -298,8 +300,9 @@ export default class Posting extends React.Component {
298
300
 
299
301
  prevViews.unshift(this.state.view);
300
302
 
301
- if (this.state.fullPosting && this.state.postingAd.town && Views.PUBLISH_6 !== this.state.view) {
303
+ if (this.state.fullPosting && this.state.postingAd.town && Views.PUBLISH_6 !== this.state.view && Views.PAYMENT_ONLINE !== view) {
302
304
  const ad = { ...this.state.postingAd };
305
+ console.log(ad)
303
306
  if (Views.PUBLISH_4 !== this.state.view) {
304
307
  delete ad.images;
305
308
  }
@@ -315,13 +318,6 @@ export default class Posting extends React.Component {
315
318
  await this._updateCurrentScreen(view, params);
316
319
  }
317
320
 
318
- async _replacePage(view) {
319
- if (view === Views.PUBLISH_2_B) {
320
- await this.publish2bScreen.loadData();
321
- }
322
- await this._updateCurrentScreen(view);
323
- }
324
-
325
321
  async _updateCurrentScreen(view, params) {
326
322
  switch (view) {
327
323
  case Views.PUBLISH_1:
@@ -331,28 +327,23 @@ export default class Posting extends React.Component {
331
327
  this.setState({ currentScreen: 2 });
332
328
  break;
333
329
  case Views.PUBLISH_2_B:
334
- await this.publish2bScreen.loadData();
335
330
  this.setState({ currentScreen: 2 });
336
331
  break;
337
332
  case Views.PUBLISH_3:
338
- await this.publish3Screen.refreshData();
339
333
  this.setState({ currentScreen: 3 });
340
334
  break;
341
335
  case Views.PUBLISH_4:
342
336
  this.setState({ currentScreen: 4 });
343
337
  break;
344
338
  case Views.PUBLISH_5:
345
- await this.publish5Screen.refreshData();
346
339
  this.setState({ currentScreen: 5 });
347
340
  break;
348
341
  case Views.PUBLISH_6:
349
- await this.publish6Screen.generateTitleDescription();
350
- await this.publish6Screen.resetSubmitClicked();
351
342
  this.setState({ currentScreen: 6 });
352
343
  break;
353
344
  case Views.PREVIEW:
354
345
  if (params) {
355
- await this.previewScreen.refreshData(params);
346
+ await this.setState({ params: params });
356
347
  }
357
348
  break;
358
349
  case Views.EDIT_SELECTOR:
@@ -403,7 +394,6 @@ export default class Posting extends React.Component {
403
394
  if (this.state.originView === Views.EDIT_SELECTOR) {
404
395
  this.setState({ isLoading: true });
405
396
  await this.loadAd();
406
- this.editSelector.refresh();
407
397
  this._goToPage(Views.EDIT_SELECTOR);
408
398
  } else {
409
399
  this.props.navigation.goBack();
@@ -437,11 +427,10 @@ export default class Posting extends React.Component {
437
427
  }
438
428
 
439
429
  imageBrowserCallback = async (photos) => {
440
- await this.setState({ showImageBrowser: false });
441
-
442
- for (let photo of photos) {
443
- this.publish4Screen.loadImage(photo);
444
- }
430
+ this.setState({
431
+ showImageBrowser: false,
432
+ images: photos
433
+ });
445
434
  }
446
435
 
447
436
  getAd = async (id) => {
@@ -453,10 +442,10 @@ export default class Posting extends React.Component {
453
442
  }
454
443
 
455
444
  _savePicture = async (picture) => {
456
- await this.setState({ showImageBrowser: false })
457
- this.setState({ view: Views.PUBLISH_4 }, () => {
458
- this.publish4Screen.loadImage(picture);
459
- })
445
+ this.setState({
446
+ showImageBrowser: false,
447
+ images: [picture]
448
+ });
460
449
  }
461
450
 
462
451
  render() {
@@ -491,130 +480,152 @@ export default class Posting extends React.Component {
491
480
  null
492
481
  }
493
482
 
494
- <Publish1 postingAd={this.state.postingAd}
495
- baseUrl={this.props.baseUrl}
496
- request={this.props.request}
497
- context={this.props.context}
498
- showLoading={() => this._showLoading()}
499
- hideLoading={() => this._hideLoading()}
500
- scroll={(ref) => this.scroll.scrollIntoView(ref)}
501
- fullPosting={this.state.fullPosting}
502
- goToPage={(view, editingStepOne) => this._goToPage(view, editingStepOne)}
503
- saveEditAd={() => this._saveEditAd()}
504
- showView={this.state.view === Views.PUBLISH_1}
505
- progressBarHeight={this.state.progressBarHeight}
506
- headerHeight={this.state.headerHeight} />
507
-
508
- <Publish2 postingAd={this.state.postingAd}
509
- scroll={(ref) => this.scroll.scrollIntoView(ref)}
510
- saveEditAd={() => this._saveEditAd()}
511
- goToPage={(view) => this._goToPage(view)}
512
- replacePage={(view) => { this._replacePage(view); this.publish2bScreen.loadData() }}
513
- baseUrl={this.props.baseUrl}
514
- request={this.props.request}
515
- context={this.props.context}
516
- showLoading={() => this._showLoading()}
517
- hideLoading={() => this._hideLoading()}
518
- hereAppId={this.props.hereAppId} hereAppCode={this.props.hereAppCode}
519
- showView={this.state.view === Views.PUBLISH_2}
520
- fullPosting={this.state.fullPosting}
521
- progressBarHeight={this.state.progressBarHeight}
522
- headerHeight={this.state.headerHeight} />
523
-
524
- <Publish2b ref={(view) => this.publish2bScreen = view}
525
- postingAd={this.state.postingAd}
526
- scroll={(ref) => this.scroll.scrollIntoView(ref)}
527
- saveEditAd={() => this._saveEditAd()}
528
- goToPage={(view) => this._goToPage(view)}
529
- replacePage={(view) => this._replacePage(view)}
530
- request={this.props.request}
531
- context={this.props.context}
532
- showLoading={() => this._showLoading()}
533
- hideLoading={() => this._hideLoading()}
534
- showView={this.state.view === Views.PUBLISH_2_B}
535
- fullPosting={this.state.fullPosting}
536
- progressBarHeight={this.state.progressBarHeight}
537
- headerHeight={this.state.headerHeight} />
538
-
539
- <Publish3 ref={(view) => this.publish3Screen = view}
540
- postingAd={this.state.postingAd}
541
- editingStepOne={this.state.editingStepOne}
542
- scroll={(ref) => this.scroll.scrollIntoView(ref)}
543
- saveEditAd={() => this._saveEditAd()}
544
- goToPage={(view) => this._goToPage(view)}
545
- goBack={() => this.goBack()}
546
- request={this.props.request}
547
- context={this.props.context}
548
- showLoading={() => this._showLoading()}
549
- hideLoading={() => this._hideLoading()}
550
- showView={this.state.view === Views.PUBLISH_3}
551
- fullPosting={this.state.fullPosting}
552
- progressBarHeight={this.state.progressBarHeight}
553
- headerHeight={this.state.headerHeight} />
554
-
555
- <Publish4 ref={(view) => this.publish4Screen = view}
556
- postingAd={this.state.postingAd}
557
- saveEditAd={() => this._saveEditAd()}
558
- goToPage={(view) => this._goToPage(view)}
559
- request={this.props.request}
560
- context={this.props.context}
561
- showLoading={() => this._showLoading()}
562
- hideLoading={() => this._hideLoading()}
563
- showView={this.state.view === Views.PUBLISH_4}
564
- fullPosting={this.state.fullPosting}
565
- progressBarHeight={this.state.progressBarHeight}
566
- headerHeight={this.state.headerHeight}
567
- openPictureSelector={() => this._openPictureSelector()}
568
- maxPictures={this.state.maxPictures} />
569
-
570
- <Publish5 ref={(view) => this.publish5Screen = view}
571
- postingAd={this.state.postingAd}
572
- scroll={(ref) => this.scroll.scrollIntoView(ref)}
573
- saveEditAd={() => this._saveEditAd()}
574
- goToPage={(view) => this._goToPage(view)}
575
- request={this.props.request}
576
- context={this.props.context}
577
- showLoading={() => this._showLoading()}
578
- hideLoading={() => this._hideLoading()}
579
- showView={this.state.view === Views.PUBLISH_5}
580
- fullPosting={this.state.fullPosting}
581
- progressBarHeight={this.state.progressBarHeight}
582
- headerHeight={this.state.headerHeight} />
583
-
584
- <Publish6 ref={(view) => this.publish6Screen = view}
585
- postingAd={this.state.postingAd}
586
- country={this.props.country}
587
- businessId={this.state.businessId}
588
- scroll={(ref) => this.scroll.scrollIntoView(ref)}
589
- saveEditAd={() => this._saveEditAd()}
590
- goToPage={(view, params) => this._goToPage(view, null, params)}
591
- request={this.props.request}
592
- context={this.props.context}
593
- showLoading={() => this._showLoading()}
594
- hideLoading={() => this._hideLoading()}
595
- showView={this.state.view === Views.PUBLISH_6}
596
- fullPosting={this.state.fullPosting}
597
- progressBarHeight={this.state.progressBarHeight}
598
- headerHeight={this.state.headerHeight} />
599
-
600
- <Preview ref={(view) => this.previewScreen = view}
601
- postingAd={this.state.postingAd}
602
- country={this.props.country}
603
- goBack={() => this.goBack()}
604
- showLoading={() => this._showLoading()}
605
- hideLoading={() => this._hideLoading()}
606
- businessId={this.state.businessId}
607
- showView={this.state.view === Views.PREVIEW}
608
- progressBarHeight={this.state.progressBarHeight}
609
- request={this.props.request}
610
- headerHeight={this.state.headerHeight}
611
- highlight={() => this._goToPage(Views.PAYMENT_ONLINE)} />
612
-
613
- <PostingEdit ref={(view) => this.editSelector = view}
614
- postingAd={this.state.postingAd}
615
- showView={this.state.view === Views.EDIT_SELECTOR}
616
- topBar={this.props.topBar}
617
- goToPage={(view) => this._goToPage(view)} />
483
+ {this.state.view === Views.PUBLISH_1 ?
484
+ <Publish1 postingAd={this.state.postingAd}
485
+ baseUrl={this.props.baseUrl}
486
+ request={this.props.request}
487
+ context={this.props.context}
488
+ showLoading={() => this._showLoading()}
489
+ hideLoading={() => this._hideLoading()}
490
+ scroll={(ref) => this.scroll.scrollIntoView(ref)}
491
+ fullPosting={this.state.fullPosting}
492
+ goToPage={(view, editingStepOne) => this._goToPage(view, editingStepOne)}
493
+ saveEditAd={() => this._saveEditAd()}
494
+ progressBarHeight={this.state.progressBarHeight}
495
+ headerHeight={this.state.headerHeight} />
496
+ :
497
+ null
498
+ }
499
+
500
+ {this.state.view === Views.PUBLISH_2 ?
501
+ <Publish2 postingAd={this.state.postingAd}
502
+ scroll={(ref) => this.scroll.scrollIntoView(ref)}
503
+ saveEditAd={() => this._saveEditAd()}
504
+ goToPage={(view) => this._goToPage(view)}
505
+ replacePage={(view) => this._updateCurrentScreen(view)}
506
+ baseUrl={this.props.baseUrl}
507
+ request={this.props.request}
508
+ context={this.props.context}
509
+ showLoading={() => this._showLoading()}
510
+ hideLoading={() => this._hideLoading()}
511
+ hereAppId={this.props.hereAppId} hereAppCode={this.props.hereAppCode}
512
+ fullPosting={this.state.fullPosting}
513
+ progressBarHeight={this.state.progressBarHeight}
514
+ headerHeight={this.state.headerHeight} />
515
+ :
516
+ null
517
+ }
518
+
519
+ {this.state.view === Views.PUBLISH_2_B ?
520
+ <Publish2b postingAd={this.state.postingAd}
521
+ scroll={(ref) => this.scroll.scrollIntoView(ref)}
522
+ saveEditAd={() => this._saveEditAd()}
523
+ goToPage={(view) => this._goToPage(view)}
524
+ replacePage={(view) => this._updateCurrentScreen(view)}
525
+ request={this.props.request}
526
+ context={this.props.context}
527
+ showLoading={() => this._showLoading()}
528
+ hideLoading={() => this._hideLoading()}
529
+ fullPosting={this.state.fullPosting}
530
+ progressBarHeight={this.state.progressBarHeight}
531
+ headerHeight={this.state.headerHeight} />
532
+ :
533
+ null
534
+ }
535
+
536
+ {this.state.view === Views.PUBLISH_3 ?
537
+ <Publish3 postingAd={this.state.postingAd}
538
+ editingStepOne={this.state.editingStepOne}
539
+ scroll={(ref) => this.scroll.scrollIntoView(ref)}
540
+ saveEditAd={() => this._saveEditAd()}
541
+ goToPage={(view) => this._goToPage(view)}
542
+ goBack={() => this.goBack()}
543
+ request={this.props.request}
544
+ context={this.props.context}
545
+ showLoading={() => this._showLoading()}
546
+ hideLoading={() => this._hideLoading()}
547
+ fullPosting={this.state.fullPosting}
548
+ progressBarHeight={this.state.progressBarHeight}
549
+ headerHeight={this.state.headerHeight} />
550
+ :
551
+ null
552
+ }
553
+
554
+ {this.state.view === Views.PUBLISH_4 ?
555
+ <Publish4 postingAd={this.state.postingAd}
556
+ saveEditAd={() => this._saveEditAd()}
557
+ goToPage={(view) => this._goToPage(view)}
558
+ request={this.props.request}
559
+ context={this.props.context}
560
+ showLoading={() => this._showLoading()}
561
+ hideLoading={() => this._hideLoading()}
562
+ fullPosting={this.state.fullPosting}
563
+ progressBarHeight={this.state.progressBarHeight}
564
+ headerHeight={this.state.headerHeight}
565
+ openPictureSelector={() => this._openPictureSelector()}
566
+ maxPictures={this.state.maxPictures}
567
+ images={this.state.images} />
568
+ :
569
+ null
570
+ }
571
+
572
+ {this.state.view === Views.PUBLISH_5 ?
573
+ <Publish5 postingAd={this.state.postingAd}
574
+ scroll={(ref) => this.scroll.scrollIntoView(ref)}
575
+ saveEditAd={() => this._saveEditAd()}
576
+ goToPage={(view) => this._goToPage(view)}
577
+ request={this.props.request}
578
+ context={this.props.context}
579
+ showLoading={() => this._showLoading()}
580
+ hideLoading={() => this._hideLoading()}
581
+ fullPosting={this.state.fullPosting}
582
+ progressBarHeight={this.state.progressBarHeight}
583
+ headerHeight={this.state.headerHeight} />
584
+ :
585
+ null
586
+ }
587
+
588
+ {this.state.view === Views.PUBLISH_6 ?
589
+ <Publish6 postingAd={this.state.postingAd}
590
+ country={this.props.country}
591
+ businessId={this.state.businessId}
592
+ scroll={(ref) => this.scroll.scrollIntoView(ref)}
593
+ saveEditAd={() => this._saveEditAd()}
594
+ goToPage={(view, params) => this._goToPage(view, null, params)}
595
+ request={this.props.request}
596
+ context={this.props.context}
597
+ showLoading={() => this._showLoading()}
598
+ hideLoading={() => this._hideLoading()}
599
+ fullPosting={this.state.fullPosting}
600
+ progressBarHeight={this.state.progressBarHeight}
601
+ headerHeight={this.state.headerHeight} />
602
+ :
603
+ null
604
+ }
605
+
606
+ {this.state.view === Views.PREVIEW ?
607
+ <Preview postingAd={this.state.postingAd}
608
+ country={this.props.country}
609
+ goBack={() => this.goBack()}
610
+ showLoading={() => this._showLoading()}
611
+ hideLoading={() => this._hideLoading()}
612
+ businessId={this.state.businessId}
613
+ progressBarHeight={this.state.progressBarHeight}
614
+ request={this.props.request}
615
+ headerHeight={this.state.headerHeight}
616
+ highlight={() => this._goToPage(Views.PAYMENT_ONLINE)}
617
+ params={this.state.params} />
618
+ :
619
+ null
620
+ }
621
+
622
+ {this.state.view === Views.EDIT_SELECTOR ?
623
+ <PostingEdit postingAd={this.state.postingAd}
624
+ topBar={this.props.topBar}
625
+ goToPage={(view) => this._goToPage(view)} />
626
+ :
627
+ null
628
+ }
618
629
 
619
630
  {this.state.view === Views.PAYMENT_ONLINE ?
620
631
  <PaymentOnlinePopup
package/PostingEdit.js CHANGED
@@ -14,8 +14,14 @@ export default class PostingEdit extends React.Component {
14
14
  };
15
15
  }
16
16
 
17
+ componentDidMount = () => {
18
+ this.refresh();
19
+ }
20
+
17
21
  componentDidUpdate = (prevProps) => {
18
- if (prevProps.postingAd.id !== this.props.postingAd.id) {
22
+ if (this.props.postingAd.images[0].id !== prevProps.postingAd.images[0].id
23
+ || this.props.postingAd.languages.filter(item => this.props.postingAd.languageId === item.language)[0].title !== prevProps.postingAd.languages.filter(item => prevProps.postingAd.languageId === item.language)[0].title
24
+ || this.props.postingAd.adTypeDetails.filter(detail => detail.value == "floorType").length !== prevProps.postingAd.adTypeDetails.filter(detail => detail.value == "floorType").length) {
19
25
  this.refresh();
20
26
  }
21
27
  }
@@ -37,7 +43,7 @@ export default class PostingEdit extends React.Component {
37
43
  render() {
38
44
  return (
39
45
  this.state.showFunctionalities != null ?
40
- <View style={[commonStyles.body, this.props.showView ? '' : commonStyles.displayNone]}>
46
+ <View style={commonStyles.body}>
41
47
  <View style={[commonStyles.row]}>
42
48
  <Icon style={[commonStyles.h2, commonStyles.homeContentH2, commonStyles.titleIcon]} name="edit" />
43
49
  <Text style={[commonStyles.h2, commonStyles.homeContentH2]}>{strings('edit.whatEditing')}</Text>