allow automatic subscription to a new p2p topic
This commit is contained in:
@@ -122,3 +122,7 @@ export const LINK_PRIVACY_POLICY = 'https://tinode.co/privacy.html';
|
|||||||
// Link to Terms of Service.
|
// Link to Terms of Service.
|
||||||
export const LINK_TERMS_OF_SERVICE = 'https://tinode.co/terms.html';
|
export const LINK_TERMS_OF_SERVICE = 'https://tinode.co/terms.html';
|
||||||
|
|
||||||
|
// When user starts a P2P topic, automatic subscription does not
|
||||||
|
// happen until the first message. Setting this option to true enables
|
||||||
|
// immediate subscription.
|
||||||
|
export const IMMEDIATE_P2P_SUBSCRIPTION = false;
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import MetaMessage from '../widgets/meta-message.jsx';
|
|||||||
import SendMessage from '../widgets/send-message.jsx';
|
import SendMessage from '../widgets/send-message.jsx';
|
||||||
import VideoPreview from '../widgets/video-preview.jsx';
|
import VideoPreview from '../widgets/video-preview.jsx';
|
||||||
|
|
||||||
import { DEFAULT_P2P_ACCESS_MODE, EDIT_PREVIEW_LENGTH, IMAGE_PREVIEW_DIM, KEYPRESS_DELAY,
|
import { DEFAULT_P2P_ACCESS_MODE, EDIT_PREVIEW_LENGTH, IMAGE_PREVIEW_DIM, IMMEDIATE_P2P_SUBSCRIPTION,
|
||||||
MESSAGES_PAGE, MAX_EXTERN_ATTACHMENT_SIZE, MAX_IMAGE_DIM, MAX_INBAND_ATTACHMENT_SIZE,
|
KEYPRESS_DELAY, MESSAGES_PAGE, MAX_EXTERN_ATTACHMENT_SIZE, MAX_IMAGE_DIM, MAX_INBAND_ATTACHMENT_SIZE,
|
||||||
READ_DELAY, QUOTED_REPLY_LENGTH, VIDEO_PREVIEW_DIM } from '../config.js';
|
READ_DELAY, QUOTED_REPLY_LENGTH, VIDEO_PREVIEW_DIM } from '../config.js';
|
||||||
import { CALL_STATE_OUTGOING_INITATED, CALL_STATE_IN_PROGRESS } from '../constants.js';
|
import { CALL_STATE_OUTGOING_INITATED, CALL_STATE_IN_PROGRESS } from '../constants.js';
|
||||||
import { blobToBase64, fileToBase64, imageScaled, makeImageUrl } from '../lib/blob-helpers.js';
|
import { blobToBase64, fileToBase64, imageScaled, makeImageUrl } from '../lib/blob-helpers.js';
|
||||||
@@ -256,7 +256,7 @@ class MessagesView extends React.Component {
|
|||||||
if ((this.state.topic != prevState.topic) || !prevProps.ready) {
|
if ((this.state.topic != prevState.topic) || !prevProps.ready) {
|
||||||
// Don't immediately subscribe to a new p2p topic, wait for the first message.
|
// Don't immediately subscribe to a new p2p topic, wait for the first message.
|
||||||
const newTopic = (this.props.newTopicParams && this.props.newTopicParams._topicName == this.props.topic);
|
const newTopic = (this.props.newTopicParams && this.props.newTopicParams._topicName == this.props.topic);
|
||||||
if (topic.isP2PType() && newTopic) {
|
if (topic.isP2PType() && newTopic && !IMMEDIATE_P2P_SUBSCRIPTION) {
|
||||||
topic.getMeta(topic.startMetaQuery().withDesc().build());
|
topic.getMeta(topic.startMetaQuery().withDesc().build());
|
||||||
} else {
|
} else {
|
||||||
this.subscribe(topic);
|
this.subscribe(topic);
|
||||||
|
|||||||
+3
-1
@@ -2212,6 +2212,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony export */ "FORWARDED_PREVIEW_LENGTH": () => (/* binding */ FORWARDED_PREVIEW_LENGTH),
|
/* harmony export */ "FORWARDED_PREVIEW_LENGTH": () => (/* binding */ FORWARDED_PREVIEW_LENGTH),
|
||||||
/* harmony export */ "IMAGE_PREVIEW_DIM": () => (/* binding */ IMAGE_PREVIEW_DIM),
|
/* harmony export */ "IMAGE_PREVIEW_DIM": () => (/* binding */ IMAGE_PREVIEW_DIM),
|
||||||
/* harmony export */ "IMAGE_THUMBNAIL_DIM": () => (/* binding */ IMAGE_THUMBNAIL_DIM),
|
/* harmony export */ "IMAGE_THUMBNAIL_DIM": () => (/* binding */ IMAGE_THUMBNAIL_DIM),
|
||||||
|
/* harmony export */ "IMMEDIATE_P2P_SUBSCRIPTION": () => (/* binding */ IMMEDIATE_P2P_SUBSCRIPTION),
|
||||||
/* harmony export */ "KEYPRESS_DELAY": () => (/* binding */ KEYPRESS_DELAY),
|
/* harmony export */ "KEYPRESS_DELAY": () => (/* binding */ KEYPRESS_DELAY),
|
||||||
/* harmony export */ "KNOWN_HOSTS": () => (/* binding */ KNOWN_HOSTS),
|
/* harmony export */ "KNOWN_HOSTS": () => (/* binding */ KNOWN_HOSTS),
|
||||||
/* harmony export */ "LINK_CONTACT_US": () => (/* binding */ LINK_CONTACT_US),
|
/* harmony export */ "LINK_CONTACT_US": () => (/* binding */ LINK_CONTACT_US),
|
||||||
@@ -2289,6 +2290,7 @@ const MAX_DURATION = 600_000;
|
|||||||
const LINK_CONTACT_US = 'mailto:support@tinode.co';
|
const LINK_CONTACT_US = 'mailto:support@tinode.co';
|
||||||
const LINK_PRIVACY_POLICY = 'https://tinode.co/privacy.html';
|
const LINK_PRIVACY_POLICY = 'https://tinode.co/privacy.html';
|
||||||
const LINK_TERMS_OF_SERVICE = 'https://tinode.co/terms.html';
|
const LINK_TERMS_OF_SERVICE = 'https://tinode.co/terms.html';
|
||||||
|
const IMMEDIATE_P2P_SUBSCRIPTION = false;
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
@@ -5292,7 +5294,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
if (topic) {
|
if (topic) {
|
||||||
if (this.state.topic != prevState.topic || !prevProps.ready) {
|
if (this.state.topic != prevState.topic || !prevProps.ready) {
|
||||||
const newTopic = this.props.newTopicParams && this.props.newTopicParams._topicName == this.props.topic;
|
const newTopic = this.props.newTopicParams && this.props.newTopicParams._topicName == this.props.topic;
|
||||||
if (topic.isP2PType() && newTopic) {
|
if (topic.isP2PType() && newTopic && !_config_js__WEBPACK_IMPORTED_MODULE_17__.IMMEDIATE_P2P_SUBSCRIPTION) {
|
||||||
topic.getMeta(topic.startMetaQuery().withDesc().build());
|
topic.getMeta(topic.startMetaQuery().withDesc().build());
|
||||||
} else {
|
} else {
|
||||||
this.subscribe(topic);
|
this.subscribe(topic);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+836
-411
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user