MCPcopy
hub / github.com/refined-github/refined-github / showWelcomePage

Function showWelcomePage

source/background.ts:86–108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

84});
85
86async function showWelcomePage(): Promise<void> {
87 if (await welcomeShown.get()) {
88 return;
89 }
90
91 const [hasStoredToken, hasPermissions] = await Promise.all([
92 hasToken(), // We can't handle an invalid token on a "Welcome" page, so just check whether the user has ever set one
93 chrome.permissions.contains({origins: ['https://github.com/*']}),
94 ]);
95
96 try {
97 if (hasStoredToken && hasPermissions) {
98 // Mark as welcomed
99 return;
100 }
101
102 const url = chrome.runtime.getURL('assets/welcome.html');
103 await chrome.tabs.create({url});
104 } finally {
105 // Make sure it's always set to true even in case of errors
106 await welcomeShown.set(true);
107 }
108}
109
110chrome.runtime.onInstalled.addListener(async () => {
111 if (isDevelopmentVersion()) {

Callers 1

background.tsFile · 0.85

Calls 3

hasTokenFunction · 0.85
getMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected