This file contains hidden or 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
val greetingModule = module(createdAtStart = true) { | |
single<GreetingService> { GreetingServiceImpl(get()) } | |
single<IpAddressService> { IpAddressServiceImpl(get()) } | |
} |
This file contains hidden or 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
fun Application.module() { | |
val jsonParser = Json { | |
ignoreUnknownKeys = true | |
isLenient = true | |
} | |
install(ContentNegotiation) { | |
json(jsonParser) | |
} | |
val client = HttpClient(Apache) { |
This file contains hidden or 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
fun Application.module() { | |
val jsonParser = Json { | |
ignoreUnknownKeys = true | |
isLenient = true | |
} | |
install(ContentNegotiation) { | |
json(jsonParser) | |
} |
This file contains hidden or 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
val restTemplate = RestTemplate() | |
restTemplate.messageConverters = mutableListOf<HttpMessageConverter<*>>( | |
KotlinSerializationJsonHttpMessageConverter(JsonParser().json) |
This file contains hidden or 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
@Configuration | |
open class ConfigureMessageConverters() : WebMvcConfigurer { | |
override fun extendMessageConverters(converters: MutableList<HttpMessageConverter<*>>) { | |
val converter = KotlinSerializationJsonHttpMessageConverter(JsonParser().json) | |
converters.forEachIndexed { index, httpMessageConverter -> | |
if (httpMessageConverter is KotlinSerializationJsonHttpMessageConverter) { | |
converters[index] = converter | |
return | |
} |
This file contains hidden or 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
class JsonParser { | |
val json = Json { ignoreUnknownKeys = true; isLenient = true; } | |
} |
This file contains hidden or 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
fun <T> Observable<T>.prodTimeout(timeout: Long, timeUnit: TimeUnit): Observable<T> { | |
return if (BuildConfig.BUILD_TYPE == "debug" || timeout == 0L) { | |
this | |
} else { | |
this.timeout(timeout, timeUnit) | |
} | |
} |
This file contains hidden or 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
private fun loadAppConfig() { | |
appConfigManager.getAppConfig(pushNotificationManager.deviceId) | |
.prodTimeout(2500, TimeUnit.MILLISECONDS) | |
.subscribeOn(Schedulers.io()) | |
.observeOn(AndroidSchedulers.mainThread()) | |
.`as`(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(lifecycle, Lifecycle.Event.ON_DESTROY))) | |
.subscribe({ appConfig -> processAppConfig(appConfig) }, | |
{ throwable -> Timber.e(throwable) }) | |
} |
This file contains hidden or 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
fun getOnboardingInfoAndSmartMessage() { | |
viewModelScope.launch { | |
try { | |
withTimeout(2500) { | |
onBoardingData.loadWith(this) { | |
onBoardDispatchManager.getOnboardingInfoAndSmartMessage() | |
} | |
} | |
} catch (error: TimeoutCancellationException) { | |
onBoardingData.postError(error) |
This file contains hidden or 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
interface GeoFenceService { | |
/** | |
* Return a list of [GeofencingResponse] awaiting for collection by given dpid | |
*/ | |
@GET("geofencing/v1/articles/{dpid}") | |
fun getGeoFenceArticles(@Path("dpid") dpid: String): Single<List<GeofencingResponse>> | |
} |