muba-posting 4.0.2 → 4.0.5

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
@@ -54,7 +54,7 @@ export default class Posting extends React.Component {
54
54
  prevViews: [],
55
55
  currentScreen: 1,
56
56
  fontLoaded: false,
57
- isLoading: true,
57
+ isLoading: false,
58
58
  showImageBrowser: false,
59
59
  headerHeight: 0,
60
60
  progressBarHeight: 0,
@@ -159,7 +159,7 @@ export default class Posting extends React.Component {
159
159
  ]);
160
160
  this.setState({ fontLoaded: true });
161
161
 
162
- this.loadData();
162
+ this.popupPermissions.open();
163
163
  }
164
164
 
165
165
  refresh = () => {
@@ -182,8 +182,7 @@ export default class Posting extends React.Component {
182
182
  });
183
183
  }
184
184
 
185
- loadData = async () => {
186
- const canPublish = await this.popupPermissions.open();
185
+ loadData = async (canPublish) => {
187
186
  if (canPublish) {
188
187
  const resultJson = await this.props.request(this, GET_COUNTRY_PHONE);
189
188
  if (resultJson.success) {
@@ -205,6 +204,7 @@ export default class Posting extends React.Component {
205
204
  }
206
205
  BackHandler.addEventListener('hardwareBackPress', this.goBack);
207
206
  } else {
207
+ this.goBack();
208
208
  await this.setState({ isLoading: false });
209
209
  }
210
210
  }
@@ -217,7 +217,9 @@ export default class Posting extends React.Component {
217
217
  originView: this.props.adId ? Views.EDIT_SELECTOR : Views.PUBLISH_1,
218
218
  prevViews: [],
219
219
  currentScreen: 1
220
- }, this.loadData);
220
+ }, () => {
221
+ this.popupPermissions.open();
222
+ });
221
223
  }
222
224
  }
223
225
 
@@ -447,7 +449,7 @@ export default class Posting extends React.Component {
447
449
  :
448
450
  null}
449
451
 
450
- <PopupPermissions ref={(element) => this.popupPermissions = element} camera={true} mediaLibrary={true} message={strings('setup.permissionsMessage')} goBack={this.goBack} />
452
+ <PopupPermissions ref={(element) => this.popupPermissions = element} camera={true} mediaLibrary={true} message={strings('setup.permissionsMessage')} onClose={this.loadData} />
451
453
 
452
454
  {this.state.fontLoaded ?
453
455
  <View style={[this.props.containerStyle, this.state.showImageBrowser ? commonStyles.displayNone : '']}>
package/Publish1.js CHANGED
@@ -23,26 +23,30 @@ export default class Publish1 extends React.Component {
23
23
  };
24
24
  }
25
25
 
26
- async componentDidMount() {
27
- this.props.showLoading();
28
- const responseJson = await this.props.request(this.props.context, GET_CATEGORIES, {
29
- userEmail: this.props.postingAd.userEmail
30
- });
31
-
32
- if (responseJson.success) {
33
- this.jsonCategories = responseJson.categoryList;
34
- this.props.postingAd.category = this.props.postingAd.category != null ? this.props.postingAd.category : this.jsonCategories[0].value;
35
- this.props.postingAd.subCategory = this.props.postingAd.subCategory != null ? this.props.postingAd.subCategory : this.jsonCategories[0].subCategoryList[0].value;
36
-
37
- await this.setState({
38
- transactionOptions: { elements: this.jsonCategories.map(jsonCategory => { return { label: jsonCategory.label, value: jsonCategory.value } }), selectedItem: this.props.postingAd.category },
39
- typeBienOptions: { elements: this.getSubCategories(this.props.postingAd.category), selectedItem: this.props.postingAd.subCategory }
40
- })
26
+ componentDidUpdate = async (prevProps) => {
27
+ if (!prevProps.showView && this.props.showView && !this.state.viewLoaded) {
28
+ this.props.showLoading();
29
+ this.setState({
30
+ viewLoaded: true
31
+ });
32
+
33
+ const responseJson = await this.props.request(this.props.context, GET_CATEGORIES, {
34
+ userEmail: this.props.postingAd.userEmail
35
+ });
36
+
37
+ if (responseJson.success) {
38
+ this.jsonCategories = responseJson.categoryList;
39
+ this.props.postingAd.category = this.props.postingAd.category != null ? this.props.postingAd.category : this.jsonCategories[0].value;
40
+ this.props.postingAd.subCategory = this.props.postingAd.subCategory != null ? this.props.postingAd.subCategory : this.jsonCategories[0].subCategoryList[0].value;
41
+
42
+ await this.setState({
43
+ transactionOptions: { elements: this.jsonCategories.map(jsonCategory => { return { label: jsonCategory.label, value: jsonCategory.value } }), selectedItem: this.props.postingAd.category },
44
+ typeBienOptions: { elements: this.getSubCategories(this.props.postingAd.category), selectedItem: this.props.postingAd.subCategory }
45
+ })
46
+ }
47
+ this.props.hideLoading();
41
48
  }
42
- this.props.hideLoading();
43
- }
44
49
 
45
- componentDidUpdate = (prevProps) => {
46
50
  const componentsHeight = this.props.headerHeight + this.props.progressBarHeight;
47
51
  const minHeight = window.height - componentsHeight;
48
52
  if (this.state.minHeight != minHeight) {
package/Publish2.js CHANGED
@@ -34,7 +34,6 @@ export default class Publish2 extends React.Component {
34
34
  });
35
35
  }
36
36
  if (!prevProps.showView && this.props.showView && !this.state.viewLoaded) {
37
- this.props.showLoading();
38
37
  this.setState({
39
38
  viewLoaded: true
40
39
  });
@@ -54,7 +53,6 @@ export default class Publish2 extends React.Component {
54
53
  }
55
54
 
56
55
  async validateLocation() {
57
- this.props.showLoading();
58
56
  let validateLocation = false;
59
57
 
60
58
  this._changeMapLocation(await this.map.getPosition());
@@ -98,8 +96,6 @@ export default class Publish2 extends React.Component {
98
96
  }
99
97
  }
100
98
 
101
- this.props.hideLoading();
102
-
103
99
  return validateLocation;
104
100
  }
105
101
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muba-posting",
3
- "version": "4.0.2",
3
+ "version": "4.0.5",
4
4
  "description": "Posting",
5
5
  "main": "Posting.js",
6
6
  "scripts": {
@@ -24,7 +24,7 @@
24
24
  "muba-font": "4",
25
25
  "muba-i18n": "4",
26
26
  "muba-input-select": "4",
27
- "muba-input-text": "4.1.0",
27
+ "muba-input-text": "4.1.2",
28
28
  "muba-loading-cursor": "4",
29
29
  "muba-map": "4",
30
30
  "muba-output-text": "4",