mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
Add messages needed for UI, bit of house work
This commit is contained in:
parent
39fac5fd02
commit
5d2f7ddb20
9 changed files with 54 additions and 34 deletions
|
@ -166,6 +166,11 @@
|
|||
"description":
|
||||
"Only available on development modes, menu option to open up the standalone device setup sequence"
|
||||
},
|
||||
"connectingLoad": {
|
||||
"message": "Connecting...",
|
||||
"description":
|
||||
"Message shown on the as a loading screen while we are connecting to something"
|
||||
},
|
||||
"loading": {
|
||||
"message": "Loading...",
|
||||
"description":
|
||||
|
@ -1942,11 +1947,13 @@
|
|||
},
|
||||
"showAddServer": {
|
||||
"message": "Add public server",
|
||||
"description": "Button action that the user can click to connect to a new public server"
|
||||
"description":
|
||||
"Button action that the user can click to connect to a new public server"
|
||||
},
|
||||
"addServerDialogTitle": {
|
||||
"message": "Connect to new public server",
|
||||
"description": "Title for the dialog box used to connect to a new public server"
|
||||
"description":
|
||||
"Title for the dialog box used to connect to a new public server"
|
||||
},
|
||||
|
||||
"seedViewTitle": {
|
||||
|
@ -1999,6 +2006,15 @@
|
|||
"passwordsDoNotMatch": {
|
||||
"message": "Passwords do not match"
|
||||
},
|
||||
"publicChatExists": {
|
||||
"message": "You are already connected to this public channel"
|
||||
},
|
||||
"connectToServerFail": {
|
||||
"message": "Failed to connect to server. Check URL"
|
||||
},
|
||||
"connectToServerSuccess": {
|
||||
"message": "Successfully connected to new public chat server"
|
||||
},
|
||||
"setPasswordFail": {
|
||||
"message": "Failed to set password"
|
||||
},
|
||||
|
|
|
@ -750,7 +750,6 @@
|
|||
});
|
||||
|
||||
Whisper.events.on('showAddServerDialog', async options => {
|
||||
console.log('Adding new server: background');
|
||||
if (appView) {
|
||||
appView.showAddServerDialog(options);
|
||||
}
|
||||
|
|
|
@ -2122,6 +2122,21 @@
|
|||
};
|
||||
},
|
||||
// maybe "Backend" instead of "Source"?
|
||||
async setPublicSource(newServer, newChannelId) {
|
||||
if (!this.isPublic()) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
this.get('server') !== newServer ||
|
||||
this.get('channelId') !== newChannelId
|
||||
) {
|
||||
this.set({ server: newServer });
|
||||
this.set({ channelId: newChannelId });
|
||||
await window.Signal.Data.updateConversation(this.id, this.attributes, {
|
||||
Conversation: Whisper.Conversation,
|
||||
});
|
||||
}
|
||||
},
|
||||
getPublicSource() {
|
||||
if (!this.isPublic()) {
|
||||
return null;
|
||||
|
|
|
@ -174,14 +174,14 @@ class LokiAppDotNetServerAPI {
|
|||
|
||||
// request an token from the server
|
||||
async requestToken() {
|
||||
const url = new URL(`${this.baseServerUrl}/loki/v1/get_challenge`);
|
||||
const params = {
|
||||
pubKey: this.chatAPI.ourKey,
|
||||
};
|
||||
url.search = new URLSearchParams(params);
|
||||
|
||||
let res;
|
||||
try {
|
||||
const url = new URL(`${this.baseServerUrl}/loki/v1/get_challenge`);
|
||||
const params = {
|
||||
pubKey: this.chatAPI.ourKey,
|
||||
};
|
||||
url.search = new URLSearchParams(params);
|
||||
|
||||
res = await nodeFetch(url);
|
||||
} catch (e) {
|
||||
return null;
|
||||
|
@ -226,15 +226,12 @@ class LokiAppDotNetServerAPI {
|
|||
url.search = new URLSearchParams(params);
|
||||
}
|
||||
let result;
|
||||
let { token } = this;
|
||||
const token = await this.getOrRefreshServerToken();
|
||||
if (!token) {
|
||||
token = await this.getOrRefreshServerToken();
|
||||
if (!token) {
|
||||
log.error('NO TOKEN');
|
||||
return {
|
||||
err: 'noToken',
|
||||
};
|
||||
}
|
||||
log.error('NO TOKEN');
|
||||
return {
|
||||
err: 'noToken',
|
||||
};
|
||||
}
|
||||
try {
|
||||
const fetchOptions = {};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global Whisper, i18n, QRCode, lokiPublicChatAPI */
|
||||
/* global Whisper, i18n, _ */
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
(function() {
|
||||
|
@ -10,15 +10,14 @@
|
|||
templateName: 'add-server-template',
|
||||
className: 'loki-dialog add-server modal',
|
||||
initialize(options = {}) {
|
||||
console.log(`Add server init: ${options}`);
|
||||
this.title = i18n('addServerDialogTitle');
|
||||
this.title = i18n('addServerDialogTitle');
|
||||
this.okText = options.okText || i18n('ok');
|
||||
this.cancelText = options.cancelText || i18n('cancel');
|
||||
this.resolve = options.resolve;
|
||||
this.$('input').focus();
|
||||
this.render();
|
||||
this.$('.add-server').bind('keyup', event => this.onKeyup(event));
|
||||
},
|
||||
events: {
|
||||
keyup: 'onKeyup',
|
||||
'click .ok': 'confirm',
|
||||
'click .cancel': 'close',
|
||||
},
|
||||
|
@ -43,6 +42,7 @@
|
|||
onKeyup(event) {
|
||||
switch (event.key) {
|
||||
case 'Enter':
|
||||
this.confirm();
|
||||
break;
|
||||
case 'Escape':
|
||||
case 'Esc':
|
||||
|
@ -54,4 +54,3 @@
|
|||
},
|
||||
});
|
||||
})();
|
||||
|
||||
|
|
|
@ -200,9 +200,8 @@
|
|||
const dialog = new Whisper.QRDialogView({ string });
|
||||
this.el.append(dialog.el);
|
||||
},
|
||||
showAddServerDialog({ resolve }) {
|
||||
console.log('Adding new server: AppView');
|
||||
const dialog = new Whisper.AddServerDialogView({ resolve });
|
||||
showAddServerDialog() {
|
||||
const dialog = new Whisper.AddServerDialogView();
|
||||
this.el.append(dialog.el);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global Whisper, i18n, QRCode, lokiPublicChatAPI */
|
||||
/* global Whisper, i18n, lokiPublicChatAPI, ConversationController, friends */
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
(function() {
|
||||
|
@ -43,5 +43,3 @@
|
|||
},
|
||||
});
|
||||
})();
|
||||
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ window.isBehindProxy = () => Boolean(config.proxyUrl);
|
|||
window.JobQueue = JobQueue;
|
||||
window.getStoragePubKey = key =>
|
||||
window.isDev() ? key.substring(0, key.length - 2) : key;
|
||||
window.getDefaultFileServer = () => config.defaultFileServer;
|
||||
|
||||
window.isBeforeVersion = (toCheck, baseVersion) => {
|
||||
try {
|
||||
|
|
|
@ -338,11 +338,7 @@ export class MainHeader extends React.Component<Props, any> {
|
|||
id: 'showAddServer',
|
||||
name: i18n('showAddServer'),
|
||||
onClick: () => {
|
||||
trigger('showAddServerDialog', {
|
||||
resolve: (serverUrl) => {
|
||||
console.log(`Adding a new server: ${serverUrl}`);
|
||||
},
|
||||
});
|
||||
trigger('showAddServerDialog');
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue