-
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.
Merge pull request #73 from futuredapp/feature/product-flavors
Extract ProductFlavor configuration
- Loading branch information
Showing
10 changed files
with
73 additions
and
55 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
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
27 changes: 27 additions & 0 deletions
27
buildSrc/src/main/kotlin/app/futured/kmptemplate/gradle/configuration/ProductFlavors.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,27 @@ | ||
package app.futured.kmptemplate.gradle.configuration | ||
|
||
/** | ||
* Defines all flavor-specific values provided to KMP during compilation. | ||
*/ | ||
interface ProductFlavor { | ||
val name: String | ||
val apolloApiUrl: String | ||
val restApiUrl: String | ||
} | ||
|
||
object ProductFlavors { | ||
|
||
val DEFAULT = Dev | ||
|
||
object Dev : ProductFlavor { | ||
override val name: String = "dev" | ||
override val apolloApiUrl: String = "https://rickandmortyapi.com/graphql" | ||
override val restApiUrl: String = "https://swapi.dev/api/" | ||
} | ||
|
||
object Prod : ProductFlavor { | ||
override val name: String = "prod" | ||
override val apolloApiUrl: String = "https://rickandmortyapi.com/graphql" | ||
override val restApiUrl: String = "https://swapi.dev/api/" | ||
} | ||
} |
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
4 changes: 2 additions & 2 deletions
4
.../graphql/src/commonMain/kotlin/app/futured/kmptemplate/network/graphql/tools/Constants.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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package app.futured.kmptemplate.network.graphql.tools | ||
|
||
import app.futured.kmptemplate.network.graphql.BuildKonfig | ||
import app.futured.kmptemplate.network.graphql.FlavorConstants | ||
import kotlin.time.Duration.Companion.seconds | ||
|
||
internal object Constants { | ||
|
||
object Configuration { | ||
val API_URL = BuildKonfig.apiUrl | ||
val API_URL = FlavorConstants.apiUrl | ||
val REQUEST_TIMEOUT = 20.seconds | ||
} | ||
} |
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