Skip to content

Commit d0f1e32

Browse files
committed
feat: alert safari users of 7 day data delete policy of safari
1 parent f3c4517 commit d0f1e32

File tree

5 files changed

+23
-18
lines changed

5 files changed

+23
-18
lines changed

src/extensions/default/Phoenix/main.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ define(function (require, exports, module) {
3131
AppInit = brackets.getModule("utils/AppInit"),
3232
Strings = brackets.getModule("strings"),
3333
Dialogs = brackets.getModule("widgets/Dialogs"),
34-
Mustache = brackets.getModule("thirdparty/mustache/mustache"),
34+
NotificationUI = brackets.getModule("widgets/NotificationUI"),
3535
DefaultDialogs = brackets.getModule("widgets/DefaultDialogs");
3636

3737
const PERSIST_STORAGE_DIALOG_DELAY_SECS = 60000;
@@ -64,21 +64,28 @@ define(function (require, exports, module) {
6464
);
6565
return;
6666
}
67+
Dialogs.showModalDialog(
68+
DefaultDialogs.DIALOG_ID_ERROR,
69+
Strings.UNSUPPORTED_BROWSER_TITLE,
70+
Strings.UNSUPPORTED_BROWSER_MESSAGE
71+
);
6772
if (!("serviceWorker" in navigator)) {
6873
// service worker is required for phcode to work
69-
Dialogs.showModalDialog(
70-
DefaultDialogs.DIALOG_ID_ERROR,
71-
Strings.UNSUPPORTED_BROWSER_TITLE,
72-
Strings.UNSUPPORTED_BROWSER_MESSAGE
73-
);
74-
throw new Error("Service worker is not supported by the browser.");
74+
throw new Error("Service worker is not supported by the browser. Phcode cannot continue.");
7575
}
7676
}
7777

7878
function _detectUnSupportedBrowser() {
7979
if(!Phoenix.isSupportedBrowser){
8080
_showUnSupportedBrowserDialogue();
8181
}
82+
if(Phoenix.browser.desktop.isSafari || Phoenix.browser.mobile.isIos) {
83+
NotificationUI.createToastFromTemplate( Strings.ATTENTION_SAFARI_USERS,
84+
Strings.ATTENTION_SAFARI_USERS_MESSAGE, {
85+
dismissOnClick: false,
86+
toastStyle: NotificationUI.NOTIFICATION_STYLES_CSS_CLASS.DANGER
87+
});
88+
}
8289
}
8390

8491
async function _persistBrowserStorage() {

src/index.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,7 @@
120120
firstBoot: false, // will be set below
121121
startTime: Date.now()
122122
};
123-
Phoenix.isSupportedBrowser = Phoenix.browser.isDeskTop &&
124-
(Phoenix.browser.desktop.isChrome || Phoenix.browser.desktop.isEdgeChromium
125-
|| Phoenix.browser.desktop.isOperaChromium);
123+
Phoenix.isSupportedBrowser = Phoenix.browser.isDeskTop && ("serviceWorker" in navigator);
126124
window.testEnvironment = window.Phoenix.isTestWindow;
127125
}());
128126
</script>

src/nls/root/strings.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,8 @@ define({
962962
"UNSUPPORTED_BROWSER_MOBILE": "Mobile and Tablet browsers are currently not fully supported. You may close this dialogue, but some features in Phoenix will not work in this browser. <br/><br/>We are working on developing native apps for iOS and Android. <a href=\"https://github.com/phcode-dev/phoenix/discussions/1046\" target=\"_blank\">Join the discussion here!</a>",
963963
"UNSUPPORTED_BROWSER_OPEN_FOLDER_TITLE": "Local Folder Access Unsupported by Browser",
964964
"UNSUPPORTED_BROWSER_OPEN_FOLDER": "Sorry, it looks like your current browser doesn't support opening local folders. For this feature, we recommend using Chrome, Edge, or Opera. <br/><br/>Alternatively, we're working on developing native apps for Windows, Mac, Linux, iOS, and Android to provide full support. <a href=\"https://github.com/phcode-dev/phoenix/discussions/1047\" target=\"_blank\">Stay tuned for updates!</a>",
965+
"ATTENTION_SAFARI_USERS": "Attention Safari Users",
966+
"ATTENTION_SAFARI_USERS_MESSAGE": "<span>Safari automatically deletes website data if a site is not revisited within 7 days. {APP_NAME} relies on browser storage to save your projects, which may be removed due to this policy. <br/> <br/><strong>To prevent data loss</strong>, please <strong>download</strong> your projects before closing the tab or stay tuned for our <strong>upcoming Web and native Mac/iOS apps</strong>.</span>",
965967
"CANNOT_PUBLISH_LARGE_PROJECT": "Cannot Publish Large Project",
966968
"CANNOT_PUBLISH_LARGE_PROJECT_MESSAGE": "Phoenix is still in experimental alpha. We have not yet enabled sync of projects with greater than 500 files.",
967969
"SHARE_WEBSITE": "Publish and Share Website?",

src/styles/brackets.less

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2683,7 +2683,7 @@ label input {
26832683
box-shadow: 0 0 20px rgba(0, 0, 0, 0.24);
26842684
padding: 9px 12px 9px 12px;
26852685
font-family: "SourceSansPro", serif;
2686-
color: black;
2686+
color: black; // text color
26872687
line-height: 1.5;
26882688
margin-top: 7px;
26892689

@@ -2692,6 +2692,10 @@ label input {
26922692
transform: translateY(-50px);
26932693
}
26942694

2695+
.notification-dialog-content strong {
2696+
color: black; // text color
2697+
}
2698+
26952699
.notification-popup-container.style-danger {
26962700
background: var(--bc-toast-danger-bg-color);
26972701
}
@@ -2740,10 +2744,6 @@ label input {
27402744
font-weight: bold;
27412745
}
27422746

2743-
.notification-dialog-content strong {
2744-
color: white;
2745-
}
2746-
27472747
.notification-dialog-content a {
27482748
color: #00ccff;
27492749
}

test/SpecRunner.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,7 @@
108108
firstBoot: false, // will be set below
109109
startTime: Date.now()
110110
};
111-
Phoenix.isSupportedBrowser = Phoenix.browser.isDeskTop &&
112-
(Phoenix.browser.desktop.isChrome || Phoenix.browser.desktop.isEdgeChromium
113-
|| Phoenix.browser.desktop.isOperaChromium);
111+
Phoenix.isSupportedBrowser = Phoenix.browser.isDeskTop;
114112
window.testEnvironment = window.Phoenix.isTestWindow;
115113
}());
116114
</script>

0 commit comments

Comments
 (0)