mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-08 05:57:02 +09:00
JS-3089: fixes
This commit is contained in:
parent
007f289e1b
commit
6e475c558e
6 changed files with 29 additions and 10 deletions
|
@ -94,7 +94,7 @@ function waitForLibraryAndCreateWindows () {
|
|||
// MacOs 12.2 (M1): doesn't fire on manual theme switch
|
||||
nativeTheme.on('updated', () => {
|
||||
MenuManager.updateTrayIcon();
|
||||
WindowManager.updateTheme();
|
||||
WindowManager.sendToAll('native-theme', Util.isDarkTheme());
|
||||
});
|
||||
|
||||
function createWindow () {
|
||||
|
|
|
@ -33,6 +33,14 @@ class Api {
|
|||
win.route = '';
|
||||
};
|
||||
|
||||
logout (win) {
|
||||
WindowManager.sendToAll('logout');
|
||||
};
|
||||
|
||||
pinCheck (win) {
|
||||
WindowManager.sendToAll('pin-check');
|
||||
};
|
||||
|
||||
setConfig (win, config) {
|
||||
ConfigManager.set(config, (err) => Util.send(win, 'config', ConfigManager.config));
|
||||
};
|
||||
|
|
|
@ -203,16 +203,11 @@ class WindowManager {
|
|||
};
|
||||
};
|
||||
|
||||
updateTheme () {
|
||||
this.list.forEach(it => {
|
||||
Util.send(it, 'native-theme', Util.isDarkTheme());
|
||||
});
|
||||
};
|
||||
|
||||
getWindowPosition (param, displayWidth, displayHeight) {
|
||||
const currentWindow = BrowserWindow.getFocusedWindow();
|
||||
|
||||
let x = Math.round(displayWidth / 2 - param.width / 2);
|
||||
let y = Math.round(displayHeight / 2 - param.height / 2 + 20);
|
||||
const currentWindow = BrowserWindow.getFocusedWindow();
|
||||
|
||||
if (currentWindow) {
|
||||
const [xPos, yPos] = currentWindow.getPosition();
|
||||
|
@ -232,6 +227,13 @@ class WindowManager {
|
|||
return { x, y };
|
||||
};
|
||||
|
||||
sendToAll () {
|
||||
const args = [ ...arguments ];
|
||||
this.list.forEach(it => {
|
||||
Util.send.apply(this, [ it ].concat(args));
|
||||
});
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
module.exports = new WindowManager();
|
|
@ -422,6 +422,13 @@ class App extends React.Component<object, State> {
|
|||
commonStore.nativeThemeSet(isDark);
|
||||
commonStore.themeSet(commonStore.theme);
|
||||
});
|
||||
|
||||
Renderer.on('pin-check', () => {
|
||||
keyboard.setPinChecked(false);
|
||||
UtilRouter.go('/auth/pin-check', { replace: true, animate: true });
|
||||
});
|
||||
|
||||
Renderer.on('logout', () => authStore.logout(false));
|
||||
};
|
||||
|
||||
onInit (e: any, data: any) {
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import * as React from 'react';
|
||||
import { Title, Label, Button, Phrase } from 'Component';
|
||||
import { I, C, translate, analytics, UtilCommon, Preview, UtilRouter } from 'Lib';
|
||||
import { I, C, translate, analytics, UtilCommon, UtilRouter, Renderer } from 'Lib';
|
||||
import { authStore } from 'Store';
|
||||
import { observer } from 'mobx-react';
|
||||
import Head from './head';
|
||||
|
||||
interface State {
|
||||
entropy: string;
|
||||
|
@ -85,6 +84,8 @@ const PopupSettingsPageLogout = observer(class PopupSettingsPageLogout extends R
|
|||
onFadeIn: () => {
|
||||
authStore.logout(false);
|
||||
setPinConfirmed(false);
|
||||
|
||||
Renderer.send('logout');
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
|
@ -917,6 +917,7 @@ class Keyboard {
|
|||
|
||||
this.setPinChecked(false);
|
||||
UtilRouter.go('/auth/pin-check', { replace: true, animate: true });
|
||||
Renderer.send('pin-check');
|
||||
}, pinTime);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue