diff --git a/app/google-services.json b/app/google-services.json
index 6212ffdb..5a8b62c9 100644
--- a/app/google-services.json
+++ b/app/google-services.json
@@ -15,11 +15,11 @@
},
"oauth_client": [
{
- "client_id": "564324081859-pp0b62lk19reni5p538ckse2dr6dr3li.apps.googleusercontent.com",
+ "client_id": "564324081859-1mq6f3s6a23k45romp1uepctunruou5p.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.k0d4black.theforce",
- "certificate_hash": "113cb837d7d15580c33a4d642ff301877a14b840"
+ "certificate_hash": "2ed02f3b703354a87ed8fdf61772ccf523a4e339"
}
},
{
@@ -51,6 +51,14 @@
}
},
"oauth_client": [
+ {
+ "client_id": "564324081859-0asij4ni6kmpr6cp9i798vmhipoqtrps.apps.googleusercontent.com",
+ "client_type": 1,
+ "android_info": {
+ "package_name": "com.k0d4black.theforce.debug",
+ "certificate_hash": "113cb837d7d15580c33a4d642ff301877a14b840"
+ }
+ },
{
"client_id": "564324081859-4udbte4ljtq9upkgevouj8rf32albjbr.apps.googleusercontent.com",
"client_type": 3
diff --git a/app/src/androidTest/kotlin/com/k0d4black/theforce/helpers/StarWarsRequestDispatcher.kt b/app/src/androidTest/kotlin/com/k0d4black/theforce/helpers/StarWarsRequestDispatcher.kt
index e928e6aa..f7e48d87 100644
--- a/app/src/androidTest/kotlin/com/k0d4black/theforce/helpers/StarWarsRequestDispatcher.kt
+++ b/app/src/androidTest/kotlin/com/k0d4black/theforce/helpers/StarWarsRequestDispatcher.kt
@@ -13,17 +13,17 @@ internal class StarWarsRequestDispatcher : Dispatcher() {
override fun dispatch(request: RecordedRequest): MockResponse {
return when (request.path) {
- "/people?search=$EXISTING_SEARCH_PARAMS" -> {
+ "/people/?search=$EXISTING_SEARCH_PARAMS" -> {
MockResponse()
.setResponseCode(HttpURLConnection.HTTP_OK)
.setBody(searchSuccess)
}
- "/people?search=$NON_EXISTENT_SEARCH_PARAMS" -> {
+ "/people/?search=$NON_EXISTENT_SEARCH_PARAMS" -> {
MockResponse()
.setResponseCode(HttpURLConnection.HTTP_OK)
.setBody(searchNoMatch)
}
- "/people?search=$ERROR_SEARCH_PARAMS" -> {
+ "/people/?search=$ERROR_SEARCH_PARAMS" -> {
MockResponse()
.setResponseCode(HttpURLConnection.HTTP_NOT_FOUND)
.setBody(notFound)
diff --git a/app/src/release/res/xml/network_security_config.xml b/app/src/release/res/xml/network_security_config.xml
index a22919f3..f53b2e93 100644
--- a/app/src/release/res/xml/network_security_config.xml
+++ b/app/src/release/res/xml/network_security_config.xml
@@ -12,7 +12,7 @@
-->
-
+
swapi.dev
\ No newline at end of file
diff --git a/data-remote/src/main/kotlin/com/k0d4black/theforce/data/remote/UrlUtils.kt b/data-remote/src/main/kotlin/com/k0d4black/theforce/data/remote/UrlUtils.kt
new file mode 100644
index 00000000..c95ff540
--- /dev/null
+++ b/data-remote/src/main/kotlin/com/k0d4black/theforce/data/remote/UrlUtils.kt
@@ -0,0 +1,20 @@
+/**
+ *
+ * Copyright 2020 David Odari
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ **/
+package com.k0d4black.theforce.data.remote
+
+
+fun String.enforceHttps(): String =
+ if (!this.contains("https"))
+ this.replace("http", "https")
+ else this
diff --git a/data-remote/src/main/kotlin/com/k0d4black/theforce/data/remote/api/StarWarsApiService.kt b/data-remote/src/main/kotlin/com/k0d4black/theforce/data/remote/api/StarWarsApiService.kt
index db04c78e..9245c147 100644
--- a/data-remote/src/main/kotlin/com/k0d4black/theforce/data/remote/api/StarWarsApiService.kt
+++ b/data-remote/src/main/kotlin/com/k0d4black/theforce/data/remote/api/StarWarsApiService.kt
@@ -7,7 +7,7 @@ import retrofit2.http.Url
interface StarWarsApiService {
- @GET("people")
+ @GET("people/")
suspend fun searchCharacters(@Query("search") params: String): SearchResponse
@GET
diff --git a/data-remote/src/main/kotlin/com/k0d4black/theforce/data/remote/repository/CharacterDetailsRepository.kt b/data-remote/src/main/kotlin/com/k0d4black/theforce/data/remote/repository/CharacterDetailsRepository.kt
index d7fa467e..3b8aca04 100644
--- a/data-remote/src/main/kotlin/com/k0d4black/theforce/data/remote/repository/CharacterDetailsRepository.kt
+++ b/data-remote/src/main/kotlin/com/k0d4black/theforce/data/remote/repository/CharacterDetailsRepository.kt
@@ -1,6 +1,7 @@
package com.k0d4black.theforce.data.remote.repository
import com.k0d4black.theforce.data.remote.api.StarWarsApiService
+import com.k0d4black.theforce.data.remote.enforceHttps
import com.k0d4black.theforce.data.remote.mappers.toDomain
import com.k0d4black.theforce.domain.models.Film
import com.k0d4black.theforce.domain.models.Planet
@@ -14,26 +15,26 @@ class CharacterDetailsRepository(
) : ICharacterDetailsRepository {
override suspend fun getCharacterPlanet(characterUrl: String): Flow = flow {
- val planetResponse = apiService.getPlanet(characterUrl)
- val planet = apiService.getPlanetDetails(planetResponse.homeworldUrl)
+ val planetResponse = apiService.getPlanet(characterUrl.enforceHttps())
+ val planet = apiService.getPlanetDetails(planetResponse.homeworldUrl.enforceHttps())
emit(planet.toDomain())
}
override suspend fun getCharacterSpecies(characterUrl: String): Flow> = flow {
- val speciesResponse = apiService.getSpecies(characterUrl)
+ val speciesResponse = apiService.getSpecies(characterUrl.enforceHttps())
val species = mutableListOf()
for (specieUrl in speciesResponse.specieUrls) {
- val specie = apiService.getSpecieDetails(specieUrl)
+ val specie = apiService.getSpecieDetails(specieUrl.enforceHttps())
species.add(specie.toDomain())
}
emit(species)
}
override suspend fun getCharacterFilms(characterUrl: String): Flow> = flow {
- val filmsResponse = apiService.getFilms(characterUrl)
+ val filmsResponse = apiService.getFilms(characterUrl.enforceHttps())
val films = mutableListOf()
for (filmUrl in filmsResponse.filmUrls) {
- val film = apiService.getFilmDetails(filmUrl)
+ val film = apiService.getFilmDetails(filmUrl.enforceHttps())
films.add(film.toDomain())
}
emit(films)
diff --git a/data-remote/src/test/kotlin/com/k0d4black/theforce/data/remote/helpers/StarWarsRequestDispatcher.kt b/data-remote/src/test/kotlin/com/k0d4black/theforce/data/remote/helpers/StarWarsRequestDispatcher.kt
index 4e651b26..64fdfe78 100644
--- a/data-remote/src/test/kotlin/com/k0d4black/theforce/data/remote/helpers/StarWarsRequestDispatcher.kt
+++ b/data-remote/src/test/kotlin/com/k0d4black/theforce/data/remote/helpers/StarWarsRequestDispatcher.kt
@@ -32,12 +32,12 @@ internal class StarWarsRequestDispatcher : Dispatcher() {
override fun dispatch(request: RecordedRequest): MockResponse {
return when (request.path) {
- "/people?search=$EXISTING_SEARCH_PARAMS" -> {
+ "/people/?search=$EXISTING_SEARCH_PARAMS" -> {
MockResponse()
.setResponseCode(HttpURLConnection.HTTP_OK)
.setBody(getJson("json/character_search.json"))
}
- "/people?search=$NON_EXISTENT_SEARCH_PARAMS" -> {
+ "/people/?search=$NON_EXISTENT_SEARCH_PARAMS" -> {
MockResponse()
.setResponseCode(HttpURLConnection.HTTP_OK)
.setBody(
diff --git a/dependencies.gradle b/dependencies.gradle
index b9b0fc22..e4c6c8e0 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -8,7 +8,7 @@ ext {
//App Versioning
versionCodeMajor = 2
versionCodeMinor = 1
- versionCodePatch = 0
+ versionCodePatch = 1
versionName = "$versionCodeMajor.$versionCodeMinor.$versionCodePatch"
//Dependencies Version - Presentation