-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add caching to protomaps tile client
This change moves the soundscape-backend specific parts of TileClient out into a sub-class so that a protomaps TileClient can share the caching code. It also removes the unused http caching from MainActivity - we no longer use the type of HTTP access that would use this cache.
- Loading branch information
Showing
6 changed files
with
70 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 9 additions & 29 deletions
38
app/src/main/java/org/scottishtecharmy/soundscape/network/ProtomapsTileClient.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
app/src/main/java/org/scottishtecharmy/soundscape/network/SoundscapeBackendTileClient.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.scottishtecharmy.soundscape.network | ||
|
||
import android.app.Application | ||
import retrofit2.Retrofit | ||
import retrofit2.converter.scalars.ScalarsConverterFactory | ||
|
||
class SoundscapeBackendTileClient(application: Application) : TileClient(application) { | ||
|
||
override fun buildRetrofit() : Retrofit { | ||
return Retrofit.Builder() | ||
.baseUrl(BASE_URL) | ||
// use it to output the string | ||
.addConverterFactory(ScalarsConverterFactory.create()) | ||
.client(okHttpClient) | ||
.build() | ||
} | ||
|
||
companion object { | ||
private const val BASE_URL = "https://soundscape.scottishtecharmy.org" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters