recv ackns moved to the SDK

This commit is contained in:
or-else
2022-06-26 19:29:51 -07:00
parent d95c53ed24
commit e77e8441cf
8 changed files with 97 additions and 61 deletions
+1 -3
View File
@@ -17,10 +17,8 @@ export const LOGGING_ENABLED = true;
// Minimum time between two keypress notifications, milliseconds.
export const KEYPRESS_DELAY = 3_000;
// Delay before sending a {note} for reciving a message, milliseconds.
export const RECEIVED_DELAY = 500;
// Delay before sending a read notification, milliseconds.
export const READ_DELAY = 1000;
export const READ_DELAY = 1_500;
// The default shortest allowed tag length. Matches the value on the server.
export const MIN_TAG_LENGTH = 2;
+7 -14
View File
@@ -18,7 +18,7 @@ import MessagesView from './messages-view.jsx';
import SidepanelView from './sidepanel-view.jsx';
import { API_KEY, APP_NAME, DEFAULT_P2P_ACCESS_MODE, FORWARDED_PREVIEW_LENGTH, LOGGING_ENABLED,
MEDIA_BREAKPOINT, RECEIVED_DELAY } from '../config.js';
MEDIA_BREAKPOINT } from '../config.js';
import { CALL_STATE_NONE, CALL_STATE_OUTGOING_INITATED,
CALL_STATE_INCOMING_RECEIVED, CALL_STATE_IN_PROGRESS,
CALL_HEAD_STARTED } from '../constants.js';
@@ -786,7 +786,9 @@ class TinodeWeb extends React.Component {
if (cont.unread > 0 && this.state.messageSounds && !archived) {
// Skip update if the topic is currently open, otherwise the badge will annoyingly flash.
if (document.hidden || this.state.topicSelected != cont.topic) {
POP_SOUND.play();
POP_SOUND.play().catch(_ => {
// play() throws if the user did not click the app first: https://goo.gl/xX8pDD.
});
}
}
// Reorder contact list to use possibly updated 'touched'.
@@ -809,12 +811,12 @@ class TinodeWeb extends React.Component {
}
} else if (what == 'del') {
// TODO: messages deleted (hard or soft) -- update pill counter.
} else if (what == 'upd') {
// upd - handled by the SDK. Explicitly ignoring here.
} else if (what == 'upd' || what == 'call') {
// call, upd - handled elsewhere. Explicitly ignoring here.
} else {
// TODO(gene): handle other types of notifications:
// * ua -- user agent changes (maybe display a pictogram for mobile/desktop).
console.info("Unsupported (yet) presence update:" + what + " in: " + cont.topic);
console.info("Unsupported (yet) contact update:" + what + " in: " + cont.topic);
}
}
@@ -883,16 +885,7 @@ class TinodeWeb extends React.Component {
this.setState(newState);
}
// Sending "received" notifications
tnData(data) {
const topic = this.tinode.getTopic(data.topic);
if (topic.msgStatus(data, true) >= Tinode.MESSAGE_STATUS_SENT && data.from != this.state.myUserId) {
clearTimeout(this.receivedTimer);
this.receivedTimer = setTimeout(() => {
this.receivedTimer = undefined;
topic.noteRecv(data.seq);
}, RECEIVED_DELAY);
}
}
/* Fnd topic: find contacts by tokens */
+11 -21
View File
@@ -2017,7 +2017,6 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ "NO_ACCESS_MODE": () => (/* binding */ NO_ACCESS_MODE),
/* harmony export */ "QUOTED_REPLY_LENGTH": () => (/* binding */ QUOTED_REPLY_LENGTH),
/* harmony export */ "READ_DELAY": () => (/* binding */ READ_DELAY),
/* harmony export */ "RECEIVED_DELAY": () => (/* binding */ RECEIVED_DELAY),
/* harmony export */ "REM_SIZE": () => (/* binding */ REM_SIZE)
/* harmony export */ });
/* harmony import */ var _version_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./version.js */ "./src/version.js");
@@ -2031,8 +2030,7 @@ const KNOWN_HOSTS = {
const DEFAULT_HOST = KNOWN_HOSTS.hosted;
const LOGGING_ENABLED = true;
const KEYPRESS_DELAY = 3000;
const RECEIVED_DELAY = 500;
const READ_DELAY = 1000;
const READ_DELAY = 1500;
const MIN_TAG_LENGTH = 2;
const MAX_TAG_LENGTH = 96;
const MAX_TAG_COUNT = 16;
@@ -8348,7 +8346,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
if (cont.unread > 0 && this.state.messageSounds && !archived) {
if (document.hidden || this.state.topicSelected != cont.topic) {
POP_SOUND.play();
POP_SOUND.play().catch(_ => {});
}
}
@@ -8365,8 +8363,8 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
topicSelectedAcs: cont.acs
});
}
} else if (what == 'del') {} else if (what == 'upd') {} else {
console.info("Unsupported (yet) presence update:" + what + " in: " + cont.topic);
} else if (what == 'del') {} else if (what == 'upd' || what == 'call') {} else {
console.info("Unsupported (yet) contact update:" + what + " in: " + cont.topic);
}
}
@@ -8427,17 +8425,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
this.setState(newState);
}
tnData(data) {
const topic = this.tinode.getTopic(data.topic);
if (topic.msgStatus(data, true) >= tinode_sdk__WEBPACK_IMPORTED_MODULE_4__.Tinode.MESSAGE_STATUS_SENT && data.from != this.state.myUserId) {
clearTimeout(this.receivedTimer);
this.receivedTimer = setTimeout(() => {
this.receivedTimer = undefined;
topic.noteRecv(data.seq);
}, _config_js__WEBPACK_IMPORTED_MODULE_12__.RECEIVED_DELAY);
}
}
tnData(data) {}
tnInitFind() {
const fnd = this.tinode.getFndTopic();
@@ -10951,8 +10939,10 @@ class CallIncoming extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
this.resetDesc(topic, this.props);
if (this.props.callState == _constants_js__WEBPACK_IMPORTED_MODULE_4__.CALL_STATE_INCOMING_RECEIVED) {
RING_SOUND.play();
this.ringTimer = setInterval(() => RING_SOUND.play(), 2000);
RING_SOUND.play().catch(_ => {});
this.ringTimer = setInterval(_ => {
RING_SOUND.play().catch(_ => {});
}, 2000);
this.props.onRinging(this.props.topic, this.props.seq);
}
}
@@ -11281,7 +11271,7 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
break;
case 'ringing':
RING_SOUND.play();
RING_SOUND.play().catch(_ => {});
break;
default:
@@ -11483,7 +11473,7 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
RING_SOUND.pause();
RING_SOUND.currentTime = 0;
CALL_ENDED_SOUND.loop = true;
CALL_ENDED_SOUND.play();
CALL_ENDED_SOUND.play().catch(_ => {});
setTimeout(_ => {
this.handleCloseClick();
}, 2000);
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+74 -19
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long