Browse Source

FIX | real-time attachment docs indicator update (BANK-722)

fix/real-time
Yevhen Romanenko 2 years ago
parent
commit
64f26c56b6
  1. 14
      ios/Podfile.lock
  2. 14
      src/modules/tasks/atoms/document-preview.atom.tsx
  3. 19
      src/modules/tasks/hooks/use-task-list-events.hook.ts
  4. 1
      src/services/system/real-time.service.ts
  5. 1
      src/shared/events/index.ts

14
ios/Podfile.lock

@ -9,9 +9,9 @@ PODS: @@ -9,9 +9,9 @@ PODS:
- React-Core (= 0.66.4)
- React-jsi (= 0.66.4)
- ReactCommon/turbomodule/core (= 0.66.4)
- ffmpeg-kit-ios-audio (4.5.1)
- ffmpeg-kit-react-native/audio (4.5.2):
- ffmpeg-kit-ios-audio (= 4.5.1)
- ffmpeg-kit-ios-full (4.5.1)
- ffmpeg-kit-react-native/full (4.5.2):
- ffmpeg-kit-ios-full (= 4.5.1)
- React-Core
- fmt (6.2.1)
- glog (0.3.5)
@ -444,7 +444,7 @@ DEPENDENCIES: @@ -444,7 +444,7 @@ DEPENDENCIES:
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
- ffmpeg-kit-react-native/audio (from `../node_modules/ffmpeg-kit-react-native/ffmpeg-kit-react-native.podspec`)
- ffmpeg-kit-react-native/full (from `../node_modules/ffmpeg-kit-react-native/ffmpeg-kit-react-native.podspec`)
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
- OneSignal (< 4.0, >= 3.0)
- Permission-Camera (from `../node_modules/react-native-permissions/ios/Camera`)
@ -516,7 +516,7 @@ DEPENDENCIES: @@ -516,7 +516,7 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- ffmpeg-kit-ios-audio
- ffmpeg-kit-ios-full
- fmt
- libwebp
- OneSignal
@ -672,7 +672,7 @@ SPEC CHECKSUMS: @@ -672,7 +672,7 @@ SPEC CHECKSUMS:
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
FBLazyVector: e5569e42a1c79ca00521846c223173a57aca1fe1
FBReactNativeSpec: fe08c1cd7e2e205718d77ad14b34957cce949b58
ffmpeg-kit-ios-audio: 662ce2064e56733ca7d8216705efbc38d9e1c3fe
ffmpeg-kit-ios-full: 1e918caa885a00501ec1606c68a874d07d681705
ffmpeg-kit-react-native: bc3c900af9f761b6fe30906ee1bd98000c79f9c9
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 5337263514dd6f09803962437687240c5dc39aa4
@ -747,6 +747,6 @@ SPEC CHECKSUMS: @@ -747,6 +747,6 @@ SPEC CHECKSUMS:
TOCropViewController: edfd4f25713d56905ad1e0b9f5be3fbe0f59c863
Yoga: e7dc4e71caba6472ff48ad7d234389b91dadc280
PODFILE CHECKSUM: d1cd3b32af0702e70a0ab15184e7f8457bfcc729
PODFILE CHECKSUM: a76c90056fe549e78e6914a0ebf8f81ff8b1ae62
COCOAPODS: 1.11.2

14
src/modules/tasks/atoms/document-preview.atom.tsx

@ -69,7 +69,7 @@ export const DocumentPreview: FC<IProps> = ({ url, allowDelete, onDelete }) => { @@ -69,7 +69,7 @@ export const DocumentPreview: FC<IProps> = ({ url, allowDelete, onDelete }) => {
)
return (
<>
<View style={styles.documentWrap}>
<IconComponent
name={'filetext-1'}
size={$size(30, 20)}
@ -80,7 +80,7 @@ export const DocumentPreview: FC<IProps> = ({ url, allowDelete, onDelete }) => { @@ -80,7 +80,7 @@ export const DocumentPreview: FC<IProps> = ({ url, allowDelete, onDelete }) => {
<Txt style={styles.label} weight="500" numberOfLines={1}>
{prepareFileName()}
</Txt>
</>
</View>
)
}
@ -107,7 +107,7 @@ export const DocumentPreview: FC<IProps> = ({ url, allowDelete, onDelete }) => { @@ -107,7 +107,7 @@ export const DocumentPreview: FC<IProps> = ({ url, allowDelete, onDelete }) => {
<TouchableOpacity
onPress={onPressPreview}
style={styles.documentWrap}>
style={styles.previewWrap}>
{renderPreview()}
</TouchableOpacity>
</View>
@ -122,6 +122,14 @@ const createStyles = (theme: PartialTheme) => @@ -122,6 +122,14 @@ const createStyles = (theme: PartialTheme) =>
justifyContent: 'center',
padding: $size(5),
},
previewWrap: {
width: '100%',
height: '100%',
borderRadius: 10,
alignItems: 'center',
justifyContent: 'center',
overflow: 'hidden',
},
documentWrap: {
width: '100%',
height: '100%',

19
src/modules/tasks/hooks/use-task-list-events.hook.ts

@ -86,6 +86,7 @@ export const useTaskListEvents = (props: IProps) => { @@ -86,6 +86,7 @@ export const useTaskListEvents = (props: IProps) => {
if (it.id === data.taskId) it.hasUnreadComments = false
return it
})
props.setItems(changedItems)
}
@ -97,6 +98,7 @@ export const useTaskListEvents = (props: IProps) => { @@ -97,6 +98,7 @@ export const useTaskListEvents = (props: IProps) => {
if (it.id === data.taskId) it.hasAttachments = false
return it
})
props.setItems(changedItems)
}
@ -109,6 +111,21 @@ export const useTaskListEvents = (props: IProps) => { @@ -109,6 +111,21 @@ export const useTaskListEvents = (props: IProps) => {
it.hasUnreadComments = true
return it
})
props.setItems(changedItems)
}
const onTaskNewDocument = (data: { taskId: number }) => {
const index = _.findIndex(props.items, item => item.id === data.taskId)
if (index < 0) return
const changedItems = props.items.map(it => {
if (it.id === data.taskId) {
it.hasAttachments = true
}
return it
})
props.setItems(changedItems)
}
@ -156,4 +173,6 @@ export const useTaskListEvents = (props: IProps) => { @@ -156,4 +173,6 @@ export const useTaskListEvents = (props: IProps) => {
useSocketListener('task/finish-task', onDeleteTask, [props.items])
useSocketListener('task/delete-task', onDeleteTask, [props.items])
useSocketListener('task/new-docs', onTaskNewDocument, [props.items])
}

1
src/services/system/real-time.service.ts

@ -82,6 +82,7 @@ export class SocketIo { @@ -82,6 +82,7 @@ export class SocketIo {
this._onSocketSendEvent('task/update-task')
this._onSocketSendEvent('task/finish-task')
this._onSocketSendEvent('task/delete-task')
this._onSocketSendEvent('task/new-docs')
this._onSocketSendEvent('user/connected')
this._onSocketSendEvent('user/disconnected')

1
src/shared/events/index.ts

@ -150,6 +150,7 @@ export type SocketEvents = { @@ -150,6 +150,7 @@ export type SocketEvents = {
executorId: number
events: Record<string, TaskEvent[]>
}
'task/new-docs': { taskId: number }
'user/connected': { userId: number; sessionType: string }
'user/disconnected': { userId: number; sessionType: string }

Loading…
Cancel
Save