mirror of
				https://github.com/zulip/zulip-desktop.git
				synced 2025-11-04 05:53:21 +00:00 
			
		
		
		
	Move About page into WebView.
This commit is contained in:
		@@ -9,7 +9,7 @@ const BrowserWindow = electron.BrowserWindow;
 | 
				
			|||||||
const shell = electron.shell;
 | 
					const shell = electron.shell;
 | 
				
			||||||
const appName = app.getName();
 | 
					const appName = app.getName();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const {about} = require('./windowmanager');
 | 
					// const {about} = require('./windowmanager');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function sendAction(action) {
 | 
					function sendAction(action) {
 | 
				
			||||||
	const win = BrowserWindow.getAllWindows()[0];
 | 
						const win = BrowserWindow.getAllWindows()[0];
 | 
				
			||||||
@@ -135,8 +135,10 @@ const darwinTpl = [
 | 
				
			|||||||
		submenu: [
 | 
							submenu: [
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				label: 'Zulip desktop',
 | 
									label: 'Zulip desktop',
 | 
				
			||||||
				click() {
 | 
									click(item, focusedWindow) {
 | 
				
			||||||
					about();
 | 
										if (focusedWindow) {
 | 
				
			||||||
 | 
											sendAction('open-about');
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,6 +18,7 @@ class ServerManagerView {
 | 
				
			|||||||
		this.$content = document.getElementById('content');
 | 
							this.$content = document.getElementById('content');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.settingsTabIndex = -1;
 | 
							this.settingsTabIndex = -1;
 | 
				
			||||||
 | 
							this.aboutTabIndex = -1;
 | 
				
			||||||
		this.activeTabIndex = -1;
 | 
							this.activeTabIndex = -1;
 | 
				
			||||||
		this.webviews = [];
 | 
							this.webviews = [];
 | 
				
			||||||
		this.tabs = [];
 | 
							this.tabs = [];
 | 
				
			||||||
@@ -104,35 +105,35 @@ class ServerManagerView {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	openAbout() {
 | 
						openAbout() {
 | 
				
			||||||
		if (this.settingsTabIndex !== -1) {
 | 
							if (this.aboutTabIndex !== -1) {
 | 
				
			||||||
			this.activateTab(this.settingsTabIndex);
 | 
								this.activateTab(this.aboutTabIndex);
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		const url = 'file://' + __dirname + '/about.html';
 | 
							const url = 'file://' + __dirname + '/about.html';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.settingsTabIndex = this.webviews.length;
 | 
							this.aboutTabIndex = this.webviews.length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.tabs.push(new Tab({
 | 
							this.tabs.push(new Tab({
 | 
				
			||||||
			url,
 | 
								url,
 | 
				
			||||||
			name: 'Settings',
 | 
								name: 'About',
 | 
				
			||||||
			type: Tab.SETTINGS_TAB,
 | 
								type: Tab.SETTINGS_TAB,
 | 
				
			||||||
			$root: this.$tabsContainer,
 | 
								$root: this.$tabsContainer,
 | 
				
			||||||
			onClick: this.activateTab.bind(this, this.settingsTabIndex)
 | 
								onClick: this.activateTab.bind(this, this.aboutTabIndex)
 | 
				
			||||||
		}));
 | 
							}));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.webviews.push(new WebView({
 | 
							this.webviews.push(new WebView({
 | 
				
			||||||
			$root: this.$content,
 | 
								$root: this.$content,
 | 
				
			||||||
			index: this.settingsTabIndex,
 | 
								index: this.aboutTabIndex,
 | 
				
			||||||
			url,
 | 
								url,
 | 
				
			||||||
			name: 'Settings',
 | 
								name: 'About',
 | 
				
			||||||
			isActive: () => {
 | 
								isActive: () => {
 | 
				
			||||||
				return this.settingsTabIndex === this.activeTabIndex;
 | 
									return this.activeTabIndex === this.aboutTabIndex;
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			onTitleChange: this.updateBadge.bind(this),
 | 
								onTitleChange: this.updateBadge.bind(this),
 | 
				
			||||||
			nodeIntegration: true
 | 
								nodeIntegration: true
 | 
				
			||||||
		}));
 | 
							}));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.activateTab(this.settingsTabIndex);
 | 
							this.activateTab(this.aboutTabIndex);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	activateTab(index) {
 | 
						activateTab(index) {
 | 
				
			||||||
@@ -191,6 +192,7 @@ class ServerManagerView {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ipcRenderer.on('open-settings', this.openSettings.bind(this));
 | 
							ipcRenderer.on('open-settings', this.openSettings.bind(this));
 | 
				
			||||||
 | 
							ipcRenderer.on('open-about', this.openAbout.bind(this));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -117,7 +117,7 @@ const createTray = function () {
 | 
				
			|||||||
	const contextMenu = Menu.buildFromTemplate([{
 | 
						const contextMenu = Menu.buildFromTemplate([{
 | 
				
			||||||
		label: 'About',
 | 
							label: 'About',
 | 
				
			||||||
		click() {
 | 
							click() {
 | 
				
			||||||
			ipcRenderer.send('trayabout');
 | 
								sendAction('open-about');
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@
 | 
				
			|||||||
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 | 
					    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 | 
				
			||||||
    <meta name="viewport" content="width=device-width">
 | 
					    <meta name="viewport" content="width=device-width">
 | 
				
			||||||
    <title>Zulip - Settings</title>
 | 
					    <title>Zulip - Settings</title>
 | 
				
			||||||
    <link rel="stylesheet" href="../css/preference.css" type="text/css" media="screen">
 | 
					    <link rel="stylesheet" href="css/preference.css" type="text/css" media="screen">
 | 
				
			||||||
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
 | 
					    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
 | 
				
			||||||
  </head>
 | 
					  </head>
 | 
				
			||||||
  <body>
 | 
					  <body>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user