muba-posting 5.0.7 → 5.0.10

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/Publish2.js CHANGED
@@ -11,6 +11,7 @@ const FontAwesomeIcon = createIconSetFromFontello(fontelloConfig);
11
11
  const window = Dimensions.get('window');
12
12
 
13
13
  const GET_LOCATION_FROM_COORDINATES = { method: 'GET', url: '/controller/location' };
14
+ const GET_CHECK_ZONE = { method: 'GET', url: '/controller/posting/check-zone' };
14
15
 
15
16
  export default class Publish2 extends React.Component {
16
17
  constructor(props) {
@@ -26,10 +27,19 @@ export default class Publish2 extends React.Component {
26
27
 
27
28
  async nextStep() {
28
29
  if (await this.validateLocation()) {
29
- if (this.props.postingAd.id == null || this.props.fullPosting) {
30
- this.props.goToPage(Views.PUBLISH_3);
30
+ const responseCheckZone = await this.props.request(this.props.context, GET_CHECK_ZONE, {
31
+ businessId: this.props.postingAd.businessId,
32
+ townId: this.props.postingAd.town
33
+ });
34
+
35
+ if (responseCheckZone.value === 'true') {
36
+ if (this.props.postingAd.id == null || this.props.fullPosting) {
37
+ this.props.goToPage(Views.PUBLISH_3);
38
+ } else {
39
+ this.props.saveEditAd()
40
+ }
31
41
  } else {
32
- this.props.saveEditAd()
42
+ this.popupNoZone.show();
33
43
  }
34
44
  } else {
35
45
  this.popupNoLocation.show();
@@ -123,6 +133,10 @@ export default class Publish2 extends React.Component {
123
133
  onClose={() => this.props.replacePage(Views.PUBLISH_2_B)} title={strings('setup.titleLocationNotFound')} onSubmit={() => { this.props.replacePage(Views.PUBLISH_2_B); return true; }} icon={<FontAwesomeIcon name='block' />}>
124
134
  <Text style={commonStyles.popupText}>{strings('setup.locationNotFound')}</Text>
125
135
  </PopupAdvice>
136
+ <PopupAdvice dialogStyle={commonStyles.popupBox} ref={(popupNoZone) => { this.popupNoZone = popupNoZone; }}
137
+ title={strings('setup.ad_cant_post_zone')} icon={<FontAwesomeIcon name='block' />}>
138
+ <Text style={commonStyles.popupText}></Text>
139
+ </PopupAdvice>
126
140
  </View>
127
141
  );
128
142
  }
package/Publish2b.js CHANGED
@@ -4,13 +4,18 @@ import { strings } from 'muba-i18n';
4
4
  import commonStyles from './commonStyles';
5
5
  import InputSelect from 'muba-input-select';
6
6
  import InputText from 'muba-input-text';
7
+ import PopupAdvice from 'muba-popup-advice';
7
8
  import { Views } from './utils/Views';
9
+ import { createIconSetFromFontello } from 'react-native-vector-icons';
10
+ import fontelloConfig from './fonts/config.json';
11
+ const FontAwesomeIcon = createIconSetFromFontello(fontelloConfig);
8
12
  const window = Dimensions.get('window');
9
13
 
10
14
  const GET_REGIONS = { method: 'GET', url: '/controller/countries/{countryCode}/regions' };
11
15
  const GET_CITIES_FROM_REGION = { method: 'GET', url: '/controller/regions/{regionId}/cities' };
12
16
  const GET_DISTRICTS_FROM_CITY = { method: 'GET', url: '/controller/cities/{cityId}/districts' };
13
17
  const GET_TOWNS_FROM_DISTRICT = { method: 'GET', url: '/controller/districts/{districtId}/towns' };
18
+ const GET_CHECK_ZONE = { method: 'GET', url: '/controller/posting/check-zone' };
14
19
 
15
20
  export default class Publish2b extends React.Component {
16
21
  constructor(props) {
@@ -213,10 +218,19 @@ export default class Publish2b extends React.Component {
213
218
 
214
219
  async nextStep() {
215
220
  if (this.validateForm()) {
216
- if (this.props.postingAd.id == null || this.props.fullPosting) {
217
- this.props.goToPage(Views.PUBLISH_3);
221
+ const responseCheckZone = await this.props.request(this.props.context, GET_CHECK_ZONE, {
222
+ businessId: this.props.postingAd.businessId,
223
+ townId: this.props.postingAd.town
224
+ });
225
+
226
+ if (responseCheckZone.value === 'true') {
227
+ if (this.props.postingAd.id == null || this.props.fullPosting) {
228
+ this.props.goToPage(Views.PUBLISH_3);
229
+ } else {
230
+ this.props.saveEditAd();
231
+ }
218
232
  } else {
219
- this.props.saveEditAd();
233
+ this.popupNoZone.show();
220
234
  }
221
235
  }
222
236
  }
@@ -305,6 +319,10 @@ export default class Publish2b extends React.Component {
305
319
  <Text style={[commonStyles.carteNote, commonStyles.carteNoteMap]}>{strings('setup.useMap')}</Text>
306
320
  </TouchableHighlight>
307
321
  </View>
322
+ <PopupAdvice dialogStyle={commonStyles.popupBox} ref={(popupNoZone) => { this.popupNoZone = popupNoZone; }}
323
+ title={strings('setup.ad_cant_post_zone')} icon={<FontAwesomeIcon name='block' />}>
324
+ <Text style={commonStyles.popupText}></Text>
325
+ </PopupAdvice>
308
326
  </View>
309
327
  );
310
328
  }
package/Publish4.js CHANGED
@@ -63,7 +63,8 @@ export default class Publish4 extends React.Component {
63
63
 
64
64
  async loadUri(photo) {
65
65
  if (photo) {
66
- let fileType = photo.uri.substring(photo.uri.lastIndexOf('.') + 1).toLowerCase();
66
+ const photoStr = photo.uri.lastIndexOf('.') > 0 && photo.uri.lastIndexOf('.') > photo.uri.length - 5 ? photo.uri : photo.filename;
67
+ const fileType = photoStr.substring(photoStr.lastIndexOf('.') + 1).toLowerCase();
67
68
 
68
69
  const image = {
69
70
  uri: photo.uri,
@@ -129,14 +130,19 @@ export default class Publish4 extends React.Component {
129
130
 
130
131
  selectMainPhoto(itemSelected) {
131
132
  let imagesArray = this.state.images.slice();
133
+ let imageSize = this.state.imageSize.slice();
132
134
 
133
135
  for (let imageObject of imagesArray) {
134
136
  imageObject.mainPicture = false;
135
137
 
136
138
  if (imageObject.uri === itemSelected.uri) {
137
139
  imageObject.mainPicture = true;
138
- imagesArray.splice(imagesArray.indexOf(imageObject), 1);
140
+ const imageIndex = imagesArray.indexOf(imageObject);
141
+ imagesArray.splice(imageIndex, 1);
139
142
  imagesArray.splice(0, 0, imageObject);
143
+
144
+ const size = imageSize.splice(imageIndex, 1);
145
+ imageSize.splice(0, 0, ...size);
140
146
  }
141
147
  }
142
148
  let index = 0;
@@ -148,7 +154,8 @@ export default class Publish4 extends React.Component {
148
154
 
149
155
  this.setState({
150
156
  updateMainPhoto: true,
151
- images: imagesArray
157
+ images: imagesArray,
158
+ imageSize: imageSize
152
159
  });
153
160
  }
154
161
 
@@ -296,8 +303,8 @@ export default class Publish4 extends React.Component {
296
303
  return (
297
304
  <View style={[commonStyles.photoBox]} onLayout={this.setContainerWidth} key={index}>
298
305
  <Image style={{ width: this.state.imageSize[index]?.width, height: this.state.imageSize[index]?.height, marginVertical: this.state.imageSize[index]?.marginVertical, marginHorizontal: this.state.imageSize[index]?.marginHorizontal }}
299
- resizeMode='center' source={{ uri: item.uri }} borderRadius={10} onError={() => this.rerenderImage(index)} />
300
- <ImageBackground style={[commonStyles.photoControls, commonStyles.row]} source={require('./assets/images/bg-shadow.png')} resizeMode='center' borderRadius={1.5}>
306
+ resizeMode='cover' source={{ uri: item.uri }} borderRadius={10} onError={() => this.rerenderImage(index)} />
307
+ <ImageBackground style={[commonStyles.photoControls, commonStyles.row]} source={require('./assets/images/bg-shadow.png')} resizeMode='stretch' borderRadius={1.5}>
301
308
 
302
309
  <TouchableHighlight style={commonStyles.leftIcon} onPress={() => this.deleteImage(item.id, index)}>
303
310
  <FontAwesomeIcon style={commonStyles.whiteIcon} name="cancel-circled" />
package/locales/ar.json CHANGED
@@ -117,7 +117,8 @@
117
117
  "south": "جنوب",
118
118
  "west": "الغرب",
119
119
  "est": "شرق",
120
- "highlight": "رفع قيمة"
120
+ "highlight": "رفع قيمة",
121
+ "ad_cant_post_zone":"لا يمكنك النشر في هذه المدينة"
121
122
  },
122
123
  "product": {
123
124
  "LISTING": "قوائم",
package/locales/en.json CHANGED
@@ -117,7 +117,8 @@
117
117
  "south": "South",
118
118
  "west": "West",
119
119
  "est": "Est",
120
- "highlight": "Highlight"
120
+ "highlight": "Highlight",
121
+ "ad_cant_post_zone":"You can't post in this city"
121
122
  },
122
123
  "product": {
123
124
  "LISTING": "Listing",
package/locales/es.json CHANGED
@@ -117,7 +117,8 @@
117
117
  "south": "Sur",
118
118
  "west": "Oeste",
119
119
  "est": "Este",
120
- "highlight": "Destacar"
120
+ "highlight": "Destacar",
121
+ "ad_cant_post_zone":"No puedes publicar en esta ciudad"
121
122
  },
122
123
  "product": {
123
124
  "LISTING": "Listing",
package/locales/fr.json CHANGED
@@ -117,7 +117,8 @@
117
117
  "south": "South",
118
118
  "west": "Ouest",
119
119
  "est": "Est",
120
- "highlight": "Mettre en valeur"
120
+ "highlight": "Mettre en valeur",
121
+ "ad_cant_post_zone":"Vous ne pouvez pas poster dans cette ville"
121
122
  },
122
123
  "product": {
123
124
  "LISTING": "Liste",
package/locales/it.json CHANGED
@@ -117,7 +117,8 @@
117
117
  "south": "Sud",
118
118
  "west": "Ovest",
119
119
  "est": "Est",
120
- "highlight": "Evidenziare"
120
+ "highlight": "Evidenziare",
121
+ "ad_cant_post_zone":"Non puoi postare in questa città"
121
122
  },
122
123
  "product": {
123
124
  "LISTING": "Inserzioni",
package/locales/nl.json CHANGED
@@ -117,7 +117,8 @@
117
117
  "south": "Zuid",
118
118
  "west": "Oost",
119
119
  "est": "North",
120
- "highlight": "Highlighting"
120
+ "highlight": "Highlighting",
121
+ "ad_cant_post_zone":"In deze stad mag je niet posten"
121
122
  },
122
123
  "product": {
123
124
  "LISTING": "Advertenties",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muba-posting",
3
- "version": "5.0.7",
3
+ "version": "5.0.10",
4
4
  "description": "Posting",
5
5
  "main": "Posting.js",
6
6
  "scripts": {