@supportworks/multi-imagepicker 5.0.4 → 5.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/changes.md CHANGED
@@ -1,3 +1,7 @@
1
+
2
+ # v5.0.5 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.5",
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
  }
@@ -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
  }
@@ -92,6 +95,32 @@ class SingleImage extends React.Component {
92
95
  onCloseCanvas(){
93
96
  this.setState({showCanvas: false, canvasData: "", filePath: ""});
94
97
  }
98
+ onDoneEditingInput(field, newValue) {
99
+ //capture change in input value, for reporting to analytics
100
+ try {
101
+ let initValue
102
+ let aType
103
+ if (field === 'title') {
104
+ initValue = this.initTitle
105
+ aType = "titleChange"
106
+ } else {
107
+ initValue = this.initDesc
108
+ aType = "descChange"
109
+ }
110
+
111
+ if (newValue !== initValue) {
112
+ //console.log("-----onDoneEditingInput: initValue=" + initValue + "; newValue=" + newValue + "; aType:" + aType);
113
+ Analytics.logEvent('mip_singleImage_' + aType, {
114
+ source_page: 'MultiImagePicker',
115
+ initValue: initValue,
116
+ newValue: newValue
117
+ })
118
+ }
119
+ } catch (err) {
120
+ console.log("-----onDoneEditingInput: error=" + err)
121
+ }
122
+ }
123
+
95
124
  render () {
96
125
  let cRef = this;
97
126
  let imgObj = cRef.props.imgObject;
@@ -140,11 +169,13 @@ class SingleImage extends React.Component {
140
169
  callback={cRef.onChangeTitle}
141
170
  editable={cRef.txtTitleEditable}
142
171
  disabled={!cRef.txtTitleEditable}
172
+ onEndEditing={(e) => cRef.onDoneEditingInput('title', e.nativeEvent.text)}
143
173
  />
144
174
  <TextInputSWMD
145
175
  label={'Description'} value={cRef.txtDesc} multiline={true} maxLength={500}
146
176
  validationType={'0'}
147
177
  callback={cRef.onChangeDesc}
178
+ onEndEditing={(e) => cRef.onDoneEditingInput('description', e.nativeEvent.text)}
148
179
  />
149
180
  </Block>
150
181
  </Section>