remove platform specific background scripts

This commit is contained in:
ivan grachev 2023-12-06 17:11:22 +03:00
parent c015e5e1a4
commit abc7f371ef
6 changed files with 11 additions and 26 deletions

View File

@ -171,6 +171,15 @@ function genId() {
return new Date().getTime() + Math.floor(Math.random() * 1000); return new Date().getTime() + Math.floor(Math.random() * 1000);
} }
const isMobile = false; // TODO: setup from platform-specific content script
function didCompleteRequest(id, tabId) {
if (isMobile) {
browser.tabs.update(tabId, { active: true });
const request = {id: id, subject: "didCompleteRequest"};
browser.runtime.sendNativeMessage("mac.tokenary.io", request);
}
}
// MARK: - iOS extension popup // MARK: - iOS extension popup
var pendingPopupRequest = null; var pendingPopupRequest = null;

View File

@ -1,9 +0,0 @@
// Copyright © 2022 Tokenary. All rights reserved.
const isMobile = true;
function didCompleteRequest(id, tabId) {
browser.tabs.update(tabId, { active: true });
const request = {id: id, subject: "didCompleteRequest"};
browser.runtime.sendNativeMessage("mac.tokenary.io", request);
}

View File

@ -15,7 +15,7 @@
}, },
"background": { "background": {
"scripts": [ "background.js", "ios-specific-background.js" ], "scripts": [ "background.js" ],
"persistent": false "persistent": false
}, },

View File

@ -1,7 +0,0 @@
// Copyright © 2022 Tokenary. All rights reserved.
const isMobile = false;
function didCompleteRequest(id, tabId) {
}

View File

@ -15,7 +15,7 @@
}, },
"background": { "background": {
"scripts": [ "background.js", "macos-specific-background.js" ], "scripts": [ "background.js" ],
"persistent": true "persistent": true
}, },

View File

