Merge branch 'offline-login' into map-on-single-view

This commit is contained in:
cyber-dream 2022-08-07 20:08:18 +03:00
commit a079b8a23e
5 changed files with 100 additions and 16 deletions

View File

@ -450,6 +450,79 @@ body, button {
transition: 0.25s ease;
}
/* loginOffline cancel button styles. */
#loginOfflineCancelContainer {
position: absolute;
top: 5%;
right: 5%;
}
/* loginOffline cancel button styles. */
#loginOfflineCancelButton {
background: none;
border: none;
outline: none;
cursor: pointer;
transition: 0.25s ease;
}
#loginOfflineCancelButton:hover #loginOfflineCancelIcon,
#loginOfflineCancelButton:hover #loginOfflineCancelText,
#loginOfflineCancelButton:focus #loginOfflineCancelIcon,
#loginOfflineCancelButton:focus #loginOfflineCancelText {
text-shadow: 0px 0px 20px white;
}
#loginOfflineCancelButton:hover #loginOfflineCancelIcon,
#loginOfflineCancelButton:focus #loginOfflineCancelIcon {
box-shadow: 0px 0px 20px white;
}
#loginOfflineCancelButton:active #loginOfflineCancelIcon,
#loginOfflineCancelButton:active #loginOfflineCancelText {
text-shadow: 0px 0px 20px rgba(255, 255, 255, 0.75);
color: rgba(255, 255, 255, 0.75);
border-color: rgba(255, 255, 255, 0.75);
}
#loginOfflineCancelButton:active #loginOfflineCancelIcon {
box-shadow: 0px 0px 20px rgba(255, 255, 255, 0.75);
}
#loginOfflineCancelButton:disabled {
pointer-events: none;
}
#loginOfflineCancelButton:disabled #loginOfflineCancelIcon,
#loginOfflineCancelButton:disabled #loginOfflineCancelText {
color: rgba(255, 255, 255, 0.75);
border-color: rgba(255, 255, 255, 0.75);
}
/* The X in a circle icon for the cancel button. */
#loginOfflineCancelIcon {
border-radius: 50%;
border: 1px solid white;
box-sizing: border-box;
height: 30px;
width: 30px;
font-size: 19px;
line-height: 30px;
margin: 0 auto;
margin-bottom: 5px;
transition: 0.25s ease;
}
/* Text for the loginOffline cancel button. */
#loginOfflineCancelText {
font-size: 15px;
transition: 0.25s ease;
}
/* Login content wrapper. */
#loginContent {
display: flex;

View File

@ -1,6 +1,8 @@
const loggerOfflineLogin = LoggerUtil1('%c[LoginOffline]', 'color: #000668; font-weight: bold')
const loginOfflineButton = document.getElementById('loginOfflineButton')
const loginOfflineButton = document.getElementById('loginOfflineButton')
const loginOfflineCancelContainer = document.getElementById('loginOfflineCancelContainer')
const loginOfflineCancelButton = document.getElementById('loginOfflineCancelButton')
function loginOfflineDisabled(v){
if(loginOfflineButton.disabled !== v){
@ -10,21 +12,28 @@ function loginOfflineDisabled(v){
function formOfflineDisabled(v){
loginOfflineDisabled(v)
//loginCancelButton.disabled = v
loginOfflineUsername.disabled = v
/*loginPassword.disabled = v
if(v){
checkmarkContainer.setAttribute('disabled', v)
} else {
checkmarkContainer.removeAttribute('disabled')
}
loginRememberOption.disabled = v*/
}
loginOfflineButton.addEventListener('click', () => {
loginOfflineButton.addEventListener('click', () => {
formOfflineDisabled(true)
AuthManager.addOfflineAccount(loginOfflineUsername.value).then((value) =>{
switchView(VIEWS.loginOffline, VIEWS.landing, 500, 500)
})
loginOfflineUsername = ''
})
loginOfflineCancelButton.addEventListener('click', () => {
if (Object.keys(ConfigManager.getAuthAccounts()).length === 0) {
loginOfflineUsername.value = ''
switchView(VIEWS.loginOffline, VIEWS.loginOptions, 500, 500)
}
else
{
loginOfflineUsername.value = ''
switchView(VIEWS.loginOffline, VIEWS.landing, 500, 500)
}
})

View File

@ -78,7 +78,8 @@ function showMainUI(data){
// If this is enabled in a development environment we'll get ratelimited.
// The relaunch frequency is usually far too high.
if(!isDev && isLoggedIn){
//if(!isDev && isLoggedIn){
if(isLoggedIn){
validateSelectedAccount()
}
@ -323,7 +324,7 @@ function refreshDistributionIndex(remote, onSuccess, onError){
async function validateSelectedAccount(){
const selectedAcc = ConfigManager.getSelectedAccount()
if(selectedAcc != null){
if(selectedAcc != null && selectedAcc.type != 'offline'){
const val = await AuthManager.validateSelected()
if(!val){
ConfigManager.removeAuthAccount(selectedAcc.uuid)

View File

@ -1,8 +1,8 @@
<div id="loginOfflineContainer" style="display: none;">
<div id="loginCancelContainer" style="display: none;">
<button id="loginCancelButton">
<div id="loginCancelIcon">X</div>
<span id="loginCancelText">Cancel</span>
<div id="loginOfflineCancelContainer" > <!--Delete style="" as temp fix-->
<button id="loginOfflineCancelButton">
<div id="loginOfflineCancelIcon">X</div>
<span id="loginOfflineCancelText">Cancel</span>
</button>
</div>
<div id="loginContent">

View File

@ -71,6 +71,7 @@
<div class="settingsAuthAccountTypeContainer">
<div class="settingsAuthAccountTypeHeader">
<div class="settingsAuthAccountTypeHeaderLeft">
<svg width="22px" height="22px" viewBox="0 0 64 64" enable-background="new 0 0 64 64" version="1.1" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="Home"><path d="M62,21v39c0,1.1-0.9,2-2,2H4c-1.1,0-2-0.9-2-2V21c0-0.7,0.4-1.4,1-1.7l28-17c0.6-0.4,1.4-0.4,2.1,0l28,17 C61.6,19.6,62,20.3,62,21z" fill="#3F51B5"/><g><path d="M44,42v18c0,1.1-0.9,2-2,2H22c-1.1,0-2-0.9-2-2V42c0-6.6,5.4-12,12-12S44,35.4,44,42z" fill="#FFC10A"/></g></g><g id="Camera"/><g id="Mail"/><g id="Print"/><g id="Save"/><g id="Folder"/><g id="Search"/><g id="User"/><g id="Pin"/><g id="Calendar"/><g id="Gallery"/><g id="time"/><g id="Pin_1_"/><g id="Setting"/><g id="Player"/><g id="Lock"/><g id="Trash_Can"/><g id="Notification"/><g id="Record"/><g id="Shopping_Bag"/></svg>
<span>Offline</span>
</div>
<div class="settingsAuthAccountTypeHeaderRight">