mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-22 03:32:12 -08:00
Integrate Microsoft login option when no accounts are left after logout.
This commit is contained in:
parent
8b23847c29
commit
d95e85aa40
@ -1,10 +1,21 @@
|
|||||||
|
const loginOptionsCancelContainer = document.getElementById('loginOptionCancelContainer')
|
||||||
const loginOptionMicrosoft = document.getElementById('loginOptionMicrosoft')
|
const loginOptionMicrosoft = document.getElementById('loginOptionMicrosoft')
|
||||||
const loginOptionMojang = document.getElementById('loginOptionMojang')
|
const loginOptionMojang = document.getElementById('loginOptionMojang')
|
||||||
|
|
||||||
|
let loginOptionsCancellable = false
|
||||||
|
|
||||||
let loginOptionsViewOnLoginSuccess
|
let loginOptionsViewOnLoginSuccess
|
||||||
let loginOptionsViewOnLoginCancel
|
let loginOptionsViewOnLoginCancel
|
||||||
let loginOptionsViewOnCancel
|
let loginOptionsViewOnCancel
|
||||||
|
|
||||||
|
function loginOptionsCancelEnabled(val){
|
||||||
|
if(val){
|
||||||
|
$(loginOptionsCancelContainer).show()
|
||||||
|
} else {
|
||||||
|
$(loginOptionsCancelContainer).hide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
loginOptionMicrosoft.onclick = (e) => {
|
loginOptionMicrosoft.onclick = (e) => {
|
||||||
switchView(getCurrentView(), VIEWS.waiting, 500, 500, () => {
|
switchView(getCurrentView(), VIEWS.waiting, 500, 500, () => {
|
||||||
ipcRenderer.send(
|
ipcRenderer.send(
|
||||||
@ -21,4 +32,4 @@ loginOptionMojang.onclick = (e) => {
|
|||||||
loginViewOnCancel = loginOptionsViewOnLoginCancel
|
loginViewOnCancel = loginOptionsViewOnLoginCancel
|
||||||
loginCancelEnabled(true)
|
loginCancelEnabled(true)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -445,7 +445,6 @@ function bindAuthAccountLogOut(){
|
|||||||
setOverlayHandler(() => {
|
setOverlayHandler(() => {
|
||||||
processLogOut(val, isLastAccount)
|
processLogOut(val, isLastAccount)
|
||||||
toggleOverlay(false)
|
toggleOverlay(false)
|
||||||
switchView(getCurrentView(), VIEWS.login)
|
|
||||||
})
|
})
|
||||||
setDismissHandler(() => {
|
setDismissHandler(() => {
|
||||||
toggleOverlay(false)
|
toggleOverlay(false)
|
||||||
@ -476,7 +475,6 @@ function processLogOut(val, isLastAccount){
|
|||||||
switchView(getCurrentView(), VIEWS.waiting, 500, 500, () => {
|
switchView(getCurrentView(), VIEWS.waiting, 500, 500, () => {
|
||||||
ipcRenderer.send(MSFT_OPCODE.OPEN_LOGOUT, uuid, isLastAccount)
|
ipcRenderer.send(MSFT_OPCODE.OPEN_LOGOUT, uuid, isLastAccount)
|
||||||
})
|
})
|
||||||
// TODO ADD LOGIC FOR LAST ACCOUNT - SAME AS SOLUTION FOR FIRST TIME LOGIN!
|
|
||||||
} else {
|
} else {
|
||||||
AuthManager.removeMojangAccount(uuid).then(() => {
|
AuthManager.removeMojangAccount(uuid).then(() => {
|
||||||
if(!isLastAccount && uuid === prevSelAcc.uuid){
|
if(!isLastAccount && uuid === prevSelAcc.uuid){
|
||||||
@ -485,6 +483,12 @@ function processLogOut(val, isLastAccount){
|
|||||||
updateSelectedAccount(selAcc)
|
updateSelectedAccount(selAcc)
|
||||||
validateSelectedAccount()
|
validateSelectedAccount()
|
||||||
}
|
}
|
||||||
|
if(isLastAccount) {
|
||||||
|
loginOptionsCancelEnabled(false)
|
||||||
|
loginOptionsViewOnLoginSuccess = VIEWS.settings
|
||||||
|
loginOptionsViewOnLoginCancel = VIEWS.loginOptions
|
||||||
|
switchView(getCurrentView(), VIEWS.loginOptions)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
$(parent).fadeOut(250, () => {
|
$(parent).fadeOut(250, () => {
|
||||||
parent.remove()
|
parent.remove()
|
||||||
@ -530,13 +534,21 @@ ipcRenderer.on(MSFT_OPCODE.REPLY_LOGOUT, (_, ...arguments_) => {
|
|||||||
updateSelectedAccount(selAcc)
|
updateSelectedAccount(selAcc)
|
||||||
validateSelectedAccount()
|
validateSelectedAccount()
|
||||||
}
|
}
|
||||||
|
if(isLastAccount) {
|
||||||
|
loginOptionsCancelEnabled(false)
|
||||||
|
loginOptionsViewOnLoginSuccess = VIEWS.settings
|
||||||
|
loginOptionsViewOnLoginCancel = VIEWS.loginOptions
|
||||||
|
switchView(getCurrentView(), VIEWS.loginOptions)
|
||||||
|
}
|
||||||
if(msAccDomElementCache) {
|
if(msAccDomElementCache) {
|
||||||
msAccDomElementCache.remove()
|
msAccDomElementCache.remove()
|
||||||
msAccDomElementCache = null
|
msAccDomElementCache = null
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
switchView(getCurrentView(), VIEWS.settings, 500, 500)
|
if(!isLastAccount) {
|
||||||
|
switchView(getCurrentView(), VIEWS.settings, 500, 500)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
* Script for welcome.ejs
|
* Script for welcome.ejs
|
||||||
*/
|
*/
|
||||||
document.getElementById('welcomeButton').addEventListener('click', e => {
|
document.getElementById('welcomeButton').addEventListener('click', e => {
|
||||||
|
loginOptionsCancelEnabled(false) // False by default, be explicit.
|
||||||
loginOptionsViewOnLoginSuccess = VIEWS.landing
|
loginOptionsViewOnLoginSuccess = VIEWS.landing
|
||||||
loginOptionsViewOnLoginCancel = VIEWS.loginOptions
|
loginOptionsViewOnLoginCancel = VIEWS.loginOptions
|
||||||
switchView(VIEWS.welcome, VIEWS.loginOptions)
|
switchView(VIEWS.welcome, VIEWS.loginOptions)
|
||||||
|
Loading…
Reference in New Issue
Block a user