muba-posting 4.1.20 → 4.1.22

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
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { BackHandler, Text, TouchableOpacity, View } from 'react-native';
2
+ import { BackHandler, TouchableOpacity, View } from 'react-native';
3
3
  import CustomScrollView from 'muba-custom-scroll-view';
4
4
  import { CommonActions } from '@react-navigation/native';
5
5
  import { loadLocaleData, currentLocale, strings } from 'muba-i18n';
@@ -33,6 +33,7 @@ const BUSINESS_ID = { method: 'GET', url: '/controller/users/{userId}/business-i
33
33
  const BUSINESS_PRODUCTS = { method: 'GET', url: '/controller/products/{key}/remaining' };
34
34
  const MAX_PICTURES = { method: 'GET', url: '/controller/posting/max-pictures' };
35
35
  const COUNTRY_PHONE = { method: 'GET', url: '/controller/countries/{countryCode}/phones' };
36
+ const LOAD_PENDING_CREATED = { method: 'GET', url: '/controller/ads/pending-created/posting' };
36
37
 
37
38
  export default class Posting extends React.Component {
38
39
  constructor(props) {
@@ -207,6 +208,16 @@ export default class Posting extends React.Component {
207
208
  if (!hasListings) {
208
209
  this.popupNoListings.show();
209
210
  } else {
211
+ const pendingAd = await this.props.request(this, LOAD_PENDING_CREATED);
212
+ if (pendingAd.httpStatus === 200) {
213
+ const languages = pendingAd?.languages.length > 0 ? pendingAd?.languages : this.state.postingAd.languages
214
+ const languageId = languages[0].language;
215
+ await this.setState({
216
+ postingAd: { ...this.state.postingAd, ...pendingAd, languageId: languageId, languages: languages },
217
+ isLoading: false
218
+ });
219
+ }
220
+
210
221
  this.setState({ view: this.state.originView });
211
222
  if (this.props.changeView) {
212
223
  this.props.changeView(this.state.originView)
@@ -274,8 +285,12 @@ export default class Posting extends React.Component {
274
285
 
275
286
  prevViews.unshift(this.state.view);
276
287
 
277
- if (!this.state.postingAd.id && this.state.postingAd.town) {
278
- const response = await this.props.request(this, CREATE_AD, this.state.postingAd);
288
+ if (this.state.fullPosting && this.state.postingAd.town && Views.PUBLISH_6 !== this.state.view) {
289
+ const ad = { ...this.state.postingAd };
290
+ if (Views.PUBLISH_4 !== this.state.view) {
291
+ delete ad.images;
292
+ }
293
+ const response = await this.props.request(this, CREATE_AD, ad);
279
294
  if (response.httpStatus === 200) {
280
295
  await this.setState({
281
296
  postingAd: { ...this.state.postingAd, id: response.id }
@@ -363,6 +378,7 @@ export default class Posting extends React.Component {
363
378
  }
364
379
 
365
380
  async _saveEditAd() {
381
+ this._showLoading();
366
382
  const ad = { ...this.state.postingAd, id: { adId: this.state.postingAd.id } };
367
383
  if (this.state.originView === Views.EDIT_SELECTOR && Views.PUBLISH_4 !== this.state.view) {
368
384
  delete ad.images;
@@ -381,6 +397,7 @@ export default class Posting extends React.Component {
381
397
  await this.setState({ postingAd: { ...this.state.postingAd, adId: response.id } });
382
398
  this._goToPage(Views.PREVIEW, null, response);
383
399
  }
400
+ this._hideLoading();
384
401
 
385
402
  if (this.props.showRatingPopup) {
386
403
  this.props.showRatingPopup();
package/Publish6.js CHANGED
@@ -62,7 +62,8 @@ export default class Publish6 extends React.Component {
62
62
  return false;
63
63
  }
64
64
  for (let index = 0; index < firstList?.length; ++index) {
65
- if (firstList[index].value != secondList[index].value) {
65
+ if (firstList[index].title != secondList[index].title
66
+ || firstList[index].description != secondList[index].description) {
66
67
  return false;
67
68
  }
68
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muba-posting",
3
- "version": "4.1.20",
3
+ "version": "4.1.22",
4
4
  "description": "Posting",
5
5
  "main": "Posting.js",
6
6
  "scripts": {