@messenger-box/platform-mobile 10.0.3-alpha.23 → 10.0.3-alpha.232
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/lib/components/messages-container-ui/BuildModeView.js +428 -0
- package/lib/components/messages-container-ui/BuildModeView.js.map +1 -0
- package/lib/components/messages-container-ui/MessagesContainerUI.js +55 -0
- package/lib/components/messages-container-ui/MessagesContainerUI.js.map +1 -0
- package/lib/components/messages-container-ui/PlanModeView.js +336 -0
- package/lib/components/messages-container-ui/PlanModeView.js.map +1 -0
- package/lib/compute.js +2 -3
- package/lib/compute.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/module.js.map +1 -1
- package/lib/queries/inboxQueries.js +62 -0
- package/lib/queries/inboxQueries.js.map +1 -0
- package/lib/routes.json +2 -3
- package/lib/screens/inbox/DialogMessages.js +8 -3
- package/lib/screens/inbox/DialogMessages.js.map +1 -1
- package/lib/screens/inbox/DialogThreadMessages.js +6 -11
- package/lib/screens/inbox/DialogThreadMessages.js.map +1 -1
- package/lib/screens/inbox/DialogThreads.js +9 -11
- package/lib/screens/inbox/DialogThreads.js.map +1 -1
- package/lib/screens/inbox/Inbox.js.map +1 -1
- package/lib/screens/inbox/components/CachedImage/consts.js +1 -1
- package/lib/screens/inbox/components/CachedImage/consts.js.map +1 -1
- package/lib/screens/inbox/components/CachedImage/index.js +125 -96
- package/lib/screens/inbox/components/CachedImage/index.js.map +1 -1
- package/lib/screens/inbox/components/DialogItem.js +160 -0
- package/lib/screens/inbox/components/DialogItem.js.map +1 -0
- package/lib/screens/inbox/components/GiftedChatInboxComponent.js +315 -0
- package/lib/screens/inbox/components/GiftedChatInboxComponent.js.map +1 -0
- package/lib/screens/inbox/components/SlackMessageContainer/ImageViewerModal.js +3 -1
- package/lib/screens/inbox/components/SlackMessageContainer/ImageViewerModal.js.map +1 -1
- package/lib/screens/inbox/components/SlackMessageContainer/PaymentMessage.js +194 -0
- package/lib/screens/inbox/components/SlackMessageContainer/PaymentMessage.js.map +1 -0
- package/lib/screens/inbox/components/SlackMessageContainer/SlackBubble.js +149 -36
- package/lib/screens/inbox/components/SlackMessageContainer/SlackBubble.js.map +1 -1
- package/lib/screens/inbox/components/SlackMessageContainer/SlackMessage.js +4 -5
- package/lib/screens/inbox/components/SlackMessageContainer/SlackMessage.js.map +1 -1
- package/lib/screens/inbox/components/SubscriptionHandler.js +22 -0
- package/lib/screens/inbox/components/SubscriptionHandler.js.map +1 -0
- package/lib/screens/inbox/components/ThreadsViewItem.js +2 -4
- package/lib/screens/inbox/components/ThreadsViewItem.js.map +1 -1
- package/lib/screens/inbox/config/config.js +4 -2
- package/lib/screens/inbox/config/config.js.map +1 -1
- package/lib/screens/inbox/containers/ConversationView.js +1093 -1090
- package/lib/screens/inbox/containers/ConversationView.js.map +1 -1
- package/lib/screens/inbox/containers/Dialogs.js +130 -577
- package/lib/screens/inbox/containers/Dialogs.js.map +1 -1
- package/lib/screens/inbox/containers/ThreadConversationView.js +864 -1408
- package/lib/screens/inbox/containers/ThreadConversationView.js.map +1 -1
- package/lib/screens/inbox/containers/ThreadsView.js +9 -15
- package/lib/screens/inbox/containers/ThreadsView.js.map +1 -1
- package/lib/screens/inbox/hooks/useInboxMessages.js +31 -0
- package/lib/screens/inbox/hooks/useInboxMessages.js.map +1 -0
- package/lib/screens/inbox/hooks/useSafeDialogThreadsMachine.js +1 -1
- package/lib/screens/inbox/hooks/useSafeDialogThreadsMachine.js.map +1 -1
- package/lib/screens/inbox/workflow/dialog-threads-xstate.js.map +1 -1
- package/package.json +10 -8
- package/CHANGELOG.md +0 -172
- package/jest.config.js +0 -24
- package/lib/screens/inbox/components/DialogsListItem.js +0 -548
- package/lib/screens/inbox/components/DialogsListItem.js.map +0 -1
- package/lib/screens/inbox/components/ServiceDialogsListItem.js +0 -489
- package/lib/screens/inbox/components/ServiceDialogsListItem.js.map +0 -1
- package/lib/screens/inbox/components/workflow/dialogs-list-item-xstate.js +0 -175
- package/lib/screens/inbox/components/workflow/dialogs-list-item-xstate.js.map +0 -1
- package/lib/screens/inbox/components/workflow/service-dialogs-list-item-xstate.js +0 -191
- package/lib/screens/inbox/components/workflow/service-dialogs-list-item-xstate.js.map +0 -1
- package/lib/screens/inbox/containers/workflow/conversation-xstate.js +0 -380
- package/lib/screens/inbox/containers/workflow/conversation-xstate.js.map +0 -1
- package/lib/screens/inbox/containers/workflow/dialogs-xstate.js +0 -211
- package/lib/screens/inbox/containers/workflow/dialogs-xstate.js.map +0 -1
- package/lib/screens/inbox/containers/workflow/thread-conversation-xstate.js +0 -438
- package/lib/screens/inbox/containers/workflow/thread-conversation-xstate.js.map +0 -1
- package/rollup.config.mjs +0 -45
- package/src/components/index.ts +0 -0
- package/src/compute.ts +0 -63
- package/src/index.ts +0 -7
- package/src/module.ts +0 -10
- package/src/navigation/InboxNavigation.tsx +0 -102
- package/src/navigation/index.ts +0 -1
- package/src/screens/inbox/DialogMessages.tsx +0 -21
- package/src/screens/inbox/DialogThreadMessages.tsx +0 -97
- package/src/screens/inbox/DialogThreads.tsx +0 -125
- package/src/screens/inbox/Inbox.tsx +0 -17
- package/src/screens/inbox/components/CachedImage/consts.ts +0 -6
- package/src/screens/inbox/components/CachedImage/index.tsx +0 -223
- package/src/screens/inbox/components/DialogsHeader.tsx +0 -30
- package/src/screens/inbox/components/DialogsListItem.tsx +0 -819
- package/src/screens/inbox/components/ServiceDialogsListItem.tsx +0 -679
- package/src/screens/inbox/components/SlackMessageContainer/ImageViewerModal.tsx +0 -113
- package/src/screens/inbox/components/SlackMessageContainer/SlackBubble.tsx +0 -313
- package/src/screens/inbox/components/SlackMessageContainer/SlackMessage.tsx +0 -145
- package/src/screens/inbox/components/SlackMessageContainer/index.ts +0 -3
- package/src/screens/inbox/components/SmartLoader.tsx +0 -61
- package/src/screens/inbox/components/SupportServiceDialogsListItem.tsx +0 -301
- package/src/screens/inbox/components/ThreadsViewItem.tsx +0 -233
- package/src/screens/inbox/components/workflow/dialogs-list-item-xstate.ts +0 -145
- package/src/screens/inbox/components/workflow/service-dialogs-list-item-xstate.ts +0 -159
- package/src/screens/inbox/config/config.ts +0 -15
- package/src/screens/inbox/config/index.ts +0 -1
- package/src/screens/inbox/containers/ConversationView.tsx +0 -1784
- package/src/screens/inbox/containers/Dialogs.tsx +0 -829
- package/src/screens/inbox/containers/SupportServiceDialogs.tsx +0 -119
- package/src/screens/inbox/containers/ThreadConversationView.tsx +0 -2295
- package/src/screens/inbox/containers/ThreadsView.tsx +0 -224
- package/src/screens/inbox/containers/workflow/apollo/handleResult.ts +0 -20
- package/src/screens/inbox/containers/workflow/conversation-xstate.ts +0 -313
- package/src/screens/inbox/containers/workflow/dialogs-xstate.ts +0 -196
- package/src/screens/inbox/containers/workflow/thread-conversation-xstate.ts +0 -401
- package/src/screens/inbox/hooks/useSafeDialogThreadsMachine.ts +0 -136
- package/src/screens/inbox/index.ts +0 -37
- package/src/screens/inbox/machines/threadsMachine.ts +0 -147
- package/src/screens/inbox/workflow/dialog-threads-xstate.ts +0 -163
- package/src/screens/index.ts +0 -4
- package/tsconfig.json +0 -13
- package/webpack.config.js +0 -58
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import React, {useState} from 'react';
|
|
2
|
-
import {Alert, Modal, StyleSheet, Text, Pressable, View,SafeAreaView,StatusBar} from 'react-native';
|
|
3
|
-
|
|
4
|
-
const ImageViewerModal = ({children,isVisible=false,setVisible,modalContent=null}:any) => {
|
|
5
|
-
|
|
6
|
-
return (
|
|
7
|
-
<Modal
|
|
8
|
-
animationType="slide"
|
|
9
|
-
// transparent={true}
|
|
10
|
-
visible={isVisible}
|
|
11
|
-
presentationStyle={'fullScreen'}
|
|
12
|
-
style={{flex:1}}
|
|
13
|
-
onRequestClose={() => {
|
|
14
|
-
setVisible(false);
|
|
15
|
-
}}>
|
|
16
|
-
<View style={styles.container}>
|
|
17
|
-
<View style={styles.headerView}>
|
|
18
|
-
{/* <View><Text></Text></View>
|
|
19
|
-
<View><Text></Text></View> */}
|
|
20
|
-
<View style={{alignSelf:'flex-end',paddingRight:5}} >
|
|
21
|
-
<Pressable
|
|
22
|
-
style={[styles.button, styles.buttonClose]}
|
|
23
|
-
onPress={() => setVisible(false)}>
|
|
24
|
-
<Text style={styles.headerTextStyle}>X</Text>
|
|
25
|
-
</Pressable></View>
|
|
26
|
-
</View>
|
|
27
|
-
<View style={styles.centeredView}>
|
|
28
|
-
{modalContent ? modalContent : children}
|
|
29
|
-
</View>
|
|
30
|
-
<View style={styles.footerView}>
|
|
31
|
-
|
|
32
|
-
</View>
|
|
33
|
-
</View>
|
|
34
|
-
</Modal>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const styles = StyleSheet.create({
|
|
39
|
-
container:{
|
|
40
|
-
flex:1,
|
|
41
|
-
},
|
|
42
|
-
headerView:{
|
|
43
|
-
width:'100%',
|
|
44
|
-
alignItems: 'center',
|
|
45
|
-
justifyContent:'space-between',
|
|
46
|
-
// backgroundColor:'rgba(r, g, b, a)',
|
|
47
|
-
backgroundColor:'#000',
|
|
48
|
-
paddingTop:50,
|
|
49
|
-
paddingBottom:10,
|
|
50
|
-
},
|
|
51
|
-
centeredView: {
|
|
52
|
-
flex: 1,
|
|
53
|
-
justifyContent: 'center',
|
|
54
|
-
alignItems: 'center',
|
|
55
|
-
backgroundColor: 'white',
|
|
56
|
-
|
|
57
|
-
borderRadius: 20,
|
|
58
|
-
shadowColor: '#000',
|
|
59
|
-
shadowOffset: {
|
|
60
|
-
width: 0,
|
|
61
|
-
height: 2,
|
|
62
|
-
},
|
|
63
|
-
shadowOpacity: 0.25,
|
|
64
|
-
shadowRadius: 4,
|
|
65
|
-
elevation: 5,
|
|
66
|
-
},
|
|
67
|
-
footerView:{
|
|
68
|
-
minHeight:100,
|
|
69
|
-
backgroundColor:'#000'
|
|
70
|
-
},
|
|
71
|
-
modalView: {
|
|
72
|
-
flex:1,
|
|
73
|
-
backgroundColor: 'white',
|
|
74
|
-
borderRadius: 20,
|
|
75
|
-
alignItems: 'center',
|
|
76
|
-
shadowColor: '#000',
|
|
77
|
-
shadowOffset: {
|
|
78
|
-
width: 0,
|
|
79
|
-
height: 2,
|
|
80
|
-
},
|
|
81
|
-
shadowOpacity: 0.25,
|
|
82
|
-
shadowRadius: 4,
|
|
83
|
-
elevation: 5,
|
|
84
|
-
},
|
|
85
|
-
button: {
|
|
86
|
-
borderRadius: 20,
|
|
87
|
-
padding: 10,
|
|
88
|
-
elevation: 2,
|
|
89
|
-
},
|
|
90
|
-
buttonOpen: {
|
|
91
|
-
backgroundColor: '#F194FF',
|
|
92
|
-
},
|
|
93
|
-
buttonClose: {
|
|
94
|
-
backgroundColor: 'transparent',
|
|
95
|
-
},
|
|
96
|
-
textStyle: {
|
|
97
|
-
color: 'white',
|
|
98
|
-
fontWeight: 'bold',
|
|
99
|
-
textAlign: 'center',
|
|
100
|
-
},
|
|
101
|
-
headerTextStyle:{
|
|
102
|
-
color: '#fff',
|
|
103
|
-
// fontWeight: 'bold',
|
|
104
|
-
textAlign: 'center',
|
|
105
|
-
fontSize:20,
|
|
106
|
-
},
|
|
107
|
-
modalText: {
|
|
108
|
-
marginBottom: 15,
|
|
109
|
-
textAlign: 'center',
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
export default ImageViewerModal;
|
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-underscore-dangle, no-use-before-define */
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Text, StyleSheet, TouchableOpacity, TouchableHighlight, View, Platform, Dimensions } from 'react-native';
|
|
4
|
-
|
|
5
|
-
import { MessageText, MessageImage, Time, utils } from 'react-native-gifted-chat';
|
|
6
|
-
import CachedImage from '../CachedImage';
|
|
7
|
-
const { isSameUser, isSameDay } = utils;
|
|
8
|
-
const windowWidth = Dimensions.get('window').width;
|
|
9
|
-
const windowHeight = Dimensions.get('window').height;
|
|
10
|
-
|
|
11
|
-
export default class Bubble extends React.Component<any> {
|
|
12
|
-
static defaultProps: {
|
|
13
|
-
touchableProps: {};
|
|
14
|
-
onLongPress: null;
|
|
15
|
-
renderMessageImage: null;
|
|
16
|
-
renderMessageText: null;
|
|
17
|
-
renderCustomView: null;
|
|
18
|
-
renderTime: null;
|
|
19
|
-
currentMessage: { text: null; createdAt: null; image: null };
|
|
20
|
-
nextMessage: {};
|
|
21
|
-
previousMessage: {};
|
|
22
|
-
containerStyle: {};
|
|
23
|
-
wrapperStyle: {};
|
|
24
|
-
tickStyle: {};
|
|
25
|
-
containerToNextStyle: {};
|
|
26
|
-
containerToPreviousStyle: {};
|
|
27
|
-
isShowImageViewer: false;
|
|
28
|
-
setImageViewer: (obj: any, v: boolean) => void;
|
|
29
|
-
};
|
|
30
|
-
static propTypes: any;
|
|
31
|
-
constructor(props: any) {
|
|
32
|
-
super(props);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
renderMessageText() {
|
|
36
|
-
if (this.props.currentMessage.text) {
|
|
37
|
-
const { containerStyle, wrapperStyle, messageTextStyle, ...messageTextProps } = this.props;
|
|
38
|
-
if (this.props.renderMessageText) {
|
|
39
|
-
return this.props.renderMessageText(messageTextProps);
|
|
40
|
-
}
|
|
41
|
-
return (
|
|
42
|
-
<MessageText
|
|
43
|
-
{...messageTextProps}
|
|
44
|
-
textStyle={{
|
|
45
|
-
left: [
|
|
46
|
-
styles.standardFont,
|
|
47
|
-
styles.slackMessageText,
|
|
48
|
-
messageTextProps.textStyle,
|
|
49
|
-
messageTextStyle,
|
|
50
|
-
],
|
|
51
|
-
}}
|
|
52
|
-
/>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
renderMessageImage() {
|
|
59
|
-
if (this.props.currentMessage.image) {
|
|
60
|
-
const { containerStyle, wrapperStyle, ...messageImageProps } = this.props;
|
|
61
|
-
if (this.props.renderMessageImage) {
|
|
62
|
-
return this.props.renderMessageImage(messageImageProps);
|
|
63
|
-
}
|
|
64
|
-
const { image, _id } = messageImageProps?.currentMessage;
|
|
65
|
-
|
|
66
|
-
// Add validation for image URL
|
|
67
|
-
if (!image || typeof image !== 'string') {
|
|
68
|
-
console.log('Invalid image URL:', image);
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Log the image URL for debugging
|
|
73
|
-
console.log('Rendering message image:', image);
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<TouchableHighlight
|
|
77
|
-
underlayColor={'transparent'}
|
|
78
|
-
style={{ width: '100%', marginVertical: 5 }}
|
|
79
|
-
onPress={() => this.props.setImageViewer(messageImageProps?.currentMessage, true)}
|
|
80
|
-
>
|
|
81
|
-
<View
|
|
82
|
-
style={{
|
|
83
|
-
width: windowWidth * 0.6, // 60% of screen width
|
|
84
|
-
height: windowWidth * 0.4, // Maintain aspect ratio
|
|
85
|
-
maxHeight: 200,
|
|
86
|
-
borderRadius: 8,
|
|
87
|
-
overflow: 'hidden',
|
|
88
|
-
borderWidth: 1,
|
|
89
|
-
borderColor: '#e0e0e0',
|
|
90
|
-
backgroundColor: '#f7f7f7',
|
|
91
|
-
}}
|
|
92
|
-
>
|
|
93
|
-
<CachedImage
|
|
94
|
-
style={[styles.slackImage, { width: '100%', height: '100%' }]}
|
|
95
|
-
cacheKey={`${_id}-slack-bubble-imageKey`}
|
|
96
|
-
source={{
|
|
97
|
-
uri: image,
|
|
98
|
-
expiresIn: 86400,
|
|
99
|
-
}}
|
|
100
|
-
resizeMode={'cover'}
|
|
101
|
-
alt={'image'}
|
|
102
|
-
placeholderContent={
|
|
103
|
-
<View
|
|
104
|
-
style={[
|
|
105
|
-
styles.slackImage,
|
|
106
|
-
{
|
|
107
|
-
width: '100%',
|
|
108
|
-
height: '100%',
|
|
109
|
-
backgroundColor: '#e1e1e1',
|
|
110
|
-
justifyContent: 'center',
|
|
111
|
-
alignItems: 'center',
|
|
112
|
-
borderRadius: 8,
|
|
113
|
-
},
|
|
114
|
-
]}
|
|
115
|
-
>
|
|
116
|
-
<Text>Loading...</Text>
|
|
117
|
-
</View>
|
|
118
|
-
}
|
|
119
|
-
/>
|
|
120
|
-
</View>
|
|
121
|
-
</TouchableHighlight>
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
renderTicks() {
|
|
128
|
-
const { currentMessage } = this.props;
|
|
129
|
-
if (this.props.renderTicks) {
|
|
130
|
-
return this.props.renderTicks(currentMessage);
|
|
131
|
-
}
|
|
132
|
-
if (currentMessage.user._id !== this.props.user._id) {
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
if (currentMessage.sent || currentMessage.received) {
|
|
136
|
-
return (
|
|
137
|
-
<View style={[styles.headerItem, styles.tickView]}>
|
|
138
|
-
{currentMessage.sent && (
|
|
139
|
-
<Text style={[styles.standardFont, styles.tick, this.props.tickStyle]}>✓</Text>
|
|
140
|
-
)}
|
|
141
|
-
{currentMessage.received && (
|
|
142
|
-
<Text style={[styles.standardFont, styles.tick, this.props.tickStyle]}>✓</Text>
|
|
143
|
-
)}
|
|
144
|
-
</View>
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
return null;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
renderUsername() {
|
|
151
|
-
const username = this.props.currentMessage.user.name;
|
|
152
|
-
if (username) {
|
|
153
|
-
const { containerStyle, wrapperStyle, ...usernameProps } = this.props;
|
|
154
|
-
if (this.props.renderUsername) {
|
|
155
|
-
return this.props.renderUsername(usernameProps);
|
|
156
|
-
}
|
|
157
|
-
return (
|
|
158
|
-
<Text style={[styles.standardFont, styles.headerItem, styles.username, this.props.usernameStyle]}>
|
|
159
|
-
{username}
|
|
160
|
-
</Text>
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
renderTime() {
|
|
167
|
-
if (this.props.currentMessage.createdAt) {
|
|
168
|
-
const { containerStyle, wrapperStyle, ...timeProps }: any = this.props;
|
|
169
|
-
if (this.props.renderTime) {
|
|
170
|
-
return this.props.renderTime(timeProps);
|
|
171
|
-
}
|
|
172
|
-
return (
|
|
173
|
-
<Time
|
|
174
|
-
{...timeProps}
|
|
175
|
-
containerStyle={{ left: [styles.timeContainer] }}
|
|
176
|
-
textStyle={{
|
|
177
|
-
left: [styles.standardFont, styles.headerItem, styles.time, timeProps.textStyle],
|
|
178
|
-
}}
|
|
179
|
-
/>
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
return null;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
renderCustomView() {
|
|
186
|
-
if (this.props.renderCustomView) {
|
|
187
|
-
return this.props.renderCustomView(this.props);
|
|
188
|
-
}
|
|
189
|
-
return null;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
render() {
|
|
193
|
-
const isSameThread =
|
|
194
|
-
isSameUser(this.props.currentMessage, this.props.previousMessage) &&
|
|
195
|
-
isSameDay(this.props.currentMessage, this.props.previousMessage);
|
|
196
|
-
|
|
197
|
-
const messageHeader = isSameThread ? null : (
|
|
198
|
-
<View style={styles.headerView}>
|
|
199
|
-
{this.renderUsername()}
|
|
200
|
-
{this.renderTime()}
|
|
201
|
-
{this.renderTicks()}
|
|
202
|
-
</View>
|
|
203
|
-
);
|
|
204
|
-
|
|
205
|
-
return (
|
|
206
|
-
<View style={[styles.container, this.props.containerStyle]}>
|
|
207
|
-
<TouchableHighlight
|
|
208
|
-
style={{ width: '100%' }}
|
|
209
|
-
// underlayColor={'#c0c0c0'}
|
|
210
|
-
underlayColor={'transparent'}
|
|
211
|
-
disabled={true}
|
|
212
|
-
accessibilityTraits="text"
|
|
213
|
-
{...this.props.touchableProps}
|
|
214
|
-
>
|
|
215
|
-
<View style={[styles.wrapper, this.props.wrapperStyle]}>
|
|
216
|
-
<View>
|
|
217
|
-
{this.renderCustomView()}
|
|
218
|
-
{messageHeader}
|
|
219
|
-
{this.renderMessageImage()}
|
|
220
|
-
{this.renderMessageText()}
|
|
221
|
-
</View>
|
|
222
|
-
</View>
|
|
223
|
-
</TouchableHighlight>
|
|
224
|
-
</View>
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// Note: Everything is forced to be "left" positioned with this component.
|
|
230
|
-
// The "right" position is only used in the default Bubble.
|
|
231
|
-
const styles = StyleSheet.create({
|
|
232
|
-
standardFont: {
|
|
233
|
-
fontSize: 15,
|
|
234
|
-
},
|
|
235
|
-
slackMessageText: {
|
|
236
|
-
marginLeft: 0,
|
|
237
|
-
marginRight: 0,
|
|
238
|
-
},
|
|
239
|
-
container: {
|
|
240
|
-
flex: 1,
|
|
241
|
-
alignItems: 'flex-start',
|
|
242
|
-
},
|
|
243
|
-
wrapper: {
|
|
244
|
-
marginRight: 60,
|
|
245
|
-
minHeight: 20,
|
|
246
|
-
justifyContent: 'flex-start',
|
|
247
|
-
},
|
|
248
|
-
username: {
|
|
249
|
-
fontWeight: 'bold',
|
|
250
|
-
top: 0,
|
|
251
|
-
paddingTop: 0,
|
|
252
|
-
marginTop: 0,
|
|
253
|
-
},
|
|
254
|
-
time: {
|
|
255
|
-
textAlign: 'left',
|
|
256
|
-
fontSize: 12,
|
|
257
|
-
},
|
|
258
|
-
timeContainer: {
|
|
259
|
-
marginLeft: 0,
|
|
260
|
-
marginRight: 0,
|
|
261
|
-
marginBottom: 0,
|
|
262
|
-
},
|
|
263
|
-
headerItem: {
|
|
264
|
-
marginRight: 10,
|
|
265
|
-
},
|
|
266
|
-
headerView: {
|
|
267
|
-
// Try to align it better with the avatar on Android.
|
|
268
|
-
marginTop: Platform.OS === 'android' ? -2 : 0,
|
|
269
|
-
flexDirection: 'row',
|
|
270
|
-
alignItems: 'baseline',
|
|
271
|
-
},
|
|
272
|
-
/* eslint-disable react-native/no-color-literals */
|
|
273
|
-
tick: {
|
|
274
|
-
backgroundColor: 'transparent',
|
|
275
|
-
color: 'white',
|
|
276
|
-
},
|
|
277
|
-
/* eslint-enable react-native/no-color-literals */
|
|
278
|
-
tickView: {
|
|
279
|
-
flexDirection: 'row',
|
|
280
|
-
},
|
|
281
|
-
slackImage: {
|
|
282
|
-
borderRadius: 3,
|
|
283
|
-
marginLeft: 8,
|
|
284
|
-
marginRight: 0,
|
|
285
|
-
},
|
|
286
|
-
});
|
|
287
|
-
|
|
288
|
-
// Bubble.contextTypes = {
|
|
289
|
-
// actionSheet: PropTypes.func,
|
|
290
|
-
// };
|
|
291
|
-
|
|
292
|
-
Bubble.defaultProps = {
|
|
293
|
-
touchableProps: {},
|
|
294
|
-
onLongPress: null,
|
|
295
|
-
renderMessageImage: null,
|
|
296
|
-
renderMessageText: null,
|
|
297
|
-
renderCustomView: null,
|
|
298
|
-
renderTime: null,
|
|
299
|
-
currentMessage: {
|
|
300
|
-
text: null,
|
|
301
|
-
createdAt: null,
|
|
302
|
-
image: null,
|
|
303
|
-
},
|
|
304
|
-
nextMessage: {},
|
|
305
|
-
previousMessage: {},
|
|
306
|
-
containerStyle: {},
|
|
307
|
-
wrapperStyle: {},
|
|
308
|
-
tickStyle: {},
|
|
309
|
-
containerToNextStyle: {},
|
|
310
|
-
containerToPreviousStyle: {},
|
|
311
|
-
isShowImageViewer: false,
|
|
312
|
-
setImageViewer: (obj: any, v: boolean) => null,
|
|
313
|
-
};
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-underscore-dangle, no-use-before-define */
|
|
2
|
-
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { View, StyleSheet } from 'react-native';
|
|
6
|
-
|
|
7
|
-
import { Day, utils } from 'react-native-gifted-chat';
|
|
8
|
-
import { Avatar, AvatarFallbackText, AvatarImage } from '@admin-layout/gluestack-ui-mobile';
|
|
9
|
-
import Bubble from './SlackBubble';
|
|
10
|
-
|
|
11
|
-
const { isSameUser, isSameDay } = utils;
|
|
12
|
-
|
|
13
|
-
export default class Message extends React.Component<any> {
|
|
14
|
-
static defaultProps: {
|
|
15
|
-
renderAvatar: undefined;
|
|
16
|
-
renderBubble: null;
|
|
17
|
-
renderDay: null;
|
|
18
|
-
currentMessage: {};
|
|
19
|
-
nextMessage: {};
|
|
20
|
-
previousMessage: {};
|
|
21
|
-
user: {};
|
|
22
|
-
containerStyle: {};
|
|
23
|
-
isShowImageViewer: false;
|
|
24
|
-
setImageViewer: (obj: any, v: boolean) => void;
|
|
25
|
-
};
|
|
26
|
-
getInnerComponentProps() {
|
|
27
|
-
const { containerStyle, ...props } = this.props;
|
|
28
|
-
return {
|
|
29
|
-
...props,
|
|
30
|
-
position: 'left',
|
|
31
|
-
isSameUser,
|
|
32
|
-
isSameDay,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
renderDay() {
|
|
37
|
-
if (this.props.currentMessage.createdAt) {
|
|
38
|
-
const dayProps = this.getInnerComponentProps();
|
|
39
|
-
if (this.props.renderDay) {
|
|
40
|
-
return this.props.renderDay(dayProps);
|
|
41
|
-
}
|
|
42
|
-
return <Day {...dayProps} />;
|
|
43
|
-
}
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
renderBubble() {
|
|
48
|
-
const bubbleProps = this.getInnerComponentProps();
|
|
49
|
-
if (this.props.renderBubble) {
|
|
50
|
-
return this.props.renderBubble(bubbleProps);
|
|
51
|
-
}
|
|
52
|
-
return (
|
|
53
|
-
<Bubble
|
|
54
|
-
{...bubbleProps}
|
|
55
|
-
isShowImageViewer={this.props.isShowImageViewer}
|
|
56
|
-
setImageViewer={this.props.setImageViewer}
|
|
57
|
-
/>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
renderAvatar() {
|
|
62
|
-
let extraStyle: any;
|
|
63
|
-
//new param added
|
|
64
|
-
let isSameUserAndSameDay: boolean = false;
|
|
65
|
-
if (
|
|
66
|
-
isSameUser(this.props.currentMessage, this.props.previousMessage) &&
|
|
67
|
-
isSameDay(this.props.currentMessage, this.props.previousMessage)
|
|
68
|
-
) {
|
|
69
|
-
// Set the invisible avatar height to 0, but keep the width, padding, etc.
|
|
70
|
-
extraStyle = { height: 0 };
|
|
71
|
-
isSameUserAndSameDay = true;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const avatarProps: any = this.getInnerComponentProps();
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<Avatar size={'sm'} className="bg-transparent rounded-none mr-2">
|
|
78
|
-
<AvatarFallbackText>
|
|
79
|
-
{isSameUserAndSameDay ? '' : avatarProps?.currentMessage?.user?.name[0]}
|
|
80
|
-
</AvatarFallbackText>
|
|
81
|
-
{!isSameUserAndSameDay && avatarProps?.currentMessage?.user?.avatar && (
|
|
82
|
-
<AvatarImage
|
|
83
|
-
alt="image"
|
|
84
|
-
style={{ ...styles.slackAvatar, ...avatarProps.imageStyle }}
|
|
85
|
-
source={{
|
|
86
|
-
uri: avatarProps?.currentMessage?.user?.avatar,
|
|
87
|
-
}}
|
|
88
|
-
/>
|
|
89
|
-
)}
|
|
90
|
-
</Avatar>
|
|
91
|
-
// <Avatar
|
|
92
|
-
// {...avatarProps}
|
|
93
|
-
// showAvatarForEveryMessage={true}
|
|
94
|
-
// imageStyle={{
|
|
95
|
-
// left: [styles.slackAvatar, avatarProps.imageStyle, extraStyle],
|
|
96
|
-
// }}
|
|
97
|
-
// />
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
render() {
|
|
102
|
-
const marginBottom = isSameUser(this.props.currentMessage, this.props.nextMessage) ? 2 : 10;
|
|
103
|
-
|
|
104
|
-
return (
|
|
105
|
-
<View>
|
|
106
|
-
{this.renderDay()}
|
|
107
|
-
<View style={[styles.container, { marginBottom }, this.props.containerStyle]}>
|
|
108
|
-
{this.renderAvatar()}
|
|
109
|
-
{this.renderBubble()}
|
|
110
|
-
</View>
|
|
111
|
-
</View>
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const styles = StyleSheet.create({
|
|
117
|
-
container: {
|
|
118
|
-
flexDirection: 'row',
|
|
119
|
-
alignItems: 'flex-start',
|
|
120
|
-
justifyContent: 'flex-start',
|
|
121
|
-
marginLeft: 8,
|
|
122
|
-
marginRight: 0,
|
|
123
|
-
},
|
|
124
|
-
slackAvatar: {
|
|
125
|
-
// The bottom should roughly line up with the first line of message text.
|
|
126
|
-
height: 40,
|
|
127
|
-
width: 40,
|
|
128
|
-
borderRadius: 3,
|
|
129
|
-
// marginTop: 0,
|
|
130
|
-
marginTop: 1,
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
Message.defaultProps = {
|
|
135
|
-
renderAvatar: undefined,
|
|
136
|
-
renderBubble: null,
|
|
137
|
-
renderDay: null,
|
|
138
|
-
currentMessage: {},
|
|
139
|
-
nextMessage: {},
|
|
140
|
-
previousMessage: {},
|
|
141
|
-
user: {},
|
|
142
|
-
containerStyle: {},
|
|
143
|
-
isShowImageViewer: false,
|
|
144
|
-
setImageViewer: (obj: any, v: boolean) => null,
|
|
145
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { Box, Spinner, Text, VStack, Button, ButtonText } from '@admin-layout/gluestack-ui-mobile';
|
|
3
|
-
import colors from 'tailwindcss/colors';
|
|
4
|
-
|
|
5
|
-
interface SmartLoaderProps {
|
|
6
|
-
isLoading: boolean;
|
|
7
|
-
timeoutMs?: number;
|
|
8
|
-
message?: string;
|
|
9
|
-
onRetry?: () => void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* SmartLoader component that automatically shows a timeout message
|
|
14
|
-
* if loading takes too long, preventing infinite loading states
|
|
15
|
-
*/
|
|
16
|
-
export const SmartLoader: React.FC<SmartLoaderProps> = ({
|
|
17
|
-
isLoading,
|
|
18
|
-
timeoutMs = 20000, // Default 20 seconds
|
|
19
|
-
message = 'Taking longer than expected...',
|
|
20
|
-
onRetry,
|
|
21
|
-
}) => {
|
|
22
|
-
const [showTimeout, setShowTimeout] = useState(false);
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (!isLoading) {
|
|
26
|
-
setShowTimeout(false);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const timeoutId = setTimeout(() => {
|
|
31
|
-
if (isLoading) {
|
|
32
|
-
setShowTimeout(true);
|
|
33
|
-
}
|
|
34
|
-
}, timeoutMs);
|
|
35
|
-
|
|
36
|
-
return () => clearTimeout(timeoutId);
|
|
37
|
-
}, [isLoading, timeoutMs]);
|
|
38
|
-
|
|
39
|
-
if (!isLoading) return null;
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<Box className="flex-1 bg-gray-100 dark:bg-gray-800 items-center justify-center">
|
|
43
|
-
<VStack space="md" className="items-center">
|
|
44
|
-
<Spinner color={colors.blue[500]} size="large" />
|
|
45
|
-
|
|
46
|
-
{showTimeout && (
|
|
47
|
-
<VStack space="sm" className="p-4 items-center">
|
|
48
|
-
<Text className="text-gray-700 dark:text-gray-300 text-center">{message}</Text>
|
|
49
|
-
{onRetry && (
|
|
50
|
-
<Button onPress={onRetry} className="bg-blue-500 mt-3 rounded-full">
|
|
51
|
-
<ButtonText>Try Again</ButtonText>
|
|
52
|
-
</Button>
|
|
53
|
-
)}
|
|
54
|
-
</VStack>
|
|
55
|
-
)}
|
|
56
|
-
</VStack>
|
|
57
|
-
</Box>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export default SmartLoader;
|