Skip to content

Commit

Permalink
update @ProtonMail web clients
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimiry committed Nov 16, 2023
1 parent 3e59510 commit 59b8822
Show file tree
Hide file tree
Showing 20 changed files with 360 additions and 225 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,16 @@ index 8f5e56ef0..a40d9dc17 100644
export default Setup;

diff --git a/applications/account/src/app/content/MainContainer.tsx b/applications/account/src/app/content/MainContainer.tsx
index 575b59dcec..5e774e01a1 100644
index 8009f7f074..1938e387fb 100644
--- a/applications/account/src/app/content/MainContainer.tsx
+++ b/applications/account/src/app/content/MainContainer.tsx
@@ -132,7 +132,7 @@ const MainContainer = () => {
const loadingFeatures = featuresFlags.some(({ loading }) => loading) || loadingDataRecovery;
@@ -137,7 +137,7 @@ const MainContainer = () => {
const loadingFeatures = featuresFlags.some(({ loading }) => loading);
const recoveryNotification = useRecoveryNotification(false);

- const appFromPathname = getAppFromPathnameSafe(location.pathname);
+ const appFromPathname = getAppFromPathnameSafe(window.location.pathname);
const app = appFromPathname || getToApp(undefined, user);
const appSlug = getSlugFromApp(app);


File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
diff --git a/applications/drive/src/.htaccess b/applications/drive/src/.htaccess
index 5b522f3deb..5523b5a5dc 100644
index b0b25a5fae..11d4e4af0f 100644
--- a/applications/drive/src/.htaccess
+++ b/applications/drive/src/.htaccess
@@ -39,11 +39,13 @@ ErrorDocument 404 /assets/404.html
Header set X-Robots-Tag "noindex"
@@ -40,10 +40,12 @@ ErrorDocument 404 /assets/404.html
</Files>

+# <electron-mail-mark>
# The download service worker gets chunk hash appended to the end of the filename
+# <electron-mail-mark>
<Files ~ "^downloadSW">
Header set Service-Worker-Allowed "/"
Header set Service-Worker "script"
</Files>
+# </electron-mail-mark>

<IfModule mod_mime.c>
AddType application/font-woff2 .woff2
<IfModule mod_deflate.c>
AddOutputFilter INCLUDES;DEFLATE svg

diff --git a/applications/drive/src/app/store/_downloads/fileSaver/download.ts b/applications/drive/src/app/store/_downloads/fileSaver/download.ts
index 66a9aba1cc..2a7ab63889 100644
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,27 +149,55 @@ index 4c16c85b5..8b93c6084 100644
+}; /* </electron-mail-mark> */

diff --git a/packages/components/hooks/useGetEncryptionPreferences.ts b/packages/components/hooks/useGetEncryptionPreferences.ts
index fe83b9e8c..b944a61e8 100644
index dae0d635c7..6308e24fa9 100644
--- a/packages/components/hooks/useGetEncryptionPreferences.ts
+++ b/packages/components/hooks/useGetEncryptionPreferences.ts
@@ -24,7 +24,7 @@ const DEFAULT_LIFETIME = 5 * MINUTE;
* The logic for how those preferences are determined is laid out in the
* Confluence document 'Encryption preferences for outgoing email'
@@ -5,7 +5,7 @@ import { MINUTE, RECIPIENT_TYPES } from '@proton/shared/lib/constants';
import { getSelfSendAddresses } from '@proton/shared/lib/helpers/address';
import { canonicalizeEmail, canonicalizeInternalEmail } from '@proton/shared/lib/helpers/email';
import { KT_VERIFICATION_STATUS } from '@proton/shared/lib/interfaces';
-import { GetEncryptionPreferences } from '@proton/shared/lib/interfaces/hooks/GetEncryptionPreferences';
+import { GetEncryptionPreferences } from '@proton/shared/lib/interfaces/hooks/GetEncryptionPreferences'; /* <electron-mail-mark/> TODO "GetEncryptionPreferences" is used as a method signature */
import { getKeyHasFlagsToEncrypt } from '@proton/shared/lib/keys';
import { getActiveKeys } from '@proton/shared/lib/keys/getActiveKeys';
import { splitKeys } from '@proton/shared/lib/keys/keys';
@@ -31,7 +31,7 @@ const DEFAULT_LIFETIME = 5 * MINUTE;
* Confluence document 'Encryption preferences for outgoing email'.
* NB: the current logic does not handle internal address keys belonging to external accounts, since these keys are not used by Inbox.
*/
-const useGetEncryptionPreferences = () => {
+const useGetEncryptionPreferences = () => { /* <electron-mail-mark> */
+const useGetEncryptionPreferences = () => { /* <electron-mail-mark> TODO "GetEncryptionPreferences" is used as a method signature */
const api = useApi();
const cache = useCache();
const getAddresses = useGetAddresses();
@@ -87,6 +87,6 @@ const useGetEncryptionPreferences = () => {
@@ -109,6 +109,6 @@ const useGetEncryptionPreferences = () => {
},
[cache, getEncryptionPreferences]
);
-};
+}; /* </electron-mail-mark> */
+}; /* <electron-mail-mark> */

export default useGetEncryptionPreferences;

diff --git a/packages/shared/lib/interfaces/hooks/GetEncryptionPreferences.ts b/packages/shared/lib/interfaces/hooks/GetEncryptionPreferences.ts
index d31b0bf797..407bb22503 100644
--- a/packages/shared/lib/interfaces/hooks/GetEncryptionPreferences.ts
+++ b/packages/shared/lib/interfaces/hooks/GetEncryptionPreferences.ts
@@ -2,6 +2,7 @@ import { EncryptionPreferences } from '../../mail/encryptionPreferences';
import { ContactEmail } from '../contacts';

export type GetEncryptionPreferences = ({
+ /* <electron-mail-mark> TODO review signatures */
email,
intendedForEmail,
lifetime,
@@ -15,4 +16,4 @@ export type GetEncryptionPreferences = ({
intendedForEmail?: boolean;
lifetime?: number;
contactEmailsMap?: { [email: string]: ContactEmail | undefined };
-}) => Promise<EncryptionPreferences>;
+}) => Promise<EncryptionPreferences>;/* </electron-mail-mark> */

diff --git a/packages/components/hooks/useApi.ts b/packages/components/hooks/useApi.ts
index e2baface5..8b4317d5a 100644
--- a/packages/components/hooks/useApi.ts
Expand Down Expand Up @@ -346,20 +374,19 @@ index 0d29745777..0000000000
-export default MailDefaultHandlerModal;

diff --git a/applications/mail/src/app/components/header/search/MailSearch.tsx b/applications/mail/src/app/components/header/search/MailSearch.tsx
index 1736085ad3..5f102e159e 100644
index 9b542628da..f26b6a9ccc 100644
--- a/applications/mail/src/app/components/header/search/MailSearch.tsx
+++ b/applications/mail/src/app/components/header/search/MailSearch.tsx
@@ -3,7 +3,6 @@ import { useEffect, useState } from 'react';
@@ -3,21 +3,17 @@ import { useEffect, useState } from 'react';
import { Location } from 'history';

import {
- FeatureCode,
TopNavbarListItemSearchButton,
generateUID,
useAddresses,
@@ -11,14 +10,11 @@ import {
useFolders,
useLabels,
useMailSettings,
usePopperAnchor,
- useProgressiveRollout,
useToggle,
Expand All @@ -372,7 +399,7 @@ index 1736085ad3..5f102e159e 100644
import { extractSearchParameters } from '../../../helpers/mailboxUrl';
import { useClickMailContent } from '../../../hooks/useClickMailContent';
import { Breakpoints } from '../../../models/utils';
@@ -39,11 +35,9 @@ interface Props {
@@ -37,17 +33,15 @@ interface Props {

const MailSearch = ({ breakpoints, labelID, location, columnMode }: Props) => {
const [uid] = useState(generateUID('advanced-search-overlay'));
Expand All @@ -381,13 +408,11 @@ index 1736085ad3..5f102e159e 100644
const searchParams = extractSearchParameters(location);
const [searchInputValue, setSearchInputValue] = useState(searchParams.keyword || '');
- const [user] = useUser();
const [, loadingMailSettings] = useMailSettings();
const [, loadingLabels] = useLabels();
const [, loadingFolders] = useFolders();
@@ -51,7 +45,7 @@ const MailSearch = ({ breakpoints, labelID, location, columnMode }: Props) => {
const { getESDBStatus, cacheIndexedDB, closeDropdown } = useEncryptedSearchContext();
const { dropdownOpened } = getESDBStatus();
const esState = useEncryptedSearchToggleState(isOpen);
const [, loadingAddresses] = useAddresses();
const { esStatus, cacheIndexedDB, closeDropdown, esIndexingProgressState } = useEncryptedSearchContext();
const { dropdownOpened } = esStatus;
- const showEncryptedSearch = isEncryptedSearchAvailable(user, isESUserInterfaceAvailable);
+ const showEncryptedSearch = false;

Expand Down
File renamed without changes.
20 changes: 20 additions & 0 deletions patches/protonmail/common-7.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
diff --git a/packages/shared/lib/helpers/desktop.ts b/packages/shared/lib/helpers/desktop.ts
index 4696b429a7..fe63f75e55 100644
--- a/packages/shared/lib/helpers/desktop.ts
+++ b/packages/shared/lib/helpers/desktop.ts
@@ -1,13 +1,6 @@
-import UAParser from 'ua-parser-js';
-
import { isMac } from './browser';

-const uaParser = new UAParser();
-const ua = uaParser.getResult();
-
-export const isElectronApp = () => {
- return /electron/i.test(ua.ua);
-};
+export const isElectronApp = () => false;

export const isElectronOnMac = () => {
return isElectronApp() && isMac();

diff --git a/packages/components/containers/unleash/UnleashFlagProvider.tsx b/packages/components/containers/unleash/UnleashFlagProvider.tsx
index 1531d1450b..a8a8d44677 100644
--- a/packages/components/containers/unleash/UnleashFlagProvider.tsx
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
diff --git a/packages/shared/lib/helpers/desktop.ts b/packages/shared/lib/helpers/desktop.ts
index 4696b429a7..fe63f75e55 100644
--- a/packages/shared/lib/helpers/desktop.ts
+++ b/packages/shared/lib/helpers/desktop.ts
@@ -1,13 +1,6 @@
-import UAParser from 'ua-parser-js';
-
import { isMac } from './browser';

-const uaParser = new UAParser();
-const ua = uaParser.getResult();
-
-export const isElectronApp = () => {
- return /electron/i.test(ua.ua);
-};
+export const isElectronApp = () => false;

export const isElectronOnMac = () => {
return isElectronApp() && isMac();

diff --git a/packages/components/containers/unleash/UnleashFlagProvider.tsx b/packages/components/containers/unleash/UnleashFlagProvider.tsx
index 1531d1450b..a8a8d44677 100644
index e9adc4f7f1..2e8d0388fd 100644
--- a/packages/components/containers/unleash/UnleashFlagProvider.tsx
+++ b/packages/components/containers/unleash/UnleashFlagProvider.tsx
@@ -3,20 +3,21 @@ import { ReactNode } from 'react';
import FlagProvider from '@unleash/proxy-client-react';
import FlagProvider from '@protontech/proxy-client-react';
import { IConfig } from 'unleash-proxy-client';

-import { Api } from '@proton/shared/lib/interfaces';
Expand Down Expand Up @@ -153,10 +173,10 @@ index 36bd0c712..c2fb3681c 100644
return;
}

diff --git a/applications/mail/src/app/components/list/auto-delete/variations/AutoDeleteFreeBanner.tsx b/applications/mail/src/app/components/list/auto-delete/variations/AutoDeleteFreeBanner.tsx
diff --git a/applications/mail/src/app/components/list/banners/auto-delete/variations/AutoDeleteFreeBanner.tsx b/applications/mail/src/app/components/list/banners/auto-delete/variations/AutoDeleteFreeBanner.tsx
index 24c56ef6fe..a6046b391c 100644
--- a/applications/mail/src/app/components/list/auto-delete/variations/AutoDeleteFreeBanner.tsx
+++ b/applications/mail/src/app/components/list/auto-delete/variations/AutoDeleteFreeBanner.tsx
--- a/applications/mail/src/app/components/list/banners/auto-delete/variations/AutoDeleteFreeBanner.tsx
+++ b/applications/mail/src/app/components/list/banners/auto-delete/variations/AutoDeleteFreeBanner.tsx
@@ -7,6 +7,10 @@ import { AutoDeleteUpsellModal, useModalState } from '@proton/components/compone
import { PromotionBanner } from '@proton/components/containers';

Expand All @@ -170,26 +190,25 @@ index 24c56ef6fe..a6046b391c 100644
return (

diff --git a/applications/mail/src/app/hooks/useShowUpsellBanner.ts b/applications/mail/src/app/hooks/useShowUpsellBanner.ts
index d203f913fa..178153c592 100644
index b82b7ae976..0907c85ec6 100644
--- a/applications/mail/src/app/hooks/useShowUpsellBanner.ts
+++ b/applications/mail/src/app/hooks/useShowUpsellBanner.ts
@@ -33,6 +33,7 @@ const useShowUpsellBanner = (labelID: string, otherBannerDisplayed: boolean) =>
@@ -33,12 +33,14 @@ const useShowUpsellBanner = (labelID: string) => {
- No other banner is shown in the message list
- If a value is found in the localStorage that should trigger a new display
*/
+ /* <electron-mail-mark> */
const canDisplayUpsellBanner =
user.isFree &&
Date.now() > threeDaysAfterCreationDate &&
@@ -40,6 +41,7 @@ const useShowUpsellBanner = (labelID: string, otherBannerDisplayed: boolean) =>
isInbox &&
needToShowUpsellBanner.current &&
!otherBannerDisplayed &&
showAgain;
+ /* </electron-mail-mark> */

const handleDismissBanner = () => {
// Set the ref to false so that we hide the banner and update the localStorage value
@@ -72,6 +74,10 @@ const useShowUpsellBanner = (labelID: string, otherBannerDisplayed: boolean) =>
@@ -71,6 +73,10 @@ const useShowUpsellBanner = (labelID: string) => {
}
}, []);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
diff --git a/packages/shared/lib/helpers/desktop.ts b/packages/shared/lib/helpers/desktop.ts
new file mode 100644
index 0000000000..6ece6922a0
--- /dev/null
+++ b/packages/shared/lib/helpers/desktop.ts
@@ -0,0 +1,3 @@
+/* <electron-mail-mark> */
+// TODO remove when ./packages/shared/lib/helpers/desktop.ts gets added for the "drive" app
+/* </electron-mail-mark> */

diff --git a/packages/components/containers/unleash/UnleashFlagProvider.tsx b/packages/components/containers/unleash/UnleashFlagProvider.tsx
index c3e007aa4b..f51a74683e 100644
--- a/packages/components/containers/unleash/UnleashFlagProvider.tsx
Expand Down Expand Up @@ -120,10 +130,10 @@ index 36bd0c712..c2fb3681c 100644
return;
}

diff --git a/applications/mail/src/app/components/list/auto-delete/variations/AutoDeleteFreeBanner.tsx b/applications/mail/src/app/components/list/auto-delete/variations/AutoDeleteFreeBanner.tsx
diff --git a/applications/mail/src/app/components/list/banners/auto-delete/variations/AutoDeleteFreeBanner.tsx b/applications/mail/src/app/components/list/banners/auto-delete/variations/AutoDeleteFreeBanner.tsx
index 24c56ef6fe..a6046b391c 100644
--- a/applications/mail/src/app/components/list/auto-delete/variations/AutoDeleteFreeBanner.tsx
+++ b/applications/mail/src/app/components/list/auto-delete/variations/AutoDeleteFreeBanner.tsx
--- a/applications/mail/src/app/components/list/banners/auto-delete/variations/AutoDeleteFreeBanner.tsx
+++ b/applications/mail/src/app/components/list/banners/auto-delete/variations/AutoDeleteFreeBanner.tsx
@@ -7,6 +7,10 @@ import { AutoDeleteUpsellModal, useModalState } from '@proton/components/compone
import { PromotionBanner } from '@proton/components/containers';

Expand All @@ -137,26 +147,25 @@ index 24c56ef6fe..a6046b391c 100644
return (

diff --git a/applications/mail/src/app/hooks/useShowUpsellBanner.ts b/applications/mail/src/app/hooks/useShowUpsellBanner.ts
index d203f913fa..178153c592 100644
index b82b7ae976..0907c85ec6 100644
--- a/applications/mail/src/app/hooks/useShowUpsellBanner.ts
+++ b/applications/mail/src/app/hooks/useShowUpsellBanner.ts
@@ -33,6 +33,7 @@ const useShowUpsellBanner = (labelID: string, otherBannerDisplayed: boolean) =>
@@ -33,12 +33,14 @@ const useShowUpsellBanner = (labelID: string) => {
- No other banner is shown in the message list
- If a value is found in the localStorage that should trigger a new display
*/
+ /* <electron-mail-mark> */
const canDisplayUpsellBanner =
user.isFree &&
Date.now() > threeDaysAfterCreationDate &&
@@ -40,6 +41,7 @@ const useShowUpsellBanner = (labelID: string, otherBannerDisplayed: boolean) =>
isInbox &&
needToShowUpsellBanner.current &&
!otherBannerDisplayed &&
showAgain;
+ /* </electron-mail-mark> */

const handleDismissBanner = () => {
// Set the ref to false so that we hide the banner and update the localStorage value
@@ -72,6 +74,10 @@ const useShowUpsellBanner = (labelID: string, otherBannerDisplayed: boolean) =>
@@ -71,6 +73,10 @@ const useShowUpsellBanner = (labelID: string) => {
}
}, []);

Expand Down
24 changes: 24 additions & 0 deletions patches/protonmail/constants-11.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/packages/shared/lib/constants.ts b/packages/shared/lib/constants.ts
index 5481e3f8e4..a5634acd3b 100644
--- a/packages/shared/lib/constants.ts
+++ b/packages/shared/lib/constants.ts
@@ -82,7 +82,7 @@ interface AppConfiguration {

export const APPS_CONFIGURATION: { [key in APP_NAMES]: AppConfiguration } = {
[APPS.PROTONACCOUNT]: {
- publicPath: '',
+ publicPath: '/account',
subdomain: 'account',
name: 'Proton Account',
bareName: 'Account',
@@ -180,8 +180,8 @@ export const APPS_CONFIGURATION: { [key in APP_NAMES]: AppConfiguration } = {
settingsSlug: '',
},
[APPS.PROTONVPN_SETTINGS]: {
- publicPath: '',
- subdomain: '',
+ publicPath: 'account/vpn',
+ subdomain: 'account',
name: VPN_APP_NAME,
bareName: VPN_SHORT_APP_NAME,
webClientID: 'web-vpn-settings',
Loading

0 comments on commit 59b8822

Please sign in to comment.