Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add namespace to gradle files on Flutter plugin to be compatible with AGP 8.+ #1129

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ConfirmTransactionJob(

override fun start(breezSDK: BlockingBreezServices) {
try {
val request = Json.decodeFromString(AddressTxsConfirmedRequest.serializer(), payload)
val request = Json.decodeFromString<AddressTxsConfirmedRequest>(AddressTxsConfirmedRequest.serializer(), payload)
this.bitcoinAddress = request.address
} catch (e: Exception) {
logger.log(TAG, "Failed to decode payload: ${e.message}", "WARN")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class LnurlPayInfoJob(
override fun start(breezSDK: BlockingBreezServices) {
var request: LnurlInfoRequest? = null
try {
request = Json.decodeFromString(LnurlInfoRequest.serializer(), payload)
request = Json.decodeFromString<LnurlInfoRequest>(LnurlInfoRequest.serializer(), payload)
// Get the fee parameters offered by the LSP for opening a new channel
val ofp = breezSDK.openChannelFee(OpenChannelFeeRequest(amountMsat = null)).feeParams
// Calculate the maximum receivable amount within the fee limit (in millisatoshis)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class LnurlPayInvoiceJob(
override fun start(breezSDK: BlockingBreezServices) {
var request: LnurlInvoiceRequest? = null
try {
request = Json.decodeFromString(LnurlInvoiceRequest.serializer(), payload)
request = Json.decodeFromString<LnurlInvoiceRequest>(LnurlInvoiceRequest.serializer(), payload)
// Get channel setup fee for invoice amount
val ofpResp =
breezSDK.openChannelFee(OpenChannelFeeRequest(amountMsat = request.amount))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ReceivePaymentJob(

override fun start(breezSDK: BlockingBreezServices) {
try {
val request = Json.decodeFromString(ReceivePaymentRequest.serializer(), payload)
val request = Json.decodeFromString<ReceivePaymentRequest>(ReceivePaymentRequest.serializer(), payload)
val payment = breezSDK.paymentByHash(request.paymentHash)
if (payment != null) {
this.receivedPayment = payment
Expand Down
52 changes: 18 additions & 34 deletions libs/sdk-flutter/android/build.gradle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we update the compileSdk/java version in libs/sdk-bindings/bindings-android and libs/sdk-react-native/android also or is it fine to leave them as is?

Copy link
Contributor Author

@erdemyerebasmaz erdemyerebasmaz Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally yes, but scope of this PR only concerns Flutter plugin. Other bindings can be addressed in separate PRs if needed.

Original file line number Diff line number Diff line change
@@ -1,53 +1,37 @@
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'org.jetbrains.kotlin.plugin.serialization'
}

group 'com.breez.breez_sdk'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.8.20'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
android {
namespace = 'com.breez.breez_sdk'
compileSdk = 34

rootProject.allprojects {
repositories {
google()
mavenCentral()
defaultConfig {
minSdk = 24
}
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlinx-serialization'

android {
compileSdkVersion 33

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '11'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
minSdkVersion 24
main {
java.srcDirs += 'src/main/kotlin'
}
}
}

dependencies {
implementation "net.java.dev.jna:jna:5.14.0@aar"
/* JSON serialization */
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3'
}
}
52 changes: 17 additions & 35 deletions libs/sdk-flutter/android/build.gradle.production
Original file line number Diff line number Diff line change
@@ -1,56 +1,38 @@
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'org.jetbrains.kotlin.plugin.serialization'
}

group 'com.breez.breez_sdk'
version '0.6.2'

buildscript {
ext.kotlin_version = '1.8.20'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
android {
namespace = 'com.breez.breez_sdk'
compileSdk = 34

rootProject.allprojects {
repositories {
google()
mavenCentral()
maven { url("https://mvn.breez.technology/releases") }
defaultConfig {
minSdk = 24
}
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlinx-serialization'

android {
compileSdkVersion 33

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '11'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
minSdkVersion 24
main {
java.srcDirs += 'src/main/kotlin'
}
}
}

dependencies {
api "breez_sdk:bindings-android:$version"
implementation "net.java.dev.jna:jna:5.14.0@aar"
/* JSON serialization */
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3'

}
4 changes: 3 additions & 1 deletion libs/sdk-flutter/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ rootProject.name = 'breez_sdk'

dependencyResolutionManagement {
repositories {
maven { url("https://mvn.breez.technology/releases") }
google()
mavenCentral()
maven { url = uri("https://mvn.breez.technology/releases") }
}
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
}
3 changes: 0 additions & 3 deletions libs/sdk-flutter/android/src/main/AndroidManifest.xml

This file was deleted.

Loading