@supportworks/multi-imagepicker 6.0.0 → 7.0.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.
@@ -1,47 +1,86 @@
1
- import AsyncStorage from "@react-native-async-storage/async-storage";
1
+ import AsyncStorage from '@react-native-async-storage/async-storage'
2
2
 
3
- export default class MIPickerApi
4
- {
5
- /**
3
+ export default class MIPickerApi {
4
+ /**
6
5
  *
7
6
  * Initialize property getters and setters
8
7
  * */
9
8
 
10
- setDefaultSavePhotosToDevice(defaultSavePhotosToDevice) {
11
- //AsyncStorage must be a string value, so converting boolean to string to save to AS
12
- let newValBool = defaultSavePhotosToDevice;
13
- let newValStr;
14
- if ((newValBool === null) || (newValBool === true)) {
15
- newValBool = true; //default
16
- newValStr = "Y";
17
- } else {
18
- newValBool = false;
19
- newValStr = "N";
20
- }
21
- AsyncStorage.setItem('@SavePhotosToDevice', newValStr)
22
- .then(res => {
23
- console.log("Set defaultSavePhotosToDevice: AsyncStorage.setItem success, set to value: " + newValStr);
24
- this._defaultSavePhotosToDevice = newValBool;
25
- })
26
- .catch(err => {
27
- console.log("Set defaultSavePhotosToDevice: AsyncStorage.setItem failed, Error: " + err);
28
- this._defaultSavePhotosToDevice = newValBool;
29
- });
9
+ setDefaultSavePhotosToDevice (defaultSavePhotosToDevice) {
10
+ // AsyncStorage must be a string value, so converting boolean to string to save to AS
11
+ let newValBool = defaultSavePhotosToDevice
12
+ let newValStr
13
+ if ((newValBool === null) || (newValBool === true)) {
14
+ newValBool = true // default
15
+ newValStr = 'Y'
16
+ } else {
17
+ newValBool = false
18
+ newValStr = 'N'
30
19
  }
31
- async getDefaultSavePhotosToDevice() {
32
- console.log("in Get defaultSavePhotosToDevice");
33
- if ((this._defaultSavePhotosToDevice !== null) && (this._defaultSavePhotosToDevice !== undefined)) {
34
- return this._defaultSavePhotosToDevice;
35
- }
36
- console.log("in Get defaultSavePhotosToDevice, trying to get value from AsyncStorage");
37
- //not a value yet, so look in AsyncStorage
38
- let retVal = await AsyncStorage.getItem("@SavePhotosToDevice");
39
- if (retVal === "N") {
40
- console.log("Get defaultSavePhotosToDevice: return false");
41
- return false;
42
- } else {
43
- console.log("Get defaultSavePhotosToDevice: return true");
44
- return true;
45
- }
20
+ AsyncStorage.setItem('@SavePhotosToDevice', newValStr)
21
+ .then(res => {
22
+ console.log('setDefaultSavePhotosToDevice: AsyncStorage.setItem success, set to value: ' + newValStr)
23
+ this._defaultSavePhotosToDevice = newValBool
24
+ })
25
+ .catch(err => {
26
+ console.log('setDefaultSavePhotosToDevice: AsyncStorage.setItem failed, Error: ' + err)
27
+ this._defaultSavePhotosToDevice = newValBool
28
+ })
29
+ }
30
+
31
+ async getDefaultSavePhotosToDevice () {
32
+ console.log('in getDefaultSavePhotosToDevice')
33
+ if ((this._defaultSavePhotosToDevice !== null) && (this._defaultSavePhotosToDevice !== undefined)) {
34
+ return this._defaultSavePhotosToDevice
35
+ }
36
+ console.log('in getDefaultSavePhotosToDevice, trying to get value from AsyncStorage')
37
+ // not a value yet, so look in AsyncStorage
38
+ const retVal = await AsyncStorage.getItem('@SavePhotosToDevice')
39
+ if (retVal === 'N') {
40
+ console.log('getDefaultSavePhotosToDevice: return false')
41
+ return false
42
+ } else {
43
+ console.log('getDefaultSavePhotosToDevice: return true')
44
+ return true
45
+ }
46
+ }
47
+
48
+ setDefaultShowToCustomer (defaultShowToCustomer) {
49
+ // AsyncStorage must be a string value, so converting boolean to string to save to AS
50
+ let newValBool = defaultShowToCustomer
51
+ let newValStr
52
+ if ((newValBool === null) || (newValBool === true)) {
53
+ newValBool = true // default
54
+ newValStr = 'Y'
55
+ } else {
56
+ newValBool = false
57
+ newValStr = 'N'
58
+ }
59
+ AsyncStorage.setItem('@MIP_ShowToCustomer', newValStr)
60
+ .then(res => {
61
+ console.log('setDefaultShowToCustomer: AsyncStorage.setItem success, set to value: ' + newValStr)
62
+ this._defaultShowToCustomer = newValBool
63
+ })
64
+ .catch(err => {
65
+ console.log('setDefaultShowToCustomer: AsyncStorage.setItem failed, Error: ' + err)
66
+ this._defaultShowToCustomer = newValBool
67
+ })
68
+ }
69
+
70
+ async getDefaultShowToCustomer () {
71
+ console.log('in getDefaultShowToCustomer')
72
+ if ((this._defaultShowToCustomer !== null) && (this._defaultShowToCustomer !== undefined)) {
73
+ return this._defaultShowToCustomer
74
+ }
75
+ console.log('in getDefaultShowToCustomer, trying to get value from AsyncStorage')
76
+ // not a value yet, so look in AsyncStorage
77
+ const retVal = await AsyncStorage.getItem('@MIP_ShowToCustomer')
78
+ if (retVal === 'N') {
79
+ console.log('getDefaultShowToCustomer: return false')
80
+ return false
81
+ } else {
82
+ console.log('getDefaultShowToCustomer: return true')
83
+ return true
46
84
  }
85
+ }
47
86
  }