Skip to content

Instantly share code, notes, and snippets.

View bolaware's full-sized avatar
👨‍🔧

Bolaji Kassim bolaware

👨‍🔧
View GitHub Profile
@bolaware
bolaware / old_jumio_dependecies.gradle
Created June 19, 2019 08:32
Old Jumio dependencies
implementation "com.jumio.android:core:2.13.0@aar"
implementation "com.jumio.android:nv:2.13.0@aar"
implementation "com.jumio.android:nv-liveness:2.13.0@aar"
implementation "com.jumio.android:javadoc:2.13.0"
implementation "com.google.android.gms:play-services-vision:17.0.2"
implementation "com.jumio.android:nv-mrz:2.13.0@aar"
implementation "com.jumio.android:nv-nfc:2.13.0@aar"
implementation "com.madgag.spongycastle:prov:1.58.0.0"
implementation "net.sf.scuba:scuba-sc-android:0.0.16"
//generic function that is responsible for making calls, it is run on Dispatcher.IO threadpool
private suspend fun <T : Any> makeCall(call: suspend () -> Response<T>): LiveData<Result<T>> = withContext(Dispatchers.IO) {
val result = MutableLiveData<Result<T>>()
try {
val response = call()
if (response.isSuccessful) {
result.postValue(Result(Status.SUCCESS, response.body(), response.message()))
} else {
result.postValue(Result(Status.ERROR, response.body(), response.errorBody()?.string(), response.code()))
}
val loginResultLD : MediatorLiveData<LoginResponse> = MediatorLiveData()
val toastLd : MutableLiveData<String> = MutableLiveData()
fun login(username : String, password : String){
if(username.isValidUsername() and password.isValidPassword()){
viewModelScope.launch {
val result = networkRepo.makeLoginRequestCall(LoginBody(username, password))
loginResultLD.addSource(result) {
it?.let {
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0-alpha01"
@Test
fun `corresponding network repo is called exactly once test`() {
val fakeLoginBody = LoginBody("my_username", "my_password")
val fakeResult = getFakeResultLiveData(fakeLoginBody)
val mockRepository = mockk<NetworkRepo>()
val vm = MainViewModel(mockRepository)
coEvery { mockRepository.makeLoginRequestCall(fakeLoginBody) } returns fakeResult
vm.login(fakeLoginBody.username, fakeLoginBody.password)
testImplementation "io.mockk:mockk:1.9.3"
@bolaware
bolaware / faq.md
Last active July 9, 2019 12:27
Sample Barter FAQ

How to open an account

Accept payment, make payouts and manage your business funds from one integrated platform that helps you connect globally. Processing billions around the world, we are the trusted payments partner of Nigerian businesses.

  • Accept payments, make payouts and manage your business funds from one integrated platform that helps you connect globally. Processing billions around the world, we are the trusted payments partner of Nigerian businesses.
  • Accept payments, make payouts and manage your business funds from one integrated.
  • Accept payments, make payouts and manage your business funds from one integrated.
@bolaware
bolaware / Account(Account settings).md
Created July 10, 2019 07:56
Account(Account settings)

What is Lorem Ipsum?

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

@bolaware
bolaware / Account(How to generate my account statement).md
Last active July 10, 2019 07:59
Account(How to generate my account statement)

##What is Lorem Ipsumzzz?

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

class MyFirebaseMessagingService : FirebaseMessagingService() {
@Inject
lateinit var cache: ICache
override fun onCreate() {
super.onCreate()
AndroidInjection.inject(this)
}