Skip to content

Commit

Permalink
Fixed an issue with registry scan, minor UI changes.
Browse files Browse the repository at this point in the history
The registry scan function exited early if no Java Development Key was found. This has been corrected by redoing the exit checks.
Social media buttons now lose focus after they are clicked to prevent a sticky appearance.
Changed the load spinner to have the text rotate within the center image.
  • Loading branch information
dscalzi committed May 10, 2018
1 parent f0b2133 commit 848440e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 16 deletions.
3 changes: 2 additions & 1 deletion app/assets/css/launcher.css
Original file line number Diff line number Diff line change
Expand Up @@ -2122,14 +2122,15 @@ p {
/* Stationary image for the spinner. */
#loadCenterImage {
position: absolute;
width: 200px;
width: 277px;
height: auto;
}

/* Rotating image for the spinner. */
#loadSpinnerImage {
width: 280px;
height: auto;
z-index: 400;
}

/* Rotating animation for the spinner. */
Expand Down
57 changes: 42 additions & 15 deletions app/assets/js/assetguard.js
Original file line number Diff line number Diff line change
Expand Up @@ -854,15 +854,14 @@ class AssetGuard extends EventEmitter {
// 'SOFTWARE\\JavaSoft\\JDK'
// Forge does not yet support Java 9, therefore we do not.

let cbTracker = 0
let cbAcc = 0

// Keys for Java 1.8 and prior:
const regKeys = [
'\\SOFTWARE\\JavaSoft\\Java Runtime Environment',
'\\SOFTWARE\\JavaSoft\\Java Development Kit'
]

let keysDone = 0

const candidates = new Set()

for(let i=0; i<regKeys.length; i++){
Expand All @@ -875,15 +874,26 @@ class AssetGuard extends EventEmitter {
if(exists) {
key.keys((err, javaVers) => {
if(err){
keysDone++
console.error(err)
if(i === regKeys.length-1 && cbAcc === cbTracker){

// REG KEY DONE
// DUE TO ERROR
if(keysDone === regKeys.length){
resolve(candidates)
}
} else {
cbTracker += javaVers.length
if(i === regKeys.length-1 && cbTracker === cbAcc){
resolve(candidates)
if(javaVers.length === 0){
// REG KEY DONE
// NO SUBKEYS
keysDone++
if(keysDone === regKeys.length){
resolve(candidates)
}
} else {

let numDone = 0

for(let j=0; j<javaVers.length; j++){
const javaVer = javaVers[j]
const vKey = javaVer.key.substring(javaVer.key.lastIndexOf('\\')+1)
Expand All @@ -893,25 +903,42 @@ class AssetGuard extends EventEmitter {
const jHome = res.value
if(jHome.indexOf('(x86)') === -1){
candidates.add(jHome)

}
cbAcc++
if(i === regKeys.length-1 && cbAcc === cbTracker){
resolve(candidates)

// SUBKEY DONE

numDone++
if(numDone === javaVers.length){
keysDone++
if(keysDone === regKeys.length){
resolve(candidates)
}
}
})
} else {
cbAcc++
if(i === regKeys.length-1 && cbAcc === cbTracker){
resolve(candidates)

// SUBKEY DONE
// NOT JAVA 8

numDone++
if(numDone === javaVers.length){
keysDone++
if(keysDone === regKeys.length){
resolve(candidates)
}
}
}
}
}
}
})
} else {
if(i === regKeys.length-1 && cbAcc === cbTracker){

// REG KEY DONE
// DUE TO NON-EXISTANCE

keysDone++
if(keysDone === regKeys.length){
resolve(candidates)
}
}
Expand Down
7 changes: 7 additions & 0 deletions app/assets/js/scripts/uicore.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ document.addEventListener('readystatechange', function () {
})
})

// Remove focus from social media buttons once they're clicked.
Array.from(document.getElementsByClassName('mediaURL')).map(val => {
val.addEventListener('click', e => {
document.activeElement.blur()
})
})

} else if(document.readyState === 'complete'){

//266.01
Expand Down

0 comments on commit 848440e

Please sign in to comment.