Skip to content

Commit cd3a4a1

Browse files
committed
refactor: use Phoenix.isNativeApp instead of Phoenix.browser.isTauri
1 parent 81b50d1 commit cd3a4a1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+120
-120
lines changed

src/assets/new-project/assets/js/new-project-from-url.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function _setupNavigation() {
165165

166166
function initNewProjectFromURL() {
167167
_setupNavigation();
168-
if(window.parent.Phoenix.browser.isTauri){ // desktop builds
168+
if(window.parent.Phoenix.isNativeApp){ // desktop builds
169169
projectLocation = newProjectExtension.getLocalProjectsPath();
170170
projectName = PARAM_SUGGESTED_NAME;
171171
$(document.getElementById("createProjectBtn")).addClass("forced-inVisible");

src/brackets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ define(function (require, exports, module) {
421421
// Add the platform (mac, win or linux) to the body tag so we can have platform-specific CSS rules
422422
const $body = $("body");
423423
$body.addClass("platform-" + brackets.platform);
424-
if(Phoenix.browser.isTauri){
424+
if(Phoenix.isNativeApp){
425425
$body.addClass("tauri");
426426
}
427427

src/command/DefaultMenus.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ define(function (require, exports, module) {
6363
}
6464
}
6565

66-
const isBrowser = !Phoenix.browser.isTauri;
67-
const isDesktop = Phoenix.browser.isTauri;
66+
const isBrowser = !Phoenix.isNativeApp;
67+
const isDesktop = Phoenix.isNativeApp;
6868
const fileNewShortcut = isDesktop ? "Ctrl-N" : ""; // Ctrl-1 universal shortcut is set in keyboard.json
6969
//`Ctrl-Shift-N` - desktop only. In browser, use can do `ctrl-T` and type phcode.dev using browser shortcuts itself. So we dont make a browser shortcut for this.
7070
const fileNewWindowShortcut = isDesktop ? "Ctrl-Shift-N" : "";
@@ -113,7 +113,7 @@ define(function (require, exports, module) {
113113
menu.addMenuItem(Commands.FILE_NEW_FOLDER);
114114
menu.addMenuItem(Commands.FILE_NEW_WINDOW, fileNewWindowShortcut);
115115
menu.addMenuDivider();
116-
if(Phoenix.browser.isTauri){
116+
if(Phoenix.isNativeApp){
117117
menu.addMenuItem(Commands.FILE_OPEN, openFileShortcut);
118118
}
119119
menu.addMenuItem(Commands.FILE_OPEN_FOLDER, openFolderShortcut);
@@ -130,7 +130,7 @@ define(function (require, exports, module) {
130130
// menu.addMenuItem(Commands.FILE_PROJECT_SETTINGS); not yet available in phoenix
131131
menu.addMenuDivider();
132132
menu.addMenuItem(Commands.FILE_EXTENSION_MANAGER);
133-
if(Phoenix.browser.isTauri){
133+
if(Phoenix.isNativeApp){
134134
menu.addMenuDivider();
135135
menu.addMenuItem(Commands.FILE_QUIT);
136136
}
@@ -146,7 +146,7 @@ define(function (require, exports, module) {
146146
// TODO: add js handlers for copy and paste using browser standards.
147147
menu.addMenuItem(Commands.EDIT_CUT);
148148
menu.addMenuItem(Commands.EDIT_COPY);
149-
if(window.Phoenix.browser.isTauri || !window.Phoenix.browser.desktop.isFirefox){
149+
if(window.Phoenix.isNativeApp || !window.Phoenix.browser.desktop.isFirefox){
150150
menu.addMenuItem(Commands.EDIT_PASTE);
151151
}
152152
menu.addMenuDivider();
@@ -288,7 +288,7 @@ define(function (require, exports, module) {
288288
var workingset_cmenu = Menus.registerContextMenu(Menus.ContextMenuIds.WORKING_SET_CONTEXT_MENU);
289289
workingset_cmenu.addMenuItem(Commands.FILE_SAVE);
290290
workingset_cmenu.addMenuItem(Commands.NAVIGATE_SHOW_IN_FILE_TREE);
291-
if(Phoenix.browser.isTauri){
291+
if(Phoenix.isNativeApp){
292292
workingset_cmenu.addMenuItem(Commands.NAVIGATE_SHOW_IN_OS);
293293
}
294294
workingset_cmenu.addMenuDivider();
@@ -322,7 +322,7 @@ define(function (require, exports, module) {
322322
var project_cmenu = Menus.registerContextMenu(Menus.ContextMenuIds.PROJECT_MENU);
323323
project_cmenu.addMenuItem(Commands.FILE_NEW);
324324
project_cmenu.addMenuItem(Commands.FILE_NEW_FOLDER);
325-
if(Phoenix.browser.isTauri){
325+
if(Phoenix.isNativeApp){
326326
project_cmenu.addMenuItem(Commands.NAVIGATE_SHOW_IN_OS);
327327
}
328328
project_cmenu.addMenuDivider();
@@ -352,7 +352,7 @@ define(function (require, exports, module) {
352352
editor_cmenu.addMenuDivider();
353353
editor_cmenu.addMenuItem(Commands.EDIT_CUT);
354354
editor_cmenu.addMenuItem(Commands.EDIT_COPY);
355-
if(window.Phoenix.browser.isTauri || !window.Phoenix.browser.desktop.isFirefox){
355+
if(window.Phoenix.isNativeApp || !window.Phoenix.browser.desktop.isFirefox){
356356
editor_cmenu.addMenuItem(Commands.EDIT_PASTE);
357357
}
358358
editor_cmenu.addMenuDivider();

src/document/DocumentCommandHandlers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2118,7 +2118,7 @@ define(function (require, exports, module) {
21182118

21192119
let isTestWindow = (new window.URLSearchParams(window.location.search || "")).get("testEnvironment");
21202120
if (!isTestWindow) {
2121-
if(Phoenix.browser.isTauri) {
2121+
if(Phoenix.isNativeApp) {
21222122
attachTauriUnloadHandler();
21232123
} else {
21242124
attachBrowserUnloadHandler();

src/extensibility/ExtensionManagerView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ define(function (require, exports, module) {
514514
// save to metric id as it is from public extension store.
515515
Metrics.countEvent(Metrics.EVENT_TYPE.EXTENSIONS, "update", id);
516516
InstallExtensionDialog.updateUsingDialog(url).done((installResult)=>{
517-
if(Phoenix.browser.isTauri) {
517+
if(Phoenix.isNativeApp) {
518518
// in tauri, due to browser cache for asset urls, updates to extensions will still load old
519519
// extension through the http cache. So we show a restart app for the update to take effect
520520
// message.

src/extensions/default/DebugCommands/main.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ define(function (require, exports, module) {
800800
});
801801
debugMenu.addMenuDivider();
802802
// Show Developer Tools (optionally enabled)
803-
if(Phoenix.browser.isTauri){
803+
if(Phoenix.isNativeApp){
804804
CommandManager.register(Strings.CMD_SHOW_DEV_TOOLS, DEBUG_SHOW_DEVELOPER_TOOLS, _handleShowDeveloperTools);
805805
debugMenu.addMenuItem(DEBUG_SHOW_DEVELOPER_TOOLS, KeyboardPrefs.showDeveloperTools);
806806
}
@@ -827,13 +827,13 @@ define(function (require, exports, module) {
827827
CommandManager.get(DEBUG_UNLOAD_CURRENT_EXTENSION)
828828
.setEnabled(extensionDevelopment.isProjectLoadedAsExtension());
829829
CommandManager.get(DEBUG_OPEN_EXTENSION_FOLDER)
830-
.setEnabled(Phoenix.browser.isTauri); // only show in tauri
830+
.setEnabled(Phoenix.isNativeApp); // only show in tauri
831831
CommandManager.get(DEBUG_ENABLE_PHNODE_INSPECTOR)
832-
.setEnabled(Phoenix.browser.isTauri); // only show in tauri
832+
.setEnabled(Phoenix.isNativeApp); // only show in tauri
833833
CommandManager.get(DEBUG_GET_PHNODE_INSPECTOR_URL)
834-
.setEnabled(Phoenix.browser.isTauri); // only show in tauri
834+
.setEnabled(Phoenix.isNativeApp); // only show in tauri
835835
CommandManager.get(DEBUG_OPEN_VIRTUAL_SERVER)
836-
.setEnabled(!Phoenix.browser.isTauri); // don't show in tauri as there is no virtual server in tauri
836+
.setEnabled(!Phoenix.isNativeApp); // don't show in tauri as there is no virtual server in tauri
837837

838838
_updateLogToConsoleMenuItemChecked();
839839

src/extensions/default/HealthData/SendToAnalytics.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ define(function (require, exports, module) {
115115
Metrics.countEvent(PLATFORM, "languageOS", brackets.app.language);
116116
Metrics.countEvent(PLATFORM, "languageBrackets", brackets.getLocale());
117117
Metrics.countEvent(PLATFORM, "bracketsVersion", brackets.metadata.version);
118-
if(Phoenix.platform === "linux" && Phoenix.browser.isTauri) {
118+
if(Phoenix.platform === "linux" && Phoenix.isNativeApp) {
119119
NodeUtils.getLinuxOSFlavorName()
120120
.then(flavor=>{
121121
if(flavor){
@@ -160,7 +160,7 @@ define(function (require, exports, module) {
160160
Metrics.valueEvent(PERFORMANCE, "startup", "PhStore", PhStore._storageBootstrapTime);
161161
_bugsnagPerformance("PhStore",
162162
PhStore._storageBootstrapTime); // expensive api, use sparsely
163-
if(Phoenix.browser.isTauri) {
163+
if(Phoenix.isNativeApp) {
164164
Metrics.valueEvent(PERFORMANCE, "startup", "tauriBoot", window._tauriBootVars.bootstrapTime);
165165
_bugsnagPerformance("tauriBootVars",
166166
window._tauriBootVars.bootstrapTime); // expensive api, use sparsely

src/extensions/default/UrlCodeHints/unittests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ define(function (require, exports, module) {
706706
EditorManager;
707707

708708
it("should hint site root '/'", async function () {
709-
if(Phoenix.browser.isTauri && Phoenix.platform === "linux") {
709+
if(Phoenix.isNativeApp && Phoenix.platform === "linux") {
710710
// This tests breaks in github actions only in linux desktop builds for no reason i can fid out.
711711
// no problem if we try to run it locally.
712712
// so we disable this tests in linux desktop builds for now.

src/extensionsIntegrated/InAppNotifications/utils.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ define(function (require, exports, module) {
3030
function isValidForThisPlatform(platformFilter) {
3131
platformFilter = platformFilter.split(",");
3232
if(platformFilter.includes("all")
33-
|| (platformFilter.includes(brackets.platform) && Phoenix.browser.isTauri) // win linux and mac is only for tauri and not for browser in platform
34-
|| (platformFilter.includes("allDesktop") && Phoenix.browser.isTauri)
35-
|| (platformFilter.includes("firefox") && Phoenix.browser.desktop.isFirefox && !Phoenix.browser.isTauri)
36-
|| (platformFilter.includes("chrome") && Phoenix.browser.desktop.isChromeBased && !Phoenix.browser.isTauri)
37-
|| (platformFilter.includes("safari") && Phoenix.browser.desktop.isSafari && !Phoenix.browser.isTauri)
38-
|| (platformFilter.includes("allBrowser") && !Phoenix.browser.isTauri)){
33+
|| (platformFilter.includes(brackets.platform) && Phoenix.isNativeApp) // win linux and mac is only for tauri and not for browser in platform
34+
|| (platformFilter.includes("allDesktop") && Phoenix.isNativeApp)
35+
|| (platformFilter.includes("firefox") && Phoenix.browser.desktop.isFirefox && !Phoenix.isNativeApp)
36+
|| (platformFilter.includes("chrome") && Phoenix.browser.desktop.isChromeBased && !Phoenix.isNativeApp)
37+
|| (platformFilter.includes("safari") && Phoenix.browser.desktop.isSafari && !Phoenix.isNativeApp)
38+
|| (platformFilter.includes("allBrowser") && !Phoenix.isNativeApp)){
3939
return true;
4040
}
4141
return false;

src/extensionsIntegrated/Phoenix-live-preview/BrowserStaticServer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ define(function (require, exports, module) {
123123
// live previews into its own domain apart from phcode.dev. Since safari doesn't support this, we are left
124124
// with using phcode.dev domain directly for live previews. That is a large attack surface for untrusted
125125
// code execution. so we will disable live previews in safari instead of shipping a security vulnerability.
126-
return Phoenix.browser.isTauri || !(Phoenix.browser.desktop.isSafari || Phoenix.browser.mobile.isIos);
126+
return Phoenix.isNativeApp || !(Phoenix.browser.desktop.isSafari || Phoenix.browser.mobile.isIos);
127127
}
128128

129129
/**

0 commit comments

Comments
 (0)