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

Upgrade to Kotlin 1.9 #509

Merged
merged 13 commits into from
Feb 13, 2024
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath("com.android.tools.build:gradle:7.4.2")
classpath("com.android.tools.build:gradle:8.1.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}")
classpath("org.jetbrains.kotlin:kotlin-serialization:${Versions.kotlin}")
classpath("com.squareup.sqldelight:gradle-plugin:${Versions.sqlDelight}")
Expand Down
23 changes: 10 additions & 13 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
object Versions {
const val lightningKmp = "1.5.15"
const val secp256k1 = "0.11.0"
const val lightningKmp = "1.6-SNAPSHOT"
const val secp256k1 = "0.13.0"
const val torMobile = "0.2.0"

const val kotlin = "1.8.21"
const val coroutines = "1.7.2"
const val serialization = "1.5.1"
const val kotlin = "1.9.22"

const val ktor = "2.3.2"
const val ktor = "2.3.7"
const val sqlDelight = "1.5.5"
const val kodeinMemory = "0.8.0"

const val slf4j = "1.7.30"
const val junit = "4.13"
Expand All @@ -18,12 +15,12 @@ object Versions {

object Android {
const val coreKtx = "1.9.0"
const val lifecycle = "2.5.1"
const val lifecycle = "2.7.0"
const val prefs = "1.2.0"
const val datastore = "1.0.0"
const val compose = "1.4.3"
const val composeCompiler = "1.4.7"
const val navCompose = "2.5.3"
const val compose = "1.6.1"
const val composeCompiler = "1.5.8"
const val navCompose = "2.7.6"
const val accompanist = "0.30.1"
const val composeConstraintLayout = "1.1.0-alpha09"
const val biometrics = "1.1.0"
Expand All @@ -39,13 +36,13 @@ object Versions {
object AndroidLegacy {
const val eclair = "0.4.23-android-phoenix"

const val safeArgs = "2.4.2"
const val safeArgs = "2.7.6"
const val appCompat = "1.3.0"
const val material = "1.7.0"
const val navigation = "2.4.2"
const val constraint = "2.0.4"
const val lifecycleExtensions = "2.2.0"
const val lifecycle = "2.4.0"
const val lifecycle = "2.7.0"
const val work = "2.8.1"
const val viewpager = "1.0.0"
const val eventbus = "3.1.1"
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ kotlin.mpp.stability.nowarn=true
kotlin.incremental.multiplatform = true
kotlin.parallel.tasks.in.project = true
kotlin.mpp.enableCInteropCommonization = true
kotlin.native.binary.memoryModel = experimental

# Android
android.useAndroidX = true
Expand All @@ -34,3 +33,6 @@ xcodeproj=phoenix-ios/phoenix-ios.xcodeproj

# the chain that we use
chain="testnet"
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
9 changes: 3 additions & 6 deletions phoenix-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ fun gitCommitHash(): String {
val chain: String by project

android {
compileSdk = 33
namespace = "fr.acinq.phoenix.android"
compileSdk = 34
defaultConfig {
applicationId = "fr.acinq.phoenix.testnet"
minSdk = 26
targetSdk = 33
targetSdk = 34
versionCode = 75
versionName = gitCommitHash()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -93,10 +94,6 @@ dependencies {

implementation("com.google.android.material:material:1.7.0")

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core") {
version { strictly(Versions.coroutines) }
}

// -- AndroidX
implementation("androidx.core:core-ktx:${Versions.Android.coreKtx}")
// -- AndroidX: livedata
Expand Down
3 changes: 1 addition & 2 deletions phoenix-android/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="fr.acinq.phoenix.android">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import androidx.navigation.navOptions
import com.google.accompanist.permissions.ExperimentalPermissionsApi
import com.google.accompanist.permissions.isGranted
import com.google.accompanist.permissions.rememberPermissionState
import fr.acinq.lightning.utils.currentTimestampMillis
import fr.acinq.phoenix.PhoenixBusiness
import fr.acinq.phoenix.android.components.Button
import fr.acinq.phoenix.android.components.Dialog
Expand Down Expand Up @@ -99,7 +100,6 @@ import io.ktor.http.decodeURLPart
import io.ktor.http.encodeURLParameter
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.first
import org.kodein.memory.util.currentTimestampMillis


@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ fun IntroView(
val internalData = application.internalDataRepository
val context = LocalContext.current
val scope = rememberCoroutineScope()
val pagerState = rememberPagerState()
val pagerState = rememberPagerState(pageCount = { 3 })

HorizontalPager(pageCount = 3, state = pagerState) { index ->
HorizontalPager(state = pagerState) { index ->
BackHandler { context.findActivity().moveTaskToBack(false) }
when (index) {
0 -> WelcomeView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,11 @@ private fun ReceiveViewPages(
defaultInvoiceDescription: String,
defaultInvoiceExpiry: Long,
) {
val pagerState = rememberPagerState()
val pagerState = rememberPagerState(pageCount = { 2 })
// we need to be responsive in some subcomponents, like the edit-invoice buttons
BoxWithConstraints {
HorizontalPager(
modifier = Modifier.fillMaxHeight(),
pageCount = 2,
state = pagerState,
contentPadding = PaddingValues(
horizontal = when {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ private fun SpliceOutFeeSummaryView(
fun spliceFailureDetails(spliceFailure: ChannelCommand.Commitment.Splice.Response.Failure): String = when (spliceFailure) {
is ChannelCommand.Commitment.Splice.Response.Failure.AbortedByPeer -> stringResource(id = R.string.splice_error_aborted_by_peer, spliceFailure.reason)
is ChannelCommand.Commitment.Splice.Response.Failure.CannotCreateCommitTx -> stringResource(id = R.string.splice_error_cannot_create_commit)
is ChannelCommand.Commitment.Splice.Response.Failure.ChannelNotIdle -> stringResource(id = R.string.splice_error_channel_not_idle)
is ChannelCommand.Commitment.Splice.Response.Failure.ConcurrentRemoteSplice -> stringResource(id = R.string.splice_error_concurrent_remote)
is ChannelCommand.Commitment.Splice.Response.Failure.ChannelNotQuiescent -> stringResource(id = R.string.splice_error_channel_not_quiescent)
is ChannelCommand.Commitment.Splice.Response.Failure.Disconnected -> stringResource(id = R.string.splice_error_disconnected)
is ChannelCommand.Commitment.Splice.Response.Failure.FundingFailure -> stringResource(id = R.string.splice_error_funding_error, spliceFailure.reason.javaClass.simpleName)
is ChannelCommand.Commitment.Splice.Response.Failure.InsufficientFunds -> stringResource(id = R.string.splice_error_insufficient_funds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
android:pathData="M 7.5 12.5 L 10.5 15.5 L 16.5 9.5"
android:fillColor="#00000000"
android:strokeColor="?attr/colorPrimary"
android:strokeWidth="2"
android:strokeWidth="0.5"
android:trimPathEnd="0"
android:strokeLineCap="round"
android:strokeLineJoin="round"/>
Expand All @@ -61,8 +61,8 @@
android:propertyName="strokeWidth"
android:startOffset="300"
android:duration="700"
android:valueFrom="3"
android:valueTo="11"
android:valueFrom="0"
android:valueTo="3"
android:valueType="floatType"
android:interpolator="@android:anim/overshoot_interpolator"/>
<objectAnimator
Expand All @@ -83,8 +83,8 @@
<objectAnimator
android:propertyName="strokeWidth"
android:duration="1000"
android:valueFrom="2"
android:valueTo="6"
android:valueFrom="0.5"
android:valueTo="2"
android:valueType="floatType"
android:interpolator="@android:anim/bounce_interpolator"/>
<objectAnimator
Expand All @@ -110,15 +110,15 @@
<set>
<objectAnimator
android:propertyName="scaleX"
android:duration="800"
android:valueFrom="0.6"
android:duration="600"
android:valueFrom="0.7"
android:valueTo="1"
android:valueType="floatType"
android:interpolator="@android:anim/overshoot_interpolator"/>
<objectAnimator
android:propertyName="scaleY"
android:duration="800"
android:valueFrom="0.6"
android:duration="600"
android:valueFrom="0.7"
android:valueTo="1"
android:valueType="floatType"
android:interpolator="@android:anim/overshoot_interpolator"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
android:name="circle"
android:fillColor="#00000000"
android:pathData="M 2 12 C 2 9.35 3.05 6.8 4.929 4.929 C 6.804 3.054 9.349 2 12 2 C 14.651 2 17.196 3.054 19.071 4.929 C 20.946 6.804 22 9.349 22 12 C 22 14.651 20.946 17.196 19.071 19.071 C 17.196 20.946 14.651 22 12 22 C 9.349 22 6.804 20.946 4.929 19.071 C 3.054 17.196 2 14.651 2 12"
android:strokeWidth="1"
android:strokeWidth="2"
android:strokeColor="?attr/colorPrimary"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:name="check"
android:fillColor="#00000000"
android:pathData="M 7.5 12.5 L 10.5 15.5 L 16.5 9.5"
android:strokeWidth="2.5"
android:strokeWidth="3"
android:strokeColor="?attr/colorPrimary"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
Expand Down
3 changes: 2 additions & 1 deletion phoenix-android/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,8 @@
<string name="splice_error_nochannels">You don\'t have any channels</string>
<string name="splice_error_aborted_by_peer">Aborted by peer [%1$s]</string>
<string name="splice_error_cannot_create_commit">Unable to create a new commitment</string>
<string name="splice_error_channel_not_idle">Channel is not available</string>
<string name="splice_error_concurrent_remote">There\'s another splice in progress</string>
<string name="splice_error_channel_not_quiescent">Aborted due to an error</string>
<string name="splice_error_disconnected">Channel is disconnected</string>
<string name="splice_error_funding_error">Funding has failed [%1$s]</string>
<string name="splice_error_insufficient_funds">Not enough funds</string>
Expand Down
28 changes: 6 additions & 22 deletions phoenix-ios/phoenix-ios/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -5719,28 +5719,6 @@
}
}
},
"Channel not idle" : {
"localizations" : {
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Canal no inactivo"
}
},
"es-419" : {
"stringUnit" : {
"state" : "translated",
"value" : "Canal no inactivo"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Canal non inactif"
}
}
}
},
"Channels are not available, try again later" : {

},
Expand Down Expand Up @@ -6671,6 +6649,9 @@
}
}
}
},
"Concurrent splice in progress" : {

},
"Configuration" : {
"localizations" : {
Expand Down Expand Up @@ -22454,6 +22435,9 @@
}
}
}
},
"Splice has been aborted" : {

},
"Splice Out" : {
"localizations" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,10 @@ struct LiquidityAdsView: View {
Text("Invalid splice-out pubKeyScript")
} else if let _ = failure.asSpliceAlreadyInProgress() {
Text("Splice already in progress")
} else if let _ = failure.asChannelNotIdle() {
Text("Channel not idle")
} else if let _ = failure.asChannelNotQuiescent() {
Text("Splice has been aborted")
} else if let _ = failure.asConcurrentRemoteSplice() {
Text("Concurrent splice in progress")
} else if let _ = failure.asInvalidLiquidityAds() {
Text("Invalid liquidity ads")
} else if let _ = failure.asFundingFailure() {
Expand Down
10 changes: 5 additions & 5 deletions phoenix-ios/phoenix-ios/views/send/SpliceOutProblem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PhoenixShared
enum SpliceOutProblem: Error {
case insufficientFunds
case spliceAlreadyInProgress
case channelNotIdle
case channelNotQuiescent
case sessionError
case disconnected
case other
Expand All @@ -16,8 +16,8 @@ enum SpliceOutProblem: Error {
return String(localized: "Insufficient funds")
case .spliceAlreadyInProgress:
return String(localized: "Splice already in progress")
case .channelNotIdle:
return String(localized: "Channel not idle")
case .channelNotQuiescent:
return String(localized: "Splice has been aborted")
case .sessionError:
return String(localized: "Splice-out session error")
case .disconnected:
Expand Down Expand Up @@ -45,8 +45,8 @@ enum SpliceOutProblem: Error {
if let _ = failure.asSpliceAlreadyInProgress() {
return .spliceAlreadyInProgress
}
if let _ = failure.asChannelNotIdle() {
return .channelNotIdle
if let _ = failure.asChannelNotQuiescent() {
return .channelNotQuiescent
}
if let _ = failure.asFundingFailure() {
return .sessionError
Expand Down
5 changes: 2 additions & 3 deletions phoenix-legacy/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ fun gitCommitHash(): String {
val chain: String by project

android {
compileSdk = 33
namespace = "fr.acinq.phoenix.legacy"
compileSdk = 34
ndkVersion = "23.1.7779620"
defaultConfig {
minSdk = 26
targetSdk = 33
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down Expand Up @@ -84,7 +84,6 @@ dependencies {
// ANDROIDX
implementation("androidx.core:core-ktx:${Versions.Android.coreKtx}")
implementation("androidx.appcompat:appcompat:${Versions.AndroidLegacy.appCompat}")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.serialization}")
// ANDROIDX - navigation
implementation("androidx.navigation:navigation-fragment-ktx:${Versions.AndroidLegacy.navigation}")
implementation("androidx.navigation:navigation-ui-ktx:${Versions.AndroidLegacy.navigation}")
Expand Down
3 changes: 1 addition & 2 deletions phoenix-legacy/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fr.acinq.phoenix.legacy">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class MainFragment : BaseFragment(), SharedPreferences.OnSharedPreferenceChangeL

private lateinit var blinkingAnimation: Animation

private val prefsListener = SharedPreferences.OnSharedPreferenceChangeListener { _: SharedPreferences, key: String ->
private val prefsListener = SharedPreferences.OnSharedPreferenceChangeListener { _: SharedPreferences, key: String? ->
if (key == Prefs.PREFS_SHOW_AMOUNT_IN_FIAT) {
refreshIncomingFundsAmountField()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PaymentsAdapter : RecyclerView.Adapter<PaymentHolder>() {

private var showFooter = false

private val mPrefsListener = SharedPreferences.OnSharedPreferenceChangeListener { _: SharedPreferences, key: String ->
private val mPrefsListener = SharedPreferences.OnSharedPreferenceChangeListener { _: SharedPreferences, key: String? ->
if (key == Prefs.PREFS_SHOW_AMOUNT_IN_FIAT) {
notifyDataSetChanged()
}
Expand Down
Loading