Merge remote-tracking branch 'mattermost/master' into auto-updater
This commit is contained in:
commit
ccdfbae3b2
|
@ -17,10 +17,11 @@
|
||||||
"no-console": 0,
|
"no-console": 0,
|
||||||
"no-process-env": 0,
|
"no-process-env": 0,
|
||||||
"no-underscore-dangle": 1,
|
"no-underscore-dangle": 1,
|
||||||
|
"no-var": 2,
|
||||||
"react/jsx-indent": [2, 2],
|
"react/jsx-indent": [2, 2],
|
||||||
"react/jsx-indent-props": [2, 2],
|
"react/jsx-indent-props": [2, 2],
|
||||||
|
"react/no-find-dom-node": 2,
|
||||||
"react/no-set-state": 1,
|
"react/no-set-state": 1,
|
||||||
"react/prefer-es6-class": 1,
|
|
||||||
"react/require-optimization": 0
|
"react/require-optimization": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -17,10 +17,18 @@ Release date: TBD
|
||||||
[#843](https://github.com/mattermost/desktop/pull/843)
|
[#843](https://github.com/mattermost/desktop/pull/843)
|
||||||
- Added `Ctrl/Cmd+F` shortcut to work as browser-like search.
|
- Added `Ctrl/Cmd+F` shortcut to work as browser-like search.
|
||||||
[#399](https://github.com/mattermost/desktop/issues/399)
|
[#399](https://github.com/mattermost/desktop/issues/399)
|
||||||
|
- Preserved case of first letter in spellcheck.
|
||||||
|
[#869](https://github.com/mattermost/desktop/pull/869)
|
||||||
|
|
||||||
|
#### Windows
|
||||||
|
- Set "app start on login" preference to default on and synchronize its state with config.json.
|
||||||
|
[#846](https://github.com/mattermost/desktop/pull/846)
|
||||||
|
|
||||||
#### Mac
|
#### Mac
|
||||||
- Add **.dmg** package to support installation.
|
- Add **.dmg** package to support installation.
|
||||||
[#588](https://github.com/mattermost/desktop/pull/588)
|
[#588](https://github.com/mattermost/desktop/pull/588)
|
||||||
|
- Support "Hide" option of Login Items in Preferences.
|
||||||
|
[#853](https://github.com/mattermost/desktop/pull/853)
|
||||||
|
|
||||||
#### Linux
|
#### Linux
|
||||||
- [tar.gz] Use SVG icon for Linux application menus in place of PNG icon
|
- [tar.gz] Use SVG icon for Linux application menus in place of PNG icon
|
||||||
|
@ -28,10 +36,13 @@ Release date: TBD
|
||||||
- Updated categories in order to be listed under the appropriate submenu of the application starter.
|
- Updated categories in order to be listed under the appropriate submenu of the application starter.
|
||||||
[#816](https://github.com/mattermost/desktop/pull/816)
|
[#816](https://github.com/mattermost/desktop/pull/816)
|
||||||
[#818](https://github.com/mattermost/desktop/pull/818)
|
[#818](https://github.com/mattermost/desktop/pull/818)
|
||||||
|
- Set "app start on login" preference to default on and synchronize its state with config.json.
|
||||||
|
[#846](https://github.com/mattermost/desktop/pull/846)
|
||||||
|
|
||||||
### Architectural Changes
|
### Architectural Changes
|
||||||
- Major version upgrade of Electron to v2.0.2. Electron is the underlying technology used to build the Desktop apps.
|
- Major version upgrade of Electron to v2.0.8. Electron is the underlying technology used to build the Desktop apps.
|
||||||
[#820](https://github.com/mattermost/desktop/pull/820)
|
[#820](https://github.com/mattermost/desktop/pull/820)
|
||||||
|
[#847](https://github.com/mattermost/desktop/pull/847)
|
||||||
- Artifact names are configured via `electron-builder.json`.
|
- Artifact names are configured via `electron-builder.json`.
|
||||||
[#825](https://github.com/mattermost/desktop/pull/825)
|
[#825](https://github.com/mattermost/desktop/pull/825)
|
||||||
|
|
||||||
|
|
484
NOTICE.txt
484
NOTICE.txt
|
@ -10,12 +10,14 @@ This document includes a list of open source components used in Mattermost Deskt
|
||||||
|
|
||||||
## auto-launch
|
## auto-launch
|
||||||
|
|
||||||
This product contains a modified portion of 'auto-launch', which allows one to launch any application or executable at startup, by Teamwork.com.
|
This product contains 'auto-launch' by Donal Linehan.
|
||||||
|
|
||||||
|
Launch node applications or executables at login (Mac, Windows, and Linux)
|
||||||
|
|
||||||
* HOMEPAGE:
|
* HOMEPAGE:
|
||||||
* https://github.com/Teamwork/node-auto-launch
|
* https://github.com/4ver/node-auto-launch
|
||||||
|
|
||||||
* LICENSE:
|
* LICENSE: MIT
|
||||||
|
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
|
@ -43,18 +45,18 @@ SOFTWARE.
|
||||||
|
|
||||||
## bootstrap
|
## bootstrap
|
||||||
|
|
||||||
This product contains a modified portion of 'bootstrap', which is an HTML, CSS, and JavaScript framework for developing responsive, mobile first
|
This product contains 'bootstrap' by The Bootstrap Authors.
|
||||||
projects on the web, by Twitter, Inc. and Bootstrap Authors.
|
|
||||||
|
The most popular front-end framework for developing responsive, mobile first projects on the web.
|
||||||
|
|
||||||
* HOMEPAGE:
|
* HOMEPAGE:
|
||||||
* https://github.com/twbs/bootstrap
|
* https://getbootstrap.com/
|
||||||
|
|
||||||
* LICENSE:
|
* LICENSE: MIT
|
||||||
|
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2011-2017 Twitter, Inc.
|
Copyright (c) 2011-2016 Twitter, Inc.
|
||||||
Copyright (c) 2011-2017 The Bootstrap Authors
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -78,150 +80,297 @@ THE SOFTWARE.
|
||||||
|
|
||||||
## electron-context-menu
|
## electron-context-menu
|
||||||
|
|
||||||
This product contains a modified portion of 'electron-context-menu', which provides a context menu for Electron apps, by Sindre Sorhus.
|
This product contains 'electron-context-menu' by Sindre Sorhus.
|
||||||
|
|
||||||
|
Context menu for your Electron app
|
||||||
|
|
||||||
* HOMEPAGE:
|
* HOMEPAGE:
|
||||||
* https://github.com/sindresorhus/electron-context-menu
|
* https://github.com/sindresorhus/electron-context-menu#readme
|
||||||
|
|
||||||
* LICENSE:
|
* LICENSE: MIT
|
||||||
|
|
||||||
The MIT License (MIT)
|
MIT License
|
||||||
|
|
||||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## electron-devtools-installer
|
## electron-devtools-installer
|
||||||
|
|
||||||
This product contains a modified portion of 'electron-devtools-installer', which allows an easy way to ensure Chrome DevTools extensions into Electron,
|
This product contains 'electron-devtools-installer' by Samuel Attard.
|
||||||
by Samuel Attard.
|
|
||||||
|
An easy way to install Dev Tools extensions into Electron applications
|
||||||
|
|
||||||
* HOMEPAGE:
|
* HOMEPAGE:
|
||||||
* https://github.com/MarshallOfSound/electron-devtools-installer
|
* https://github.com/GPMDP/electron-devtools-installer#readme
|
||||||
|
|
||||||
* LICENSE:
|
* LICENSE: MIT
|
||||||
|
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
Copyright (c) 2016 Samuel Attard
|
Copyright (c) 2016 Samuel Attard
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
|
|
||||||
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
|
||||||
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## electron-is-dev
|
## electron-is-dev
|
||||||
|
|
||||||
This product contains a modified portion of 'electron-is-dev', which checks if Electron is running in development, by Sindre Sorhus.
|
This product contains 'electron-is-dev' by Sindre Sorhus.
|
||||||
|
|
||||||
|
Check if Electron is running in development
|
||||||
|
|
||||||
* HOMEPAGE:
|
* HOMEPAGE:
|
||||||
* https://github.com/sindresorhus/electron-is-dev
|
* https://github.com/sindresorhus/electron-is-dev#readme
|
||||||
|
|
||||||
* LICENSE:
|
* LICENSE: MIT
|
||||||
|
|
||||||
The MIT License (MIT)
|
MIT License
|
||||||
|
|
||||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
## electron-squirrel-startup
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
This product contains 'electron-squirrel-startup' by Lucas Hrabovsky.
|
||||||
|
|
||||||
|
Default Squirrel.Windows event handler for your Electron apps.
|
||||||
|
|
||||||
|
* HOMEPAGE:
|
||||||
|
* http://github.com/mongodb-js/electron-squirrel-startup
|
||||||
|
|
||||||
|
* LICENSE: Apache-2.0
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright {yyyy} {name of copyright owner}
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## prop-types
|
## prop-types
|
||||||
|
|
||||||
This product contains a modified portion of 'prop-types', runtime type checking for React props and similar objects, by Facebook, Inc.
|
This product contains 'prop-types' by Facebook.
|
||||||
|
|
||||||
|
Runtime type checking for React props and similar objects.
|
||||||
|
|
||||||
* HOMEPAGE:
|
* HOMEPAGE:
|
||||||
* https://github.com/facebook/prop-types
|
* https://facebook.github.io/react/
|
||||||
|
|
||||||
* LICENSE:
|
* LICENSE: MIT
|
||||||
|
|
||||||
BSD License
|
|
||||||
|
|
||||||
For React software
|
|
||||||
|
|
||||||
Copyright (c) 2013-present, Facebook, Inc.
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
* Neither the name Facebook nor the names of its contributors may be used to
|
|
||||||
endorse or promote products derived from this software without specific
|
|
||||||
prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
||||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## react
|
|
||||||
|
|
||||||
This product contains a modified portion of 'react', a declarative, efficient, and flexible JavaScript library for building user interfaces,
|
|
||||||
'create-react-class', a drop-in replacement for React.createClass, and 'react-dom', the entry point of the DOM-related
|
|
||||||
rendering paths, by Facebook, Inc.
|
|
||||||
|
|
||||||
* HOMEPAGE:
|
|
||||||
* https://github.com/facebook/react
|
|
||||||
|
|
||||||
* LICENSE:
|
|
||||||
|
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
|
@ -247,15 +396,51 @@ SOFTWARE.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## react-bootstrap
|
## react
|
||||||
|
|
||||||
This product contains a modified portion of 'react-bootstrap', Bootstrap 3 components for front-end framework built with React, by Stephen J. Collings,
|
This product contains 'react' by Facebook.
|
||||||
Matthew Honnibal, Pieter Vanderwerff and react-bootstrap.
|
|
||||||
|
React is a JavaScript library for building user interfaces.
|
||||||
|
|
||||||
* HOMEPAGE:
|
* HOMEPAGE:
|
||||||
* https://github.com/react-bootstrap/react-bootstrap
|
* https://reactjs.org/
|
||||||
|
|
||||||
* LICENSE:
|
* LICENSE: MIT
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## react-bootstrap
|
||||||
|
|
||||||
|
This product contains 'react-bootstrap' by Stephen J. Collings.
|
||||||
|
|
||||||
|
Bootstrap 3 components built with React
|
||||||
|
|
||||||
|
* HOMEPAGE:
|
||||||
|
* https://react-bootstrap.github.io/
|
||||||
|
|
||||||
|
* LICENSE: MIT
|
||||||
|
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
@ -281,14 +466,51 @@ THE SOFTWARE.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## react-transition-group
|
## react-dom
|
||||||
|
|
||||||
This product contains a modified portion of 'react-transition-group', a fork, and "drop in" replacement for the original React TransitionGroup addons, by React Community.
|
This product contains 'react-dom' by Facebook.
|
||||||
|
|
||||||
|
React package for working with the DOM.
|
||||||
|
|
||||||
* HOMEPAGE:
|
* HOMEPAGE:
|
||||||
* https://github.com/reactjs/react-transition-group
|
* https://reactjs.org/
|
||||||
|
|
||||||
* LICENSE:
|
* LICENSE: MIT
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## react-transition-group
|
||||||
|
|
||||||
|
This product contains 'react-transition-group' by React Community.
|
||||||
|
|
||||||
|
A react component toolset for managing animations
|
||||||
|
|
||||||
|
* HOMEPAGE:
|
||||||
|
* https://github.com/reactjs/react-transition-group#readme
|
||||||
|
|
||||||
|
* LICENSE: BSD-3-Clause
|
||||||
|
|
||||||
BSD 3-Clause License
|
BSD 3-Clause License
|
||||||
|
|
||||||
|
@ -325,16 +547,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
## simple-spellchecker
|
## simple-spellchecker
|
||||||
|
|
||||||
This product contains a modified portion of 'simple-spellchecker', a simple and fast spellchecker with spelling suggestions and Electron's integration, by jfmdev.
|
This product contains 'simple-spellchecker' by JFMDev.
|
||||||
|
|
||||||
Access to the source code of Simple Spellchecker ©jfmdev can be found at https://github.com/jfmdev/simple-spellchecker.
|
A simple spellchecker compatible with Electron
|
||||||
|
|
||||||
* HOMEPAGE:
|
* HOMEPAGE:
|
||||||
* https://github.com/jfmdev/simple-spellchecker
|
* https://github.com/jfmdev/simple-spellchecker#readme
|
||||||
|
|
||||||
* LICENSE:
|
* LICENSE: MPL-2.0
|
||||||
|
|
||||||
Mozilla Public License Version 2.0
|
Mozilla Public License Version 2.0
|
||||||
==================================
|
==================================
|
||||||
|
|
||||||
1. Definitions
|
1. Definitions
|
||||||
|
@ -712,16 +934,16 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||||
|
|
||||||
## underscore
|
## underscore
|
||||||
|
|
||||||
This product contains a modified portion of 'underscore', a utility-belt library for JavaScript that provides support for usual functional suspects
|
This product contains 'underscore' by Jeremy Ashkenas.
|
||||||
without extending any core JavaScript objects, by Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors.
|
|
||||||
|
JavaScript's functional programming helper library.
|
||||||
|
|
||||||
* HOMEPAGE:
|
* HOMEPAGE:
|
||||||
* https://github.com/jashkenas/underscore
|
* http://underscorejs.org
|
||||||
|
|
||||||
* LICENSE:
|
* LICENSE: MIT
|
||||||
|
|
||||||
The MIT License (MIT)
|
Copyright (c) 2009-2018 Jeremy Ashkenas, DocumentCloud and Investigative
|
||||||
Copyright (c) 2009-2017 Jeremy Ashkenas, DocumentCloud and Investigative
|
|
||||||
Reporters & Editors
|
Reporters & Editors
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
@ -749,12 +971,14 @@ OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
## yargs
|
## yargs
|
||||||
|
|
||||||
This product contains a modified portion of 'yargs', a modern successor to optimist, by James Halliday and Yargs.
|
This product contains 'yargs' by GitHub user "yargs".
|
||||||
|
|
||||||
|
yargs the modern, pirate-themed, successor to optimist.
|
||||||
|
|
||||||
* HOMEPAGE:
|
* HOMEPAGE:
|
||||||
* https://github.com/yargs/yargs
|
* http://yargs.js.org/
|
||||||
|
|
||||||
* LICENSE:
|
* LICENSE: MIT
|
||||||
|
|
||||||
Copyright 2010 James Halliday (mail@substack.net)
|
Copyright 2010 James Halliday (mail@substack.net)
|
||||||
Modified work Copyright 2014 Contributors (ben@npmjs.com)
|
Modified work Copyright 2014 Contributors (ben@npmjs.com)
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
"cross-env": "^5.1.6",
|
"cross-env": "^5.1.6",
|
||||||
"css-loader": "^0.28.11",
|
"css-loader": "^0.28.11",
|
||||||
"devtron": "^1.4.0",
|
"devtron": "^1.4.0",
|
||||||
"electron": "2.0.2",
|
"electron": "2.0.8",
|
||||||
"electron-builder": "20.14.7",
|
"electron-builder": "20.14.7",
|
||||||
"electron-builder-squirrel-windows": "~20.14.0",
|
"electron-builder-squirrel-windows": "~20.14.0",
|
||||||
"electron-connect": "^0.6.3",
|
"electron-connect": "^0.6.3",
|
||||||
|
|
|
@ -3,26 +3,27 @@
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import {findDOMNode} from 'react-dom';
|
|
||||||
import {Button, Col, ControlLabel, Form, FormGroup, FormControl, Modal} from 'react-bootstrap';
|
import {Button, Col, ControlLabel, Form, FormGroup, FormControl, Modal} from 'react-bootstrap';
|
||||||
|
|
||||||
export default class LoginModal extends React.Component {
|
export default class LoginModal extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.handleSubmit = this.handleSubmit.bind(this);
|
this.handleSubmit = this.handleSubmit.bind(this);
|
||||||
|
this.usernameRef = React.createRef();
|
||||||
|
this.passwordRef = React.createRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSubmit(event) {
|
handleSubmit(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const usernameNode = findDOMNode(this.refs.username);
|
const usernameNode = this.usernameRef.current;
|
||||||
const passwordNode = findDOMNode(this.refs.password);
|
const passwordNode = this.passwordRef.current;
|
||||||
this.props.onLogin(this.props.request, usernameNode.value, passwordNode.value);
|
this.props.onLogin(this.props.request, usernameNode.value, passwordNode.value);
|
||||||
usernameNode.value = '';
|
usernameNode.value = '';
|
||||||
passwordNode.value = '';
|
passwordNode.value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
var theServer = '';
|
let theServer = '';
|
||||||
if (!this.props.show) {
|
if (!this.props.show) {
|
||||||
theServer = '';
|
theServer = '';
|
||||||
} else if (this.props.authInfo.isProxy) {
|
} else if (this.props.authInfo.isProxy) {
|
||||||
|
@ -53,7 +54,7 @@ export default class LoginModal extends React.Component {
|
||||||
<FormControl
|
<FormControl
|
||||||
type='text'
|
type='text'
|
||||||
placeholder='User Name'
|
placeholder='User Name'
|
||||||
ref='username'
|
ref={this.usernameRef}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}}
|
}}
|
||||||
|
@ -69,7 +70,7 @@ export default class LoginModal extends React.Component {
|
||||||
<FormControl
|
<FormControl
|
||||||
type='password'
|
type='password'
|
||||||
placeholder='Password'
|
placeholder='Password'
|
||||||
ref='password'
|
ref={this.passwordRef}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
// Copyright (c) 2015-2016 Yuya Ochiai
|
// Copyright (c) 2015-2016 Yuya Ochiai
|
||||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
/* eslint-disable react/no-set-state */
|
||||||
|
|
||||||
import url from 'url';
|
import url from 'url';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import createReactClass from 'create-react-class';
|
|
||||||
import {CSSTransition, TransitionGroup} from 'react-transition-group';
|
import {CSSTransition, TransitionGroup} from 'react-transition-group';
|
||||||
import {Grid, Row} from 'react-bootstrap';
|
import {Grid, Row} from 'react-bootstrap';
|
||||||
|
|
||||||
|
@ -21,24 +23,13 @@ import PermissionRequestDialog from './PermissionRequestDialog.jsx';
|
||||||
import Finder from './Finder.jsx';
|
import Finder from './Finder.jsx';
|
||||||
import NewTeamModal from './NewTeamModal.jsx';
|
import NewTeamModal from './NewTeamModal.jsx';
|
||||||
|
|
||||||
const MainPage = createReactClass({
|
export default class MainPage extends React.Component {
|
||||||
propTypes: {
|
constructor(props) {
|
||||||
onUnreadCountChange: PropTypes.func.isRequired,
|
super(props);
|
||||||
teams: PropTypes.array.isRequired,
|
|
||||||
onTeamConfigChange: PropTypes.func.isRequired,
|
|
||||||
initialIndex: PropTypes.number.isRequired,
|
|
||||||
useSpellChecker: PropTypes.bool.isRequired,
|
|
||||||
onSelectSpellCheckerLocale: PropTypes.func.isRequired,
|
|
||||||
deeplinkingUrl: PropTypes.string,
|
|
||||||
showAddServerButton: PropTypes.bool.isRequired,
|
|
||||||
requestingPermission: TabBar.propTypes.requestingPermission,
|
|
||||||
onClickPermissionDialog: PropTypes.func,
|
|
||||||
},
|
|
||||||
|
|
||||||
getInitialState() {
|
|
||||||
let key = this.props.initialIndex;
|
let key = this.props.initialIndex;
|
||||||
if (this.props.deeplinkingUrl !== null) {
|
if (this.props.deeplinkingUrl !== null) {
|
||||||
for (var i = 0; i < this.props.teams.length; i++) {
|
for (let i = 0; i < this.props.teams.length; i++) {
|
||||||
if (this.props.deeplinkingUrl.includes(this.props.teams[i].url)) {
|
if (this.props.deeplinkingUrl.includes(this.props.teams[i].url)) {
|
||||||
key = i;
|
key = i;
|
||||||
break;
|
break;
|
||||||
|
@ -46,8 +37,9 @@ const MainPage = createReactClass({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
this.state = {
|
||||||
key,
|
key,
|
||||||
|
sessionsExpired: new Array(this.props.teams.length),
|
||||||
unreadCounts: new Array(this.props.teams.length),
|
unreadCounts: new Array(this.props.teams.length),
|
||||||
mentionCounts: new Array(this.props.teams.length),
|
mentionCounts: new Array(this.props.teams.length),
|
||||||
unreadAtActive: new Array(this.props.teams.length),
|
unreadAtActive: new Array(this.props.teams.length),
|
||||||
|
@ -55,9 +47,22 @@ const MainPage = createReactClass({
|
||||||
loginQueue: [],
|
loginQueue: [],
|
||||||
targetURL: '',
|
targetURL: '',
|
||||||
};
|
};
|
||||||
},
|
|
||||||
|
this.activateFinder = this.activateFinder.bind(this);
|
||||||
|
this.addServer = this.addServer.bind(this);
|
||||||
|
this.closeFinder = this.closeFinder.bind(this);
|
||||||
|
this.focusOnWebView = this.focusOnWebView.bind(this);
|
||||||
|
this.handleLogin = this.handleLogin.bind(this);
|
||||||
|
this.handleLoginCancel = this.handleLoginCancel.bind(this);
|
||||||
|
this.handleOnTeamFocused = this.handleOnTeamFocused.bind(this);
|
||||||
|
this.handleSelect = this.handleSelect.bind(this);
|
||||||
|
this.handleTargetURLChange = this.handleTargetURLChange.bind(this);
|
||||||
|
this.inputBlur = this.inputBlur.bind(this);
|
||||||
|
this.markReadAtActive = this.markReadAtActive.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
var self = this;
|
const self = this;
|
||||||
ipcRenderer.on('login-request', (event, request, authInfo) => {
|
ipcRenderer.on('login-request', (event, request, authInfo) => {
|
||||||
self.setState({
|
self.setState({
|
||||||
loginRequired: true,
|
loginRequired: true,
|
||||||
|
@ -96,7 +101,7 @@ const MainPage = createReactClass({
|
||||||
self.refs[`mattermostView${self.state.key}`].focusOnWebView();
|
self.refs[`mattermostView${self.state.key}`].focusOnWebView();
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentWindow = remote.getCurrentWindow();
|
const currentWindow = remote.getCurrentWindow();
|
||||||
currentWindow.on('focus', focusListener);
|
currentWindow.on('focus', focusListener);
|
||||||
window.addEventListener('beforeunload', () => {
|
window.addEventListener('beforeunload', () => {
|
||||||
currentWindow.removeListener('focus', focusListener);
|
currentWindow.removeListener('focus', focusListener);
|
||||||
|
@ -132,7 +137,7 @@ const MainPage = createReactClass({
|
||||||
|
|
||||||
ipcRenderer.on('protocol-deeplink', (event, deepLinkUrl) => {
|
ipcRenderer.on('protocol-deeplink', (event, deepLinkUrl) => {
|
||||||
const lastUrlDomain = Utils.getDomain(deepLinkUrl);
|
const lastUrlDomain = Utils.getDomain(deepLinkUrl);
|
||||||
for (var i = 0; i < this.props.teams.length; i++) {
|
for (let i = 0; i < this.props.teams.length; i++) {
|
||||||
if (lastUrlDomain === Utils.getDomain(self.refs[`mattermostView${i}`].getSrc())) {
|
if (lastUrlDomain === Utils.getDomain(self.refs[`mattermostView${i}`].getSrc())) {
|
||||||
if (this.state.key !== i) {
|
if (this.state.key !== i) {
|
||||||
this.handleSelect(i);
|
this.handleSelect(i);
|
||||||
|
@ -146,30 +151,34 @@ const MainPage = createReactClass({
|
||||||
ipcRenderer.on('toggle-find', () => {
|
ipcRenderer.on('toggle-find', () => {
|
||||||
this.activateFinder(true);
|
this.activateFinder(true);
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps, prevState) {
|
componentDidUpdate(prevProps, prevState) {
|
||||||
if (prevState.key !== this.state.key) { // i.e. When tab has been changed
|
if (prevState.key !== this.state.key) { // i.e. When tab has been changed
|
||||||
this.refs[`mattermostView${this.state.key}`].focusOnWebView();
|
this.refs[`mattermostView${this.state.key}`].focusOnWebView();
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
handleSelect(key) {
|
handleSelect(key) {
|
||||||
const newKey = (this.props.teams.length + key) % this.props.teams.length;
|
const newKey = (this.props.teams.length + key) % this.props.teams.length;
|
||||||
this.setState({
|
this.setState({
|
||||||
key: newKey,
|
key: newKey,
|
||||||
finderVisible: false,
|
finderVisible: false,
|
||||||
});
|
});
|
||||||
var webview = document.getElementById('mattermostView' + newKey);
|
const webview = document.getElementById('mattermostView' + newKey);
|
||||||
ipcRenderer.send('update-title', {
|
ipcRenderer.send('update-title', {
|
||||||
title: webview.getTitle(),
|
title: webview.getTitle(),
|
||||||
});
|
});
|
||||||
this.handleOnTeamFocused(newKey);
|
this.handleOnTeamFocused(newKey);
|
||||||
},
|
}
|
||||||
|
|
||||||
handleUnreadCountChange(index, unreadCount, mentionCount, isUnread, isMentioned) {
|
handleBadgeChange = (index, sessionExpired, unreadCount, mentionCount, isUnread, isMentioned) => {
|
||||||
var unreadCounts = this.state.unreadCounts;
|
const sessionsExpired = this.state.sessionsExpired;
|
||||||
var mentionCounts = this.state.mentionCounts;
|
const unreadCounts = this.state.unreadCounts;
|
||||||
var unreadAtActive = this.state.unreadAtActive;
|
const mentionCounts = this.state.mentionCounts;
|
||||||
var mentionAtActiveCounts = this.state.mentionAtActiveCounts;
|
const unreadAtActive = this.state.unreadAtActive;
|
||||||
|
const mentionAtActiveCounts = this.state.mentionAtActiveCounts;
|
||||||
|
sessionsExpired[index] = sessionExpired;
|
||||||
unreadCounts[index] = unreadCount;
|
unreadCounts[index] = unreadCount;
|
||||||
mentionCounts[index] = mentionCount;
|
mentionCounts[index] = mentionCount;
|
||||||
|
|
||||||
|
@ -181,27 +190,32 @@ const MainPage = createReactClass({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
|
sessionsExpired,
|
||||||
unreadCounts,
|
unreadCounts,
|
||||||
mentionCounts,
|
mentionCounts,
|
||||||
unreadAtActive,
|
unreadAtActive,
|
||||||
mentionAtActiveCounts,
|
mentionAtActiveCounts,
|
||||||
});
|
});
|
||||||
this.handleUnreadCountTotalChange();
|
this.handleBadgesChange();
|
||||||
},
|
}
|
||||||
|
|
||||||
markReadAtActive(index) {
|
markReadAtActive(index) {
|
||||||
var unreadAtActive = this.state.unreadAtActive;
|
const unreadAtActive = this.state.unreadAtActive;
|
||||||
var mentionAtActiveCounts = this.state.mentionAtActiveCounts;
|
const mentionAtActiveCounts = this.state.mentionAtActiveCounts;
|
||||||
unreadAtActive[index] = false;
|
unreadAtActive[index] = false;
|
||||||
mentionAtActiveCounts[index] = 0;
|
mentionAtActiveCounts[index] = 0;
|
||||||
this.setState({
|
this.setState({
|
||||||
unreadAtActive,
|
unreadAtActive,
|
||||||
mentionAtActiveCounts,
|
mentionAtActiveCounts,
|
||||||
});
|
});
|
||||||
this.handleUnreadCountTotalChange();
|
this.handleBadgesChange();
|
||||||
},
|
}
|
||||||
handleUnreadCountTotalChange() {
|
|
||||||
if (this.props.onUnreadCountChange) {
|
handleBadgesChange = () => {
|
||||||
var allUnreadCount = this.state.unreadCounts.reduce((prev, curr) => {
|
if (this.props.onBadgeChange) {
|
||||||
|
const someSessionsExpired = this.state.sessionsExpired.some((sessionExpired) => sessionExpired);
|
||||||
|
|
||||||
|
let allUnreadCount = this.state.unreadCounts.reduce((prev, curr) => {
|
||||||
return prev + curr;
|
return prev + curr;
|
||||||
}, 0);
|
}, 0);
|
||||||
this.state.unreadAtActive.forEach((state) => {
|
this.state.unreadAtActive.forEach((state) => {
|
||||||
|
@ -209,31 +223,36 @@ const MainPage = createReactClass({
|
||||||
allUnreadCount += 1;
|
allUnreadCount += 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var allMentionCount = this.state.mentionCounts.reduce((prev, curr) => {
|
|
||||||
|
let allMentionCount = this.state.mentionCounts.reduce((prev, curr) => {
|
||||||
return prev + curr;
|
return prev + curr;
|
||||||
}, 0);
|
}, 0);
|
||||||
this.state.mentionAtActiveCounts.forEach((count) => {
|
this.state.mentionAtActiveCounts.forEach((count) => {
|
||||||
allMentionCount += count;
|
allMentionCount += count;
|
||||||
});
|
});
|
||||||
this.props.onUnreadCountChange(allUnreadCount, allMentionCount);
|
|
||||||
|
this.props.onBadgeChange(someSessionsExpired, allUnreadCount, allMentionCount);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
handleOnTeamFocused(index) {
|
handleOnTeamFocused(index) {
|
||||||
// Turn off the flag to indicate whether unread message of active channel contains at current tab.
|
// Turn off the flag to indicate whether unread message of active channel contains at current tab.
|
||||||
this.markReadAtActive(index);
|
this.markReadAtActive(index);
|
||||||
},
|
}
|
||||||
|
|
||||||
handleLogin(request, username, password) {
|
handleLogin(request, username, password) {
|
||||||
ipcRenderer.send('login-credentials', request, username, password);
|
ipcRenderer.send('login-credentials', request, username, password);
|
||||||
const loginQueue = this.state.loginQueue;
|
const loginQueue = this.state.loginQueue;
|
||||||
loginQueue.shift();
|
loginQueue.shift();
|
||||||
this.setState({loginQueue});
|
this.setState({loginQueue});
|
||||||
},
|
}
|
||||||
|
|
||||||
handleLoginCancel() {
|
handleLoginCancel() {
|
||||||
const loginQueue = this.state.loginQueue;
|
const loginQueue = this.state.loginQueue;
|
||||||
loginQueue.shift();
|
loginQueue.shift();
|
||||||
this.setState({loginQueue});
|
this.setState({loginQueue});
|
||||||
},
|
}
|
||||||
|
|
||||||
handleTargetURLChange(targetURL) {
|
handleTargetURLChange(targetURL) {
|
||||||
clearTimeout(this.targetURLDisappearTimeout);
|
clearTimeout(this.targetURLDisappearTimeout);
|
||||||
if (targetURL === '') {
|
if (targetURL === '') {
|
||||||
|
@ -244,47 +263,49 @@ const MainPage = createReactClass({
|
||||||
} else {
|
} else {
|
||||||
this.setState({targetURL});
|
this.setState({targetURL});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
addServer() {
|
addServer() {
|
||||||
this.setState({
|
this.setState({
|
||||||
showNewTeamModal: true,
|
showNewTeamModal: true,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
focusOnWebView(e) {
|
focusOnWebView(e) {
|
||||||
if (e.target.className !== 'finder-input') {
|
if (e.target.className !== 'finder-input') {
|
||||||
this.refs[`mattermostView${this.state.key}`].focusOnWebView();
|
this.refs[`mattermostView${this.state.key}`].focusOnWebView();
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
activateFinder() {
|
activateFinder() {
|
||||||
this.setState({
|
this.setState({
|
||||||
finderVisible: true,
|
finderVisible: true,
|
||||||
focusFinder: true,
|
focusFinder: true,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
closeFinder() {
|
closeFinder() {
|
||||||
this.setState({
|
this.setState({
|
||||||
finderVisible: false,
|
finderVisible: false,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
inputBlur() {
|
inputBlur() {
|
||||||
this.setState({
|
this.setState({
|
||||||
focusFinder: false,
|
focusFinder: false,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
var self = this;
|
const self = this;
|
||||||
var tabsRow;
|
let tabsRow;
|
||||||
if (this.props.teams.length > 1) {
|
if (this.props.teams.length > 1) {
|
||||||
tabsRow = (
|
tabsRow = (
|
||||||
<Row>
|
<Row>
|
||||||
<TabBar
|
<TabBar
|
||||||
id='tabBar'
|
id='tabBar'
|
||||||
teams={this.props.teams}
|
teams={this.props.teams}
|
||||||
|
sessionsExpired={this.state.sessionsExpired}
|
||||||
unreadCounts={this.state.unreadCounts}
|
unreadCounts={this.state.unreadCounts}
|
||||||
mentionCounts={this.state.mentionCounts}
|
mentionCounts={this.state.mentionCounts}
|
||||||
unreadAtActive={this.state.unreadAtActive}
|
unreadAtActive={this.state.unreadAtActive}
|
||||||
|
@ -300,15 +321,15 @@ const MainPage = createReactClass({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
var views = this.props.teams.map((team, index) => {
|
const views = this.props.teams.map((team, index) => {
|
||||||
function handleUnreadCountChange(unreadCount, mentionCount, isUnread, isMentioned) {
|
function handleBadgeChange(sessionExpired, unreadCount, mentionCount, isUnread, isMentioned) {
|
||||||
self.handleUnreadCountChange(index, unreadCount, mentionCount, isUnread, isMentioned);
|
self.handleBadgeChange(index, sessionExpired, unreadCount, mentionCount, isUnread, isMentioned);
|
||||||
}
|
}
|
||||||
function handleNotificationClick() {
|
function handleNotificationClick() {
|
||||||
self.handleSelect(index);
|
self.handleSelect(index);
|
||||||
}
|
}
|
||||||
var id = 'mattermostView' + index;
|
const id = 'mattermostView' + index;
|
||||||
var isActive = self.state.key === index;
|
const isActive = self.state.key === index;
|
||||||
|
|
||||||
let teamUrl = team.url;
|
let teamUrl = team.url;
|
||||||
const deeplinkingUrl = this.props.deeplinkingUrl;
|
const deeplinkingUrl = this.props.deeplinkingUrl;
|
||||||
|
@ -326,27 +347,27 @@ const MainPage = createReactClass({
|
||||||
src={teamUrl}
|
src={teamUrl}
|
||||||
name={team.name}
|
name={team.name}
|
||||||
onTargetURLChange={self.handleTargetURLChange}
|
onTargetURLChange={self.handleTargetURLChange}
|
||||||
onUnreadCountChange={handleUnreadCountChange}
|
onBadgeChange={handleBadgeChange}
|
||||||
onNotificationClick={handleNotificationClick}
|
onNotificationClick={handleNotificationClick}
|
||||||
ref={id}
|
ref={id}
|
||||||
active={isActive}
|
active={isActive}
|
||||||
/>);
|
/>);
|
||||||
});
|
});
|
||||||
var viewsRow = (
|
const viewsRow = (
|
||||||
<Row>
|
<Row>
|
||||||
{views}
|
{views}
|
||||||
</Row>);
|
</Row>);
|
||||||
|
|
||||||
var request = null;
|
let request = null;
|
||||||
var authServerURL = null;
|
let authServerURL = null;
|
||||||
var authInfo = null;
|
let authInfo = null;
|
||||||
if (this.state.loginQueue.length !== 0) {
|
if (this.state.loginQueue.length !== 0) {
|
||||||
request = this.state.loginQueue[0].request;
|
request = this.state.loginQueue[0].request;
|
||||||
const tmpURL = url.parse(this.state.loginQueue[0].request.url);
|
const tmpURL = url.parse(this.state.loginQueue[0].request.url);
|
||||||
authServerURL = `${tmpURL.protocol}//${tmpURL.host}`;
|
authServerURL = `${tmpURL.protocol}//${tmpURL.host}`;
|
||||||
authInfo = this.state.loginQueue[0].authInfo;
|
authInfo = this.state.loginQueue[0].authInfo;
|
||||||
}
|
}
|
||||||
var modal = (
|
const modal = (
|
||||||
<NewTeamModal
|
<NewTeamModal
|
||||||
show={this.state.showNewTeamModal}
|
show={this.state.showNewTeamModal}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
|
@ -419,7 +440,18 @@ const MainPage = createReactClass({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
export default MainPage;
|
MainPage.propTypes = {
|
||||||
|
onBadgeChange: PropTypes.func.isRequired,
|
||||||
|
teams: PropTypes.array.isRequired,
|
||||||
|
onTeamConfigChange: PropTypes.func.isRequired,
|
||||||
|
initialIndex: PropTypes.number.isRequired,
|
||||||
|
useSpellChecker: PropTypes.bool.isRequired,
|
||||||
|
onSelectSpellCheckerLocale: PropTypes.func.isRequired,
|
||||||
|
deeplinkingUrl: PropTypes.string,
|
||||||
|
showAddServerButton: PropTypes.bool.isRequired,
|
||||||
|
requestingPermission: TabBar.propTypes.requestingPermission,
|
||||||
|
onClickPermissionDialog: PropTypes.func,
|
||||||
|
};
|
||||||
|
|
|
@ -9,8 +9,6 @@ import url from 'url';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import createReactClass from 'create-react-class';
|
|
||||||
import {findDOMNode} from 'react-dom';
|
|
||||||
import {ipcRenderer, remote, shell} from 'electron';
|
import {ipcRenderer, remote, shell} from 'electron';
|
||||||
|
|
||||||
import contextMenu from '../js/contextMenu';
|
import contextMenu from '../js/contextMenu';
|
||||||
|
@ -43,37 +41,40 @@ function isNetworkDrive(fileURL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MattermostView = createReactClass({
|
export default class MattermostView extends React.Component {
|
||||||
propTypes: {
|
constructor(props) {
|
||||||
name: PropTypes.string,
|
super(props);
|
||||||
id: PropTypes.string,
|
|
||||||
onTargetURLChange: PropTypes.func,
|
|
||||||
onUnreadCountChange: PropTypes.func,
|
|
||||||
src: PropTypes.string,
|
|
||||||
active: PropTypes.bool,
|
|
||||||
withTab: PropTypes.bool,
|
|
||||||
useSpellChecker: PropTypes.bool,
|
|
||||||
onSelectSpellCheckerLocale: PropTypes.func,
|
|
||||||
},
|
|
||||||
|
|
||||||
getInitialState() {
|
this.state = {
|
||||||
return {
|
|
||||||
errorInfo: null,
|
errorInfo: null,
|
||||||
isContextMenuAdded: false,
|
isContextMenuAdded: false,
|
||||||
reloadTimeoutID: null,
|
reloadTimeoutID: null,
|
||||||
isLoaded: false,
|
isLoaded: false,
|
||||||
};
|
};
|
||||||
},
|
|
||||||
|
|
||||||
handleUnreadCountChange(unreadCount, mentionCount, isUnread, isMentioned) {
|
this.handleUnreadCountChange = this.handleUnreadCountChange.bind(this);
|
||||||
if (this.props.onUnreadCountChange) {
|
this.reload = this.reload.bind(this);
|
||||||
this.props.onUnreadCountChange(unreadCount, mentionCount, isUnread, isMentioned);
|
this.clearCacheAndReload = this.clearCacheAndReload.bind(this);
|
||||||
|
this.focusOnWebView = this.focusOnWebView.bind(this);
|
||||||
|
this.canGoBack = this.canGoBack.bind(this);
|
||||||
|
this.canGoForward = this.canGoForward.bind(this);
|
||||||
|
this.goBack = this.goBack.bind(this);
|
||||||
|
this.goForward = this.goForward.bind(this);
|
||||||
|
this.getSrc = this.getSrc.bind(this);
|
||||||
|
this.handleDeepLink = this.handleDeepLink.bind(this);
|
||||||
|
|
||||||
|
this.webviewRef = React.createRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
handleUnreadCountChange(sessionExpired, unreadCount, mentionCount, isUnread, isMentioned) {
|
||||||
|
if (this.props.onBadgeChange) {
|
||||||
|
this.props.onBadgeChange(sessionExpired, unreadCount, mentionCount, isUnread, isMentioned);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
var self = this;
|
const self = this;
|
||||||
var webview = findDOMNode(this.refs.webview);
|
const webview = this.webviewRef.current;
|
||||||
|
|
||||||
webview.addEventListener('did-fail-load', (e) => {
|
webview.addEventListener('did-fail-load', (e) => {
|
||||||
console.log(self.props.name, 'webview did-fail-load', e);
|
console.log(self.props.name, 'webview did-fail-load', e);
|
||||||
|
@ -105,8 +106,8 @@ const MattermostView = createReactClass({
|
||||||
|
|
||||||
// Open link in browserWindow. for exmaple, attached files.
|
// Open link in browserWindow. for exmaple, attached files.
|
||||||
webview.addEventListener('new-window', (e) => {
|
webview.addEventListener('new-window', (e) => {
|
||||||
var currentURL = url.parse(webview.getURL());
|
const currentURL = url.parse(webview.getURL());
|
||||||
var destURL = url.parse(e.url);
|
const destURL = url.parse(e.url);
|
||||||
if (destURL.protocol !== 'http:' && destURL.protocol !== 'https:' && destURL.protocol !== `${scheme}:`) {
|
if (destURL.protocol !== 'http:' && destURL.protocol !== 'https:' && destURL.protocol !== `${scheme}:`) {
|
||||||
ipcRenderer.send('confirm-protocol', destURL.protocol, e.url);
|
ipcRenderer.send('confirm-protocol', destURL.protocol, e.url);
|
||||||
return;
|
return;
|
||||||
|
@ -157,15 +158,16 @@ const MattermostView = createReactClass({
|
||||||
isLoaded: true,
|
isLoaded: true,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'onUnreadCountChange':
|
case 'onBadgeChange': {
|
||||||
var unreadCount = event.args[0];
|
const sessionExpired = event.args[0];
|
||||||
var mentionCount = event.args[1];
|
const unreadCount = event.args[1];
|
||||||
|
const mentionCount = event.args[2];
|
||||||
|
const isUnread = event.args[3];
|
||||||
|
const isMentioned = event.args[4];
|
||||||
|
self.handleUnreadCountChange(sessionExpired, unreadCount, mentionCount, isUnread, isMentioned);
|
||||||
|
|
||||||
// isUnread and isMentioned is pulse flag.
|
|
||||||
var isUnread = event.args[2];
|
|
||||||
var isMentioned = event.args[3];
|
|
||||||
self.handleUnreadCountChange(unreadCount, mentionCount, isUnread, isMentioned);
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 'onNotificationClick':
|
case 'onNotificationClick':
|
||||||
self.props.onNotificationClick();
|
self.props.onNotificationClick();
|
||||||
break;
|
break;
|
||||||
|
@ -207,7 +209,7 @@ const MattermostView = createReactClass({
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
reload() {
|
reload() {
|
||||||
clearTimeout(this.state.reloadTimeoutID);
|
clearTimeout(this.state.reloadTimeoutID);
|
||||||
|
@ -216,63 +218,63 @@ const MattermostView = createReactClass({
|
||||||
reloadTimeoutID: null,
|
reloadTimeoutID: null,
|
||||||
isLoaded: false,
|
isLoaded: false,
|
||||||
});
|
});
|
||||||
var webview = findDOMNode(this.refs.webview);
|
const webview = this.webviewRef.current;
|
||||||
webview.reload();
|
webview.reload();
|
||||||
},
|
}
|
||||||
|
|
||||||
clearCacheAndReload() {
|
clearCacheAndReload() {
|
||||||
this.setState({
|
this.setState({
|
||||||
errorInfo: null,
|
errorInfo: null,
|
||||||
});
|
});
|
||||||
var webContents = findDOMNode(this.refs.webview).getWebContents();
|
const webContents = this.webviewRef.current.getWebContents();
|
||||||
webContents.session.clearCache(() => {
|
webContents.session.clearCache(() => {
|
||||||
webContents.reload();
|
webContents.reload();
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
focusOnWebView() {
|
focusOnWebView() {
|
||||||
const webview = findDOMNode(this.refs.webview);
|
const webview = this.webviewRef.current;
|
||||||
const webContents = webview.getWebContents(); // webContents might not be created yet.
|
const webContents = webview.getWebContents(); // webContents might not be created yet.
|
||||||
if (webContents && !webContents.isFocused()) {
|
if (webContents && !webContents.isFocused()) {
|
||||||
webview.focus();
|
webview.focus();
|
||||||
webContents.focus();
|
webContents.focus();
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
canGoBack() {
|
canGoBack() {
|
||||||
const webview = findDOMNode(this.refs.webview);
|
const webview = this.webviewRef.current;
|
||||||
return webview.getWebContents().canGoBack();
|
return webview.getWebContents().canGoBack();
|
||||||
},
|
}
|
||||||
|
|
||||||
canGoForward() {
|
canGoForward() {
|
||||||
const webview = findDOMNode(this.refs.webview);
|
const webview = this.webviewRef.current;
|
||||||
return webview.getWebContents().canGoForward();
|
return webview.getWebContents().canGoForward();
|
||||||
},
|
}
|
||||||
|
|
||||||
goBack() {
|
goBack() {
|
||||||
const webview = findDOMNode(this.refs.webview);
|
const webview = this.webviewRef.current;
|
||||||
webview.getWebContents().goBack();
|
webview.getWebContents().goBack();
|
||||||
},
|
}
|
||||||
|
|
||||||
goForward() {
|
goForward() {
|
||||||
const webview = findDOMNode(this.refs.webview);
|
const webview = this.webviewRef.current;
|
||||||
webview.getWebContents().goForward();
|
webview.getWebContents().goForward();
|
||||||
},
|
}
|
||||||
|
|
||||||
getSrc() {
|
getSrc() {
|
||||||
const webview = findDOMNode(this.refs.webview);
|
const webview = this.webviewRef.current;
|
||||||
return webview.src;
|
return webview.src;
|
||||||
},
|
}
|
||||||
|
|
||||||
handleDeepLink(relativeUrl) {
|
handleDeepLink(relativeUrl) {
|
||||||
const webview = findDOMNode(this.refs.webview);
|
const webview = this.webviewRef.current;
|
||||||
webview.executeJavaScript(
|
webview.executeJavaScript(
|
||||||
'history.pushState(null, null, "' + relativeUrl + '");'
|
'history.pushState(null, null, "' + relativeUrl + '");'
|
||||||
);
|
);
|
||||||
webview.executeJavaScript(
|
webview.executeJavaScript(
|
||||||
'dispatchEvent(new PopStateEvent("popstate", null));'
|
'dispatchEvent(new PopStateEvent("popstate", null));'
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const errorView = this.state.errorInfo ? (
|
const errorView = this.state.errorInfo ? (
|
||||||
|
@ -312,11 +314,21 @@ const MattermostView = createReactClass({
|
||||||
id={this.props.id}
|
id={this.props.id}
|
||||||
preload={preloadJS}
|
preload={preloadJS}
|
||||||
src={this.props.src}
|
src={this.props.src}
|
||||||
ref='webview'
|
ref={this.webviewRef}
|
||||||
/>
|
/>
|
||||||
{ loadingImage }
|
{ loadingImage }
|
||||||
</div>);
|
</div>);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
export default MattermostView;
|
MattermostView.propTypes = {
|
||||||
|
name: PropTypes.string,
|
||||||
|
id: PropTypes.string,
|
||||||
|
onTargetURLChange: PropTypes.func,
|
||||||
|
onBadgeChange: PropTypes.func,
|
||||||
|
src: PropTypes.string,
|
||||||
|
active: PropTypes.bool,
|
||||||
|
withTab: PropTypes.bool,
|
||||||
|
useSpellChecker: PropTypes.bool,
|
||||||
|
onSelectSpellCheckerLocale: PropTypes.func,
|
||||||
|
};
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
// Copyright (c) 2015-2016 Yuya Ochiai
|
// Copyright (c) 2015-2016 Yuya Ochiai
|
||||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
/* eslint-disable react/no-set-state */
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import createReactClass from 'create-react-class';
|
|
||||||
import ReactDOM from 'react-dom';
|
|
||||||
import {Button, Checkbox, Col, FormGroup, Grid, HelpBlock, Navbar, Radio, Row} from 'react-bootstrap';
|
import {Button, Checkbox, Col, FormGroup, Grid, HelpBlock, Navbar, Radio, Row} from 'react-bootstrap';
|
||||||
|
|
||||||
import {ipcRenderer, remote} from 'electron';
|
import {ipcRenderer, remote} from 'electron';
|
||||||
import AutoLaunch from 'auto-launch';
|
|
||||||
import {debounce} from 'underscore';
|
import {debounce} from 'underscore';
|
||||||
|
|
||||||
import buildConfig from '../../common/config/buildConfig';
|
import buildConfig from '../../common/config/buildConfig';
|
||||||
|
@ -17,11 +17,6 @@ import settings from '../../common/settings';
|
||||||
import TeamList from './TeamList.jsx';
|
import TeamList from './TeamList.jsx';
|
||||||
import AutoSaveIndicator from './AutoSaveIndicator.jsx';
|
import AutoSaveIndicator from './AutoSaveIndicator.jsx';
|
||||||
|
|
||||||
const appLauncher = new AutoLaunch({
|
|
||||||
name: remote.app.getName(),
|
|
||||||
isHidden: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
function backToIndex(index) {
|
function backToIndex(index) {
|
||||||
const target = typeof index === 'undefined' ? 0 : index;
|
const target = typeof index === 'undefined' ? 0 : index;
|
||||||
const indexURL = remote.getGlobal('isDev') ? 'http://localhost:8080/browser/index.html' : `file://${remote.app.getAppPath()}/browser/index.html`;
|
const indexURL = remote.getGlobal('isDev') ? 'http://localhost:8080/browser/index.html' : `file://${remote.app.getAppPath()}/browser/index.html`;
|
||||||
|
@ -31,20 +26,16 @@ function backToIndex(index) {
|
||||||
const CONFIG_TYPE_SERVERS = 'servers';
|
const CONFIG_TYPE_SERVERS = 'servers';
|
||||||
const CONFIG_TYPE_APP_OPTIONS = 'appOptions';
|
const CONFIG_TYPE_APP_OPTIONS = 'appOptions';
|
||||||
|
|
||||||
const SettingsPage = createReactClass({
|
export default class SettingsPage extends React.Component {
|
||||||
propTypes: {
|
constructor(props) {
|
||||||
configFile: PropTypes.string,
|
super(props);
|
||||||
enableServerManagement: PropTypes.bool,
|
|
||||||
},
|
|
||||||
|
|
||||||
getInitialState() {
|
let initialState;
|
||||||
var initialState;
|
|
||||||
try {
|
try {
|
||||||
initialState = settings.readFileSync(this.props.configFile);
|
initialState = settings.readFileSync(this.props.configFile);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
initialState = settings.loadDefault();
|
initialState = settings.loadDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
initialState.showAddTeamForm = false;
|
initialState.showAddTeamForm = false;
|
||||||
initialState.trayWasVisible = remote.getCurrentWindow().trayWasVisible;
|
initialState.trayWasVisible = remote.getCurrentWindow().trayWasVisible;
|
||||||
if (initialState.teams.length === 0) {
|
if (initialState.teams.length === 0) {
|
||||||
|
@ -54,18 +45,32 @@ const SettingsPage = createReactClass({
|
||||||
appOptions: AutoSaveIndicator.SAVING_STATE_DONE,
|
appOptions: AutoSaveIndicator.SAVING_STATE_DONE,
|
||||||
servers: AutoSaveIndicator.SAVING_STATE_DONE,
|
servers: AutoSaveIndicator.SAVING_STATE_DONE,
|
||||||
};
|
};
|
||||||
|
this.state = initialState;
|
||||||
|
|
||||||
|
this.startSaveConfig = this.startSaveConfig.bind(this);
|
||||||
|
this.didSaveConfig = this.didSaveConfig.bind(this);
|
||||||
|
this.handleTeamsChange = this.handleTeamsChange.bind(this);
|
||||||
|
this.saveConfig = this.saveConfig.bind(this);
|
||||||
|
this.handleCancel = this.handleCancel.bind(this);
|
||||||
|
this.handleChangeShowTrayIcon = this.handleChangeShowTrayIcon.bind(this);
|
||||||
|
this.handleChangeTrayIconTheme = this.handleChangeTrayIconTheme.bind(this);
|
||||||
|
this.handleChangeAutoStart = this.handleChangeAutoStart.bind(this);
|
||||||
|
this.handleChangeMinimizeToTray = this.handleChangeMinimizeToTray.bind(this);
|
||||||
|
this.toggleShowTeamForm = this.toggleShowTeamForm.bind(this);
|
||||||
|
this.setShowTeamFormVisibility = this.setShowTeamFormVisibility.bind(this);
|
||||||
|
this.handleFlashWindow = this.handleFlashWindow.bind(this);
|
||||||
|
this.handleBounceIcon = this.handleBounceIcon.bind(this);
|
||||||
|
this.handleBounceIconType = this.handleBounceIconType.bind(this);
|
||||||
|
this.handleShowUnreadBadge = this.handleShowUnreadBadge.bind(this);
|
||||||
|
this.handleChangeUseSpellChecker = this.handleChangeUseSpellChecker.bind(this);
|
||||||
|
this.handleChangeEnableHardwareAcceleration = this.handleChangeEnableHardwareAcceleration.bind(this);
|
||||||
|
this.updateTeam = this.updateTeam.bind(this);
|
||||||
|
this.addServer = this.addServer.bind(this);
|
||||||
|
|
||||||
|
this.trayIconThemeRef = React.createRef();
|
||||||
|
}
|
||||||
|
|
||||||
return initialState;
|
|
||||||
},
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (process.platform === 'win32' || process.platform === 'linux') {
|
|
||||||
var self = this;
|
|
||||||
appLauncher.isEnabled().then((enabled) => {
|
|
||||||
self.setState({
|
|
||||||
autostart: enabled,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
ipcRenderer.on('add-server', () => {
|
ipcRenderer.on('add-server', () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showAddTeamForm: true,
|
showAddTeamForm: true,
|
||||||
|
@ -74,7 +79,7 @@ const SettingsPage = createReactClass({
|
||||||
ipcRenderer.on('switch-tab', (event, key) => {
|
ipcRenderer.on('switch-tab', (event, key) => {
|
||||||
backToIndex(key);
|
backToIndex(key);
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
startSaveConfig(configType) {
|
startSaveConfig(configType) {
|
||||||
if (!this.startSaveConfigImpl) {
|
if (!this.startSaveConfigImpl) {
|
||||||
|
@ -97,7 +102,7 @@ const SettingsPage = createReactClass({
|
||||||
savingState[configType] = AutoSaveIndicator.SAVING_STATE_SAVING;
|
savingState[configType] = AutoSaveIndicator.SAVING_STATE_SAVING;
|
||||||
this.setState({savingState});
|
this.setState({savingState});
|
||||||
this.startSaveConfigImpl[configType]();
|
this.startSaveConfigImpl[configType]();
|
||||||
},
|
}
|
||||||
|
|
||||||
didSaveConfig(configType) {
|
didSaveConfig(configType) {
|
||||||
if (!this.didSaveConfigImpl) {
|
if (!this.didSaveConfigImpl) {
|
||||||
|
@ -111,7 +116,7 @@ const SettingsPage = createReactClass({
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}
|
}
|
||||||
this.didSaveConfigImpl[configType]();
|
this.didSaveConfigImpl[configType]();
|
||||||
},
|
}
|
||||||
|
|
||||||
handleTeamsChange(teams) {
|
handleTeamsChange(teams) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -122,10 +127,10 @@ const SettingsPage = createReactClass({
|
||||||
this.setState({showAddTeamForm: true});
|
this.setState({showAddTeamForm: true});
|
||||||
}
|
}
|
||||||
setImmediate(this.startSaveConfig, CONFIG_TYPE_SERVERS);
|
setImmediate(this.startSaveConfig, CONFIG_TYPE_SERVERS);
|
||||||
},
|
}
|
||||||
|
|
||||||
saveConfig(callback) {
|
saveConfig(callback) {
|
||||||
var config = {
|
const config = {
|
||||||
teams: this.state.teams,
|
teams: this.state.teams,
|
||||||
showTrayIcon: this.state.showTrayIcon,
|
showTrayIcon: this.state.showTrayIcon,
|
||||||
trayIconTheme: this.state.trayIconTheme,
|
trayIconTheme: this.state.trayIconTheme,
|
||||||
|
@ -140,6 +145,7 @@ const SettingsPage = createReactClass({
|
||||||
useSpellChecker: this.state.useSpellChecker,
|
useSpellChecker: this.state.useSpellChecker,
|
||||||
spellCheckerLocale: this.state.spellCheckerLocale,
|
spellCheckerLocale: this.state.spellCheckerLocale,
|
||||||
enableHardwareAcceleration: this.state.enableHardwareAcceleration,
|
enableHardwareAcceleration: this.state.enableHardwareAcceleration,
|
||||||
|
autostart: this.state.autostart,
|
||||||
};
|
};
|
||||||
|
|
||||||
settings.writeFile(this.props.configFile, config, (err) => {
|
settings.writeFile(this.props.configFile, config, (err) => {
|
||||||
|
@ -149,36 +155,16 @@ const SettingsPage = createReactClass({
|
||||||
}
|
}
|
||||||
ipcRenderer.send('update-menu', config);
|
ipcRenderer.send('update-menu', config);
|
||||||
ipcRenderer.send('update-config');
|
ipcRenderer.send('update-config');
|
||||||
if (process.platform === 'win32' || process.platform === 'linux') {
|
callback();
|
||||||
const autostart = this.state.autostart;
|
|
||||||
this.saveAutoStart(autostart, callback);
|
|
||||||
} else {
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
saveAutoStart(autostart, callback) {
|
|
||||||
appLauncher.isEnabled().then((enabled) => {
|
|
||||||
if (enabled && !autostart) {
|
|
||||||
appLauncher.disable().then(() => {
|
|
||||||
callback();
|
|
||||||
}).catch(callback);
|
|
||||||
} else if (!enabled && autostart) {
|
|
||||||
appLauncher.enable().then(() => {
|
|
||||||
callback();
|
|
||||||
}).catch(callback);
|
|
||||||
} else {
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
}).catch(callback);
|
|
||||||
},
|
|
||||||
|
|
||||||
handleCancel() {
|
handleCancel() {
|
||||||
backToIndex();
|
backToIndex();
|
||||||
},
|
}
|
||||||
|
|
||||||
handleChangeShowTrayIcon() {
|
handleChangeShowTrayIcon() {
|
||||||
var shouldShowTrayIcon = !this.refs.showTrayIcon.props.checked;
|
const shouldShowTrayIcon = !this.refs.showTrayIcon.props.checked;
|
||||||
this.setState({
|
this.setState({
|
||||||
showTrayIcon: shouldShowTrayIcon,
|
showTrayIcon: shouldShowTrayIcon,
|
||||||
});
|
});
|
||||||
|
@ -190,19 +176,22 @@ const SettingsPage = createReactClass({
|
||||||
}
|
}
|
||||||
|
|
||||||
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
||||||
},
|
}
|
||||||
|
|
||||||
handleChangeTrayIconTheme() {
|
handleChangeTrayIconTheme() {
|
||||||
this.setState({
|
this.setState({
|
||||||
trayIconTheme: ReactDOM.findDOMNode(this.refs.trayIconTheme).value,
|
trayIconTheme: this.trayIconThemeRef.current.value,
|
||||||
});
|
});
|
||||||
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
||||||
},
|
}
|
||||||
|
|
||||||
handleChangeAutoStart() {
|
handleChangeAutoStart() {
|
||||||
this.setState({
|
this.setState({
|
||||||
autostart: !this.refs.autostart.props.checked,
|
autostart: !this.refs.autostart.props.checked,
|
||||||
});
|
});
|
||||||
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
||||||
},
|
}
|
||||||
|
|
||||||
handleChangeMinimizeToTray() {
|
handleChangeMinimizeToTray() {
|
||||||
const shouldMinimizeToTray = this.state.showTrayIcon && !this.refs.minimizeToTray.props.checked;
|
const shouldMinimizeToTray = this.state.showTrayIcon && !this.refs.minimizeToTray.props.checked;
|
||||||
|
|
||||||
|
@ -210,18 +199,21 @@ const SettingsPage = createReactClass({
|
||||||
minimizeToTray: shouldMinimizeToTray,
|
minimizeToTray: shouldMinimizeToTray,
|
||||||
});
|
});
|
||||||
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
||||||
},
|
}
|
||||||
|
|
||||||
toggleShowTeamForm() {
|
toggleShowTeamForm() {
|
||||||
this.setState({
|
this.setState({
|
||||||
showAddTeamForm: !this.state.showAddTeamForm,
|
showAddTeamForm: !this.state.showAddTeamForm,
|
||||||
});
|
});
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
},
|
}
|
||||||
|
|
||||||
setShowTeamFormVisibility(val) {
|
setShowTeamFormVisibility(val) {
|
||||||
this.setState({
|
this.setState({
|
||||||
showAddTeamForm: val,
|
showAddTeamForm: val,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
handleFlashWindow() {
|
handleFlashWindow() {
|
||||||
this.setState({
|
this.setState({
|
||||||
notifications: {
|
notifications: {
|
||||||
|
@ -230,7 +222,8 @@ const SettingsPage = createReactClass({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
||||||
},
|
}
|
||||||
|
|
||||||
handleBounceIcon() {
|
handleBounceIcon() {
|
||||||
this.setState({
|
this.setState({
|
||||||
notifications: {
|
notifications: {
|
||||||
|
@ -239,7 +232,8 @@ const SettingsPage = createReactClass({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
||||||
},
|
}
|
||||||
|
|
||||||
handleBounceIconType(event) {
|
handleBounceIconType(event) {
|
||||||
this.setState({
|
this.setState({
|
||||||
notifications: {
|
notifications: {
|
||||||
|
@ -248,45 +242,46 @@ const SettingsPage = createReactClass({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
||||||
},
|
}
|
||||||
|
|
||||||
handleShowUnreadBadge() {
|
handleShowUnreadBadge() {
|
||||||
this.setState({
|
this.setState({
|
||||||
showUnreadBadge: !this.refs.showUnreadBadge.props.checked,
|
showUnreadBadge: !this.refs.showUnreadBadge.props.checked,
|
||||||
});
|
});
|
||||||
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
||||||
},
|
}
|
||||||
|
|
||||||
handleChangeUseSpellChecker() {
|
handleChangeUseSpellChecker() {
|
||||||
this.setState({
|
this.setState({
|
||||||
useSpellChecker: !this.refs.useSpellChecker.props.checked,
|
useSpellChecker: !this.refs.useSpellChecker.props.checked,
|
||||||
});
|
});
|
||||||
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
||||||
},
|
}
|
||||||
|
|
||||||
handleChangeEnableHardwareAcceleration() {
|
handleChangeEnableHardwareAcceleration() {
|
||||||
this.setState({
|
this.setState({
|
||||||
enableHardwareAcceleration: !this.refs.enableHardwareAcceleration.props.checked,
|
enableHardwareAcceleration: !this.refs.enableHardwareAcceleration.props.checked,
|
||||||
});
|
});
|
||||||
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS);
|
||||||
},
|
}
|
||||||
|
|
||||||
updateTeam(index, newData) {
|
updateTeam(index, newData) {
|
||||||
var teams = this.state.teams;
|
const teams = this.state.teams;
|
||||||
teams[index] = newData;
|
teams[index] = newData;
|
||||||
this.setState({
|
this.setState({
|
||||||
teams,
|
teams,
|
||||||
});
|
});
|
||||||
setImmediate(this.startSaveConfig, CONFIG_TYPE_SERVERS);
|
setImmediate(this.startSaveConfig, CONFIG_TYPE_SERVERS);
|
||||||
},
|
}
|
||||||
|
|
||||||
addServer(team) {
|
addServer(team) {
|
||||||
var teams = this.state.teams;
|
const teams = this.state.teams;
|
||||||
teams.push(team);
|
teams.push(team);
|
||||||
this.setState({
|
this.setState({
|
||||||
teams,
|
teams,
|
||||||
});
|
});
|
||||||
setImmediate(this.startSaveConfig, CONFIG_TYPE_SERVERS);
|
setImmediate(this.startSaveConfig, CONFIG_TYPE_SERVERS);
|
||||||
},
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const settingsPage = {
|
const settingsPage = {
|
||||||
|
@ -324,7 +319,7 @@ const SettingsPage = createReactClass({
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var teamsRow = (
|
const teamsRow = (
|
||||||
<Row>
|
<Row>
|
||||||
<Col md={12}>
|
<Col md={12}>
|
||||||
<TeamList
|
<TeamList
|
||||||
|
@ -344,7 +339,7 @@ const SettingsPage = createReactClass({
|
||||||
</Row>
|
</Row>
|
||||||
);
|
);
|
||||||
|
|
||||||
var serversRow = (
|
const serversRow = (
|
||||||
<Row>
|
<Row>
|
||||||
<Col
|
<Col
|
||||||
md={10}
|
md={10}
|
||||||
|
@ -375,7 +370,7 @@ const SettingsPage = createReactClass({
|
||||||
</Row>
|
</Row>
|
||||||
);
|
);
|
||||||
|
|
||||||
var srvMgmt;
|
let srvMgmt;
|
||||||
if (this.props.enableServerManagement === true) {
|
if (this.props.enableServerManagement === true) {
|
||||||
srvMgmt = (
|
srvMgmt = (
|
||||||
<div>
|
<div>
|
||||||
|
@ -386,7 +381,7 @@ const SettingsPage = createReactClass({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
var options = [];
|
const options = [];
|
||||||
|
|
||||||
// MacOS has an option in the Dock, to set the app to autostart, so we choose to not support this option for OSX
|
// MacOS has an option in the Dock, to set the app to autostart, so we choose to not support this option for OSX
|
||||||
if (process.platform === 'win32' || process.platform === 'linux') {
|
if (process.platform === 'win32' || process.platform === 'linux') {
|
||||||
|
@ -417,7 +412,7 @@ const SettingsPage = createReactClass({
|
||||||
{'Check spelling'}
|
{'Check spelling'}
|
||||||
<HelpBlock>
|
<HelpBlock>
|
||||||
{'Highlight misspelled words in your messages.'}
|
{'Highlight misspelled words in your messages.'}
|
||||||
{' Available for English, French, German, Spanish, and Dutch.'}
|
{' Available for English, French, German, Portuguese, Spanish, and Dutch.'}
|
||||||
</HelpBlock>
|
</HelpBlock>
|
||||||
</Checkbox>);
|
</Checkbox>);
|
||||||
|
|
||||||
|
@ -514,6 +509,7 @@ const SettingsPage = createReactClass({
|
||||||
options.push(
|
options.push(
|
||||||
<FormGroup
|
<FormGroup
|
||||||
key='trayIconTheme'
|
key='trayIconTheme'
|
||||||
|
ref={this.trayIconThemeRef}
|
||||||
style={{marginLeft: '20px'}}
|
style={{marginLeft: '20px'}}
|
||||||
>
|
>
|
||||||
{'Icon theme: '}
|
{'Icon theme: '}
|
||||||
|
@ -576,7 +572,7 @@ const SettingsPage = createReactClass({
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
);
|
);
|
||||||
|
|
||||||
var optionsRow = (options.length > 0) ? (
|
const optionsRow = (options.length > 0) ? (
|
||||||
<Row>
|
<Row>
|
||||||
<Col md={12}>
|
<Col md={12}>
|
||||||
<h2 style={settingsPage.sectionHeading}>{'App Options'}</h2>
|
<h2 style={settingsPage.sectionHeading}>{'App Options'}</h2>
|
||||||
|
@ -625,7 +621,10 @@ const SettingsPage = createReactClass({
|
||||||
</Grid>
|
</Grid>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
export default SettingsPage;
|
SettingsPage.propTypes = {
|
||||||
|
configFile: PropTypes.string,
|
||||||
|
enableServerManagement: PropTypes.bool,
|
||||||
|
};
|
||||||
|
|
|
@ -10,6 +10,8 @@ import PermissionRequestDialog from './PermissionRequestDialog.jsx';
|
||||||
export default class TabBar extends React.Component { // need "this"
|
export default class TabBar extends React.Component { // need "this"
|
||||||
render() {
|
render() {
|
||||||
const tabs = this.props.teams.map((team, index) => {
|
const tabs = this.props.teams.map((team, index) => {
|
||||||
|
const sessionExpired = this.props.sessionsExpired[index];
|
||||||
|
|
||||||
let unreadCount = 0;
|
let unreadCount = 0;
|
||||||
if (this.props.unreadCounts[index] > 0) {
|
if (this.props.unreadCounts[index] > 0) {
|
||||||
unreadCount = this.props.unreadCounts[index];
|
unreadCount = this.props.unreadCounts[index];
|
||||||
|
@ -27,11 +29,16 @@ export default class TabBar extends React.Component { // need "this"
|
||||||
}
|
}
|
||||||
|
|
||||||
let badgeDiv;
|
let badgeDiv;
|
||||||
if (mentionCount !== 0) {
|
if (sessionExpired) {
|
||||||
|
badgeDiv = (
|
||||||
|
<div className='TabBar-badge TabBar-badge-nomention'>{'•'}</div>
|
||||||
|
);
|
||||||
|
} else if (mentionCount !== 0) {
|
||||||
badgeDiv = (
|
badgeDiv = (
|
||||||
<div className='TabBar-badge'>
|
<div className='TabBar-badge'>
|
||||||
{mentionCount}
|
{mentionCount}
|
||||||
</div>);
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const id = 'teamTabItem' + index;
|
const id = 'teamTabItem' + index;
|
||||||
const requestingPermission = this.props.requestingPermission[index];
|
const requestingPermission = this.props.requestingPermission[index];
|
||||||
|
@ -114,6 +121,7 @@ TabBar.propTypes = {
|
||||||
id: PropTypes.string,
|
id: PropTypes.string,
|
||||||
onSelect: PropTypes.func,
|
onSelect: PropTypes.func,
|
||||||
teams: PropTypes.array,
|
teams: PropTypes.array,
|
||||||
|
sessionsExpired: PropTypes.array,
|
||||||
unreadCounts: PropTypes.array,
|
unreadCounts: PropTypes.array,
|
||||||
unreadAtActive: PropTypes.array,
|
unreadAtActive: PropTypes.array,
|
||||||
mentionCounts: PropTypes.array,
|
mentionCounts: PropTypes.array,
|
||||||
|
|
|
@ -3,27 +3,17 @@
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import createReactClass from 'create-react-class';
|
|
||||||
import {ListGroup} from 'react-bootstrap';
|
import {ListGroup} from 'react-bootstrap';
|
||||||
|
|
||||||
import TeamListItem from './TeamListItem.jsx';
|
import TeamListItem from './TeamListItem.jsx';
|
||||||
import NewTeamModal from './NewTeamModal.jsx';
|
import NewTeamModal from './NewTeamModal.jsx';
|
||||||
import RemoveServerModal from './RemoveServerModal.jsx';
|
import RemoveServerModal from './RemoveServerModal.jsx';
|
||||||
|
|
||||||
const TeamList = createReactClass({
|
export default class TeamList extends React.Component {
|
||||||
propTypes: {
|
constructor(props) {
|
||||||
onTeamsChange: PropTypes.func,
|
super(props);
|
||||||
showAddTeamForm: PropTypes.bool,
|
|
||||||
teams: PropTypes.array,
|
|
||||||
addServer: PropTypes.func,
|
|
||||||
updateTeam: PropTypes.func,
|
|
||||||
toggleAddTeamForm: PropTypes.func,
|
|
||||||
setAddTeamFormVisibility: PropTypes.func,
|
|
||||||
onTeamClick: PropTypes.func,
|
|
||||||
},
|
|
||||||
|
|
||||||
getInitialState() {
|
this.state = {
|
||||||
return {
|
|
||||||
showEditTeamForm: false,
|
showEditTeamForm: false,
|
||||||
indexToRemoveServer: -1,
|
indexToRemoveServer: -1,
|
||||||
team: {
|
team: {
|
||||||
|
@ -32,15 +22,23 @@ const TeamList = createReactClass({
|
||||||
index: false,
|
index: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
|
||||||
|
this.handleTeamRemove = this.handleTeamRemove.bind(this);
|
||||||
|
this.handleTeamAdd = this.handleTeamAdd.bind(this);
|
||||||
|
this.handleTeamEditing = this.handleTeamEditing.bind(this);
|
||||||
|
this.openServerRemoveModal = this.openServerRemoveModal.bind(this);
|
||||||
|
this.closeServerRemoveModal = this.closeServerRemoveModal.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
handleTeamRemove(index) {
|
handleTeamRemove(index) {
|
||||||
console.log(index);
|
console.log(index);
|
||||||
var teams = this.props.teams;
|
const teams = this.props.teams;
|
||||||
teams.splice(index, 1);
|
teams.splice(index, 1);
|
||||||
this.props.onTeamsChange(teams);
|
this.props.onTeamsChange(teams);
|
||||||
},
|
}
|
||||||
|
|
||||||
handleTeamAdd(team) {
|
handleTeamAdd(team) {
|
||||||
var teams = this.props.teams;
|
const teams = this.props.teams;
|
||||||
|
|
||||||
// check if team already exists and then change existing team or add new one
|
// check if team already exists and then change existing team or add new one
|
||||||
if ((typeof team.index !== 'undefined') && teams[team.index]) {
|
if ((typeof team.index !== 'undefined') && teams[team.index]) {
|
||||||
|
@ -60,7 +58,8 @@ const TeamList = createReactClass({
|
||||||
});
|
});
|
||||||
|
|
||||||
this.props.onTeamsChange(teams);
|
this.props.onTeamsChange(teams);
|
||||||
},
|
}
|
||||||
|
|
||||||
handleTeamEditing(teamName, teamUrl, teamIndex) {
|
handleTeamEditing(teamName, teamUrl, teamIndex) {
|
||||||
this.setState({
|
this.setState({
|
||||||
showEditTeamForm: true,
|
showEditTeamForm: true,
|
||||||
|
@ -70,19 +69,19 @@ const TeamList = createReactClass({
|
||||||
index: teamIndex,
|
index: teamIndex,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
openServerRemoveModal(indexForServer) {
|
openServerRemoveModal(indexForServer) {
|
||||||
this.setState({indexToRemoveServer: indexForServer});
|
this.setState({indexToRemoveServer: indexForServer});
|
||||||
},
|
}
|
||||||
|
|
||||||
closeServerRemoveModal() {
|
closeServerRemoveModal() {
|
||||||
this.setState({indexToRemoveServer: -1});
|
this.setState({indexToRemoveServer: -1});
|
||||||
},
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
var self = this;
|
const self = this;
|
||||||
var teamNodes = this.props.teams.map((team, i) => {
|
const teamNodes = this.props.teams.map((team, i) => {
|
||||||
function handleTeamRemove() {
|
function handleTeamRemove() {
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
self.openServerRemoveModal(i);
|
self.openServerRemoveModal(i);
|
||||||
|
@ -110,7 +109,7 @@ const TeamList = createReactClass({
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
var addServerForm = (
|
const addServerForm = (
|
||||||
<NewTeamModal
|
<NewTeamModal
|
||||||
show={this.props.showAddTeamForm || this.state.showEditTeamForm}
|
show={this.props.showAddTeamForm || this.state.showEditTeamForm}
|
||||||
editMode={this.state.showEditTeamForm}
|
editMode={this.state.showEditTeamForm}
|
||||||
|
@ -126,7 +125,7 @@ const TeamList = createReactClass({
|
||||||
this.props.setAddTeamFormVisibility(false);
|
this.props.setAddTeamFormVisibility(false);
|
||||||
}}
|
}}
|
||||||
onSave={(newTeam) => {
|
onSave={(newTeam) => {
|
||||||
var teamData = {
|
const teamData = {
|
||||||
name: newTeam.name,
|
name: newTeam.name,
|
||||||
url: newTeam.url,
|
url: newTeam.url,
|
||||||
};
|
};
|
||||||
|
@ -171,7 +170,16 @@ const TeamList = createReactClass({
|
||||||
{ removeServerModal}
|
{ removeServerModal}
|
||||||
</ListGroup>
|
</ListGroup>
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
export default TeamList;
|
TeamList.propTypes = {
|
||||||
|
onTeamsChange: PropTypes.func,
|
||||||
|
showAddTeamForm: PropTypes.bool,
|
||||||
|
teams: PropTypes.array,
|
||||||
|
addServer: PropTypes.func,
|
||||||
|
updateTeam: PropTypes.func,
|
||||||
|
toggleAddTeamForm: PropTypes.func,
|
||||||
|
setAddTeamFormVisibility: PropTypes.func,
|
||||||
|
onTeamClick: PropTypes.func,
|
||||||
|
};
|
||||||
|
|
|
@ -53,6 +53,11 @@
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.TabBar .TabBar-badge.TabBar-badge-nomention {
|
||||||
|
font-size: 22pt;
|
||||||
|
line-height: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
.TabBar .teamTabItem-unread {
|
.TabBar .teamTabItem-unread {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,19 +31,23 @@ if (teams.length === 0) {
|
||||||
window.location = 'settings.html';
|
window.location = 'settings.html';
|
||||||
}
|
}
|
||||||
|
|
||||||
function showUnreadBadgeWindows(unreadCount, mentionCount) {
|
function showBadgeWindows(sessionExpired, unreadCount, mentionCount) {
|
||||||
function sendBadge(dataURL, description) {
|
function sendBadge(dataURL, description) {
|
||||||
// window.setOverlayIcon() does't work with NativeImage across remote boundaries.
|
// window.setOverlayIcon() does't work with NativeImage across remote boundaries.
|
||||||
// https://github.com/atom/electron/issues/4011
|
// https://github.com/atom/electron/issues/4011
|
||||||
ipcRenderer.send('update-unread', {
|
ipcRenderer.send('update-unread', {
|
||||||
overlayDataURL: dataURL,
|
overlayDataURL: dataURL,
|
||||||
description,
|
description,
|
||||||
|
sessionExpired,
|
||||||
unreadCount,
|
unreadCount,
|
||||||
mentionCount,
|
mentionCount,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mentionCount > 0) {
|
if (sessionExpired) {
|
||||||
|
const dataURL = createBadgeDataURL('•');
|
||||||
|
sendBadge(dataURL, 'Session Expired: Please sign in to continue receiving notifications.');
|
||||||
|
} else if (mentionCount > 0) {
|
||||||
const dataURL = createBadgeDataURL(mentionCount.toString());
|
const dataURL = createBadgeDataURL(mentionCount.toString());
|
||||||
sendBadge(dataURL, 'You have unread mentions (' + mentionCount + ')');
|
sendBadge(dataURL, 'You have unread mentions (' + mentionCount + ')');
|
||||||
} else if (unreadCount > 0 && AppConfig.data.showUnreadBadge) {
|
} else if (unreadCount > 0 && AppConfig.data.showUnreadBadge) {
|
||||||
|
@ -54,8 +58,10 @@ function showUnreadBadgeWindows(unreadCount, mentionCount) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showUnreadBadgeOSX(unreadCount, mentionCount) {
|
function showBadgeOSX(sessionExpired, unreadCount, mentionCount) {
|
||||||
if (mentionCount > 0) {
|
if (sessionExpired) {
|
||||||
|
remote.app.dock.setBadge('•');
|
||||||
|
} else if (mentionCount > 0) {
|
||||||
remote.app.dock.setBadge(mentionCount.toString());
|
remote.app.dock.setBadge(mentionCount.toString());
|
||||||
} else if (unreadCount > 0 && AppConfig.data.showUnreadBadge) {
|
} else if (unreadCount > 0 && AppConfig.data.showUnreadBadge) {
|
||||||
remote.app.dock.setBadge('•');
|
remote.app.dock.setBadge('•');
|
||||||
|
@ -64,34 +70,39 @@ function showUnreadBadgeOSX(unreadCount, mentionCount) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ipcRenderer.send('update-unread', {
|
ipcRenderer.send('update-unread', {
|
||||||
|
sessionExpired,
|
||||||
unreadCount,
|
unreadCount,
|
||||||
mentionCount,
|
mentionCount,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function showUnreadBadgeLinux(unreadCount, mentionCount) {
|
function showBadgeLinux(sessionExpired, unreadCount, mentionCount) {
|
||||||
if (remote.app.isUnityRunning()) {
|
if (remote.app.isUnityRunning()) {
|
||||||
remote.app.setBadgeCount(mentionCount);
|
if (sessionExpired) {
|
||||||
|
remote.app.setBadgeCount(mentionCount + 1);
|
||||||
|
} else {
|
||||||
|
remote.app.setBadgeCount(mentionCount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ipcRenderer.send('update-unread', {
|
ipcRenderer.send('update-unread', {
|
||||||
|
sessionExpired,
|
||||||
unreadCount,
|
unreadCount,
|
||||||
mentionCount,
|
mentionCount,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function showUnreadBadge(unreadCount, mentionCount) {
|
function showBadge(sessionExpired, unreadCount, mentionCount) {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
showUnreadBadgeWindows(unreadCount, mentionCount);
|
showBadgeWindows(sessionExpired, unreadCount, mentionCount);
|
||||||
break;
|
break;
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
showUnreadBadgeOSX(unreadCount, mentionCount);
|
showBadgeOSX(sessionExpired, unreadCount, mentionCount);
|
||||||
break;
|
break;
|
||||||
case 'linux':
|
case 'linux':
|
||||||
showUnreadBadgeLinux(unreadCount, mentionCount);
|
showBadgeLinux(sessionExpired, unreadCount, mentionCount);
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +179,7 @@ ReactDOM.render(
|
||||||
<MainPage
|
<MainPage
|
||||||
teams={teams}
|
teams={teams}
|
||||||
initialIndex={initialIndex}
|
initialIndex={initialIndex}
|
||||||
onUnreadCountChange={showUnreadBadge}
|
onBadgeChange={showBadge}
|
||||||
onTeamConfigChange={teamConfigChange}
|
onTeamConfigChange={teamConfigChange}
|
||||||
useSpellChecker={AppConfig.data.useSpellChecker}
|
useSpellChecker={AppConfig.data.useSpellChecker}
|
||||||
onSelectSpellCheckerLocale={handleSelectSpellCheckerLocale}
|
onSelectSpellCheckerLocale={handleSelectSpellCheckerLocale}
|
||||||
|
|
|
@ -22,7 +22,7 @@ function getSuggestionsMenus(win, suggestions) {
|
||||||
function getSpellCheckerLocaleMenus(onSelectSpellCheckerLocale) {
|
function getSpellCheckerLocaleMenus(onSelectSpellCheckerLocale) {
|
||||||
const currentLocale = ipcRenderer.sendSync('get-spellchecker-locale');
|
const currentLocale = ipcRenderer.sendSync('get-spellchecker-locale');
|
||||||
const locales = [
|
const locales = [
|
||||||
{language: 'English', locale: 'en-US'},
|
{language: 'English (US)', locale: 'en-US'},
|
||||||
{language: 'French', locale: 'fr-FR'},
|
{language: 'French', locale: 'fr-FR'},
|
||||||
{language: 'German', locale: 'de-DE'},
|
{language: 'German', locale: 'de-DE'},
|
||||||
{language: 'Spanish', locale: 'es-ES'},
|
{language: 'Spanish', locale: 'es-ES'},
|
||||||
|
|
|
@ -51,7 +51,7 @@ window.addEventListener('load', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
function hasClass(element, className) {
|
function hasClass(element, className) {
|
||||||
var rclass = /[\t\r\n\f]/g;
|
const rclass = /[\t\r\n\f]/g;
|
||||||
if ((' ' + element.className + ' ').replace(rclass, ' ').indexOf(className) > -1) {
|
if ((' ' + element.className + ' ').replace(rclass, ' ').indexOf(className) > -1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -66,9 +66,13 @@ function getUnreadCount() {
|
||||||
this.mentionCount = 0;
|
this.mentionCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// LHS not found => Log out => Count should be 0.
|
// LHS not found => Log out => Count should be 0, but session may be expired.
|
||||||
if (document.getElementById('sidebar-left') === null) {
|
if (document.getElementById('sidebar-left') === null) {
|
||||||
ipcRenderer.sendToHost('onUnreadCountChange', 0, 0, false, false);
|
const extraParam = (new URLSearchParams(window.location.search)).get('extra');
|
||||||
|
const sessionExpired = extraParam === 'expired';
|
||||||
|
|
||||||
|
ipcRenderer.sendToHost('onBadgeChange', sessionExpired, 0, 0, false, false);
|
||||||
|
this.sessionExpired = sessionExpired;
|
||||||
this.unreadCount = 0;
|
this.unreadCount = 0;
|
||||||
this.mentionCount = 0;
|
this.mentionCount = 0;
|
||||||
setTimeout(getUnreadCount, UNREAD_COUNT_INTERVAL);
|
setTimeout(getUnreadCount, UNREAD_COUNT_INTERVAL);
|
||||||
|
@ -77,7 +81,7 @@ function getUnreadCount() {
|
||||||
|
|
||||||
// unreadCount in sidebar
|
// unreadCount in sidebar
|
||||||
// Note: the active channel doesn't have '.unread-title'.
|
// Note: the active channel doesn't have '.unread-title'.
|
||||||
var unreadCount = document.getElementsByClassName('unread-title').length;
|
let unreadCount = document.getElementsByClassName('unread-title').length;
|
||||||
|
|
||||||
// unreadCount in team sidebar
|
// unreadCount in team sidebar
|
||||||
const teamSideBar = document.getElementsByClassName('team-sidebar'); // team-sidebar doesn't have id
|
const teamSideBar = document.getElementsByClassName('team-sidebar'); // team-sidebar doesn't have id
|
||||||
|
@ -86,30 +90,30 @@ function getUnreadCount() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// mentionCount in sidebar
|
// mentionCount in sidebar
|
||||||
var elem = document.getElementsByClassName('badge');
|
const elem = document.getElementsByClassName('badge');
|
||||||
var mentionCount = 0;
|
let mentionCount = 0;
|
||||||
for (var i = 0; i < elem.length; i++) {
|
for (let i = 0; i < elem.length; i++) {
|
||||||
if (isElementVisible(elem[i]) && !hasClass(elem[i], 'badge-notify')) {
|
if (isElementVisible(elem[i]) && !hasClass(elem[i], 'badge-notify')) {
|
||||||
mentionCount += Number(elem[i].innerHTML);
|
mentionCount += Number(elem[i].innerHTML);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var postAttrName = 'data-reactid';
|
const postAttrName = 'data-reactid';
|
||||||
var lastPostElem = document.querySelector('div[' + postAttrName + '="' + this.lastCheckedPostId + '"]');
|
const lastPostElem = document.querySelector('div[' + postAttrName + '="' + this.lastCheckedPostId + '"]');
|
||||||
var isUnread = false;
|
let isUnread = false;
|
||||||
var isMentioned = false;
|
let isMentioned = false;
|
||||||
if (lastPostElem === null || !isElementVisible(lastPostElem)) {
|
if (lastPostElem === null || !isElementVisible(lastPostElem)) {
|
||||||
// When load channel or change channel, this.lastCheckedPostId is invalid.
|
// When load channel or change channel, this.lastCheckedPostId is invalid.
|
||||||
// So we get latest post and save lastCheckedPostId.
|
// So we get latest post and save lastCheckedPostId.
|
||||||
|
|
||||||
// find active post-list.
|
// find active post-list.
|
||||||
var postLists = document.querySelectorAll('div.post-list__content');
|
const postLists = document.querySelectorAll('div.post-list__content');
|
||||||
if (postLists.length === 0) {
|
if (postLists.length === 0) {
|
||||||
setTimeout(getUnreadCount, UNREAD_COUNT_INTERVAL);
|
setTimeout(getUnreadCount, UNREAD_COUNT_INTERVAL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var post = null;
|
let post = null;
|
||||||
for (var j = 0; j < postLists.length; j++) {
|
for (let j = 0; j < postLists.length; j++) {
|
||||||
if (isElementVisible(postLists[j])) {
|
if (isElementVisible(postLists[j])) {
|
||||||
post = postLists[j].children[0];
|
post = postLists[j].children[0];
|
||||||
}
|
}
|
||||||
|
@ -130,19 +134,19 @@ function getUnreadCount() {
|
||||||
post = post.nextSibling;
|
post = post.nextSibling;
|
||||||
}
|
}
|
||||||
} else if (lastPostElem !== null) {
|
} else if (lastPostElem !== null) {
|
||||||
var newPostElem = lastPostElem.nextSibling;
|
let newPostElem = lastPostElem.nextSibling;
|
||||||
while (newPostElem) {
|
while (newPostElem) {
|
||||||
this.lastCheckedPostId = newPostElem.getAttribute(postAttrName);
|
this.lastCheckedPostId = newPostElem.getAttribute(postAttrName);
|
||||||
isUnread = true;
|
isUnread = true;
|
||||||
var activeChannel = document.querySelector('.active .sidebar-channel');
|
const activeChannel = document.querySelector('.active .sidebar-channel');
|
||||||
var closeButton = activeChannel.getElementsByClassName('btn-close');
|
const closeButton = activeChannel.getElementsByClassName('btn-close');
|
||||||
if (closeButton.length === 1 && closeButton[0].getAttribute('aria-describedby') === 'remove-dm-tooltip') {
|
if (closeButton.length === 1 && closeButton[0].getAttribute('aria-describedby') === 'remove-dm-tooltip') {
|
||||||
// If active channel is DM, all posts is treated as menion.
|
// If active channel is DM, all posts is treated as menion.
|
||||||
isMentioned = true;
|
isMentioned = true;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// If active channel is public/private channel, only mentioned post is treated as mention.
|
// If active channel is public/private channel, only mentioned post is treated as mention.
|
||||||
var highlight = newPostElem.getElementsByClassName('mention-highlight');
|
const highlight = newPostElem.getElementsByClassName('mention-highlight');
|
||||||
if (highlight.length !== 0 && isElementVisible(highlight[0])) {
|
if (highlight.length !== 0 && isElementVisible(highlight[0])) {
|
||||||
isMentioned = true;
|
isMentioned = true;
|
||||||
break;
|
break;
|
||||||
|
@ -152,11 +156,12 @@ function getUnreadCount() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.unreadCount !== unreadCount || this.mentionCount !== mentionCount || isUnread || isMentioned) {
|
if (this.sessionExpired || this.unreadCount !== unreadCount || this.mentionCount !== mentionCount || isUnread || isMentioned) {
|
||||||
ipcRenderer.sendToHost('onUnreadCountChange', unreadCount, mentionCount, isUnread, isMentioned);
|
ipcRenderer.sendToHost('onBadgeChange', false, unreadCount, mentionCount, isUnread, isMentioned);
|
||||||
}
|
}
|
||||||
this.unreadCount = unreadCount;
|
this.unreadCount = unreadCount;
|
||||||
this.mentionCount = mentionCount;
|
this.mentionCount = mentionCount;
|
||||||
|
this.sessionExpired = false;
|
||||||
setTimeout(getUnreadCount, UNREAD_COUNT_INTERVAL);
|
setTimeout(getUnreadCount, UNREAD_COUNT_INTERVAL);
|
||||||
}
|
}
|
||||||
setTimeout(getUnreadCount, UNREAD_COUNT_INTERVAL);
|
setTimeout(getUnreadCount, UNREAD_COUNT_INTERVAL);
|
||||||
|
|
|
@ -20,6 +20,7 @@ const defaultPreferences = {
|
||||||
showUnreadBadge: true,
|
showUnreadBadge: true,
|
||||||
useSpellChecker: true,
|
useSpellChecker: true,
|
||||||
enableHardwareAcceleration: true,
|
enableHardwareAcceleration: true,
|
||||||
|
autostart: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default defaultPreferences;
|
export default defaultPreferences;
|
||||||
|
|
|
@ -20,7 +20,7 @@ function upgradeV0toV1(configV0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function upgradeToLatest(config) {
|
export default function upgradeToLatest(config) {
|
||||||
var configVersion = config.version ? config.version : 0;
|
const configVersion = config.version ? config.version : 0;
|
||||||
switch (configVersion) {
|
switch (configVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
return upgradeToLatest(upgradeV0toV1(config));
|
return upgradeToLatest(upgradeV0toV1(config));
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
var releaseSplit = os.release().split('.');
|
const releaseSplit = os.release().split('.');
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
major: parseInt(releaseSplit[0], 10),
|
major: parseInt(releaseSplit[0], 10),
|
||||||
|
|
|
@ -45,7 +45,7 @@ export default {
|
||||||
if (config.version !== defaultPreferences.version) {
|
if (config.version !== defaultPreferences.version) {
|
||||||
throw new Error('version ' + config.version + ' is not equal to ' + defaultPreferences.version);
|
throw new Error('version ' + config.version + ' is not equal to ' + defaultPreferences.version);
|
||||||
}
|
}
|
||||||
var data = JSON.stringify(config, null, ' ');
|
const data = JSON.stringify(config, null, ' ');
|
||||||
fs.writeFile(configFile, data, 'utf8', callback);
|
fs.writeFile(configFile, data, 'utf8', callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ export default {
|
||||||
fs.mkdirSync(dir);
|
fs.mkdirSync(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = JSON.stringify(config, null, ' ');
|
const data = JSON.stringify(config, null, ' ');
|
||||||
fs.writeFileSync(configFile, data, 'utf8');
|
fs.writeFileSync(configFile, data, 'utf8');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
40
src/main.js
40
src/main.js
|
@ -23,6 +23,7 @@ import {parse as parseArgv} from 'yargs';
|
||||||
|
|
||||||
import {protocols} from '../electron-builder.json';
|
import {protocols} from '../electron-builder.json';
|
||||||
|
|
||||||
|
import AutoLauncher from './main/AutoLauncher';
|
||||||
import CriticalErrorHandler from './main/CriticalErrorHandler';
|
import CriticalErrorHandler from './main/CriticalErrorHandler';
|
||||||
import upgradeAutoLaunch from './main/autoLaunch';
|
import upgradeAutoLaunch from './main/autoLaunch';
|
||||||
import autoUpdater from './main/autoUpdater';
|
import autoUpdater from './main/autoUpdater';
|
||||||
|
@ -48,6 +49,7 @@ import PermissionManager from './main/PermissionManager';
|
||||||
import permissionRequestHandler from './main/permissionRequestHandler';
|
import permissionRequestHandler from './main/permissionRequestHandler';
|
||||||
import AppStateManager from './main/AppStateManager';
|
import AppStateManager from './main/AppStateManager';
|
||||||
import initCookieManager from './main/cookieManager';
|
import initCookieManager from './main/cookieManager';
|
||||||
|
import {shouldBeHiddenOnStartup} from './main/utils';
|
||||||
|
|
||||||
import SpellChecker from './main/SpellChecker';
|
import SpellChecker from './main/SpellChecker';
|
||||||
|
|
||||||
|
@ -55,7 +57,7 @@ const assetsDir = path.resolve(app.getAppPath(), 'assets');
|
||||||
|
|
||||||
// Keep a global reference of the window object, if you don't, the window will
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
var mainWindow = null;
|
let mainWindow = null;
|
||||||
let spellChecker = null;
|
let spellChecker = null;
|
||||||
let deeplinkingUrl = null;
|
let deeplinkingUrl = null;
|
||||||
let scheme = null;
|
let scheme = null;
|
||||||
|
@ -63,11 +65,7 @@ let appState = null;
|
||||||
let permissionManager = null;
|
let permissionManager = null;
|
||||||
|
|
||||||
const argv = parseArgv(process.argv.slice(1));
|
const argv = parseArgv(process.argv.slice(1));
|
||||||
|
const hideOnStartup = shouldBeHiddenOnStartup(argv);
|
||||||
var hideOnStartup;
|
|
||||||
if (argv.hidden) {
|
|
||||||
hideOnStartup = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argv['data-dir']) {
|
if (argv['data-dir']) {
|
||||||
app.setPath('userData', path.resolve(argv['data-dir']));
|
app.setPath('userData', path.resolve(argv['data-dir']));
|
||||||
|
@ -75,7 +73,7 @@ if (argv['data-dir']) {
|
||||||
|
|
||||||
global.isDev = isDev && !argv.disableDevMode;
|
global.isDev = isDev && !argv.disableDevMode;
|
||||||
|
|
||||||
var config = {};
|
let config = {};
|
||||||
try {
|
try {
|
||||||
const configFile = app.getPath('userData') + '/config.json';
|
const configFile = app.getPath('userData') + '/config.json';
|
||||||
config = settings.readFileSync(configFile);
|
config = settings.readFileSync(configFile);
|
||||||
|
@ -100,6 +98,15 @@ if (config.enableHardwareAcceleration === false) {
|
||||||
ipcMain.on('update-config', () => {
|
ipcMain.on('update-config', () => {
|
||||||
const configFile = app.getPath('userData') + '/config.json';
|
const configFile = app.getPath('userData') + '/config.json';
|
||||||
config = settings.readFileSync(configFile);
|
config = settings.readFileSync(configFile);
|
||||||
|
if (process.platform === 'win32' || process.platform === 'linux') {
|
||||||
|
const appLauncher = new AutoLauncher();
|
||||||
|
const autoStartTask = config.autostart ? appLauncher.enable() : appLauncher.disable();
|
||||||
|
autoStartTask.then(() => {
|
||||||
|
console.log('config.autostart has been configured:', config.autostart);
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log('error:', err);
|
||||||
|
});
|
||||||
|
}
|
||||||
const trustedURLs = settings.mergeDefaultTeams(config.teams).map((team) => team.url);
|
const trustedURLs = settings.mergeDefaultTeams(config.teams).map((team) => team.url);
|
||||||
permissionManager.setTrustedURLs(trustedURLs);
|
permissionManager.setTrustedURLs(trustedURLs);
|
||||||
ipcMain.emit('update-dict', true, config.spellCheckerLocale);
|
ipcMain.emit('update-dict', true, config.spellCheckerLocale);
|
||||||
|
@ -118,7 +125,7 @@ function switchMenuIconImages(icons, isDarkMode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var trayIcon = null;
|
let trayIcon = null;
|
||||||
const trayImages = (() => {
|
const trayImages = (() => {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
|
@ -294,7 +301,7 @@ app.on('certificate-error', (event, webContents, url, error, certificate, callba
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
callback(true);
|
callback(true);
|
||||||
} else {
|
} else {
|
||||||
var detail = `URL: ${url}\nError: ${error}`;
|
let detail = `URL: ${url}\nError: ${error}`;
|
||||||
if (certificateStore.isExisting(url)) {
|
if (certificateStore.isExisting(url)) {
|
||||||
detail = 'Certificate is different from previous one.\n\n' + detail;
|
detail = 'Certificate is different from previous one.\n\n' + detail;
|
||||||
}
|
}
|
||||||
|
@ -526,7 +533,14 @@ app.on('ready', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trayIcon && !trayIcon.isDestroyed()) {
|
if (trayIcon && !trayIcon.isDestroyed()) {
|
||||||
if (arg.mentionCount > 0) {
|
if (arg.sessionExpired) {
|
||||||
|
// reuse the mention icon when the session is expired
|
||||||
|
trayIcon.setImage(trayImages.mention);
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
trayIcon.setPressedImage(trayImages.clicked.mention);
|
||||||
|
}
|
||||||
|
trayIcon.setToolTip('Session Expired: Please sign in to continue receiving notifications.');
|
||||||
|
} else if (arg.mentionCount > 0) {
|
||||||
trayIcon.setImage(trayImages.mention);
|
trayIcon.setImage(trayImages.mention);
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
trayIcon.setPressedImage(trayImages.clicked.mention);
|
trayIcon.setPressedImage(trayImages.clicked.mention);
|
||||||
|
@ -551,8 +565,8 @@ app.on('ready', () => {
|
||||||
|
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
session.defaultSession.on('will-download', (event, item) => {
|
session.defaultSession.on('will-download', (event, item) => {
|
||||||
var filename = item.getFilename();
|
const filename = item.getFilename();
|
||||||
var savePath = dialog.showSaveDialog({
|
const savePath = dialog.showSaveDialog({
|
||||||
title: filename,
|
title: filename,
|
||||||
defaultPath: os.homedir() + '/Downloads/' + filename,
|
defaultPath: os.homedir() + '/Downloads/' + filename,
|
||||||
});
|
});
|
||||||
|
@ -567,7 +581,7 @@ app.on('ready', () => {
|
||||||
|
|
||||||
// Set application menu
|
// Set application menu
|
||||||
ipcMain.on('update-menu', (event, configData) => {
|
ipcMain.on('update-menu', (event, configData) => {
|
||||||
var aMenu = appMenu.createMenu(mainWindow, configData, global.isDev);
|
const aMenu = appMenu.createMenu(mainWindow, configData, global.isDev);
|
||||||
Menu.setApplicationMenu(aMenu);
|
Menu.setApplicationMenu(aMenu);
|
||||||
|
|
||||||
// set up context menu for tray icon
|
// set up context menu for tray icon
|
||||||
|
|
48
src/main/AutoLauncher.js
Normal file
48
src/main/AutoLauncher.js
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
// Copyright (c) 2015-2016 Yuya Ochiai
|
||||||
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||||
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import AutoLaunch from 'auto-launch';
|
||||||
|
import {app} from 'electron';
|
||||||
|
import isDev from 'electron-is-dev';
|
||||||
|
|
||||||
|
export default class AutoLauncher {
|
||||||
|
constructor() {
|
||||||
|
this.appLauncher = new AutoLaunch({
|
||||||
|
name: app.getName(),
|
||||||
|
isHidden: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
isEnabled() {
|
||||||
|
return this.appLauncher.isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
async blankPromise() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
async enable() {
|
||||||
|
if (isDev) {
|
||||||
|
console.log('In development mode, autostart config never effects');
|
||||||
|
return this.blankPromise();
|
||||||
|
}
|
||||||
|
const enabled = await this.isEnabled();
|
||||||
|
if (!enabled) {
|
||||||
|
return this.appLauncher.enable();
|
||||||
|
}
|
||||||
|
return this.blankPromise();
|
||||||
|
}
|
||||||
|
|
||||||
|
async disable() {
|
||||||
|
if (isDev) {
|
||||||
|
console.log('In development mode, autostart config never effects');
|
||||||
|
return this.blankPromise();
|
||||||
|
}
|
||||||
|
const enabled = await this.isEnabled();
|
||||||
|
if (enabled) {
|
||||||
|
return this.appLauncher.disable();
|
||||||
|
}
|
||||||
|
return this.blankPromise();
|
||||||
|
}
|
||||||
|
}
|
|
@ -70,7 +70,24 @@ export default class SpellChecker extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuggestions(word, maxSuggestions) {
|
getSuggestions(word, maxSuggestions) {
|
||||||
return this.dict.getSuggestions(word, maxSuggestions);
|
const suggestions = this.dict.getSuggestions(word, maxSuggestions);
|
||||||
|
|
||||||
|
const firstCharWord = word.charAt(0);
|
||||||
|
let i;
|
||||||
|
for (i = 0; i < suggestions.length; i++) {
|
||||||
|
if (suggestions[i].charAt(0).toUpperCase() === firstCharWord.toUpperCase()) {
|
||||||
|
suggestions[i] = firstCharWord + suggestions[i].slice(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const uniqueSuggestions = suggestions.reduce((a, b) => {
|
||||||
|
if (a.indexOf(b) < 0) {
|
||||||
|
a.push(b);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return uniqueSuggestions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import fs from 'fs';
|
||||||
import {app, dialog, ipcMain, shell} from 'electron';
|
import {app, dialog, ipcMain, shell} from 'electron';
|
||||||
|
|
||||||
const allowedProtocolFile = path.resolve(app.getPath('userData'), 'allowedProtocols.json');
|
const allowedProtocolFile = path.resolve(app.getPath('userData'), 'allowedProtocols.json');
|
||||||
var allowedProtocols = [];
|
let allowedProtocols = [];
|
||||||
|
|
||||||
function init(mainWindow) {
|
function init(mainWindow) {
|
||||||
fs.readFile(allowedProtocolFile, 'utf-8', (err, data) => {
|
fs.readFile(allowedProtocolFile, 'utf-8', (err, data) => {
|
||||||
|
|
|
@ -56,7 +56,7 @@ CertificateStore.prototype.isExisting = function isExisting(targetURL) {
|
||||||
};
|
};
|
||||||
|
|
||||||
CertificateStore.prototype.isTrusted = function isTrusted(targetURL, certificate) {
|
CertificateStore.prototype.isTrusted = function isTrusted(targetURL, certificate) {
|
||||||
var host = getHost(targetURL);
|
const host = getHost(targetURL);
|
||||||
if (!this.isExisting(targetURL)) {
|
if (!this.isExisting(targetURL)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import path from 'path';
|
||||||
import {app, BrowserWindow} from 'electron';
|
import {app, BrowserWindow} from 'electron';
|
||||||
|
|
||||||
function saveWindowState(file, window) {
|
function saveWindowState(file, window) {
|
||||||
var windowState = window.getBounds();
|
const windowState = window.getBounds();
|
||||||
windowState.maximized = window.isMaximized();
|
windowState.maximized = window.isMaximized();
|
||||||
windowState.fullscreen = window.isFullScreen();
|
windowState.fullscreen = window.isFullScreen();
|
||||||
try {
|
try {
|
||||||
|
@ -26,7 +26,7 @@ function createMainWindow(config, options) {
|
||||||
|
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
const boundsInfoPath = path.join(app.getPath('userData'), 'bounds-info.json');
|
const boundsInfoPath = path.join(app.getPath('userData'), 'bounds-info.json');
|
||||||
var windowOptions;
|
let windowOptions;
|
||||||
try {
|
try {
|
||||||
windowOptions = JSON.parse(fs.readFileSync(boundsInfoPath, 'utf-8'));
|
windowOptions = JSON.parse(fs.readFileSync(boundsInfoPath, 'utf-8'));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -15,11 +15,11 @@ function createTemplate(mainWindow, config, isDev) {
|
||||||
type: 'separator',
|
type: 'separator',
|
||||||
};
|
};
|
||||||
|
|
||||||
var appName = app.getName();
|
const appName = app.getName();
|
||||||
var firstMenuName = (process.platform === 'darwin') ? appName : 'File';
|
const firstMenuName = (process.platform === 'darwin') ? appName : 'File';
|
||||||
var template = [];
|
const template = [];
|
||||||
|
|
||||||
var platformAppMenu = process.platform === 'darwin' ? [{
|
let platformAppMenu = process.platform === 'darwin' ? [{
|
||||||
label: 'About ' + appName,
|
label: 'About ' + appName,
|
||||||
role: 'about',
|
role: 'about',
|
||||||
click() {
|
click() {
|
||||||
|
@ -217,7 +217,7 @@ function createTemplate(mainWindow, config, isDev) {
|
||||||
}],
|
}],
|
||||||
};
|
};
|
||||||
template.push(windowMenu);
|
template.push(windowMenu);
|
||||||
var submenu = [];
|
const submenu = [];
|
||||||
if (buildConfig.helpLink) {
|
if (buildConfig.helpLink) {
|
||||||
submenu.push({
|
submenu.push({
|
||||||
label: 'Learn More...',
|
label: 'Learn More...',
|
||||||
|
|
|
@ -10,7 +10,7 @@ import settings from '../../common/settings';
|
||||||
function createTemplate(mainWindow, config, isDev) {
|
function createTemplate(mainWindow, config, isDev) {
|
||||||
const settingsURL = isDev ? 'http://localhost:8080/browser/settings.html' : `file://${app.getAppPath()}/browser/settings.html`;
|
const settingsURL = isDev ? 'http://localhost:8080/browser/settings.html' : `file://${app.getAppPath()}/browser/settings.html`;
|
||||||
const teams = settings.mergeDefaultTeams(config.teams);
|
const teams = settings.mergeDefaultTeams(config.teams);
|
||||||
var template = [
|
const template = [
|
||||||
...teams.slice(0, 9).map((team, i) => {
|
...teams.slice(0, 9).map((team, i) => {
|
||||||
return {
|
return {
|
||||||
label: team.name,
|
label: team.name,
|
||||||
|
|
17
src/main/utils.js
Normal file
17
src/main/utils.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (c) 2015-2016 Yuya Ochiai
|
||||||
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||||
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import {app} from 'electron';
|
||||||
|
|
||||||
|
export function shouldBeHiddenOnStartup(parsedArgv) {
|
||||||
|
if (parsedArgv.hidden) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
if (app.getLoginItemSettings().wasOpenedAsHidden) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -11,7 +11,6 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"auto-launch": "^5.0.5",
|
"auto-launch": "^5.0.5",
|
||||||
"bootstrap": "^3.3.7",
|
"bootstrap": "^3.3.7",
|
||||||
"create-react-class": "^15.6.3",
|
|
||||||
"electron-context-menu": "0.9.0",
|
"electron-context-menu": "0.9.0",
|
||||||
"electron-devtools-installer": "^2.2.4",
|
"electron-devtools-installer": "^2.2.4",
|
||||||
"electron-is-dev": "^0.3.0",
|
"electron-is-dev": "^0.3.0",
|
||||||
|
|
|
@ -136,14 +136,6 @@ core-js@^2.4.0:
|
||||||
version "2.5.1"
|
version "2.5.1"
|
||||||
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.1.tgz#ae6874dc66937789b80754ff5428df66819ca50b"
|
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.1.tgz#ae6874dc66937789b80754ff5428df66819ca50b"
|
||||||
|
|
||||||
create-react-class@^15.6.3:
|
|
||||||
version "15.6.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.3.tgz#2d73237fb3f970ae6ebe011a9e66f46dbca80036"
|
|
||||||
dependencies:
|
|
||||||
fbjs "^0.8.9"
|
|
||||||
loose-envify "^1.3.1"
|
|
||||||
object-assign "^4.1.1"
|
|
||||||
|
|
||||||
cross-unzip@0.0.2:
|
cross-unzip@0.0.2:
|
||||||
version "0.0.2"
|
version "0.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/cross-unzip/-/cross-unzip-0.0.2.tgz#5183bc47a09559befcf98cc4657964999359372f"
|
resolved "https://registry.yarnpkg.com/cross-unzip/-/cross-unzip-0.0.2.tgz#5183bc47a09559befcf98cc4657964999359372f"
|
||||||
|
|
|
@ -67,6 +67,27 @@ describe('main/Spellchecker.js', function() {
|
||||||
spellchecker.spellCheck('Mattermost').should.equal(true);
|
spellchecker.spellCheck('Mattermost').should.equal(true);
|
||||||
spellchecker.spellCheck('mattermost').should.equal(true);
|
spellchecker.spellCheck('mattermost').should.equal(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should give at most the requested number of suggestions', function() {
|
||||||
|
// helllo known to give at least 4 suggestions
|
||||||
|
spellchecker.getSuggestions('helllo', 4).length.should.be.equal(4);
|
||||||
|
spellchecker.getSuggestions('helllo', 1).length.should.be.equal(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should give suggestions which preserve case of first letter', function() {
|
||||||
|
let suggestions = spellchecker.getSuggestions('carr', 4);
|
||||||
|
suggestions.length.should.not.be.equal(0);
|
||||||
|
let i;
|
||||||
|
for (i = 0; i < suggestions.length; i++) {
|
||||||
|
suggestions[i].charAt(0).should.be.equal('c');
|
||||||
|
}
|
||||||
|
|
||||||
|
suggestions = spellchecker.getSuggestions('Carr', 4);
|
||||||
|
suggestions.length.should.not.be.equal(0);
|
||||||
|
for (i = 0; i < suggestions.length; i++) {
|
||||||
|
suggestions[i].charAt(0).should.be.equal('C');
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('en-GB', function() {
|
describe('en-GB', function() {
|
||||||
|
@ -107,5 +128,20 @@ describe('main/Spellchecker.js', function() {
|
||||||
spellchecker.spellCheck('-100').should.equal(true);
|
spellchecker.spellCheck('-100').should.equal(true);
|
||||||
spellchecker.spellCheck('3.14').should.equal(true);
|
spellchecker.spellCheck('3.14').should.equal(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should give suggestions which preserve case of first letter', function() {
|
||||||
|
let suggestions = spellchecker.getSuggestions('gutenn', 4);
|
||||||
|
suggestions.length.should.not.be.equal(0);
|
||||||
|
let i;
|
||||||
|
for (i = 0; i < suggestions.length; i++) {
|
||||||
|
suggestions[i].charAt(0).should.be.equal('g');
|
||||||
|
}
|
||||||
|
|
||||||
|
suggestions = spellchecker.getSuggestions('Gutenn', 4);
|
||||||
|
suggestions.length.should.not.be.equal(0);
|
||||||
|
for (i = 0; i < suggestions.length; i++) {
|
||||||
|
suggestions[i].charAt(0).should.be.equal('G');
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -3726,9 +3726,9 @@ electron-to-chromium@^1.3.47:
|
||||||
version "1.3.48"
|
version "1.3.48"
|
||||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.48.tgz#d3b0d8593814044e092ece2108fc3ac9aea4b900"
|
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.48.tgz#d3b0d8593814044e092ece2108fc3ac9aea4b900"
|
||||||
|
|
||||||
electron@2.0.2:
|
electron@2.0.8:
|
||||||
version "2.0.2"
|
version "2.0.8"
|
||||||
resolved "https://registry.yarnpkg.com/electron/-/electron-2.0.2.tgz#b77e05f83419cc5ec921a2d21f35b55e4bfc3d68"
|
resolved "https://registry.yarnpkg.com/electron/-/electron-2.0.8.tgz#6ec7113b356e09cc9899797e0d41ebff8163e962"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/node" "^8.0.24"
|
"@types/node" "^8.0.24"
|
||||||
electron-download "^3.0.1"
|
electron-download "^3.0.1"
|
||||||
|
|
Loading…
Reference in a new issue