muba-posting 4.1.28 → 4.2.0

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,
@@ -315,13 +317,6 @@ export default class Posting extends React.Component {
315
317
  await this._updateCurrentScreen(view, params);
316
318
  }
317
319
 
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
320
  async _updateCurrentScreen(view, params) {
326
321
  switch (view) {
327
322
  case Views.PUBLISH_1:
@@ -331,28 +326,23 @@ export default class Posting extends React.Component {
331
326
  this.setState({ currentScreen: 2 });
332
327
  break;
333
328
  case Views.PUBLISH_2_B:
334
- await this.publish2bScreen.loadData();
335
329
  this.setState({ currentScreen: 2 });
336
330
  break;
337
331
  case Views.PUBLISH_3:
338
- await this.publish3Screen.refreshData();
339
332
  this.setState({ currentScreen: 3 });
340
333
  break;
341
334
  case Views.PUBLISH_4:
342
335
  this.setState({ currentScreen: 4 });
343
336
  break;
344
337
  case Views.PUBLISH_5:
345
- await this.publish5Screen.refreshData();
346
338
  this.setState({ currentScreen: 5 });
347
339
  break;
348
340
  case Views.PUBLISH_6:
349
- await this.publish6Screen.generateTitleDescription();
350
- await this.publish6Screen.resetSubmitClicked();
351
341
  this.setState({ currentScreen: 6 });
352
342
  break;
353
343
  case Views.PREVIEW:
354
344
  if (params) {
355
- await this.previewScreen.refreshData(params);
345
+ await this.setState({ params: params });
356
346
  }
357
347
  break;
358
348
  case Views.EDIT_SELECTOR:
@@ -403,7 +393,6 @@ export default class Posting extends React.Component {
403
393
  if (this.state.originView === Views.EDIT_SELECTOR) {
404
394
  this.setState({ isLoading: true });
405
395
  await this.loadAd();
406
- this.editSelector.refresh();
407
396
  this._goToPage(Views.EDIT_SELECTOR);
408
397
  } else {
409
398
  this.props.navigation.goBack();
@@ -437,11 +426,10 @@ export default class Posting extends React.Component {
437
426
  }
438
427
 
439
428
  imageBrowserCallback = async (photos) => {
440
- await this.setState({ showImageBrowser: false });
441
-
442
- for (let photo of photos) {
443
- this.publish4Screen.loadImage(photo);
444
- }
429
+ this.setState({
430
+ showImageBrowser: false,
431
+ images: photos
432
+ });
445
433
  }
446
434
 
447
435
  getAd = async (id) => {
@@ -453,10 +441,10 @@ export default class Posting extends React.Component {
453
441
  }
454
442
 
455
443
  _savePicture = async (picture) => {
456
- await this.setState({ showImageBrowser: false })
457
- this.setState({ view: Views.PUBLISH_4 }, () => {
458
- this.publish4Screen.loadImage(picture);
459
- })
444
+ this.setState({
445
+ showImageBrowser: false,
446
+ images: [picture]
447
+ });
460
448
  }
461
449
 
462
450
  render() {
@@ -491,130 +479,152 @@ export default class Posting extends React.Component {
491
479
  null
492
480
  }
493
481
 
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)} />
482
+ {this.state.view === Views.PUBLISH_1 ?
483
+ <Publish1 postingAd={this.state.postingAd}
484
+ baseUrl={this.props.baseUrl}
485
+ request={this.props.request}
486
+ context={this.props.context}
487
+ showLoading={() => this._showLoading()}
488
+ hideLoading={() => this._hideLoading()}
489
+ scroll={(ref) => this.scroll.scrollIntoView(ref)}
490
+ fullPosting={this.state.fullPosting}
491
+ goToPage={(view, editingStepOne) => this._goToPage(view, editingStepOne)}
492
+ saveEditAd={() => this._saveEditAd()}
493
+ progressBarHeight={this.state.progressBarHeight}
494
+ headerHeight={this.state.headerHeight} />
495
+ :
496
+ null
497
+ }
498
+
499
+ {this.state.view === Views.PUBLISH_2 ?
500
+ <Publish2 postingAd={this.state.postingAd}
501
+ scroll={(ref) => this.scroll.scrollIntoView(ref)}
502
+ saveEditAd={() => this._saveEditAd()}
503
+ goToPage={(view) => this._goToPage(view)}
504
+ replacePage={(view) => this._updateCurrentScreen(view)}
505
+ baseUrl={this.props.baseUrl}
506
+ request={this.props.request}
507
+ context={this.props.context}
508
+ showLoading={() => this._showLoading()}
509
+ hideLoading={() => this._hideLoading()}
510
+ hereAppId={this.props.hereAppId} hereAppCode={this.props.hereAppCode}
511
+ fullPosting={this.state.fullPosting}
512
+ progressBarHeight={this.state.progressBarHeight}
513
+ headerHeight={this.state.headerHeight} />
514
+ :
515
+ null
516
+ }
517
+
518
+ {this.state.view === Views.PUBLISH_2_B ?
519
+ <Publish2b postingAd={this.state.postingAd}
520
+ scroll={(ref) => this.scroll.scrollIntoView(ref)}
521
+ saveEditAd={() => this._saveEditAd()}
522
+ goToPage={(view) => this._goToPage(view)}
523
+ replacePage={(view) => this._updateCurrentScreen(view)}
524
+ request={this.props.request}
525
+ context={this.props.context}
526
+ showLoading={() => this._showLoading()}
527
+ hideLoading={() => this._hideLoading()}
528
+ fullPosting={this.state.fullPosting}
529
+ progressBarHeight={this.state.progressBarHeight}
530
+ headerHeight={this.state.headerHeight} />
531
+ :
532
+ null
533
+ }
534
+
535
+ {this.state.view === Views.PUBLISH_3 ?
536
+ <Publish3 postingAd={this.state.postingAd}
537
+ editingStepOne={this.state.editingStepOne}
538
+ scroll={(ref) => this.scroll.scrollIntoView(ref)}
539
+ saveEditAd={() => this._saveEditAd()}
540
+ goToPage={(view) => this._goToPage(view)}
541
+ goBack={() => this.goBack()}
542
+ request={this.props.request}
543
+ context={this.props.context}
544
+ showLoading={() => this._showLoading()}
545
+ hideLoading={() => this._hideLoading()}
546
+ fullPosting={this.state.fullPosting}
547
+ progressBarHeight={this.state.progressBarHeight}
548
+ headerHeight={this.state.headerHeight} />
549
+ :
550
+ null
551
+ }
552
+
553
+ {this.state.view === Views.PUBLISH_4 ?
554
+ <Publish4 postingAd={this.state.postingAd}
555
+ saveEditAd={() => this._saveEditAd()}
556
+ goToPage={(view) => this._goToPage(view)}
557
+ request={this.props.request}
558
+ context={this.props.context}
559
+ showLoading={() => this._showLoading()}
560
+ hideLoading={() => this._hideLoading()}
561
+ fullPosting={this.state.fullPosting}
562
+ progressBarHeight={this.state.progressBarHeight}
563
+ headerHeight={this.state.headerHeight}
564
+ openPictureSelector={() => this._openPictureSelector()}
565
+ maxPictures={this.state.maxPictures}
566
+ images={this.state.images} />
567
+ :
568
+ null
569
+ }
570
+
571
+ {this.state.view === Views.PUBLISH_5 ?
572
+ <Publish5 postingAd={this.state.postingAd}
573
+ scroll={(ref) => this.scroll.scrollIntoView(ref)}
574
+ saveEditAd={() => this._saveEditAd()}
575
+ goToPage={(view) => this._goToPage(view)}
576
+ request={this.props.request}
577
+ context={this.props.context}
578
+ showLoading={() => this._showLoading()}
579
+ hideLoading={() => this._hideLoading()}
580
+ fullPosting={this.state.fullPosting}
581
+ progressBarHeight={this.state.progressBarHeight}
582
+ headerHeight={this.state.headerHeight} />
583
+ :
584
+ null
585
+ }
586
+
587
+ {this.state.view === Views.PUBLISH_6 ?
588
+ <Publish6 postingAd={this.state.postingAd}
589
+ country={this.props.country}
590
+ businessId={this.state.businessId}
591
+ scroll={(ref) => this.scroll.scrollIntoView(ref)}
592
+ saveEditAd={() => this._saveEditAd()}
593
+ goToPage={(view, params) => this._goToPage(view, null, params)}
594
+ request={this.props.request}
595
+ context={this.props.context}
596
+ showLoading={() => this._showLoading()}
597
+ hideLoading={() => this._hideLoading()}
598
+ fullPosting={this.state.fullPosting}
599
+ progressBarHeight={this.state.progressBarHeight}
600
+ headerHeight={this.state.headerHeight} />
601
+ :
602
+ null
603
+ }
604
+
605
+ {this.state.view === Views.PREVIEW ?
606
+ <Preview postingAd={this.state.postingAd}
607
+ country={this.props.country}
608
+ goBack={() => this.goBack()}
609
+ showLoading={() => this._showLoading()}
610
+ hideLoading={() => this._hideLoading()}
611
+ businessId={this.state.businessId}
612
+ progressBarHeight={this.state.progressBarHeight}
613
+ request={this.props.request}
614
+ headerHeight={this.state.headerHeight}
615
+ highlight={() => this._goToPage(Views.PAYMENT_ONLINE)}
616
+ params={this.state.params} />
617
+ :
618
+ null
619
+ }
620
+
621
+ {this.state.view === Views.EDIT_SELECTOR ?
622
+ <PostingEdit postingAd={this.state.postingAd}
623
+ topBar={this.props.topBar}
624
+ goToPage={(view) => this._goToPage(view)} />
625
+ :
626
+ null
627
+ }
618
628
 
619
629
  {this.state.view === Views.PAYMENT_ONLINE ?
620
630
  <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>