Fix metadata loading, loading animation, osu charts, and gpicker

- Speed up metadata loading by not waiting for the audio
- Make loading animation bigger on mobile
- Fix osu charts imported with gdrive
- Fix gpicker not appearing after cancelling
This commit is contained in:
LoveEevee 2020-10-29 09:04:36 +03:00
parent 3fea149353
commit f590222568
3 changed files with 20 additions and 16 deletions

View File

@ -13,8 +13,8 @@
flex-direction: column;
justify-content: center;
align-items: center;
width: 20vw;
height: 15vw;
width: 20vmax;
height: 15vmax;
background: rgba(0, 0, 0, 0.75);
border-radius: 5px;
border: 3px solid white;
@ -22,14 +22,14 @@
z-index: 1;
}
#loading-don{
width: 10vw;
height: calc(10vw / 120 * 115);
width: 10vmax;
height: calc(10vmax / 120 * 115);
background-size: contain;
background-repeat: no-repeat;
}
.loading-text{
position: relative;
font-size: 1.5vw;
font-size: 1.5vmax;
text-align: center;
z-index: 1;
}

View File

@ -21,6 +21,9 @@ class Gpicker{
for(var i = 0; i < files.length; i++){
var path = files[i].path ? files[i].path + "/" : ""
var list = files[i].list
if(!list){
continue
}
for(var j = 0; j < list.length; j++){
var file = list[j]
if(file.mimeType === this.folder){
@ -68,7 +71,7 @@ class Gpicker{
}
loadApi(){
if(window.gapi && gapi.client && gapi.client.drive){
return
return Promise.resolve()
}
return loader.loadScript("https://apis.google.com/js/api.js")
.then(() => new Promise((resolve, reject) =>
@ -83,7 +86,7 @@ class Gpicker{
}
getToken(lockedCallback){
if(this.oauthToken){
return
return Promise.resolve()
}
if(!this.auth){
var authPromise = gapi.auth2.init({

View File

@ -2407,7 +2407,7 @@ class SongSelect{
return snd.previewGain.load(currentSong.music)
})
}else if(currentSong.unloaded){
var promise = this.getUnloaded(this.selectedSong, songObj)
var promise = this.getUnloaded(this.selectedSong, songObj, currentId)
}else if(currentSong.sound){
songObj.preview_time = prvTime
currentSong.sound.gain = snd.previewGain
@ -2468,13 +2468,13 @@ class SongSelect{
snd.musicGain.fadeOut(0.4)
}
}
getUnloaded(selectedSong, songObj){
getUnloaded(selectedSong, songObj, currentId){
var currentSong = this.songs[selectedSong]
var file = currentSong.chart
var importSongs = new ImportSongs(false, assets.otherFiles)
return file.read(currentSong.type === "tja" ? "sjis" : "").then(data => {
currentSong.chart = new CachedFile(data, file)
return importSongs.addTja({
return importSongs[currentSong.type === "tja" ? "addTja" : "addOsu"]({
file: currentSong.chart,
index: 0
})
@ -2485,14 +2485,15 @@ class SongSelect{
imported.order = currentSong.order
delete imported.song_skin
songObj.preview_time = imported.preview
if(imported.music){
var index = assets.songs.findIndex(song => song.id === currentSong.id)
if(index !== -1){
assets.songs[index] = imported
}
this.songs[selectedSong] = this.addSong(imported)
if(imported.music && currentId === this.previewId){
return snd.previewGain.load(imported.music).then(sound => {
imported.sound = sound
var index = assets.songs.findIndex(song => song.id === currentSong.id)
if(index !== -1){
assets.songs[index] = imported
}
this.songs[selectedSong] = this.addSong(imported)
this.songs[selectedSong].sound = sound
return sound.copy()
})
}else{