Skip to content

Commit dd23d28

Browse files
authored
Merge pull request #7 from AzlanCoding/bug-fixes
Fixed No Auto Sync After Extension Refresh Due to Permission Changes + Other Minor Bugs
2 parents b1909d0 + 3a21504 commit dd23d28

3 files changed

Lines changed: 22 additions & 16 deletions

File tree

extension/background.js

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,14 @@ function fileAccessSchemeExtPageSwitch(){
317317
fileAccessSchemeExtPage = true;
318318
}
319319
async function blockingWindow(url, callback){
320+
await logData("info","BlockingWindow Initilising!");
320321
return chrome.windows.create({
321322
url: url,
322323
type: "popup",
323324
state: "fullscreen"
324-
}, callback).then(async() => {
325+
}, callback)/*.then(async() => {
325326
logData("info","BlockingWindow Initilised!");
326-
})
327+
})*/
327328
}
328329
function relaunchEnforceWindow(windowId) {
329330
let timenow = new Date().getTime();
@@ -558,19 +559,23 @@ async function handleExternalAction(sendResponse, func, args){
558559

559560

560561
/*---Main Startup---*/
561-
function initExtension(){
562-
if (typeof syncEnrollmentInterval == 'undefined'){
563-
syncEnrollment();
564-
let syncEnrollmentInterval = setInterval(syncEnrollment, 30000);
565-
}
566-
if (typeof syncEnrollmentInterval == 'undefined'){
567-
let setBlockedSitesInterval = setBlockedSitesLoop();
568-
}
569-
if (typeof permissionsCheckInterval == 'undefined'){
570-
checkPermissions();
571-
let permissionsCheckInterval = setInterval(checkPermissions, 1000);
562+
async function initExtension(){
563+
let startupInfo = chrome.storage.session.get('initStarted')
564+
if (typeof startupInfo.initStarted == 'undefined'){
565+
await chrome.storage.session.set({initStarted: true})
566+
if (typeof syncEnrollmentInterval == 'undefined'){
567+
syncEnrollment();
568+
let syncEnrollmentInterval = setInterval(syncEnrollment, 30000);
569+
}
570+
if (typeof syncEnrollmentInterval == 'undefined'){
571+
let setBlockedSitesInterval = setBlockedSitesLoop();
572+
}
573+
if (typeof permissionsCheckInterval == 'undefined'){
574+
checkPermissions();
575+
let permissionsCheckInterval = setInterval(checkPermissions, 1000);
576+
}
577+
return logData("info","EXTENSION INITILISATION COMPLETE");
572578
}
573-
return logData("info","EXTENSION INITILISATION COMPLETE");
574579
}
575580

576581
if (typeof window == 'undefined') { //The javascript equivilant of `if __name__ == '__main__':` in python
@@ -601,4 +606,5 @@ if (typeof window == 'undefined') { //The javascript equivilant of `if __name__
601606

602607
chrome.runtime.onStartup.addListener(initExtension);
603608
chrome.runtime.onInstalled.addListener(initExtension);
609+
initExtension();
604610
}

extension/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "Ignite DMA",
4-
"version": "1.1.2",
4+
"version": "1.1.3",
55
"author": "AzlanCoding",
66
"description": "A Device Manager Application (DMA) for students under MOE",
77
"homepage_url": "https://ignitedma.mooo.com/",

server/assets/service/update.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
33
<app appid='clhnfaboginbheghbebffggbdnijjika'>
4-
<updatecheck codebase='https://ignitedma.mooo.com/assets/service/chrome_extension/v1.1.2.crx' version='1.1.2' />
4+
<updatecheck codebase='https://ignitedma.mooo.com/assets/service/chrome_extension/v1.1.3.crx' version='1.1.3' />
55
</app>
66
</gupdate>

0 commit comments

Comments
 (0)