Skip to content

Instantly share code, notes, and snippets.

View bolaware's full-sized avatar
👨‍🔧

Bolaji Kassim bolaware

👨‍🔧
View GitHub Profile
@bolaware
bolaware / barter_t_and_c.md
Last active October 8, 2020 11:56
Barter Terms and Conditions

Flutterwave's Barter® Terms of Service

Introduction

These Terms and Conditions ("Terms") contained herein on this page is a legal agreement between you, as a prospective customer and or customer of Flutterwave's services and Flutterwave UK Limited (Flutterwave, "we", "our" or "us") and shall govern your access to and use of Flutterwave's services which include all pages within the Flutterwave website, mobile applications and other products and services (collectively referred to

class MyFirebaseMessagingService : FirebaseMessagingService() {
@Inject
lateinit var cache: ICache
override fun onCreate() {
super.onCreate()
AndroidInjection.inject(this)
}
@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.

@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 / 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.
testImplementation "io.mockk:mockk:1.9.3"
@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)
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0-alpha01"
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 {
//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()))
}