Skip to content

Commit

Permalink
Merge pull request #83 from jumaallan/deps-updates
Browse files Browse the repository at this point in the history
Update AS & Libraries
  • Loading branch information
wangerekaharun authored Feb 16, 2023
2 parents 4659a35 + f276127 commit 980544b
Show file tree
Hide file tree
Showing 13 changed files with 473 additions and 261 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ Kotlin

```kotlin
dependencies {
implementation("com.androidstudy.daraja:daraja:2.0.1")
implementation("com.androidstudy.daraja:daraja:2.0.2")
}
```

Groovy

```groovy
dependencies {
implementation 'com.androidstudy.daraja:daraja:2.0.1'
implementation 'com.androidstudy.daraja:daraja:2.0.2'
}
```

Expand Down
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ android {
targetSdk = AndroidSdk.targetSdkVersion
versionCode = AndroidSdk.versionCode
versionName = AndroidSdk.versionName
multiDexEnabled = true
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner = "com.androidstudy.mpesa.runner.MockTestRunner"
}
Expand Down Expand Up @@ -65,6 +66,7 @@ android {
isMinifyEnabled = true
}
}
namespace = "com.androidstudy.mpesa"
}

kapt {
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.androidstudy.mpesa">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />

Expand All @@ -16,7 +15,8 @@

<activity
android:name=".ui.PaymentActivity"
android:label="@string/title_activity_payment">
android:label="@string/title_activity_payment"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ class PaymentActivity : AppCompatActivity() {
} else {
// initiate payment
showProgressDialog()
daraja.initiatePayment(token, phoneNumber, amount.toString(), AppUtils.generateUUID(), "Payment") { darajaResult ->
daraja.initiatePayment(
token,
phoneNumber,
amount.toString(),
AppUtils.generateUUID(),
"Payment"
) { darajaResult ->
dismissProgressDialog()
when (darajaResult) {
is DarajaResult.Success -> {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ allprojects {
}

buildscript {
val kotlinVersion by extra("1.5.21")
val kotlinVersion by extra("1.6.21")
val jacocoVersion by extra("0.2")
val nexusPublishVersion by extra("1.1.0")

Expand Down
54 changes: 27 additions & 27 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
object Versions {

// Material and androidX
const val material = "1.3.0-alpha02"
const val constraintLayout = "2.0.1"
const val material = "1.9.0-alpha01"
const val constraintLayout = "2.1.4"

// Firebase
const val firebase = "26.2.0"

//Networking
const val retrofit = "2.9.0"
const val okhttp = "4.8.1"
const val loggingInterceptor = "4.8.1"
const val okhttp = "4.10.0"
const val loggingInterceptor = "4.10.0"

// Lifecycle
const val lifecycle = "2.2.0"
const val lifecycle = "2.6.0-beta01"

// Logging - debug builds
const val timber = "4.7.1"
const val leakCanary = "2.4"
const val chucker = "3.4.0"
const val timber = "5.0.1"
const val leakCanary = "2.10"
const val chucker = "3.5.2"

// Kotlin
const val kotlinVersion = "1.5.21"
const val coreKtx = "1.5.0-alpha02"
const val kotlinVersion = "1.8.0"
const val coreKtx = "1.10.0-alpha02"

// Gradle Plugins
const val ktlint = "10.1.0"
const val detekt = "1.18.0"
const val spotless = "5.9.0"
const val ktlint = "11.2.0"
const val detekt = "1.22.0"
const val spotless = "6.15.0"
const val jacoco = "0.8.4"
const val dokka = "1.5.0"
const val gradleVersionsPlugin = "0.29.0"
const val dokka = "1.7.20"
const val gradleVersionsPlugin = "0.45.0"

// tests
const val junit = "4.13"
const val espresso = "3.3.0"
const val roboelectric = "4.4-beta-1"
const val androidXJUnit = "1.1.1"
const val truth = "1.0.1"
const val mockWebServer = "4.8.1"
const val androidXTestCore = "1.3.0"
const val runner = "1.3.0"
const val rules = "1.3.0"
const val espresso = "3.5.1"
const val roboelectric = "4.9.2"
const val androidXJUnit = "1.1.5"
const val truth = "1.1.3"
const val mockWebServer = "4.10.0"
const val androidXTestCore = "1.5.0"
const val runner = "1.5.2"
const val rules = "1.5.0"
const val archComponentTest = "2.1.0"
const val kakao = "2.3.4"
const val kakao = "2.4.0"
const val mockK = "1.10.0"
const val liveDataTesting = "1.1.2"
const val kotlinxCoroutines = "1.2.1"
const val kotlinxCoroutines = "1.6.4"
}

object BuildPlugins {
Expand Down Expand Up @@ -86,7 +86,7 @@ object Libraries {
"com.squareup.okhttp3:logging-interceptor:${Versions.loggingInterceptor}"

// Lifecycle
const val lifecycle = "androidx.lifecycle:lifecycle-extensions:${Versions.lifecycle}"
const val lifecycle = "androidx.lifecycle:lifecycle-runtime-ktx:${Versions.lifecycle}"

// Debug - for debug builds only
const val timber = "com.jakewharton.timber:timber:${Versions.timber}"
Expand Down Expand Up @@ -124,7 +124,7 @@ object BuildModules {

object AndroidSdk {
const val minSdkVersion = 16
const val compileSdkVersion = 30
const val compileSdkVersion = 33
const val targetSdkVersion = compileSdkVersion
const val versionCode = 1
const val versionName = "1.0"
Expand Down
3 changes: 2 additions & 1 deletion daraja/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ android {
isMinifyEnabled = false
}
}
namespace = "com.androidstudy.daraja"
}

dependencies {
Expand Down Expand Up @@ -76,7 +77,7 @@ tasks {
isFailOnError = false
dependsOn(android.libraryVariants.toList().last().javaCompileProvider)

if (! project.plugins.hasPlugin("org.jetbrains.kotlin.android")) {
if (!project.plugins.hasPlugin("org.jetbrains.kotlin.android")) {
setSource(sourceFiles)
}
android.bootClasspath.forEach { classpath += project.fileTree(it) }
Expand Down
2 changes: 1 addition & 1 deletion daraja/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<manifest package="com.androidstudy.daraja" />
<manifest />
15 changes: 12 additions & 3 deletions daraja/src/main/java/com/androidstudy/daraja/Daraja.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
*/
package com.androidstudy.daraja

import com.androidstudy.daraja.callback.*
import com.androidstudy.daraja.util.TransactionType
import com.androidstudy.daraja.callback.DarajaCallback
import com.androidstudy.daraja.callback.DarajaPaymentCallback
import com.androidstudy.daraja.callback.DarajaResult
import com.androidstudy.daraja.data.model.AccessToken
import com.androidstudy.daraja.data.model.PaymentResult
import com.androidstudy.daraja.data.repo.DarajaRepository
import com.androidstudy.daraja.util.TransactionType

/**
* Creates Mpesa Payment Payload Details
Expand All @@ -42,7 +44,14 @@ object Daraja {
repo.accessToken.enqueue(DarajaCallback(callback))
}

fun initiatePayment(token: String, phoneNumber: String, amount: String, accountReference: String, description: String, callback: ((darajaResult: DarajaResult<PaymentResult>) -> Unit)) {
fun initiatePayment(
token: String,
phoneNumber: String,
amount: String,
accountReference: String,
description: String,
callback: ((darajaResult: DarajaResult<PaymentResult>) -> Unit)
) {
repo.initiatePayment(
token = token,
phoneNumber = phoneNumber,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class DarajaPaymentCallback(
val error = gson.fromJson(response.errorBody()?.string(), ErrorResponse::class.java)
callback.invoke(DarajaResult.Failure(false, DarajaException(error)))
} catch (e: IOException) {
e.printStackTrace()
callback.invoke(DarajaResult.Failure(false, DarajaException("${response.code()}")))
}
}
Expand Down
Loading

0 comments on commit 980544b

Please sign in to comment.