@ -172,8 +172,6 @@
2CC89471269A334A00879245 /* UserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CC89470269A334A00879245 /* UserDefaults.swift */; }; 2CC89471269A334A00879245 /* UserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CC89470269A334A00879245 /* UserDefaults.swift */; };
2CC8C5A22767D3B30083FB1B /* GasPriceSliderTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CC8C5A02767D3B30083FB1B /* GasPriceSliderTableViewCell.swift */; }; 2CC8C5A22767D3B30083FB1B /* GasPriceSliderTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CC8C5A02767D3B30083FB1B /* GasPriceSliderTableViewCell.swift */; };
2CC8C5A32767D3B30083FB1B /* GasPriceSliderTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2CC8C5A12767D3B30083FB1B /* GasPriceSliderTableViewCell.xib */; }; 2CC8C5A32767D3B30083FB1B /* GasPriceSliderTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2CC8C5A12767D3B30083FB1B /* GasPriceSliderTableViewCell.xib */; };
2CC8C5A5276A52670083FB1B /* ios-specific-background.js in Resources */ = {isa = PBXBuildFile; fileRef = 2CC8C5A4276A52670083FB1B /* ios-specific-background.js */; };
2CC8C5A7276A54DA0083FB1B /* macos-specific-background.js in Resources */ = {isa = PBXBuildFile; fileRef = 2CC8C5A6276A54DA0083FB1B /* macos-specific-background.js */; };
2CC8C5AC276A7EF70083FB1B /* EthereumNetwork.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C9F0B6726BDCB2E008FA3D6 /* EthereumNetwork.swift */; }; 2CC8C5AC276A7EF70083FB1B /* EthereumNetwork.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C9F0B6726BDCB2E008FA3D6 /* EthereumNetwork.swift */; };
2CC8C5AD276A7EF80083FB1B /* EthereumNetwork.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C9F0B6726BDCB2E008FA3D6 /* EthereumNetwork.swift */; }; 2CC8C5AD276A7EF80083FB1B /* EthereumNetwork.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C9F0B6726BDCB2E008FA3D6 /* EthereumNetwork.swift */; };
2CC8C5B4276A96760083FB1B /* Haptic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CC8C5B3276A96760083FB1B /* Haptic.swift */; }; 2CC8C5B4276A96760083FB1B /* Haptic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CC8C5B3276A96760083FB1B /* Haptic.swift */; };
@ -433,8 +431,6 @@
2CC89470269A334A00879245 /* UserDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaults.swift; sourceTree = "<group>"; }; 2CC89470269A334A00879245 /* UserDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaults.swift; sourceTree = "<group>"; };
2CC8C5A02767D3B30083FB1B /* GasPriceSliderTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GasPriceSliderTableViewCell.swift; sourceTree = "<group>"; }; 2CC8C5A02767D3B30083FB1B /* GasPriceSliderTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GasPriceSliderTableViewCell.swift; sourceTree = "<group>"; };
2CC8C5A12767D3B30083FB1B /* GasPriceSliderTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GasPriceSliderTableViewCell.xib; sourceTree = "<group>"; }; 2CC8C5A12767D3B30083FB1B /* GasPriceSliderTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GasPriceSliderTableViewCell.xib; sourceTree = "<group>"; };
2CC8C5A4276A52670083FB1B /* ios-specific-background.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "ios-specific-background.js"; sourceTree = "<group>"; };
2CC8C5A6276A54DA0083FB1B /* macos-specific-background.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "macos-specific-background.js"; sourceTree = "<group>"; };
2CC8C5B3276A96760083FB1B /* Haptic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Haptic.swift; sourceTree = "<group>"; }; 2CC8C5B3276A96760083FB1B /* Haptic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Haptic.swift; sourceTree = "<group>"; };
2CCEB82D27594E2A00768473 /* Safari iOS.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Safari iOS.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; 2CCEB82D27594E2A00768473 /* Safari iOS.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Safari iOS.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
2CCEB83627594E2A00768473 /* manifest.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = manifest.json; sourceTree = "<group>"; }; 2CCEB83627594E2A00768473 /* manifest.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = manifest.json; sourceTree = "<group>"; };
@ -573,7 +569,6 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
2C09CBA8273979C1009AD39B /* manifest.json */, 2C09CBA8273979C1009AD39B /* manifest.json */,
2CC8C5A6276A54DA0083FB1B /* macos-specific-background.js */,
); );
path = Resources; path = Resources;
sourceTree = "<group>"; sourceTree = "<group>";
@ -921,7 +916,6 @@
2C8155692ADFC7B900F4559B /* popup.js */, 2C8155692ADFC7B900F4559B /* popup.js */,
2C81556C2ADFC7C400F4559B /* popup.html */, 2C81556C2ADFC7C400F4559B /* popup.html */,
2CFDDF4D2765417D00F89019 /* ios-specific-content.js */, 2CFDDF4D2765417D00F89019 /* ios-specific-content.js */,
2CC8C5A4276A52670083FB1B /* ios-specific-background.js */,
); );
path = Resources; path = Resources;
sourceTree = "<group>"; sourceTree = "<group>";
@ -1281,7 +1275,6 @@
files = ( files = (
2CB3845C27654EB300A189B9 /* _locales in Resources */, 2CB3845C27654EB300A189B9 /* _locales in Resources */,
2CB3845D27654EB300A189B9 /* images in Resources */, 2CB3845D27654EB300A189B9 /* images in Resources */,
2CC8C5A7276A54DA0083FB1B /* macos-specific-background.js in Resources */,
2CEFEB16274D5DCA00CE23BD /* inpage.js in Resources */, 2CEFEB16274D5DCA00CE23BD /* inpage.js in Resources */,
2C09CBAB273979C1009AD39B /* background.js in Resources */, 2C09CBAB273979C1009AD39B /* background.js in Resources */,
2C09CBA9273979C1009AD39B /* manifest.json in Resources */, 2C09CBA9273979C1009AD39B /* manifest.json in Resources */,
@ -1324,7 +1317,6 @@
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
2CC8C5A5276A52670083FB1B /* ios-specific-background.js in Resources */,
2CB3845A27654EA900A189B9 /* _locales in Resources */, 2CB3845A27654EA900A189B9 /* _locales in Resources */,
2CB3845B27654EA900A189B9 /* images in Resources */, 2CB3845B27654EA900A189B9 /* images in Resources */,
2CE0594027640E8E0042D844 /* background.js in Resources */, 2CE0594027640E8E0042D844 /* background.js in Resources */,