Added error popup when failed to download map

This commit is contained in:
Yair Morgenstern 2019-09-18 22:28:16 +03:00
parent f4d828d5e4
commit 753efe5f47
2 changed files with 7 additions and 1 deletions

View file

@ -114,6 +114,12 @@ class MapDownloadTable(mapEditorScreen: MapEditorScreen):PopupTable(mapEditorScr
val downloadMapButton = TextButton(downloadableMap.name, CameraStageBaseScreen.skin)
downloadMapButton.onClick {
val mapJsonGzipped = DropBox().downloadFile(downloadableMap.path_display)
if(mapJsonGzipped==""){
val couldNotDownloadMapPopup = PopupTable(screen)
couldNotDownloadMapPopup.addGoodSizedLabel("Could not download map!").row()
couldNotDownloadMapPopup.addCloseButton()
return@onClick
}
val decodedMapJson = Gzip.unzip(mapJsonGzipped)
val mapObject = MapSaver().mapFromJson(decodedMapJson)
MapSaver().saveMap(downloadableMap.name, mapObject)

View file

@ -41,7 +41,7 @@ class DropBox(){
println(ex.message)
val reader = BufferedReader(InputStreamReader(errorStream))
println(reader.readText())
return "Error!"
return ""
}
}
}