stream-chat-react-native-core 5.27.0-beta.11 → 5.27.0-beta.12
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/commonjs/components/Chat/hooks/handleEventToSyncDB.js +100 -37
- package/lib/commonjs/components/Chat/hooks/handleEventToSyncDB.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/useSyncDatabase.js +3 -1
- package/lib/commonjs/components/Chat/hooks/useSyncDatabase.js.map +1 -1
- package/lib/commonjs/i18n/en.json +1 -1
- package/lib/commonjs/i18n/es.json +43 -43
- package/lib/commonjs/i18n/fr.json +43 -43
- package/lib/commonjs/i18n/he.json +43 -43
- package/lib/commonjs/i18n/hi.json +43 -43
- package/lib/commonjs/i18n/it.json +43 -43
- package/lib/commonjs/i18n/ja.json +42 -42
- package/lib/commonjs/i18n/ko.json +42 -42
- package/lib/commonjs/i18n/nl.json +42 -42
- package/lib/commonjs/i18n/pt-BR.json +42 -42
- package/lib/commonjs/i18n/ru.json +42 -42
- package/lib/commonjs/i18n/tr.json +42 -42
- package/lib/commonjs/store/apis/upsertChannelDataFromChannel.js +21 -0
- package/lib/commonjs/store/apis/upsertChannelDataFromChannel.js.map +1 -0
- package/lib/commonjs/store/mappers/mapChannelToStorable.js +63 -0
- package/lib/commonjs/store/mappers/mapChannelToStorable.js.map +1 -0
- package/lib/commonjs/utils/DBSyncManager.js +73 -68
- package/lib/commonjs/utils/DBSyncManager.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Chat/hooks/handleEventToSyncDB.js +100 -37
- package/lib/module/components/Chat/hooks/handleEventToSyncDB.js.map +1 -1
- package/lib/module/components/Chat/hooks/useSyncDatabase.js +3 -1
- package/lib/module/components/Chat/hooks/useSyncDatabase.js.map +1 -1
- package/lib/module/i18n/en.json +1 -1
- package/lib/module/i18n/es.json +43 -43
- package/lib/module/i18n/fr.json +43 -43
- package/lib/module/i18n/he.json +43 -43
- package/lib/module/i18n/hi.json +43 -43
- package/lib/module/i18n/it.json +43 -43
- package/lib/module/i18n/ja.json +42 -42
- package/lib/module/i18n/ko.json +42 -42
- package/lib/module/i18n/nl.json +42 -42
- package/lib/module/i18n/pt-BR.json +42 -42
- package/lib/module/i18n/ru.json +42 -42
- package/lib/module/i18n/tr.json +42 -42
- package/lib/module/store/apis/upsertChannelDataFromChannel.js +21 -0
- package/lib/module/store/apis/upsertChannelDataFromChannel.js.map +1 -0
- package/lib/module/store/mappers/mapChannelToStorable.js +63 -0
- package/lib/module/store/mappers/mapChannelToStorable.js.map +1 -0
- package/lib/module/utils/DBSyncManager.js +73 -68
- package/lib/module/utils/DBSyncManager.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Chat/hooks/handleEventToSyncDB.d.ts +4 -2
- package/lib/typescript/i18n/en.json +1 -1
- package/lib/typescript/i18n/es.json +43 -43
- package/lib/typescript/i18n/fr.json +43 -43
- package/lib/typescript/i18n/he.json +43 -43
- package/lib/typescript/i18n/hi.json +43 -43
- package/lib/typescript/i18n/it.json +43 -43
- package/lib/typescript/i18n/ja.json +42 -42
- package/lib/typescript/i18n/ko.json +42 -42
- package/lib/typescript/i18n/nl.json +42 -42
- package/lib/typescript/i18n/pt-BR.json +42 -42
- package/lib/typescript/i18n/ru.json +42 -42
- package/lib/typescript/i18n/tr.json +42 -42
- package/lib/typescript/store/apis/upsertChannelDataFromChannel.d.ts +6 -0
- package/lib/typescript/store/mappers/mapChannelToStorable.d.ts +4 -0
- package/lib/typescript/utils/DBSyncManager.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Chat/hooks/handleEventToSyncDB.ts +132 -46
- package/src/components/Chat/hooks/useSyncDatabase.ts +1 -1
- package/src/i18n/en.json +1 -1
- package/src/i18n/es.json +43 -43
- package/src/i18n/fr.json +43 -43
- package/src/i18n/he.json +43 -43
- package/src/i18n/hi.json +43 -43
- package/src/i18n/it.json +43 -43
- package/src/i18n/ja.json +42 -42
- package/src/i18n/ko.json +42 -42
- package/src/i18n/nl.json +42 -42
- package/src/i18n/pt-BR.json +42 -42
- package/src/i18n/ru.json +42 -42
- package/src/i18n/tr.json +42 -42
- package/src/store/apis/upsertChannelDataFromChannel.ts +25 -0
- package/src/store/mappers/mapChannelToStorable.ts +68 -0
- package/src/utils/DBSyncManager.ts +7 -3
- package/src/version.json +1 -1
|
@@ -1,61 +1,116 @@
|
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
1
2
|
Object.defineProperty(exports, "__esModule", {
|
|
2
3
|
value: true
|
|
3
4
|
});
|
|
4
5
|
exports.handleEventToSyncDB = void 0;
|
|
6
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
5
7
|
var _deleteChannel = require("../../../store/apis/deleteChannel");
|
|
6
8
|
var _deleteMember = require("../../../store/apis/deleteMember");
|
|
7
9
|
var _deleteMessagesForChannel = require("../../../store/apis/deleteMessagesForChannel");
|
|
8
10
|
var _updateMessage = require("../../../store/apis/updateMessage");
|
|
9
11
|
var _upsertChannelData = require("../../../store/apis/upsertChannelData");
|
|
12
|
+
var _upsertChannelDataFromChannel = require("../../../store/apis/upsertChannelDataFromChannel");
|
|
10
13
|
var _upsertChannels = require("../../../store/apis/upsertChannels");
|
|
11
14
|
var _upsertMembers = require("../../../store/apis/upsertMembers");
|
|
12
15
|
var _upsertMessages = require("../../../store/apis/upsertMessages");
|
|
13
16
|
var _upsertReads = require("../../../store/apis/upsertReads");
|
|
14
|
-
var
|
|
17
|
+
var _QuickSqliteClient = require("../../../store/QuickSqliteClient");
|
|
18
|
+
var _createSelectQuery = require("../../../store/sqlite-utils/createSelectQuery");
|
|
19
|
+
var handleEventToSyncDB = function handleEventToSyncDB(event, client, flush) {
|
|
15
20
|
var type = event.type;
|
|
21
|
+
var queriesWithChannelGuard = function queriesWithChannelGuard(createQueries) {
|
|
22
|
+
var _event$channel;
|
|
23
|
+
var cid = event.cid || ((_event$channel = event.channel) == null ? void 0 : _event$channel.cid);
|
|
24
|
+
if (!cid) return createQueries(flush);
|
|
25
|
+
var channels = _QuickSqliteClient.QuickSqliteClient.executeSql.apply(null, (0, _createSelectQuery.createSelectQuery)('channels', ['cid'], {
|
|
26
|
+
cid: cid
|
|
27
|
+
}));
|
|
28
|
+
if (channels.length === 0) {
|
|
29
|
+
var channel = event.channel_type && event.channel_id ? client.channel(event.channel_type, event.channel_id) : undefined;
|
|
30
|
+
if (channel && channel.initialized && !channel.disconnected) {
|
|
31
|
+
var channelQuery = (0, _upsertChannelDataFromChannel.upsertChannelDataFromChannel)({
|
|
32
|
+
channel: channel,
|
|
33
|
+
flush: flush
|
|
34
|
+
});
|
|
35
|
+
if (channelQuery) {
|
|
36
|
+
var newQueries = [].concat((0, _toConsumableArray2["default"])(channelQuery), (0, _toConsumableArray2["default"])(createQueries(false)));
|
|
37
|
+
if (flush !== false) {
|
|
38
|
+
_QuickSqliteClient.QuickSqliteClient.executeSqlBatch(newQueries);
|
|
39
|
+
}
|
|
40
|
+
return newQueries;
|
|
41
|
+
} else {
|
|
42
|
+
console.warn("Couldnt create channel queries on " + type + " event for an initialized channel that is not in DB, skipping event", {
|
|
43
|
+
event: event
|
|
44
|
+
});
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
console.warn("Received " + type + " event for a non initialized channel that is not in DB, skipping event", {
|
|
49
|
+
event: event
|
|
50
|
+
});
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return createQueries(flush);
|
|
55
|
+
};
|
|
16
56
|
if (type === 'message.read') {
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
57
|
+
var cid = event.cid;
|
|
58
|
+
var user = event.user;
|
|
59
|
+
if (user != null && user.id && cid) {
|
|
60
|
+
return queriesWithChannelGuard(function (flushOverride) {
|
|
61
|
+
return (0, _upsertReads.upsertReads)({
|
|
62
|
+
cid: cid,
|
|
63
|
+
flush: flushOverride,
|
|
64
|
+
reads: [{
|
|
65
|
+
last_read: event.received_at,
|
|
66
|
+
unread_messages: 0,
|
|
67
|
+
user: user
|
|
68
|
+
}]
|
|
69
|
+
});
|
|
27
70
|
});
|
|
28
71
|
}
|
|
29
72
|
}
|
|
30
73
|
if (type === 'message.new') {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
74
|
+
var message = event.message;
|
|
75
|
+
if (message && (!message.parent_id || message.show_in_channel)) {
|
|
76
|
+
return queriesWithChannelGuard(function (flushOverride) {
|
|
77
|
+
return (0, _upsertMessages.upsertMessages)({
|
|
78
|
+
flush: flushOverride,
|
|
79
|
+
messages: [message]
|
|
80
|
+
});
|
|
35
81
|
});
|
|
36
82
|
}
|
|
37
83
|
}
|
|
38
84
|
if (type === 'message.updated' || type === 'message.deleted') {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
85
|
+
var _message = event.message;
|
|
86
|
+
if (_message && !_message.parent_id) {
|
|
87
|
+
return queriesWithChannelGuard(function (flushOverride) {
|
|
88
|
+
return (0, _updateMessage.updateMessage)({
|
|
89
|
+
flush: flushOverride,
|
|
90
|
+
message: _message
|
|
91
|
+
});
|
|
43
92
|
});
|
|
44
93
|
}
|
|
45
94
|
}
|
|
46
95
|
if (type === 'reaction.updated') {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
96
|
+
var _message2 = event.message;
|
|
97
|
+
if (_message2 && event.reaction) {
|
|
98
|
+
return queriesWithChannelGuard(function (flushOverride) {
|
|
99
|
+
return (0, _updateMessage.updateMessage)({
|
|
100
|
+
flush: flushOverride,
|
|
101
|
+
message: _message2
|
|
102
|
+
});
|
|
51
103
|
});
|
|
52
104
|
}
|
|
53
105
|
}
|
|
54
106
|
if (type === 'reaction.new' || type === 'reaction.deleted') {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
107
|
+
var _message3 = event.message;
|
|
108
|
+
if (_message3 && !_message3.parent_id) {
|
|
109
|
+
return queriesWithChannelGuard(function (flushOverride) {
|
|
110
|
+
return (0, _updateMessage.updateMessage)({
|
|
111
|
+
flush: flushOverride,
|
|
112
|
+
message: _message3
|
|
113
|
+
});
|
|
59
114
|
});
|
|
60
115
|
}
|
|
61
116
|
}
|
|
@@ -95,20 +150,28 @@ var handleEventToSyncDB = function handleEventToSyncDB(event, flush) {
|
|
|
95
150
|
}
|
|
96
151
|
}
|
|
97
152
|
if (type === 'member.added' || type === 'member.updated') {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
153
|
+
var member = event.member;
|
|
154
|
+
var _cid = event.cid;
|
|
155
|
+
if (member && _cid) {
|
|
156
|
+
return queriesWithChannelGuard(function (flushOverride) {
|
|
157
|
+
return (0, _upsertMembers.upsertMembers)({
|
|
158
|
+
cid: _cid,
|
|
159
|
+
flush: flushOverride,
|
|
160
|
+
members: [member]
|
|
161
|
+
});
|
|
103
162
|
});
|
|
104
163
|
}
|
|
105
164
|
}
|
|
106
165
|
if (type === 'member.removed') {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
166
|
+
var _member = event.member;
|
|
167
|
+
var _cid2 = event.cid;
|
|
168
|
+
if (_member && _cid2) {
|
|
169
|
+
return queriesWithChannelGuard(function (flushOverride) {
|
|
170
|
+
return (0, _deleteMember.deleteMember)({
|
|
171
|
+
cid: _cid2,
|
|
172
|
+
flush: flushOverride,
|
|
173
|
+
member: _member
|
|
174
|
+
});
|
|
112
175
|
});
|
|
113
176
|
}
|
|
114
177
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_deleteChannel","require","_deleteMember","_deleteMessagesForChannel","_updateMessage","_upsertChannelData","_upsertChannels","_upsertMembers","_upsertMessages","_upsertReads","handleEventToSyncDB","event","flush","type","_event$user","user","id","cid","upsertReads","reads","last_read","received_at","unread_messages","message","parent_id","show_in_channel","upsertMessages","messages","updateMessage","reaction","channel","upsertChannelData","deleteChannel","deleteMessagesForChannel","_event$queriedChannel","_event$queriedChannel2","queriedChannels","channels","length","_event$queriedChannel3","_event$queriedChannel4","upsertChannels","isLatestMessagesSet","isLatestMessageSet","member","upsertMembers","members","deleteMember","exports"],"sources":["handleEventToSyncDB.ts"],"sourcesContent":["import type { Event } from 'stream-chat';\n\nimport { deleteChannel } from '../../../store/apis/deleteChannel';\nimport { deleteMember } from '../../../store/apis/deleteMember';\nimport { deleteMessagesForChannel } from '../../../store/apis/deleteMessagesForChannel';\nimport { updateMessage } from '../../../store/apis/updateMessage';\nimport { upsertChannelData } from '../../../store/apis/upsertChannelData';\nimport { upsertChannels } from '../../../store/apis/upsertChannels';\nimport { upsertMembers } from '../../../store/apis/upsertMembers';\nimport { upsertMessages } from '../../../store/apis/upsertMessages';\nimport { upsertReads } from '../../../store/apis/upsertReads';\n\nexport const handleEventToSyncDB = (event: Event, flush?: boolean) => {\n const { type } = event;\n\n if (type === 'message.read') {\n if (event.user?.id && event.cid) {\n return upsertReads({\n cid: event.cid,\n flush,\n reads: [\n {\n last_read: event.received_at as string,\n unread_messages: 0,\n user: event.user,\n },\n ],\n });\n }\n }\n\n if (type === 'message.new') {\n if (event.message && (!event.message.parent_id || event.message.show_in_channel)) {\n return upsertMessages({\n flush,\n messages: [event.message],\n });\n }\n }\n\n if (type === 'message.updated' || type === 'message.deleted') {\n if (event.message && !event.message.parent_id) {\n // Update only if it exists, otherwise event could be related\n // to a message which is not in database.\n return updateMessage({\n flush,\n message: event.message,\n });\n }\n }\n\n if (type === 'reaction.updated') {\n if (event.message && event.reaction) {\n // We update the entire message to make sure we also update\n // reaction_counts.\n return updateMessage({\n flush,\n message: event.message,\n });\n }\n }\n\n if (type === 'reaction.new' || type === 'reaction.deleted') {\n if (event.message && !event.message.parent_id) {\n // Here we are relying on the fact message.latest_reactions always includes\n // the new reaction. So we first delete all the existing reactions and populate\n // the reactions table with message.latest_reactions\n return updateMessage({\n flush,\n message: event.message,\n });\n }\n }\n\n if (\n type === 'channel.updated' ||\n type === 'channel.visible' ||\n type === 'notification.added_to_channel' ||\n type === 'notification.message_new'\n ) {\n if (event.channel) {\n return upsertChannelData({\n channel: event.channel,\n flush,\n });\n }\n }\n\n if (\n type === 'channel.hidden' ||\n type === 'channel.deleted' ||\n type === 'notification.removed_from_channel'\n ) {\n if (event.channel) {\n return deleteChannel({\n cid: event.channel.cid,\n flush,\n });\n }\n }\n\n if (type === 'channel.truncated') {\n if (event.channel) {\n return deleteMessagesForChannel({\n cid: event.channel.cid,\n flush,\n });\n }\n }\n\n if (type === 'channels.queried') {\n if (event.queriedChannels?.channels?.length) {\n return upsertChannels({\n channels: event.queriedChannels?.channels,\n flush,\n isLatestMessagesSet: event.queriedChannels?.isLatestMessageSet,\n });\n }\n }\n\n if (type === 'member.added' || type === 'member.updated') {\n if (event.member && event.cid) {\n return upsertMembers({\n cid: event.cid,\n flush,\n members: [event.member],\n });\n }\n }\n\n if (type === 'member.removed') {\n if (event.member && event.cid) {\n return deleteMember({\n cid: event.cid,\n flush,\n member: event.member,\n });\n }\n }\n\n return [];\n};\n"],"mappings":";;;;AAEA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,yBAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AAEO,IAAMS,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,KAAY,EAAEC,KAAe,EAAK;EACpE,IAAQC,IAAI,GAAKF,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,EAAE;MAAA,IAAAC,sBAAA,EAAAC,sBAAA;MAC3C,OAAO,IAAAC,8BAAc,EAAC;QACpBJ,QAAQ,GAAAE,sBAAA,GAAE5B,KAAK,CAACyB,eAAe,qBAArBG,sBAAA,CAAuBF,QAAQ;QACzCzB,KAAK,EAALA,KAAK;QACL8B,mBAAmB,GAAAF,sBAAA,GAAE7B,KAAK,CAACyB,eAAe,qBAArBI,sBAAA,CAAuBG;MAC9C,CAAC,CAAC;IACJ;EACF;EAEA,IAAI9B,IAAI,KAAK,cAAc,IAAIA,IAAI,KAAK,gBAAgB,EAAE;IACxD,IAAIF,KAAK,CAACiC,MAAM,IAAIjC,KAAK,CAACM,GAAG,EAAE;MAC7B,OAAO,IAAA4B,4BAAa,EAAC;QACnB5B,GAAG,EAAEN,KAAK,CAACM,GAAG;QACdL,KAAK,EAALA,KAAK;QACLkC,OAAO,EAAE,CAACnC,KAAK,CAACiC,MAAM;MACxB,CAAC,CAAC;IACJ;EACF;EAEA,IAAI/B,IAAI,KAAK,gBAAgB,EAAE;IAC7B,IAAIF,KAAK,CAACiC,MAAM,IAAIjC,KAAK,CAACM,GAAG,EAAE;MAC7B,OAAO,IAAA8B,0BAAY,EAAC;QAClB9B,GAAG,EAAEN,KAAK,CAACM,GAAG;QACdL,KAAK,EAALA,KAAK;QACLgC,MAAM,EAAEjC,KAAK,CAACiC;MAChB,CAAC,CAAC;IACJ;EACF;EAEA,OAAO,EAAE;AACX,CAAC;AAACI,OAAA,CAAAtC,mBAAA,GAAAA,mBAAA"}
|
|
1
|
+
{"version":3,"names":["_deleteChannel","require","_deleteMember","_deleteMessagesForChannel","_updateMessage","_upsertChannelData","_upsertChannelDataFromChannel","_upsertChannels","_upsertMembers","_upsertMessages","_upsertReads","_QuickSqliteClient","_createSelectQuery","handleEventToSyncDB","event","client","flush","type","queriesWithChannelGuard","createQueries","_event$channel","cid","channel","channels","QuickSqliteClient","executeSql","apply","createSelectQuery","length","channel_type","channel_id","undefined","initialized","disconnected","channelQuery","upsertChannelDataFromChannel","newQueries","concat","_toConsumableArray2","executeSqlBatch","console","warn","user","id","flushOverride","upsertReads","reads","last_read","received_at","unread_messages","message","parent_id","show_in_channel","upsertMessages","messages","updateMessage","reaction","upsertChannelData","deleteChannel","deleteMessagesForChannel","_event$queriedChannel","_event$queriedChannel2","queriedChannels","_event$queriedChannel3","_event$queriedChannel4","upsertChannels","isLatestMessagesSet","isLatestMessageSet","member","upsertMembers","members","deleteMember","exports"],"sources":["handleEventToSyncDB.ts"],"sourcesContent":["import { DefaultStreamChatGenerics } from 'src/types/types';\nimport type { Event, StreamChat } from 'stream-chat';\n\nimport { deleteChannel } from '../../../store/apis/deleteChannel';\nimport { deleteMember } from '../../../store/apis/deleteMember';\nimport { deleteMessagesForChannel } from '../../../store/apis/deleteMessagesForChannel';\nimport { updateMessage } from '../../../store/apis/updateMessage';\nimport { upsertChannelData } from '../../../store/apis/upsertChannelData';\nimport { upsertChannelDataFromChannel } from '../../../store/apis/upsertChannelDataFromChannel';\nimport { upsertChannels } from '../../../store/apis/upsertChannels';\nimport { upsertMembers } from '../../../store/apis/upsertMembers';\nimport { upsertMessages } from '../../../store/apis/upsertMessages';\nimport { upsertReads } from '../../../store/apis/upsertReads';\nimport { QuickSqliteClient } from '../../../store/QuickSqliteClient';\nimport { createSelectQuery } from '../../../store/sqlite-utils/createSelectQuery';\nimport { PreparedQueries } from '../../../store/types';\n\nexport const handleEventToSyncDB = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n event: Event,\n client: StreamChat<StreamChatGenerics>,\n flush?: boolean,\n) => {\n const { type } = event;\n\n // This function is used to guard the queries that require channel to be present in the db first\n // If channel is not present in the db, we first fetch the channel data from the channel object\n // and then add the queries with a channel create query first\n const queriesWithChannelGuard = (\n createQueries: (flushOverride?: boolean) => PreparedQueries[],\n ) => {\n const cid = event.cid || event.channel?.cid;\n\n if (!cid) return createQueries(flush);\n const channels = QuickSqliteClient.executeSql.apply(\n null,\n createSelectQuery('channels', ['cid'], {\n cid,\n }),\n );\n // a channel is not present in the db, we first fetch the channel data from the channel object.\n // this can happen for example when a message.new event is received for a channel that is not in the db due to a channel being hidden.\n if (channels.length === 0) {\n const channel =\n event.channel_type && event.channel_id\n ? client.channel(event.channel_type, event.channel_id)\n : undefined;\n if (channel && channel.initialized && !channel.disconnected) {\n const channelQuery = upsertChannelDataFromChannel({\n channel,\n flush,\n });\n if (channelQuery) {\n const newQueries = [...channelQuery, ...createQueries(false)];\n if (flush !== false) {\n QuickSqliteClient.executeSqlBatch(newQueries);\n }\n return newQueries;\n } else {\n console.warn(\n `Couldnt create channel queries on ${type} event for an initialized channel that is not in DB, skipping event`,\n { event },\n );\n return [];\n }\n } else {\n console.warn(\n `Received ${type} event for a non initialized channel that is not in DB, skipping event`,\n { event },\n );\n return [];\n }\n }\n return createQueries(flush);\n };\n\n if (type === 'message.read') {\n const cid = event.cid;\n const user = event.user;\n if (user?.id && cid) {\n return queriesWithChannelGuard((flushOverride) =>\n upsertReads({\n cid,\n flush: flushOverride,\n reads: [\n {\n last_read: event.received_at as string,\n unread_messages: 0,\n user,\n },\n ],\n }),\n );\n }\n }\n\n if (type === 'message.new') {\n const message = event.message;\n if (message && (!message.parent_id || message.show_in_channel)) {\n return queriesWithChannelGuard((flushOverride) =>\n upsertMessages({\n flush: flushOverride,\n messages: [message],\n }),\n );\n }\n }\n\n if (type === 'message.updated' || type === 'message.deleted') {\n const message = event.message;\n if (message && !message.parent_id) {\n // Update only if it exists, otherwise event could be related\n // to a message which is not in database.\n return queriesWithChannelGuard((flushOverride) =>\n updateMessage({\n flush: flushOverride,\n message,\n }),\n );\n }\n }\n\n if (type === 'reaction.updated') {\n const message = event.message;\n if (message && event.reaction) {\n // We update the entire message to make sure we also update\n // reaction_counts.\n return queriesWithChannelGuard((flushOverride) =>\n updateMessage({\n flush: flushOverride,\n message,\n }),\n );\n }\n }\n\n if (type === 'reaction.new' || type === 'reaction.deleted') {\n const message = event.message;\n if (message && !message.parent_id) {\n // Here we are relying on the fact message.latest_reactions always includes\n // the new reaction. So we first delete all the existing reactions and populate\n // the reactions table with message.latest_reactions\n return queriesWithChannelGuard((flushOverride) =>\n updateMessage({\n flush: flushOverride,\n message,\n }),\n );\n }\n }\n\n if (\n type === 'channel.updated' ||\n type === 'channel.visible' ||\n type === 'notification.added_to_channel' ||\n type === 'notification.message_new'\n ) {\n if (event.channel) {\n return upsertChannelData({\n channel: event.channel,\n flush,\n });\n }\n }\n\n if (\n type === 'channel.hidden' ||\n type === 'channel.deleted' ||\n type === 'notification.removed_from_channel'\n ) {\n if (event.channel) {\n return deleteChannel({\n cid: event.channel.cid,\n flush,\n });\n }\n }\n\n if (type === 'channel.truncated') {\n if (event.channel) {\n return deleteMessagesForChannel({\n cid: event.channel.cid,\n flush,\n });\n }\n }\n\n if (type === 'channels.queried') {\n if (event.queriedChannels?.channels?.length) {\n return upsertChannels({\n channels: event.queriedChannels?.channels,\n flush,\n isLatestMessagesSet: event.queriedChannels?.isLatestMessageSet,\n });\n }\n }\n\n if (type === 'member.added' || type === 'member.updated') {\n const member = event.member;\n const cid = event.cid;\n if (member && cid) {\n return queriesWithChannelGuard((flushOverride) =>\n upsertMembers({\n cid,\n flush: flushOverride,\n members: [member],\n }),\n );\n }\n }\n\n if (type === 'member.removed') {\n const member = event.member;\n const cid = event.cid;\n if (member && cid) {\n return queriesWithChannelGuard((flushOverride) =>\n deleteMember({\n cid,\n flush: flushOverride,\n member,\n }),\n );\n }\n }\n\n return [];\n};\n"],"mappings":";;;;;;AAGA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,yBAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,6BAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,cAAA,GAAAP,OAAA;AACA,IAAAQ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O,GAAG;IACrB,IAAI+C,MAAM,IAAI/C,IAAG,EAAE;MACjB,OAAOH,uBAAuB,CAAC,UAAC0B,aAAa;QAAA,OAC3C,IAAAyB,4BAAa,EAAC;UACZhD,GAAG,EAAHA,IAAG;UACHL,KAAK,EAAE4B,aAAa;UACpB0B,OAAO,EAAE,CAACF,MAAM;QAClB,CAAC,CAAC;MAAA,CACJ,CAAC;IACH;EACF;EAEA,IAAInD,IAAI,KAAK,gBAAgB,EAAE;IAC7B,IAAMmD,OAAM,GAAGtD,KAAK,CAACsD,MAAM;IAC3B,IAAM/C,KAAG,GAAGP,KAAK,CAACO,GAAG;IACrB,IAAI+C,OAAM,IAAI/C,KAAG,EAAE;MACjB,OAAOH,uBAAuB,CAAC,UAAC0B,aAAa;QAAA,OAC3C,IAAA2B,0BAAY,EAAC;UACXlD,GAAG,EAAHA,KAAG;UACHL,KAAK,EAAE4B,aAAa;UACpBwB,MAAM,EAANA;QACF,CAAC,CAAC;MAAA,CACJ,CAAC;IACH;EACF;EAEA,OAAO,EAAE;AACX,CAAC;AAACI,OAAA,CAAA3D,mBAAA,GAAAA,mBAAA"}
|
|
@@ -11,7 +11,9 @@ var useSyncDatabase = function useSyncDatabase(_ref) {
|
|
|
11
11
|
(0, _react.useEffect)(function () {
|
|
12
12
|
var listener;
|
|
13
13
|
if (enableOfflineSupport && initialisedDatabase) {
|
|
14
|
-
listener = client == null ? void 0 : client.on(
|
|
14
|
+
listener = client == null ? void 0 : client.on(function (event) {
|
|
15
|
+
return (0, _handleEventToSyncDB.handleEventToSyncDB)(event, client);
|
|
16
|
+
});
|
|
15
17
|
}
|
|
16
18
|
return function () {
|
|
17
19
|
var _listener;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_handleEventToSyncDB","useSyncDatabase","_ref","client","enableOfflineSupport","initialisedDatabase","useEffect","listener","on","handleEventToSyncDB","_listener","unsubscribe","exports"],"sources":["useSyncDatabase.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nimport type { StreamChat } from 'stream-chat';\n\nimport { handleEventToSyncDB } from './handleEventToSyncDB';\n\nimport type { DefaultStreamChatGenerics } from '../../../types/types';\n\ntype Params<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {\n client: StreamChat<StreamChatGenerics>;\n enableOfflineSupport: boolean;\n initialisedDatabase: boolean;\n};\nexport const useSyncDatabase = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n client,\n enableOfflineSupport,\n initialisedDatabase,\n}: Params<StreamChatGenerics>) => {\n useEffect(() => {\n let listener: ReturnType<StreamChat['on']> | undefined;\n\n if (enableOfflineSupport && initialisedDatabase) {\n listener = client?.on(handleEventToSyncDB);\n }\n\n return () => {\n listener?.unsubscribe();\n };\n }, [client, initialisedDatabase]);\n};\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,oBAAA,GAAAD,OAAA;AASO,IAAME,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAMM;EAAA,IAHhCC,MAAM,GAAAD,IAAA,CAANC,MAAM;IACNC,oBAAoB,GAAAF,IAAA,CAApBE,oBAAoB;IACpBC,mBAAmB,GAAAH,IAAA,CAAnBG,mBAAmB;EAEnB,IAAAC,gBAAS,EAAC,YAAM;IACd,IAAIC,QAAkD;IAEtD,IAAIH,oBAAoB,IAAIC,mBAAmB,EAAE;MAC/CE,QAAQ,GAAGJ,MAAM,oBAANA,MAAM,CAAEK,EAAE,
|
|
1
|
+
{"version":3,"names":["_react","require","_handleEventToSyncDB","useSyncDatabase","_ref","client","enableOfflineSupport","initialisedDatabase","useEffect","listener","on","event","handleEventToSyncDB","_listener","unsubscribe","exports"],"sources":["useSyncDatabase.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nimport type { StreamChat } from 'stream-chat';\n\nimport { handleEventToSyncDB } from './handleEventToSyncDB';\n\nimport type { DefaultStreamChatGenerics } from '../../../types/types';\n\ntype Params<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {\n client: StreamChat<StreamChatGenerics>;\n enableOfflineSupport: boolean;\n initialisedDatabase: boolean;\n};\nexport const useSyncDatabase = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n client,\n enableOfflineSupport,\n initialisedDatabase,\n}: Params<StreamChatGenerics>) => {\n useEffect(() => {\n let listener: ReturnType<StreamChat['on']> | undefined;\n\n if (enableOfflineSupport && initialisedDatabase) {\n listener = client?.on((event) => handleEventToSyncDB(event, client));\n }\n\n return () => {\n listener?.unsubscribe();\n };\n }, [client, initialisedDatabase]);\n};\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,oBAAA,GAAAD,OAAA;AASO,IAAME,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAMM;EAAA,IAHhCC,MAAM,GAAAD,IAAA,CAANC,MAAM;IACNC,oBAAoB,GAAAF,IAAA,CAApBE,oBAAoB;IACpBC,mBAAmB,GAAAH,IAAA,CAAnBG,mBAAmB;EAEnB,IAAAC,gBAAS,EAAC,YAAM;IACd,IAAIC,QAAkD;IAEtD,IAAIH,oBAAoB,IAAIC,mBAAmB,EAAE;MAC/CE,QAAQ,GAAGJ,MAAM,oBAANA,MAAM,CAAEK,EAAE,CAAC,UAACC,KAAK;QAAA,OAAK,IAAAC,wCAAmB,EAACD,KAAK,EAAEN,MAAM,CAAC;MAAA,EAAC;IACtE;IAEA,OAAO,YAAM;MAAA,IAAAQ,SAAA;MACX,CAAAA,SAAA,GAAAJ,QAAQ,qBAARI,SAAA,CAAUC,WAAW,CAAC,CAAC;IACzB,CAAC;EACH,CAAC,EAAE,CAACT,MAAM,EAAEE,mBAAmB,CAAC,CAAC;AACnC,CAAC;AAACQ,OAAA,CAAAZ,eAAA,GAAAA,eAAA"}
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"File type not supported": "File type not supported",
|
|
27
27
|
"Flag": "Flag",
|
|
28
28
|
"Flag Message": "Flag Message",
|
|
29
|
-
"Flag action failed either due to a network issue or the message is already flagged": "Flag action failed either due to a network issue or the message is already flagged",
|
|
29
|
+
"Flag action failed either due to a network issue or the message is already flagged": "Flag action failed either due to a network issue or the message is already flagged.",
|
|
30
30
|
"How about sending your first message to a friend?": "How about sending your first message to a friend?",
|
|
31
31
|
"Instant Commands": "Instant Commands",
|
|
32
32
|
"Let's start chatting!": "Let's start chatting!",
|
|
@@ -1,79 +1,79 @@
|
|
|
1
1
|
{
|
|
2
2
|
"1 Reply": "1 respuesta",
|
|
3
|
-
"1 Thread Reply": "
|
|
3
|
+
"1 Thread Reply": "",
|
|
4
4
|
"Allow access to your Gallery": "",
|
|
5
5
|
"Allow camera access in device settings": "",
|
|
6
6
|
"Also send to channel": "",
|
|
7
|
-
"Are you sure you want to permanently delete this message?": "",
|
|
8
|
-
"Are you sure?": "
|
|
9
|
-
"Block User": "",
|
|
10
|
-
"Cancel": "",
|
|
11
|
-
"Cannot Flag Message": "",
|
|
12
|
-
"Consider how your comment might make others feel and be sure to follow our Community Guidelines": "
|
|
13
|
-
"Copy Message": "",
|
|
14
|
-
"Delete": "",
|
|
15
|
-
"Delete Message": "",
|
|
7
|
+
"Are you sure you want to permanently delete this message?": "¿Estás seguro de que deseas eliminar permanentemente este mensaje?",
|
|
8
|
+
"Are you sure?": "",
|
|
9
|
+
"Block User": "Bloquear usuario",
|
|
10
|
+
"Cancel": "Cancelar",
|
|
11
|
+
"Cannot Flag Message": "No se puede reportar el mensaje",
|
|
12
|
+
"Consider how your comment might make others feel and be sure to follow our Community Guidelines": "",
|
|
13
|
+
"Copy Message": "Copiar mensaje",
|
|
14
|
+
"Delete": "Eliminar",
|
|
15
|
+
"Delete Message": "Eliminar mensaje",
|
|
16
16
|
"Device camera is used to take photos or videos.": "",
|
|
17
|
-
"Do you want to send a copy of this message to a moderator for further investigation?": "",
|
|
18
|
-
"Edit Message": "",
|
|
19
|
-
"Editing Message": "
|
|
20
|
-
"Emoji matching": "
|
|
17
|
+
"Do you want to send a copy of this message to a moderator for further investigation?": "¿Deseas enviar una copia de este mensaje a un moderador para una investigación adicional?",
|
|
18
|
+
"Edit Message": "Editar mensaje",
|
|
19
|
+
"Editing Message": "",
|
|
20
|
+
"Emoji matching": "",
|
|
21
21
|
"Empty message...": "Mensaje vacío...",
|
|
22
|
-
"Error loading": "
|
|
22
|
+
"Error loading": "",
|
|
23
23
|
"Error loading channel list...": "Error al cargar la lista de canales...",
|
|
24
24
|
"Error loading messages for this channel...": "Error al cargar los mensajes de este canal...",
|
|
25
25
|
"Error while loading, please reload/refresh": "Error al cargar, por favor recarga/actualiza",
|
|
26
26
|
"File type not supported": "",
|
|
27
|
-
"Flag": "",
|
|
28
|
-
"Flag Message": "",
|
|
29
|
-
"Flag action failed either due to a network issue or the message is already flagged": "",
|
|
27
|
+
"Flag": "Reportar",
|
|
28
|
+
"Flag Message": "Reportar mensaje",
|
|
29
|
+
"Flag action failed either due to a network issue or the message is already flagged": "El reporte falló debido a un problema de red o el mensaje ya fue reportado.",
|
|
30
30
|
"How about sending your first message to a friend?": "¿Qué tal enviar tu primer mensaje a un amigo?",
|
|
31
|
-
"Instant Commands": "
|
|
31
|
+
"Instant Commands": "",
|
|
32
32
|
"Let's start chatting!": "¡Empecemos a charlar!",
|
|
33
33
|
"Links are disabled": "Los enlaces están desactivados",
|
|
34
|
-
"Loading channels...": "",
|
|
35
|
-
"Loading messages...": "",
|
|
36
|
-
"Loading...": "",
|
|
34
|
+
"Loading channels...": "Cargando canales...",
|
|
35
|
+
"Loading messages...": "Cargando mensajes...",
|
|
36
|
+
"Loading...": "Cargando...",
|
|
37
37
|
"Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "El archivo supera el tamaño máximo permitido. Por favor, selecciona un archivo menor a {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.",
|
|
38
|
-
"Message Reactions": "",
|
|
38
|
+
"Message Reactions": "Reacciones al mensaje",
|
|
39
39
|
"Message deleted": "Mensaje eliminado",
|
|
40
|
-
"Message flagged": "",
|
|
41
|
-
"Mute User": "",
|
|
40
|
+
"Message flagged": "Mensaje reportado",
|
|
41
|
+
"Mute User": "Silenciar usuario",
|
|
42
42
|
"Not supported": "",
|
|
43
43
|
"Nothing yet...": "Aún no hay nada...",
|
|
44
|
-
"Ok": "",
|
|
45
|
-
"Only visible to you": "
|
|
44
|
+
"Ok": "Aceptar",
|
|
45
|
+
"Only visible to you": "",
|
|
46
46
|
"Open Settings": "",
|
|
47
47
|
"Photo": "Foto",
|
|
48
48
|
"Photos and Videos": "",
|
|
49
|
-
"Pin to Conversation": "",
|
|
50
|
-
"Pinned by": "
|
|
49
|
+
"Pin to Conversation": "Fijar a la conversación",
|
|
50
|
+
"Pinned by": "",
|
|
51
51
|
"Please enable access to your photos and videos so you can share them.": "",
|
|
52
|
-
"Please select a channel first": "",
|
|
52
|
+
"Please select a channel first": "Por favor, selecciona primero un canal",
|
|
53
53
|
"Reconnecting...": "Reconectando...",
|
|
54
|
-
"Reply": "",
|
|
54
|
+
"Reply": "Responder",
|
|
55
55
|
"Reply to Message": "",
|
|
56
|
-
"Resend": "",
|
|
57
|
-
"Search GIFs": "",
|
|
56
|
+
"Resend": "Reenviar",
|
|
57
|
+
"Search GIFs": "Buscar GIFs",
|
|
58
58
|
"Select More Photos": "",
|
|
59
|
-
"Send Anyway": "
|
|
60
|
-
"Send a message": "",
|
|
59
|
+
"Send Anyway": "",
|
|
60
|
+
"Send a message": "Enviar un mensaje",
|
|
61
61
|
"Sending links is not allowed in this conversation": "No está permitido enviar enlaces en esta conversación",
|
|
62
|
-
"Slow mode ON": "",
|
|
63
|
-
"The message has been reported to a moderator.": "",
|
|
64
|
-
"Thread Reply": "",
|
|
65
|
-
"Unblock User": "",
|
|
62
|
+
"Slow mode ON": "Modo lento ACTIVADO",
|
|
63
|
+
"The message has been reported to a moderator.": "El mensaje ha sido reportado a un moderador.",
|
|
64
|
+
"Thread Reply": "Respuesta de hilo",
|
|
65
|
+
"Unblock User": "Desbloquear usuario",
|
|
66
66
|
"Unknown User": "",
|
|
67
|
-
"Unmute User": "",
|
|
68
|
-
"Unpin from Conversation": "",
|
|
69
|
-
"Unread Messages": "",
|
|
67
|
+
"Unmute User": "Activar sonido del usuario",
|
|
68
|
+
"Unpin from Conversation": "Desmarcar de la conversación",
|
|
69
|
+
"Unread Messages": "Mensajes no leídos",
|
|
70
70
|
"Video": "Video",
|
|
71
71
|
"You": "Tú",
|
|
72
72
|
"You can't send messages in this channel": "",
|
|
73
73
|
"{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "{{ firstUser }} y {{ nonSelfUserLength }} más están escribiendo",
|
|
74
74
|
"{{ index }} of {{ photoLength }}": "",
|
|
75
75
|
"{{ replyCount }} Replies": "{{ replyCount }} Respuestas",
|
|
76
|
-
"{{ replyCount }} Thread Replies": "
|
|
76
|
+
"{{ replyCount }} Thread Replies": "",
|
|
77
77
|
"{{ user }} is typing": "{{ user }} está escribiendo",
|
|
78
78
|
"🏙 Attachment...": "🏙 Adjunto..."
|
|
79
79
|
}
|
|
@@ -1,79 +1,79 @@
|
|
|
1
1
|
{
|
|
2
2
|
"1 Reply": "1 Réponse",
|
|
3
|
-
"1 Thread Reply": "
|
|
3
|
+
"1 Thread Reply": "",
|
|
4
4
|
"Allow access to your Gallery": "",
|
|
5
5
|
"Allow camera access in device settings": "",
|
|
6
6
|
"Also send to channel": "",
|
|
7
|
-
"Are you sure you want to permanently delete this message?": "",
|
|
8
|
-
"Are you sure?": "
|
|
9
|
-
"Block User": "",
|
|
10
|
-
"Cancel": "",
|
|
11
|
-
"Cannot Flag Message": "",
|
|
12
|
-
"Consider how your comment might make others feel and be sure to follow our Community Guidelines": "
|
|
13
|
-
"Copy Message": "",
|
|
14
|
-
"Delete": "",
|
|
15
|
-
"Delete Message": "",
|
|
7
|
+
"Are you sure you want to permanently delete this message?": "Êtes-vous sûr de vouloir supprimer définitivement ce message?",
|
|
8
|
+
"Are you sure?": "",
|
|
9
|
+
"Block User": "Bloquer un utilisateur",
|
|
10
|
+
"Cancel": "Annuler",
|
|
11
|
+
"Cannot Flag Message": "Impossible de signaler le message",
|
|
12
|
+
"Consider how your comment might make others feel and be sure to follow our Community Guidelines": "",
|
|
13
|
+
"Copy Message": "Copier le message",
|
|
14
|
+
"Delete": "Supprimer",
|
|
15
|
+
"Delete Message": "Supprimer un message",
|
|
16
16
|
"Device camera is used to take photos or videos.": "",
|
|
17
|
-
"Do you want to send a copy of this message to a moderator for further investigation?": "",
|
|
18
|
-
"Edit Message": "",
|
|
19
|
-
"Editing Message": "
|
|
20
|
-
"Emoji matching": "
|
|
17
|
+
"Do you want to send a copy of this message to a moderator for further investigation?": "Voulez-vous envoyer une copie de ce message à un modérateur pour une enquête plus approfondie?",
|
|
18
|
+
"Edit Message": "Éditer un message",
|
|
19
|
+
"Editing Message": "",
|
|
20
|
+
"Emoji matching": "",
|
|
21
21
|
"Empty message...": "Message vide...",
|
|
22
|
-
"Error loading": "
|
|
22
|
+
"Error loading": "",
|
|
23
23
|
"Error loading channel list...": "Erreur lors du chargement de la liste de canaux...",
|
|
24
24
|
"Error loading messages for this channel...": "Erreur lors du chargement des messages de ce canal...",
|
|
25
25
|
"Error while loading, please reload/refresh": "Erreur lors du chargement, veuillez recharger/rafraîchir",
|
|
26
26
|
"File type not supported": "",
|
|
27
|
-
"Flag": "",
|
|
28
|
-
"Flag Message": "",
|
|
29
|
-
"Flag action failed either due to a network issue or the message is already flagged": "",
|
|
27
|
+
"Flag": "Signaler",
|
|
28
|
+
"Flag Message": "Signaler le message",
|
|
29
|
+
"Flag action failed either due to a network issue or the message is already flagged": "L'action de signalisation a échoué en raison d'un problème de réseau ou le message est déjà signalé.",
|
|
30
30
|
"How about sending your first message to a friend?": "Et si vous envoyiez votre premier message à un ami ?",
|
|
31
|
-
"Instant Commands": "
|
|
31
|
+
"Instant Commands": "",
|
|
32
32
|
"Let's start chatting!": "Commençons à discuter !",
|
|
33
33
|
"Links are disabled": "Links are disabled",
|
|
34
|
-
"Loading channels...": "",
|
|
35
|
-
"Loading messages...": "",
|
|
36
|
-
"Loading...": "",
|
|
34
|
+
"Loading channels...": "Chargement des canaux...",
|
|
35
|
+
"Loading messages...": "Chargement des messages...",
|
|
36
|
+
"Loading...": "Chargement...",
|
|
37
37
|
"Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "Taille maximale de téléchargement de fichier atteinte. Veuillez télécharger un fichier inférieur à {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} Mo.",
|
|
38
|
-
"Message Reactions": "",
|
|
38
|
+
"Message Reactions": "Réactions aux messages",
|
|
39
39
|
"Message deleted": "Message supprimé",
|
|
40
|
-
"Message flagged": "",
|
|
41
|
-
"Mute User": "",
|
|
40
|
+
"Message flagged": "Message signalé",
|
|
41
|
+
"Mute User": "Utilisateur muet",
|
|
42
42
|
"Not supported": "",
|
|
43
43
|
"Nothing yet...": "Aucun message...",
|
|
44
|
-
"Ok": "",
|
|
45
|
-
"Only visible to you": "
|
|
44
|
+
"Ok": "Ok",
|
|
45
|
+
"Only visible to you": "",
|
|
46
46
|
"Open Settings": "",
|
|
47
47
|
"Photo": "Photo",
|
|
48
48
|
"Photos and Videos": "",
|
|
49
|
-
"Pin to Conversation": "",
|
|
50
|
-
"Pinned by": "
|
|
49
|
+
"Pin to Conversation": "Épingler à la conversation",
|
|
50
|
+
"Pinned by": "",
|
|
51
51
|
"Please enable access to your photos and videos so you can share them.": "",
|
|
52
|
-
"Please select a channel first": "",
|
|
52
|
+
"Please select a channel first": "Veuillez d'abord selectionnez un canal",
|
|
53
53
|
"Reconnecting...": "Se Reconnecter...",
|
|
54
|
-
"Reply": "",
|
|
54
|
+
"Reply": "Répondre",
|
|
55
55
|
"Reply to Message": "",
|
|
56
|
-
"Resend": "",
|
|
57
|
-
"Search GIFs": "",
|
|
56
|
+
"Resend": "Renvoyer",
|
|
57
|
+
"Search GIFs": "Rechercher des GIF",
|
|
58
58
|
"Select More Photos": "",
|
|
59
|
-
"Send Anyway": "
|
|
60
|
-
"Send a message": "",
|
|
59
|
+
"Send Anyway": "",
|
|
60
|
+
"Send a message": "Envoyer un message",
|
|
61
61
|
"Sending links is not allowed in this conversation": "Sending links is not allowed in this conversation",
|
|
62
|
-
"Slow mode ON": "",
|
|
63
|
-
"The message has been reported to a moderator.": "",
|
|
64
|
-
"Thread Reply": "",
|
|
65
|
-
"Unblock User": "",
|
|
62
|
+
"Slow mode ON": "Mode lent activé",
|
|
63
|
+
"The message has been reported to a moderator.": "Le message a été signalé à un modérateur.",
|
|
64
|
+
"Thread Reply": "Réponse à la discussion",
|
|
65
|
+
"Unblock User": "Débloquer Utilisateur",
|
|
66
66
|
"Unknown User": "",
|
|
67
|
-
"Unmute User": "",
|
|
68
|
-
"Unpin from Conversation": "",
|
|
69
|
-
"Unread Messages": "",
|
|
67
|
+
"Unmute User": "Activer le son de Utilisateur",
|
|
68
|
+
"Unpin from Conversation": "Décrocher de la conversation",
|
|
69
|
+
"Unread Messages": "Messages non lus",
|
|
70
70
|
"Video": "Vidéo",
|
|
71
71
|
"You": "Toi",
|
|
72
72
|
"You can't send messages in this channel": "",
|
|
73
73
|
"{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "{{ firstUser }} et {{ nonSelfUserLength }} autres sont en train d'écrire",
|
|
74
74
|
"{{ index }} of {{ photoLength }}": "",
|
|
75
75
|
"{{ replyCount }} Replies": "{{ replyCount }} Réponses",
|
|
76
|
-
"{{ replyCount }} Thread Replies": "
|
|
76
|
+
"{{ replyCount }} Thread Replies": "",
|
|
77
77
|
"{{ user }} is typing": "{{ user }} est en train d'écrire",
|
|
78
78
|
"🏙 Attachment...": "🏙 Pièce jointe..."
|
|
79
79
|
}
|