Commit Graph

68 Commits

Author SHA1 Message Date
Devin Binnie
080e4bf727 [MM-59543] Disallow use of file: protocol in the app, remove all references to it, add mattermost-desktop: protocol to read local files (#3095) 2024-07-18 16:01:44 -04:00
Devin Binnie
0d4800fd61 [MM-54863] Add permissions manager UI in Edit Server modal, improve permission checks to be less missable (#3059)
* [MM-54863] Add permissions manager UI in Edit Server modal, improve permission checks to be less missable

* Removing this for E2E (which was having issues anyways)

* PR feedback

* Disable permissions dialog for current E2E tests

* Fixed the dark mode CSS

* Update icon
2024-06-19 09:19:24 -04:00
Devin Binnie
bf07674d68 [MM-58593] Ensure desktop app reloads the current URL when reloading manually (#3061) 2024-06-13 09:03:10 -04:00
Devin Binnie
e1c957e774 Various QoL fixes for Desktop App (#2999)
* Some ESLint fixes

* Add login/logout signal to API, clear mentions on logout and flush cookies on login/logout

* Fix issue where local and HTTP-only servers would not validate correctly

* Reduce noise of renderer logging, adjust a few local renderer logs to be louder when needed

* Fallback to beginning of hostname for servers that don't change the site name

* Fix Save Image crash

* Update the name for insecure servers too

* Fix test

* Fix lint

* Reduce repetition
2024-04-08 09:12:35 -04:00
Devin Binnie
da59e13477 Use .close() instead of the private .destroy() to stop leaking WebContents (#2990)
* Use `.close()` instead of the private `.destroy()` to stop leaking WebContents

* Fix tests
2024-03-22 12:26:51 -04:00
Devin Binnie
9b36c25e4e [MM-52696] Upgrade and clean up Desktop App dev dependencies (#2970)
* Upgrade to ESLint v8

* Upgrade TypeScript, api-types, react-intl

* Remove unnecessary dependencies

* Update to React 17.0.2

* npm audit fixes, remove storybook

* Lock some packages

* Remove nan patch

* Remove some deprecated dependencies

* Fix lint/type/tests

* Merge'd

* Fix bad use of spawn

* Fix notarize

* Fix afterpack, switch to tsc es2020

* Fix api types

* Use @mattermost/eslint-plugin
2024-03-07 15:55:33 -05:00
Devin Binnie
0cab09b7f5 [MM-55152] Add new Desktop API endpoints, improve preload script, some clean-up (#2900)
* Add constants for app info, add to API

* Migrate history button

* Converted calls API over to context bridge, removed some unnecessary logging

* Convert to TS, add types for web app to consume

* Fix tests, prune

* Fix lint

* More changes to support the legacy API

* Force legacy code off, add support for unreads/mentions/expired through the API

* Fix issues with cross-tab login, removed need for log in/log out signalling

* Fixed test, typos

* Change package name for types

* Add some other stuff to the types

* PR feedback

* More feedback

* Use npm package

* Change types and API to provide off listeners

* Version number

* Lock

* Fix typo

* Add sessionID for calls
2023-12-13 09:39:46 -05:00
Devin Binnie
762324b596 [MM-55317] Force deep linking to use formatted path names when rewriting the URL (#2907)
* [MM-55317] Force deep linking to use formatted path names when rewriting the URL

* PR feedback
2023-11-10 10:48:26 -05:00
Devin Binnie
9c3febd4c9 [MM-53847] Expose isDev API to allow webapp to check if the app is in dev mode (#2800)
* [MM-53847] Expose isDev API to allow webapp to check if the app is in dev mode

* Fix test
2023-08-29 10:07:33 -04:00
Florian Apolloner
f581f439df Upgrade to Electron v26.1.0 (#2808)
* Upgrade to Electron v26.1.0

* Fix TS issues

---------

Co-authored-by: Devin Binnie <devin.binnie@mattermost.com>
2023-08-29 09:19:29 -04:00
Devin Binnie
21e3044ff2 [MM-52333] Create Server View State module, move into new app module (#2739)
* Create Server View State Module

* Move currentServerId to serverViewState

* Move view state into server view state module

* PR feedback/bug fixes
2023-06-12 08:35:14 -04:00
Devin Binnie
a7c25ee95e [MM-53056] Force a pathname when checking for deep links (#2748) 2023-06-07 11:16:04 -04:00
Devin Binnie
316beba950 [MM-14093] Rename 'team' to 'server' and 'tab' to 'view' in most cases, some additional cleanup (#2711)
* Rename MattermostTeam -> UniqueServer, MattermostTab -> UniqueView

* Rename 'team' to 'server'

* Some further cleanup

* Rename weirdly named function

* Rename 'tab' to 'view' in most instances

* Fix i18n

* PR feedback
2023-05-08 09:17:01 -04:00
Devin Binnie
c20088f6fa [MM-52625] Rework tray icon code into a class, make the behaviour of the tray icon consistent with the OS it's running on (#2708)
* Rework tray into a class, make click behaviour consistent

* Fix issue where app wouldn't switch to workspace where the app was visible

* Fixed an issue where the app would show the window with hideOnStart enabled

* Add comment about StatusIconLinuxDbus

* Fix tests
2023-05-04 09:21:50 -04:00
Devin Binnie
e227c6bf1d [MM-52587] Clean up URL utils, use isInternalURL when possible (#2702) 2023-05-03 08:48:41 -04:00
Devin Binnie
f4f4511cc7 Remove WindowManager, separate functionality into smaller modules (#2682)
* Move sendToRenderer to respective singletons

* Move to using ViewManager call for getting view by webContentsId

* Move show and create logic to main window, handle deep linking seperately

* Move resizing logic and event handing to mainWindow

* Move server switching logic to main/app

* Move tab switching logic to main/app, rely on showById for most usage

* Migrate remaining functions, remove windowManager objects, set up imports for self-contained singletons

* Fix E2E tests

* Update src/main/app/servers.ts

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>

---------

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2023-04-19 11:04:26 -04:00
Devin Binnie
b71322a682 Migrate teamDropdownView to singleton (#2677) 2023-04-14 12:14:11 -04:00
Devin Binnie
1428ba694b Clean up appState module, move to common, simplify events (#2676)
* Refactor appState into class, simplify events

* Move appState to common module, make case for object consistent

* Naming change

* Update name
2023-04-14 12:09:33 -04:00
Devin Binnie
686b4ac9f1 [MM-50485] Migrate app to ServerManager, remove view names and replace with IDs (#2672)
* Migrate app to ServerManager, remove view names and replace with IDs

* Fixed a test

* Fixed a bug when adding the initial server

* Merge'd

* Bug fixes and PR feedback
2023-04-12 12:52:34 -04:00
Devin Binnie
88eb2e2c70 [MM-51964] Clean up MattermostView, remove tuple in preparation for id (#2668)
undefined
2023-04-06 11:17:33 -04:00
Devin Binnie
53fb8c8fd3 [MM-50485] Implement ServerManager, introduce id concept for identifying servers/views (#2654)
* Implement ServerManager, introduce id concept for identifying servers/views

* REVERT ME (eventually): Move back to old logging

* PR feedback

* PR feedback

* Revert "REVERT ME (eventually): Move back to old logging"

This reverts commit 46954a5bbed4dd29e89ca9d5217bb75af2837bb3.

* Merge'd

* Use the correct method for Logger in ServerManager
2023-04-05 16:30:50 -04:00
Devin Binnie
862287edff Migrate viewManager to singleton (#2656) 2023-04-05 13:01:09 -04:00
Devin Binnie
245215c678 [MM-51873] Create central logging module for adding prefixes to differentiate logs between modules (#2652)
* Create central logging module for adding prefixes to differentiate logs between modules

* Turn logger into class

* Merge'd

* Rework to use class more intelligently

* Fix modalView

* Fix webContentEvents

* Update src/main/app/intercom.ts

Co-authored-by: Daniel Espino García <larkox@gmail.com>

* Shorten prefixes on object creation

---------

Co-authored-by: Daniel Espino García <larkox@gmail.com>
2023-04-05 12:09:56 -04:00
Devin Binnie
39150137b6 [MM-51874] Migrate loading screen to singleton (#2655)
* Migrate loadingScreen to singleton

* REVERT ME when MainWindow singleton changes are merged

* Revert "REVERT ME when MainWindow singleton changes are merged"

This reverts commit 2de5520117b9aefb8eeb161d493de7cb275f7a5b.
2023-04-04 11:49:40 -04:00
Devin Binnie
22ec280945 [MM-51871] Migrate mainWindow and settingsWindow to singletons (#2650)
* Migrate mainWindow to singleton

* Migrate settingsWindow to singleton

* PR feedback

* Missed a couple unwrapping cases
2023-04-04 10:01:40 -04:00
Claudio Costa
a52e96694d [MM-50973] Harden Calls windows URL navigation checks (#2573)
* Harden Calls windows URL navigation checks

* Update src/main/windows/callsWidgetWindow.ts

Co-authored-by: Eva Sarafianou <eva.sarafianou@gmail.com>

* Fix bad merge

* Extract team name to use isUrlType

* Simplify

---------

Co-authored-by: Eva Sarafianou <eva.sarafianou@gmail.com>
2023-03-02 13:10:47 -05:00
Devin Binnie
5cc2e98a1d Merge and migrate locally-trusted preload scripts to contextBridge API (#2553)
* Migrate intl_provider to contextBridge

* Migrate modalPreload to contextBridge

* Migrate loadingScreenPreload to contextBridge

* Migrate downloadDropdown preloads to contextBridge

* Migrate server dropdown preload to contextBridge

* Migrate urlView preload to contextBridge

* Merge all desktop API scripts into one

* Remove unused communication channel constants
2023-02-15 13:42:53 -05:00
Devin Binnie
07e41ec678 Remove use of getView() and replace with getViewByURL() where necessary. (#2544)
* WIP

* Replace getView with getViewByURL
2023-02-07 08:59:35 -05:00
Devin Binnie
09ecc7430f [MM-49690] Set currentView to undefined instead of using delete (#2522) 2023-01-27 14:32:48 -05:00
Tasos Boulis
5bafaff297 Check if view is destroyed before sending ipc message (#2505) 2023-01-18 19:24:42 +02:00
Devin Binnie
db76a67fb5 Reduce the number of writes to the config (#2498)
* Add some logging, refactor setting config items

* Move active team to setMultiple, reduce serverInfos calls if the data is already the same

* Fix some logging

* Lint fix
2023-01-12 08:46:06 -05:00
Devin Binnie
dc49003d38 [MM-47779] Prevent crash when either URL view or main window was destroyed first (#2300) 2022-10-21 09:19:33 -04:00
Devin Binnie
4c968dc747 Add webContents listeners to modals (#2247)
* Add webContents listeners to modals

* Fix tests
2022-09-01 09:41:06 -04:00
Julian Mondragón
faf2dae74b MM-25003_Improve Onboarding screens for the desktop app - Intro Screen (#2220) 2022-08-16 12:33:03 -05:00
Devin Binnie
829b49571f [MM-43941] Optimize app resizing on Windows/Linux by waiting for the viewport to resize (#2204)
* [MM-43941] Optimize app resizing on Windows/Linux by waiting for the viewport to resize

* Some mitigations for Windows

* Make the logs sillier

* Fixed the no servers case

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-07-26 10:25:13 -04:00
Devin Binnie
59e4e7e516 [MM-14058] Add support for i18n (#2190)
* Add language files

* Add react-intl, mmjstool, setup for adding translations

* Translated main module

* Translations for renderer

* A few minor fixes

* More fixes

* Add CI, add missing menu translations, other cleanup

* Added setting to manually select the language of the app

* Force English for E2e

* Unit tests

* Fix mmjstool

* Move set language to before update menu

* PR feedback
2022-07-14 11:04:18 -04:00
Devin Binnie
c6cc870e19 [MM-44932] Fixed issue where deleting a server doesn't switch to another server (or show the new server modal) (#2174) 2022-06-28 08:00:25 -04:00
Devin Binnie
37fe523e8c Fix issue with changing servers and tabs (#2126) 2022-05-26 14:17:44 -04:00
vas
4efac368d5 only refresh view when the server URL changes (MM-34565) (#2082) (#2094)
* only refresh view when the server URL changes (MM-34565)

Create views of current and incoming tabs indexed
by unique [URL, TABTYPE] tuples, and diffing them.
Tuples that are identical are recycled, merely
porting the new server name over.

* lint fixes

* WIP

* linting

* remove dependency on by, duad

* provide a more exaplanatory name for TabView.prototype.tuple (urlTypeTuple)

* minor improvements in viewManager

- remove stateful behaviour from makeView
- more descriptive variable names when looping
- create new arrays before sorting (sort is in-place by default)

* resolve linting errors
2022-05-20 11:06:43 -04:00
Devin Binnie
ebf5897f99 [MM-44022] Switch to using current BrowserView for determining window bounds for URL view (#2087) 2022-05-09 10:26:54 -04:00
Devin Binnie
a26e3caf23 [MM-43185] Fix size of BrowserView for URLView (#2050) 2022-04-18 11:29:23 -04:00
Devin Binnie
626fea84a5 [MM-41999] Add additional logging for debugging, allow users to change log level (#2031)
* Add debug logging switch

* Add tests

* Mock electron-log globally in jest

* New logs for debugging

* Switch to a dropdown to choose log levels

* Fix tests

* Update wording
2022-03-31 16:46:57 -04:00
Devin Binnie
3eb904cd67 [MM-41891] Improve error and reload states (#2019) 2022-03-18 10:16:12 -04:00
Devin Binnie
14197d1707 [MM-42086] Upgrade to Electron v17 (#2013)
* [MM-42086] Upgrade to Electron v17

* Added viewName

* merge'd

* Update package-lock

* Try it again
2022-03-14 10:09:36 -04:00
Devin Binnie
0ab6a1f80f [MM-42072] Fix issues with loading screen animations (#2010)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-07 09:24:26 -05:00
Devin Binnie
94cc15168c [MM-41559] Dynamically size URL view to avoid overlapping bottom links (#1991) 2022-02-04 11:05:06 -05:00
Devin Binnie
39fbdf45c5 [MM-40406] Add more singletons, refactor main.ts into pieces, add tests and some cleanup + tests for additional coverage (#1890)
* Refactor main.ts dependencies into singleton pattern

* Split main.ts into testable pieces, some other refactoring for singleton pattern

* Unit tests for main/app/app

* Unit tests for main/app/config

* Unit tests for main/app/initialize

* Unit tests for main/app/intercom

* Unit tests for main/app/utils

* Add some more tests to get to 70% coverage

* Fix for linux

* Fix for alternate data dir paths

* Fix E2E test
2021-12-09 15:11:55 -05:00
Devin Binnie
72f7cb4f08 [MM-40329] Unit tests for main/views (#1883)
* WIP

* [MM-40329] Unit tests for main/views

* Lint/type fix

* Merge'd
2021-12-06 10:13:26 -05:00
Devin Binnie
73056d2649 Code cleanup, update eslint from webapp, add ts-prune (#1884) 2021-12-03 16:01:49 -05:00
Devin Binnie
c53e897bfd [MM-38875] Migrate E2E testing to Playwright, re-enable tests (#1800)
* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* [MM-38875] Migrate E2E testing to Playwright, re-enable tests

* Add functionality to map view names to Playwright windows

* Added search box test

* Added robot.js for automating key presses

* Add test using key strokes to navigate menu

* Reload test and added webcontentsid to test helper

* Check Ctrl+Shift+R as well

* oops

* Reorganize

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-10-28 13:17:10 -04:00