forked from getodk/collect
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only use presence of download token to include/disclude Mapbox
- Loading branch information
1 parent
d101b29
commit 96afe0e
Showing
7 changed files
with
45 additions
and
18 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
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,10 @@ | ||
// Helper for grabbing secrets from `secrets.properties` file | ||
ext.getSecrets = { -> | ||
def secretsFile = file("$rootDir/secrets.properties") | ||
def secrets = new Properties() | ||
if (secretsFile.exists()) { | ||
secrets.load(new FileInputStream(secretsFile)) | ||
} | ||
|
||
return secrets | ||
} |
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
25 changes: 25 additions & 0 deletions
25
shared/src/main/java/org/odk/collect/shared/injection/MultiClassProvider.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,25 @@ | ||
package org.odk.collect.shared | ||
|
||
import java.util.function.Supplier | ||
|
||
interface MultiClassProviderHost { | ||
fun getMultiClassProvider(): MultiClassProvider | ||
} | ||
|
||
interface MultiClassProvider { | ||
fun <T> provide(clazz: Class<T>): T | ||
} | ||
|
||
class SupplierMultiClassProvider : MultiClassProvider { | ||
|
||
private val suppliers: MutableMap<Class<*>, Supplier<*>> = mutableMapOf() | ||
|
||
fun <T> addSupplier(clazz: Class<T>, supplier: Supplier<T>) { | ||
suppliers[clazz] = supplier | ||
} | ||
|
||
@Suppress("UNCHECKED_CAST") | ||
override fun <T> provide(clazz: Class<T>): T { | ||
return suppliers[clazz]!!.get() as T | ||
} | ||
} |