Convert the loading window to TypeScript
This commit is contained in:
		
					parent
					
						
							
								310f0dc88f
							
						
					
				
			
			
				commit
				
					
						f33a0db32c
					
				
			
		
					 7 changed files with 51 additions and 37 deletions
				
			
		| 
						 | 
					@ -22,7 +22,6 @@
 | 
				
			||||||
      <div class="message"></div>
 | 
					      <div class="message"></div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <script type="text/javascript" src="js/components.js"></script>
 | 
					    <script type="text/javascript" src="js/components.js"></script>
 | 
				
			||||||
    <script type="text/javascript" src="ts/backboneJquery.js"></script>
 | 
					    <script type="text/javascript" src="ts/windows/loading/start.js"></script>
 | 
				
			||||||
    <script type="text/javascript" src="js/loading_start.js"></script>
 | 
					 | 
				
			||||||
  </body>
 | 
					  </body>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,16 +0,0 @@
 | 
				
			||||||
// Copyright 2020 Signal Messenger, LLC
 | 
					 | 
				
			||||||
// SPDX-License-Identifier: AGPL-3.0-only
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* global window */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const { ipcRenderer } = require('electron');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const url = require('url');
 | 
					 | 
				
			||||||
const i18n = require('./js/modules/i18n');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const config = url.parse(window.location.toString(), true).query;
 | 
					 | 
				
			||||||
const { locale } = config;
 | 
					 | 
				
			||||||
const localeMessages = ipcRenderer.sendSync('locale-data');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
window.i18n = i18n.setup(locale, localeMessages);
 | 
					 | 
				
			||||||
