mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 05:09:25 +07:00
Rate limit handling for Dropbox (#6416)
* Added rate limit handling to dropbox + some refactor to make the whole file one object * Added error messages on rate limit reached + refactored some popup code to reduce repetition * Fixed merge error * Made variables private * Fixed file upload not working because of missing override flag for dropbox * Stop multiplayer refresher if rate limit reached * Fixed typo * Various code changes/fixes - ErrorResponse var name has to be `error` because that's how DropBox's json property is named - Change FileStorageRateLimitReached exception to store the seconds remaining as its own property instead of in the message - Use toIntOrNull to avoid setting defaults in two places * Fixed missed exception message Co-authored-by: Azzurite <azzurite@gmail.com>
This commit is contained in:
@ -15,6 +15,7 @@ import androidx.work.*
|
||||
import com.badlogic.gdx.backends.android.AndroidApplication
|
||||
import com.unciv.logic.GameInfo
|
||||
import com.unciv.logic.GameSaver
|
||||
import com.unciv.logic.multiplayer.FileStorageRateLimitReached
|
||||
import com.unciv.models.metadata.GameSettings
|
||||
import com.unciv.logic.multiplayer.OnlineMultiplayer
|
||||
import java.io.FileNotFoundException
|
||||
@ -269,6 +270,9 @@ class MultiplayerTurnCheckWorker(appContext: Context, workerParams: WorkerParame
|
||||
foundGame = Pair(gameNames[arrayIndex], gameIds[arrayIndex])
|
||||
}
|
||||
arrayIndex++
|
||||
} catch (ex: FileStorageRateLimitReached) {
|
||||
// We just break here as configuredDelay is probably enough to wait for the rate limit anyway
|
||||
break
|
||||
} catch (ex: FileNotFoundException){
|
||||
// FileNotFoundException is thrown by OnlineMultiplayer().tryDownloadGamePreview(gameId)
|
||||
// and indicates that there is no game preview present for this game
|
||||
|
Reference in New Issue
Block a user