Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14864795
D14478.id42176.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D14478.id42176.diff
View Options
diff --git a/cashtab/src/components/App.js b/cashtab/src/components/App.js
--- a/cashtab/src/components/App.js
+++ b/cashtab/src/components/App.js
@@ -41,6 +41,7 @@
import { checkForTokenById } from 'utils/tokenMethods.js';
import ServiceWorkerWrapper from './Common/ServiceWorkerWrapper';
import aliasSettings from 'config/alias';
+import appConfig from 'config/app';
const GlobalStyle = createGlobalStyle`
*::placeholder {
@@ -488,6 +489,16 @@
}
};
+ const getExtensionInstallationStatus = async () => {
+ // Wait 2s to check
+ // window.bitcoinAbc is set by the extension, and is undefined on page load
+ // We will also want to wait for some configurable interval anyway, so that the page
+ // does not load with a popup
+ const popupWaitInterval = 2000;
+ await new Promise(resolve => setTimeout(resolve, popupWaitInterval));
+ return window && window.bitcoinAbc && window.bitcoinAbc === 'cashtab';
+ };
+
// Easter egg boolean not used in extension/src/components/App.js
const hasTab = validWallet
? checkForTokenById(
@@ -496,8 +507,17 @@
)
: false;
- useEffect(() => {
+ useEffect(async () => {
checkForPersistentStorage();
+ if (appConfig.monitorExtension) {
+ const extensionInstalled = await getExtensionInstallationStatus();
+ // TODO if false and other conditions are met, show popup advertising browser extension
+ console.log(
+ `Cashtab browser extension: ${
+ extensionInstalled ? 'Installed' : 'Not installed'
+ }`,
+ );
+ }
}, []);
return (
diff --git a/cashtab/src/config/app.js b/cashtab/src/config/app.js
--- a/cashtab/src/config/app.js
+++ b/cashtab/src/config/app.js
@@ -21,6 +21,7 @@
notificationDurationShort: 3,
notificationDurationLong: 5,
localStorageMaxCharacters: 24,
+ monitorExtension: false,
};
export default appConfig;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 20, 22:25 (18 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5866057
Default Alt Text
D14478.id42176.diff (1 KB)
Attached To
D14478: [Cashtab] Check if user has browser extension installed
Event Timeline
Log In to Comment