window.Backbone = require('backbone');
 | 
					 | 
				
			||||||
							
								
								
									
										3
									
								
								main.js
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								main.js
									
										
									
									
									
								
							| 
						 | 
					@ -1253,7 +1253,8 @@ app.on('ready', async () => {
 | 
				
			||||||
      webPreferences: {
 | 
					      webPreferences: {
 | 
				
			||||||
        ...defaultWebPrefs,
 | 
					        ...defaultWebPrefs,
 | 
				
			||||||
        nodeIntegration: false,
 | 
					        nodeIntegration: false,
 | 
				
			||||||
        preload: path.join(__dirname, 'loading_preload.js'),
 | 
					        contextIsolation: false,
 | 
				
			||||||
 | 
					        preload: path.join(__dirname, 'ts', 'windows', 'loading', 'preload.js'),
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      icon: windowIcon,
 | 
					      icon: windowIcon,
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -412,7 +412,6 @@
 | 
				
			||||||
      "settings_preload.js",
 | 
					      "settings_preload.js",
 | 
				
			||||||
      "permissions_popup_preload.js",
 | 
					      "permissions_popup_preload.js",
 | 
				
			||||||
      "debug_log_preload.js",
 | 
					      "debug_log_preload.js",
 | 
				
			||||||
      "loading_preload.js",
 | 
					 | 
				
			||||||
      "main.js",
 | 
					      "main.js",
 | 
				
			||||||
      "images/**",
 | 
					      "images/**",
 | 
				
			||||||
      "fonts/**",
 | 
					      "fonts/**",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -170,20 +170,6 @@
 | 
				
			||||||
    "updated": "2018-09-19T18:13:29.628Z",
 | 
					    "updated": "2018-09-19T18:13:29.628Z",
 | 
				
			||||||
    "reasonDetail": "Interacting with already-existing DOM nodes"
 | 
					    "reasonDetail": "Interacting with already-existing DOM nodes"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    "rule": "jQuery-$(",
 | 
					 | 
				
			||||||
    "path": "js/loading_start.js",
 | 
					 | 
				
			||||||
    "line": "$(() => {",
 | 
					 | 
				
			||||||
    "reasonCategory": "usageTrusted",
 | 
					 | 
				
			||||||
    "updated": "2020-03-25T15:45:04.024Z"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    "rule": "jQuery-$(",
 | 
					 | 
				
			||||||
    "path": "js/loading_start.js",
 | 
					 | 
				
			||||||
    "line": "  $('.message').text(window.i18n('optimizingApplication'));",
 | 
					 | 
				
			||||||
    "reasonCategory": "usageTrusted",
 | 
					 | 
				
			||||||
    "updated": "2020-03-25T15:45:04.024Z"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    "rule": "jQuery-load(",
 | 
					    "rule": "jQuery-load(",
 | 
				
			||||||
    "path": "js/modules/emojis.js",
 | 
					    "path": "js/modules/emojis.js",
 | 
				
			||||||
| 
						 | 
					@ -14455,5 +14441,33 @@
 | 
				
			||||||
    "line": "  const lastFocusedRef = React.useRef<HTMLElement | null>(null);",
 | 
					    "line": "  const lastFocusedRef = React.useRef<HTMLElement | null>(null);",
 | 
				
			||||||
    "reasonCategory": "usageTrusted",
 | 
					    "reasonCategory": "usageTrusted",
 | 
				
			||||||
    "updated": "2021-07-30T16:57:33.618Z"
 | 
					    "updated": "2021-07-30T16:57:33.618Z"
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    "rule": "jQuery-$(",
 | 
				
			||||||
 | 
					    "path": "ts/windows/loading/start.js",
 | 
				
			||||||
 | 
					    "line": "$(() => {",
 | 
				
			||||||
 | 
					    "reasonCategory": "usageTrusted",
 | 
				
			||||||
 | 
					    "updated": "2020-03-25T15:45:04.024Z"
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    "rule": "jQuery-$(",
 | 
				
			||||||
 | 
					    "path": "ts/windows/loading/start.js",
 | 
				
			||||||
 | 
					    "line": "    $('.message').text(window.i18n('optimizingApplication'));",
 | 
				
			||||||
 | 
					    "reasonCategory": "usageTrusted",
 | 
				
			||||||
 | 
					    "updated": "2021-07-22T03:00:34.561Z"
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    "rule": "jQuery-$(",
 | 
				
			||||||
 | 
					    "path": "ts/windows/loading/start.ts",
 | 
				
			||||||
 | 
					    "line": "  $('.message').text(window.i18n('optimizingApplication'));",
 | 
				
			||||||
 | 
					    "reasonCategory": "usageTrusted",
 | 
				
			||||||
 | 
					    "updated": "2020-03-25T15:45:04.024Z"
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    "rule": "jQuery-$(",
 | 
				
			||||||
 | 
					    "path": "ts/windows/loading/start.ts",
 | 
				
			||||||
 | 
					    "line": "$(() => {",
 | 
				
			||||||
 | 
					    "reasonCategory": "usageTrusted",
 | 
				
			||||||
 | 
					    "updated": "2021-07-22T03:00:34.561Z"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
							
								
								
									
										19
									
								
								ts/windows/loading/preload.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								ts/windows/loading/preload.ts
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,19 @@
 | 
				
			||||||
 | 
					// Copyright 2020-2021 Signal Messenger, LLC
 | 
				
			||||||
 | 
					// SPDX-License-Identifier: AGPL-3.0-only
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { ipcRenderer } from 'electron';
 | 
				
			||||||
 | 
					import * as url from 'url';
 | 
				
			||||||
 | 
					import * as i18n from '../../../js/modules/i18n';
 | 
				
			||||||
 | 
					import { strictAssert } from '../../util/assert';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const config = url.parse(window.location.toString(), true).query;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const { locale } = config;
 | 
				
			||||||
 | 
					strictAssert(
 | 
				
			||||||
 | 
					  typeof locale === 'string',
 | 
				
			||||||
 | 
					  'Expected to be configured with a string locale'
 | 
				
			||||||
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const localeMessages = ipcRenderer.sendSync('locale-data');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					window.i18n = i18n.setup(locale, localeMessages);
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,6 @@
 | 
				
			||||||
// Copyright 2020 Signal Messenger, LLC
 | 
					// Copyright 2020-2021 Signal Messenger, LLC
 | 
				
			||||||
// SPDX-License-Identifier: AGPL-3.0-only
 | 
					// SPDX-License-Identifier: AGPL-3.0-only
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* global $ */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$(() => {
 | 
					$(() => {
 | 
				
			||||||
  $('.message').text(window.i18n('optimizingApplication'));
 | 
					  $('.message').text(window.i18n('optimizingApplication'));
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue