Removes some Backbone views
This commit is contained in:
parent
93bc094342
commit
94d116c621
22 changed files with 160 additions and 656 deletions
|
@ -51,9 +51,6 @@ const {
|
|||
} = require('../../ts/components/conversation/MessageDetail');
|
||||
const { Quote } = require('../../ts/components/conversation/Quote');
|
||||
const { ProgressModal } = require('../../ts/components/ProgressModal');
|
||||
const {
|
||||
SafetyNumberChangeDialog,
|
||||
} = require('../../ts/components/SafetyNumberChangeDialog');
|
||||
const {
|
||||
StagedLinkPreview,
|
||||
} = require('../../ts/components/conversation/StagedLinkPreview');
|
||||
|
@ -79,13 +76,9 @@ const {
|
|||
createConversationHeader,
|
||||
} = require('../../ts/state/roots/createConversationHeader');
|
||||
const { createApp } = require('../../ts/state/roots/createApp');
|
||||
const { createCallManager } = require('../../ts/state/roots/createCallManager');
|
||||
const {
|
||||
createForwardMessageModal,
|
||||
} = require('../../ts/state/roots/createForwardMessageModal');
|
||||
const {
|
||||
createGlobalModalContainer,
|
||||
} = require('../../ts/state/roots/createGlobalModalContainer');
|
||||
const {
|
||||
createGroupLinkManagement,
|
||||
} = require('../../ts/state/roots/createGroupLinkManagement');
|
||||
|
@ -347,7 +340,6 @@ exports.setup = (options = {}) => {
|
|||
MessageDetail,
|
||||
Quote,
|
||||
ProgressModal,
|
||||
SafetyNumberChangeDialog,
|
||||
StagedLinkPreview,
|
||||
DisappearingTimeDialog,
|
||||
Types: {
|
||||
|
@ -357,14 +349,12 @@ exports.setup = (options = {}) => {
|
|||
|
||||
const Roots = {
|
||||
createApp,
|
||||
createCallManager,
|
||||
createChatColorPicker,
|
||||
createCompositionArea,
|
||||
createContactModal,
|
||||
createConversationDetails,
|
||||
createConversationHeader,
|
||||
createForwardMessageModal,
|
||||
createGlobalModalContainer,
|
||||
createGroupLinkManagement,
|
||||
createGroupV1MigrationModal,
|
||||
createGroupV2JoinModal,
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
// Copyright 2017-2020 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
/* global Whisper, $ */
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
(function () {
|
||||
window.Whisper = window.Whisper || {};
|
||||
|
||||
Whisper.BannerView = Whisper.View.extend({
|
||||
className: 'banner',
|
||||
template: () => $('#banner').html(),
|
||||
events: {
|
||||
'click .dismiss': 'onDismiss',
|
||||
'click .body': 'onClick',
|
||||
},
|
||||
initialize(options) {
|
||||
this.message = options.message;
|
||||
this.callbacks = {
|
||||
onDismiss: options.onDismiss,
|
||||
onClick: options.onClick,
|
||||
};
|
||||
this.render();
|
||||
},
|
||||
render_attributes() {
|
||||
return {
|
||||
message: this.message,
|
||||
};
|
||||
},
|
||||
onDismiss(e) {
|
||||
this.callbacks.onDismiss();
|
||||
e.stopPropagation();
|
||||
},
|
||||
onClick() {
|
||||
this.callbacks.onClick();
|
||||
},
|
||||
});
|
||||
})();
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright 2015-2020 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
/* global Whisper, textsecure, $ */
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
(function () {
|
||||
window.Whisper = window.Whisper || {};
|
||||
|
||||
Whisper.ContactListView = Whisper.ListView.extend({
|
||||
tagName: 'div',
|
||||
itemView: Whisper.View.extend({
|
||||
tagName: 'div',
|
||||
className: 'contact',
|
||||
template: () => $('#contact').html(),
|
||||
initialize(options) {
|
||||
this.ourNumber = textsecure.storage.user.getNumber();
|
||||
this.listenBack = options.listenBack;
|
||||
this.loading = false;
|
||||
this.conversation = options.conversation;
|
||||
|
||||
this.listenTo(this.model, 'change', this.render);
|
||||
},
|
||||
render() {
|
||||
if (this.contactView) {
|
||||
this.contactView.remove();
|
||||
this.contactView = null;
|
||||
}
|
||||
|
||||
const formattedContact = this.model.format();
|
||||
|
||||
this.contactView = new Whisper.ReactWrapperView({
|
||||
className: 'contact-wrapper',
|
||||
Component: window.Signal.Components.ContactListItem,
|
||||
props: {
|
||||
...formattedContact,
|
||||
onClick: () =>
|
||||
this.conversation.trigger(
|
||||
'show-contact-modal',
|
||||
formattedContact.id
|
||||
),
|
||||
},
|
||||
});
|
||||
this.$el.append(this.contactView.el);
|
||||
return this;
|
||||
},
|
||||
}),
|
||||
});
|
||||
})();
|
|
@ -1,42 +0,0 @@
|
|||
// Copyright 2015-2020 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
/* global Whisper, i18n, $ */
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
(function () {
|
||||
window.Whisper = window.Whisper || {};
|
||||
|
||||
Whisper.GroupMemberList = Whisper.View.extend({
|
||||
className: 'group-member-list panel',
|
||||
template: () => $('#group-member-list').html(),
|
||||
initialize(options) {
|
||||
this.needVerify = options.needVerify;
|
||||
|
||||
this.render();
|
||||
|
||||
this.member_list_view = new Whisper.ContactListView({
|
||||
collection: this.model,
|
||||
className: 'members',
|
||||
toInclude: {
|
||||
listenBack: options.listenBack,
|
||||
conversation: options.conversation,
|
||||
},
|
||||
});
|
||||
this.member_list_view.render();
|
||||
|
||||
this.$('.container').append(this.member_list_view.el);
|
||||
},
|
||||
render_attributes() {
|
||||
let summary;
|
||||
if (this.needVerify) {
|
||||
summary = i18n('membersNeedingVerification');
|
||||
}
|
||||
|
||||
return {
|
||||
members: i18n('groupMembers'),
|
||||
summary,
|
||||
};
|
||||
},
|
||||
});
|
||||
})();
|
|
@ -137,8 +137,6 @@
|
|||
this.startConnectionListener();
|
||||
} else {
|
||||
this.setupLeftPane();
|
||||
this.setupCallManagerUI();
|
||||
this.setupGlobalModalContainer();
|
||||
}
|
||||
|
||||
Whisper.events.on('pack-install-failed', () => {
|
||||
|
@ -155,28 +153,6 @@
|
|||
events: {
|
||||
click: 'onClick',
|
||||
},
|
||||
setupCallManagerUI() {
|
||||
if (this.callManagerView) {
|
||||
return;
|
||||
}
|
||||
this.callManagerView = new Whisper.ReactWrapperView({
|
||||
className: 'call-manager-wrapper',
|
||||
JSX: Signal.State.Roots.createCallManager(window.reduxStore),
|
||||
});
|
||||
this.$('.call-manager-placeholder').append(this.callManagerView.el);
|
||||
},
|
||||
setupGlobalModalContainer() {
|
||||
if (this.globalModalContainerView) {
|
||||
return;
|
||||
}
|
||||
this.globalModalContainerView = new Whisper.ReactWrapperView({
|
||||
JSX: Signal.State.Roots.createGlobalModalContainer(window.reduxStore),
|
||||
});
|
||||
const node = document.querySelector('.inbox-container');
|
||||
if (node) {
|
||||
node.appendChild(this.globalModalContainerView.el);
|
||||
}
|
||||
},
|
||||
setupLeftPane() {
|
||||
if (this.leftPaneView) {
|
||||
return;
|
||||
|
@ -217,8 +193,6 @@
|
|||
},
|
||||
onEmpty() {
|
||||
this.setupLeftPane();
|
||||
this.setupCallManagerUI();
|
||||
this.setupGlobalModalContainer();
|
||||
|
||||
const view = this.appLoadingScreen;
|
||||
if (view) {
|
||||
|
@ -241,14 +215,6 @@
|
|||
this.$('#header, .gutter').addClass('inactive');
|
||||
this.$('.conversation-stack').removeClass('inactive');
|
||||
},
|
||||
focusHeader() {
|
||||
this.$('.conversation-stack').addClass('inactive');
|
||||
this.$('#header, .gutter').removeClass('inactive');
|
||||
this.$('.conversation:first .menu').trigger('close');
|
||||
},
|
||||
reloadBackgroundPage() {
|
||||
window.location.reload();
|
||||
},
|
||||
closeRecording(e) {
|
||||
if (e && this.$(e.target).closest('.capture-audio').length > 0) {
|
||||
return;
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
// Copyright 2014-2020 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
/* global Backbone, Whisper, _ */
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
(function () {
|
||||
window.Whisper = window.Whisper || {};
|
||||
|
||||
/*
|
||||
* Generic list view that watches a given collection, wraps its members in
|
||||
* a given child view and adds the child view elements to its own element.
|
||||
*/
|
||||
Whisper.ListView = Backbone.View.extend({
|
||||
tagName: 'ul',
|
||||
itemView: Backbone.View,
|
||||
initialize(options) {
|
||||
this.options = options || {};
|
||||
this.listenTo(this.collection, 'add', this.addOne);
|
||||
this.listenTo(this.collection, 'reset', this.addAll);
|
||||
},
|
||||
|
||||
addOne(model) {
|
||||
if (this.itemView) {
|
||||
const options = _.extend({}, this.options.toInclude, { model });
|
||||
// eslint-disable-next-line new-cap
|
||||
const view = new this.itemView(options);
|
||||
this.$el.append(view.render().el);
|
||||
this.$el.trigger('add');
|
||||
}
|
||||
},
|
||||
|
||||
addAll() {
|
||||
this.$el.html('');
|
||||
this.collection.each(this.addOne, this);
|
||||
},
|
||||
|
||||
render() {
|
||||
this.addAll();
|
||||
return this;
|
||||
},
|
||||
});
|
||||
})();
|
|
@ -1,41 +0,0 @@
|
|||
// Copyright 2020 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
/* global Whisper, Signal, $ */
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
(function () {
|
||||
window.Whisper = window.Whisper || {};
|
||||
|
||||
Whisper.SafetyNumberChangeDialogView = Whisper.View.extend({
|
||||
template: () => $('#safety-number-change-dialog').html(),
|
||||
initialize(options) {
|
||||
const dialog = new Whisper.ReactWrapperView({
|
||||
Component: window.Signal.Components.SafetyNumberChangeDialog,
|
||||
props: {
|
||||
confirmText: options.confirmText,
|
||||
contacts: options.contacts.map(contact => contact.format()),
|
||||
i18n: window.i18n,
|
||||
onCancel: () => {
|
||||
dialog.remove();
|
||||
this.remove();
|
||||
options.reject();
|
||||
},
|
||||
onConfirm: () => {
|
||||
dialog.remove();
|
||||
this.remove();
|
||||
options.resolve();
|
||||
},
|
||||
renderSafetyNumber(props) {
|
||||
return Signal.State.Roots.createSafetyNumberViewer(
|
||||
window.reduxStore,
|
||||
props
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
this.$('.safety-number-change-dialog-wrapper').append(dialog.el);
|
||||
},
|
||||
});
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue