@supportworks/multi-imagepicker 5.0.4 → 5.0.6

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/changes.md CHANGED
@@ -1,3 +1,7 @@
1
+
2
+ # v5.0.5 & v5.0.6 2025-05-15
3
+ * added analytics
4
+
1
5
  # v5.0.4 2024-11-14
2
6
  * updated multiimagepicker perms message for android to be more clear
3
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supportworks/multi-imagepicker",
3
- "version": "5.0.4",
3
+ "version": "5.0.6",
4
4
  "description": "Android and iOS customized multiple image picker. For react-native >= 0.60.",
5
5
  "main": "index.js",
6
6
  "author": {
@@ -14,6 +14,7 @@
14
14
  "@react-native-async-storage/async-storage": "^1.15.5",
15
15
  "@react-native-community/blur": ">=3.6.0",
16
16
  "@react-native-camera-roll/camera-roll": ">=5.7.2",
17
+ "@supportworks/analytics": ">=1.0.1",
17
18
  "@supportworks/api-core": ">=1.0.9",
18
19
  "@supportworks/app-styler": ">=1.0.6",
19
20
  "@supportworks/core-controls": ">=1.1.6",
@@ -16,6 +16,7 @@ import {LoadingOverlay} from '@supportworks/navbars';
16
16
  import {CheckBox} from "@supportworks/core-controls";
17
17
  import {CameraRoll} from "@react-native-camera-roll/camera-roll";
18
18
  import {Api} from '@supportworks/api-core';
19
+ import {Analytics} from '@supportworks/analytics';
19
20
 
20
21
  class AddImages extends React.Component
21
22
  {
@@ -163,6 +164,7 @@ class AddImages extends React.Component
163
164
  }
164
165
 
165
166
  onPressCheckbox() {
167
+ Analytics.logEvent('mip_addImages_saveToDevice_onPressCheckbox', { source_page: 'MultiImagePicker', saveToDeviceSetTo: !this.state.saveToDevice })
166
168
  this.setState({saveToDevice: !this.state.saveToDevice});
167
169
  }
168
170
 
@@ -181,6 +183,7 @@ class AddImages extends React.Component
181
183
  //only save user selection if they had a chance to enable/disable sabving to camera roll
182
184
  await Api.getApi().setDefaultSavePhotosToDevice(cRef.state.saveToDevice);
183
185
  }
186
+ Analytics.logEvent('mip_addImages_onAttach', { source_page: 'MultiImagePicker' })
184
187
  if (cRef.props.callback) {
185
188
  cRef.props.callback();
186
189
  }
@@ -3,6 +3,7 @@ import {
3
3
  View
4
4
  } from 'react-native';
5
5
  import SingleImage from "./SingleImage";
6
+ import { Analytics } from '@supportworks/analytics'
6
7
 
7
8
  class SelectedImages extends React.Component {
8
9
 
@@ -19,6 +20,10 @@ class SelectedImages extends React.Component {
19
20
  this.onChangeImageInfo = this.onChangeImageInfo.bind(this);
20
21
  }
21
22
 
23
+ componentDidMount () {
24
+ Analytics.setCurrentScreen('MultiImagePicker/SelectedImages', this.constructor.name)
25
+ }
26
+
22
27
  onChangeImageInfo(payload) {
23
28
  //callback from ProjectAttachmentsSelectedImage, to update imgArr with any changes (called per keystroke)
24
29
  //payload expected (json): {name: 'fieldname', value: 'fieldvalue', isValid: boolean, imgIndex: number});
@@ -76,4 +81,4 @@ class SelectedImages extends React.Component {
76
81
  }
77
82
  }
78
83
 
79
- export default SelectedImages;
84
+ export default SelectedImages;
@@ -15,6 +15,7 @@ import {Api} from '@supportworks/api-core';
15
15
  import AppStyler, {colors, stdStyles} from "@supportworks/app-styler";
16
16
  import { Canvas } from '@supportworks/react-native-annotate';
17
17
  import ImageResizer from '@bam.tech/react-native-image-resizer';
18
+ import {Analytics} from '@supportworks/analytics';
18
19
 
19
20
  class SingleImage extends React.Component {
20
21
 
@@ -37,7 +38,9 @@ class SingleImage extends React.Component {
37
38
  this.txtTitle = !!props.imgObject.defaultName ? props.imgObject.defaultName : Moment(new Date()).format('YYYY-MM-DD_hmmssa');
38
39
  this.txtTitleEditable = !!props.imgObject.defaultName ? (props.imgObject.defaultOnly===false) : true;
39
40
  this.txtDesc = '';
40
- this.state = {
41
+ this.initTitle = this.txtTitle
42
+ this.initDesc = this.txtDesc
43
+ this.state = {
41
44
  showCanvas: false,
42
45
  version: 1
43
46
  }
@@ -69,6 +72,7 @@ class SingleImage extends React.Component {
69
72
  //console.log("-----onChangeDesc end: description=" + cRef.txtDesc);
70
73
  }
71
74
  async onReadyCanvas(path){
75
+ Analytics.logEvent('mip_singleImage_onReadyCanvas_annotate', { source_page: 'MultiImagePicker' })
72
76
  let data = await Api.getApi().getBase64FromLocal(path);
73
77
  let json = await Api.getApi().getUTF8FromLocal(path+".json");
74
78
  let origData = await Api.getApi().getBase64FromLocal(path+".orig");
@@ -92,6 +96,32 @@ class SingleImage extends React.Component {
92
96
  onCloseCanvas(){
93
97
  this.setState({showCanvas: false, canvasData: "", filePath: ""});
94
98
  }
99
+ onDoneEditingInput(field, newValue) {
100
+ //capture change in input value, for reporting to analytics
101
+ try {
102
+ let initValue
103
+ let aType
104
+ if (field === 'title') {
105
+ initValue = this.initTitle
106
+ aType = "titleChange"
107
+ } else {
108
+ initValue = this.initDesc
109
+ aType = "descChange"
110
+ }
111
+
112
+ if (newValue !== initValue) {
113
+ //console.log("-----onDoneEditingInput: initValue=" + initValue + "; newValue=" + newValue + "; aType:" + aType);
114
+ Analytics.logEvent('mip_singleImage_' + aType, {
115
+ source_page: 'MultiImagePicker',
116
+ initValue: initValue,
117
+ newValue: newValue
118
+ })
119
+ }
120
+ } catch (err) {
121
+ console.log("-----onDoneEditingInput: error=" + err)
122
+ }
123
+ }
124
+
95
125
  render () {
96
126
  let cRef = this;
97
127
  let imgObj = cRef.props.imgObject;
@@ -140,11 +170,13 @@ class SingleImage extends React.Component {
140
170
  callback={cRef.onChangeTitle}
141
171
  editable={cRef.txtTitleEditable}
142
172
  disabled={!cRef.txtTitleEditable}
173
+ onEndEditing={(e) => cRef.onDoneEditingInput('title', e.nativeEvent.text)}
143
174
  />
144
175
  <TextInputSWMD
145
176
  label={'Description'} value={cRef.txtDesc} multiline={true} maxLength={500}
146
177
  validationType={'0'}
147
178
  callback={cRef.onChangeDesc}
179
+ onEndEditing={(e) => cRef.onDoneEditingInput('description', e.nativeEvent.text)}
148
180
  />
149
181
  </Block>
150
182
  </Section>