File tree Expand file tree Collapse file tree 12 files changed +44
-23
lines changed
androidTest/java/to/bitkit/services
test/java/to/bitkit/repositories Expand file tree Collapse file tree 12 files changed +44
-23
lines changed Original file line number Diff line number Diff line change 4646 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4747 CHATWOOT_API : ${{ secrets.CHATWOOT_API }}
4848 E2E : true
49+ GEO : false
4950 run : ./gradlew assembleDevDebug
5051
5152 - name : Rename APK
7374 - { name: settings, grep: "@settings" }
7475 - { name: send, grep: "@send" }
7576 - { name: lightning_security, grep: "@lightning|@security" }
76- - { name: lnurl , grep: "@lnurl" }
77+ - { name: lnurl_transfer , grep: "@lnurl|@transfer " }
7778
7879 name : e2e-tests - ${{ matrix.shard.name }}
7980
Original file line number Diff line number Diff line change @@ -87,6 +87,14 @@ Simply pass `E2E=true` as environment variable and build any flavor.
8787E2E=true ./gradlew assembleDevRelease
8888```
8989
90+ #### Disable Geoblocking Checks
91+
92+ By default, geoblocking checks via API are enabled. To disable at build time, use the ` GEO ` environment variable:
93+
94+ ``` sh
95+ GEO=false E2E=true ./gradlew assembleDevRelease
96+ ```
97+
9098### Build for Release
9199
92100** Prerequisites**
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ android {
4848 useSupportLibrary = true
4949 }
5050 buildConfigField(" boolean" , " E2E" , System .getenv(" E2E" )?.toBoolean()?.toString() ? : " false" )
51+ buildConfigField(" boolean" , " GEO" , System .getenv(" GEO" )?.toBoolean()?.toString() ? : " true" )
5152 }
5253
5354 flavorDimensions + = " network"
Original file line number Diff line number Diff line change @@ -82,11 +82,11 @@ class BlocktankTest {
8282 }
8383
8484 @Test
85- fun testCreateCjitOrder () = runBlocking {
85+ fun testCreateCjitEntry () = runBlocking {
8686 // Test creating a CJIT order
8787 val channelSizeSat = 100_000uL // 100k sats
8888 val invoiceSat = 10_000uL // 10k sats for the invoice
89- val invoiceDescription = " Test CJIT order "
89+ val invoiceDescription = " Test CJIT"
9090 val nodeId = " 03e7156ae33b0a208d0744199163177e909e80176e55d97a2f221ede0f934dd9ad" // Example node ID
9191 val channelExpiryWeeks = 6u
9292 val options = CreateCjitOptions (source = " bitkit" , discountCode = null )
@@ -122,7 +122,7 @@ class BlocktankTest {
122122 )
123123
124124 // Test getting CJIT entries
125- val entries = service.blocktank.cjitOrders (
125+ val entries = service.blocktank.cjitEntries (
126126 entryIds = listOf (cjitEntry.id),
127127 filter = null ,
128128 refresh = true
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import kotlin.io.path.Path
1515internal object Env {
1616 val isDebug = BuildConfig .DEBUG
1717 const val isE2eTest = BuildConfig .E2E
18+ const val isGeoblockingEnabled = BuildConfig .GEO
1819 val network = Network .valueOf(BuildConfig .NETWORK )
1920 val walletSyncIntervalSecs = 10_uL // TODO review
2021 val platform = " Android ${Build .VERSION .RELEASE } (API ${Build .VERSION .SDK_INT } )"
Original file line number Diff line number Diff line change @@ -148,8 +148,8 @@ class WakeNodeWorker @AssistedInject constructor(
148148 val sats = channel.amountOnClose
149149 self.bestAttemptContent?.title = " Received ⚡ $sats sats"
150150
151- val cjitOrder = channel.let { blocktankRepo.getCjitOrder (it) }
152- if (cjitOrder != null ) {
151+ val cjitEntry = channel.let { blocktankRepo.getCjitEntry (it) }
152+ if (cjitEntry != null ) {
153153 val amount = channel.amountOnClose.toLong()
154154
155155 // Save for UI to pick up
@@ -161,7 +161,7 @@ class WakeNodeWorker @AssistedInject constructor(
161161 sats = amount,
162162 )
163163 )
164- activityRepo.insertActivityFromChannel(cjitOrder = cjitOrder , channel = channel)
164+ activityRepo.insertActivityFromCjit(cjitEntry = cjitEntry , channel = channel)
165165 }
166166 }
167167 } else if (self.notificationType == orderPaymentConfirmed) {
Original file line number Diff line number Diff line change @@ -469,17 +469,17 @@ class ActivityRepo @Inject constructor(
469469 }
470470
471471 /* *
472- * Inserts a new activity
472+ * Inserts a new activity for a fulfilled (channel ready) cjit channel order
473473 */
474- suspend fun insertActivityFromChannel (
475- cjitOrder : IcJitEntry ? ,
474+ suspend fun insertActivityFromCjit (
475+ cjitEntry : IcJitEntry ? ,
476476 channel : ChannelDetails ,
477477 ): Result <Unit > = withContext(bgDispatcher) {
478478 runCatching {
479- requireNotNull(cjitOrder )
479+ requireNotNull(cjitEntry )
480480
481481 val amount = channel.amountOnClose
482- val now = nowTimestamp().toEpochMilli() .toULong()
482+ val now = nowTimestamp().epochSecond .toULong()
483483
484484 return @withContext insertActivity(
485485 Activity .Lightning (
@@ -489,7 +489,7 @@ class ActivityRepo @Inject constructor(
489489 status = PaymentState .SUCCEEDED ,
490490 value = amount,
491491 fee = 0U ,
492- invoice = cjitOrder .invoice.request,
492+ invoice = cjitEntry .invoice.request,
493493 message = " " ,
494494 timestamp = now,
495495 preimage = null ,
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ class BlocktankRepo @Inject constructor(
9898 }
9999 }
100100
101- suspend fun getCjitOrder (channel : ChannelDetails ): IcJitEntry ? = withContext(bgDispatcher) {
101+ suspend fun getCjitEntry (channel : ChannelDetails ): IcJitEntry ? = withContext(bgDispatcher) {
102102 return @withContext _blocktankState .value.cjitEntries.firstOrNull { order ->
103103 order.channelSizeSat == channel.channelValueSats &&
104104 order.lspNode.pubkey == channel.counterpartyNodeId
@@ -132,7 +132,7 @@ class BlocktankRepo @Inject constructor(
132132
133133 // Sync instantly from cache
134134 val cachedOrders = coreService.blocktank.orders(refresh = false )
135- val cachedCjitEntries = coreService.blocktank.cjitOrders (refresh = false )
135+ val cachedCjitEntries = coreService.blocktank.cjitEntries (refresh = false )
136136 _blocktankState .update { state ->
137137 state.copy(
138138 orders = cachedOrders,
@@ -143,7 +143,7 @@ class BlocktankRepo @Inject constructor(
143143
144144 // Then refresh from server
145145 val orders = coreService.blocktank.orders(refresh = true )
146- val cjitEntries = coreService.blocktank.cjitOrders (refresh = true )
146+ val cjitEntries = coreService.blocktank.cjitEntries (refresh = true )
147147 _blocktankState .update { state ->
148148 state.copy(
149149 orders = orders,
Original file line number Diff line number Diff line change @@ -109,7 +109,13 @@ class CoreService @Inject constructor(
109109 }
110110 }
111111
112+ @Suppress(" KotlinConstantConditions" )
112113 private suspend fun isGeoBlocked (): Boolean {
114+ if (! Env .isGeoblockingEnabled) {
115+ Logger .verbose(" Geoblocking disabled via build config" , context = " GeoCheck" )
116+ return false
117+ }
118+
113119 return ServiceQueue .CORE .background {
114120 runCatching {
115121 Logger .verbose(" Checking geo status…" , context = " GeoCheck" )
@@ -584,7 +590,7 @@ class BlocktankService(
584590 }
585591 }
586592
587- suspend fun cjitOrders (
593+ suspend fun cjitEntries (
588594 entryIds : List <String >? = null,
589595 filter : CJitStateEnum ? = null,
590596 refresh : Boolean = true,
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import androidx.compose.runtime.setValue
2020import androidx.compose.ui.Alignment
2121import androidx.compose.ui.Modifier
2222import androidx.compose.ui.layout.ContentScale
23+ import androidx.compose.ui.platform.testTag
2324import androidx.compose.ui.res.painterResource
2425import androidx.compose.ui.res.stringResource
2526import androidx.compose.ui.tooling.preview.Preview
@@ -98,7 +99,9 @@ private fun Content(
9899 onCloseClick : () -> Unit = {},
99100) {
100101 val inProgress = progressState == SavingsProgressState .PROGRESS
101- ScreenColumn {
102+ ScreenColumn (
103+ modifier = Modifier .testTag(if (inProgress) " TransferSettingUp" else " TransferSuccess" )
104+ ) {
102105 AppTopBar (
103106 titleText = when (progressState) {
104107 SavingsProgressState .PROGRESS -> stringResource(R .string.lightning__transfer__nav_title)
@@ -182,6 +185,7 @@ private fun Content(
182185 PrimaryButton (
183186 text = stringResource(R .string.common__ok),
184187 onClick = onContinueClick,
188+ modifier = Modifier .testTag(" TransferSuccess-button" )
185189 )
186190 }
187191 Spacer (modifier = Modifier .height(16 .dp))
You can’t perform that action at this time.
0 commit comments