Skip to content

Instantly share code, notes, and snippets.

View adesamp's full-sized avatar
🏠

Ade Dyas adesamp

🏠
View GitHub Profile
image: softartdev/android-fastlane
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/
before_script:
- chmod +x ./gradlew
- echo "$ENV_PROP" > local.properties
json_key_file("/service_account.json") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one
package_name("id.sydev.justversion") # e.g. com.krausefx.app
@adesamp
adesamp / FastFile
Last active November 27, 2021 23:42
for internal
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
@adesamp
adesamp / .gitlba-ci
Created November 20, 2021 12:49
simple gitlab CI
image: jangrewe/gitlab-ci-android
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/
before_script:
- chmod +x ./gradlew
@adesamp
adesamp / asynctest.kt
Created July 7, 2021 11:45
asynctest.kt
@Test
fun `Await Test`() {
runBlocking {
val deferred: Deferred<String> = async { return@async Thread.currentThread().name }
println(deferred.await())
}
}
@Test
fun `AwaitAll Test`() {
@adesamp
adesamp / exceptionHandlingWIthTryCatch.kt
Created July 7, 2021 11:44
exceptionHandlingWIthTryCatch.kt
@Test
fun `direct throw exception in launch with try-catch`() {
runBlocking {
val job = launch {
println("start job")
throw IllegalArgumentException("throw IllegalArgumentException from launch")
}
try {
job.join()
} catch (e: IllegalArgumentException) {
@adesamp
adesamp / ExceptionHandlingWithLaunch.kt
Created July 7, 2021 11:44
ExceptionHandlingWithLaunch.kt
private val exceptionHandling = CoroutineExceptionHandler { coroutineContext, throwable ->
print("got error: ${throwable.message}")
}
@Test
fun `exception with handling in launch with scope`() {
runBlocking {
val job = GlobalScope.launch(exceptionHandling) {
println("start job")
throw IllegalArgumentException("throw IllegalArgumentException from launch")
@adesamp
adesamp / ExceptionHandlingWithAsync.kt
Created July 7, 2021 11:43
ExceptionHandlingWithAsync.kt
@Test
fun `direct throw exception in async with scope with try-catch`() {
runBlocking {
val deferred: Deferred<String> = GlobalScope.async {
println("start job")
throw IllegalArgumentException("throw IllegalArgumentException from launch")
}
try {
println(deferred.await())
} catch (e: IllegalArgumentException) {
@adesamp
adesamp / jobtest.kt
Last active July 7, 2021 11:45
JobTest
@Test
fun `Join Test`() {
runBlocking {
val job : Job = launch { println(Thread.currentThread().name) }
job.join()
}
}
@Test
fun `JoinAll Test`() {
class MainActivity : AppCompatActivity() {
// initialize view model, in this case using koin extension
private val viewModel: MainViewModel by viewModel()
// observe value
viewModel.name.observe(this, ::setName)
private fun setName(name: String?) = binding.edtName.setText(name)
// fetch data on the first time / activtity created