{this.renderHeader()}
+ { this.state.modal ? this.state.modal : null }
{overlay ? this.renderClosableOverlay(overlay) : this.renderConversations()}
);
}
+
+
+ public setModal (modal: null | JSX.Element) {
+ this.setState({
+ modal
+ });
+ }
+
public renderConversations() {
return (
@@ -434,7 +447,7 @@ export class LeftPaneMessageSection extends React.Component
{
return;
}
this.setState({ loading: true }, async () => {
- const groupCreated = await MainViewController.createClosedGroup(groupName, groupMembers);
+ const groupCreated = await MainViewController.createClosedGroup(groupName, groupMembers, setModal);
if (groupCreated) {
this.handleToggleOverlay(undefined);
diff --git a/ts/components/session/SessionConfirm.tsx b/ts/components/session/SessionConfirm.tsx
index 04a68e7e9..03e2496ae 100644
--- a/ts/components/session/SessionConfirm.tsx
+++ b/ts/components/session/SessionConfirm.tsx
@@ -12,12 +12,12 @@ type Props = {
title: string;
onOk?: any;
onClose?: any;
- onClickOk: any;
+ onClickOk?: any;
onClickClose?: any;
okText?: string;
cancelText?: string;
hideCancel?: boolean;
- okTheme: SessionButtonColor;
+ okTheme?: SessionButtonColor;
closeTheme?: SessionButtonColor;
sessionIcon?: SessionIconType;
iconSize?: SessionIconSize;
diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx
index cc6e8e173..57f3f7561 100644
--- a/ts/components/session/settings/SessionSettings.tsx
+++ b/ts/components/session/settings/SessionSettings.tsx
@@ -12,7 +12,6 @@ import { getConversationLookup, getConversations } from '../../../state/selector
import { connect } from 'react-redux';
import { getPasswordHash } from '../../../../ts/data/data';
import { PasswordAction, SessionPasswordModal } from '../SessionPasswordModal';
-import { ModalStatusLight } from '../../OnionStatusDialog';
export enum SessionSettingCategory {
Appearance = 'appearance',
diff --git a/ts/models/conversation.ts b/ts/models/conversation.ts
index aa92d145a..c8c740efd 100644
--- a/ts/models/conversation.ts
+++ b/ts/models/conversation.ts
@@ -422,7 +422,6 @@ export class ConversationModel extends Backbone.Model {
onUnblockContact: this.unblock,
onCopyPublicKey: this.copyPublicKey,
onDeleteContact: this.deleteContact,
- onChangeNickname: this.changeNickname,
onClearNickname: this.clearNickname,
onDeleteMessages: this.deleteMessages,
onLeaveGroup: () => {
@@ -1306,17 +1305,6 @@ export class ConversationModel extends Backbone.Model {
void ConversationInteraction.copyPublicKey(this.id);
}
- public changeNickname() {
- if (this.isGroup()) {
- throw new Error(
- 'Called changeNickname() on a group. This is only supported in 1-on-1 conversation items and 1-on-1 conversation headers'
- );
- }
- window.showNicknameDialog({
- convoId: this.id,
- });
- }
-
public clearNickname = () => {
void this.setNickname('');
};
diff --git a/ts/receiver/closedGroups.ts b/ts/receiver/closedGroups.tsx
similarity index 97%
rename from ts/receiver/closedGroups.ts
rename to ts/receiver/closedGroups.tsx
index 6f9fd0039..e757ce684 100644
--- a/ts/receiver/closedGroups.ts
+++ b/ts/receiver/closedGroups.tsx
@@ -1,3 +1,4 @@
+import React from 'react';
import { SignalService } from '../protobuf';
import { removeFromCache } from './cache';
import { EnvelopePlus } from './types';
@@ -35,6 +36,7 @@ import { queueAllCachedFromSource } from './receiver';
import { actions as conversationActions } from '../state/ducks/conversations';
import { SwarmPolling } from '../session/snode_api/swarmPolling';
import { MessageModel } from '../models/message';
+import { SessionConfirm } from '../components/session/SessionConfirm';
export const distributingClosedGroupEncryptionKeyPairs = new Map();
@@ -45,8 +47,7 @@ export async function handleClosedGroupControlMessage(
const { type } = groupUpdate;
const { Type } = SignalService.DataMessage.ClosedGroupControlMessage;
window.log.info(
- ` handle closed group update from ${envelope.senderIdentity || envelope.source} about group ${
- envelope.source
+ ` handle closed group update from ${envelope.senderIdentity || envelope.source} about group ${envelope.source
}`
);
@@ -837,7 +838,7 @@ async function handleClosedGroupEncryptionKeyPairRequest(
return removeFromCache(envelope);
}
-export async function createClosedGroup(groupName: string, members: Array) {
+export async function createClosedGroup(groupName: string, members: Array, setModal: any) {
const setOfMembers = new Set(members);
const ourNumber = UserUtils.getOurPubKeyFromCache();
@@ -892,7 +893,8 @@ export async function createClosedGroup(groupName: string, members: Array,
encryptionKeyPair: ECKeyPair,
dbMessage: MessageModel,
- isRetry: boolean = false
+ setModal: any,
+ isRetry: boolean = false,
): Promise {
const promises = createInvitePromises(
listOfMembers,
@@ -948,14 +951,28 @@ async function sendToGroupMembers(
inviteResults.length > 1
? window.i18n('closedGroupInviteSuccessTitlePlural')
: window.i18n('closedGroupInviteSuccessTitle');
- window.confirmationDialog({
- title: invitesTitle,
- message: window.i18n('closedGroupInviteSuccessMessage'),
- });
+
+ // setModal()
+
+ setModal(
+ )
+ )
+
+ // window.confirmationDialog({
+ // title: invitesTitle,
+ // message: window.i18n('closedGroupInviteSuccessMessage'),
+ // });
}
return allInvitesSent;
} else {
// Confirmation dialog that recursively calls sendToGroupMembers on resolve
+
window.confirmationDialog({
title:
inviteResults.length > 1
@@ -984,6 +1001,7 @@ async function sendToGroupMembers(
admins,
encryptionKeyPair,
dbMessage,
+ setModal,
isRetrySend
);
}
diff --git a/ts/window.d.ts b/ts/window.d.ts
index 065e1536c..3309f1a17 100644
--- a/ts/window.d.ts
+++ b/ts/window.d.ts
@@ -41,7 +41,6 @@ declare global {
Whisper: any;
clearLocalData: any;
clipboard: any;
- confirmationDialog: (params: ConfirmationDialogParams) => any;
dcodeIO: any;
displayNameRegex: any;
friends: any;
@@ -68,9 +67,6 @@ declare global {
seedNodeList: any;
setPassword: any;
setSettingValue: any;
- showEditProfileDialog: any;
- showNicknameDialog: (options: { convoId: string }) => void;
- showOnionStatusDialog: any;
showResetSessionIdDialog: any;
storage: any;
textsecure: LibTextsecure;