Skip to content

Commit d4c0b34

Browse files
committed
chore: move bitrefill constants out of env
1 parent 27f3f76 commit d4c0b34

File tree

2 files changed

+21
-28
lines changed

2 files changed

+21
-28
lines changed

app/src/main/java/to/bitkit/env/Env.kt

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ internal object Env {
7676
return storagePathOf(walletIndex, network.name.lowercase(), "core")
7777
}
7878

79-
fun buildBitrefillUri(
80-
page: String,
81-
): String {
82-
return "$BIT_REFILL_URL/$page/$BITREFILL_PARAMS"
83-
}
84-
8579
/**
8680
* Generates the storage path for a specified wallet index, network, and directory.
8781
*
@@ -177,13 +171,7 @@ internal object Env {
177171

178172
const val RELEASE_URL = "https://github.com/synonymdev/bitkit-android/releases/download/updater/release.json"
179173
const val EXCHANGES_URL = "https://bitcoin.org/en/exchanges#international"
180-
const val BIT_REFILL_URL = "https://embed.bitrefill.com"
181174
const val BTC_MAP_URL = "https://btcmap.org/map"
182-
private const val BITREFILL_REF = "AL6dyZYt"
183-
private const val BITREFILL_PAYMENT_METHOD = "bitcoin" // Payment method "bitcoin" gives a unified invoice
184-
private const val BITREFILL_APP_NAME = "Bitkit"
185-
private const val BITREFILL_PARAMS =
186-
"?ref=${BITREFILL_REF}&paymentMethod=${BITREFILL_PAYMENT_METHOD}&theme=dark&utm_source=${BITREFILL_APP_NAME}"
187175
const val BITKIT_WEBSITE = "https://bitkit.to/"
188176
const val SYNONYM_CONTACT = "https://synonym.to/contact"
189177
const val SYNONYM_MEDIUM = "https://medium.com/synonym-to"
@@ -195,13 +183,10 @@ internal object Env {
195183
const val TERMS_OF_USE_URL = "https://bitkit.to/terms-of-use"
196184
const val PRIVACY_POLICY_URL = "https://bitkit.to/privacy-policy"
197185
const val STORING_BITCOINS_URL = "https://en.bitcoin.it/wiki/Storing_bitcoins"
198-
const val BIT_REFILL_URL = "https://embed.bitrefill.com"
199186

200-
private const val BITREFILL_REF = "AL6dyZYt"
201-
private const val BITREFILL_PAYMENT_METHOD = "bitcoin" // Payment method "bitcoin" gives a unified invoice
202-
private const val BITREFILL_APP_NAME = "Bitkit"
203-
private const val BITREFILL_PARAMS =
204-
"?ref=${BITREFILL_REF}&paymentMethod=${BITREFILL_PAYMENT_METHOD}&theme=dark&utm_source=${BITREFILL_APP_NAME}"
187+
const val BITREFILL_URL = "https://embed.bitrefill.com"
188+
const val BITREFILL_APP = "Bitkit"
189+
const val BITREFILL_REF = "AL6dyZYt"
205190

206191
// endregion
207192
}
@@ -217,13 +202,6 @@ object TransactionDefaults {
217202
val dustLimit = 546u
218203
}
219204

220-
private object ElectrumServers {
221-
const val BITCOIN = "ssl://fulcrum.bitkit.blocktank.to:8900"
222-
const val TESTNET = "ssl://electrum.blockstream.info:60002"
223-
const val REGTEST = "tcp://34.65.252.32:18483"
224-
const val E2E = "tcp://127.0.0.1:60001"
225-
}
226-
227205
object Peers {
228206
val staging =
229207
PeerDetails.parse("028a8910b0048630d4eb17af25668cdd7ea6f2d8ae20956e7a06e2ae46ebcb69fc@34.65.86.104:9400")
@@ -234,3 +212,10 @@ object Peers {
234212
val mainnetLnd4 =
235213
PeerDetails.parse("02a371038863605300d0b3fc9de0cf5ccb57728b7f8906535709a831b16e311187@34.65.186.40:9735")
236214
}
215+
216+
private object ElectrumServers {
217+
const val BITCOIN = "ssl://fulcrum.bitkit.blocktank.to:8900"
218+
const val TESTNET = "ssl://electrum.blockstream.info:60002"
219+
const val REGTEST = "tcp://34.65.252.32:18483"
220+
const val E2E = "tcp://127.0.0.1:60001"
221+
}

app/src/main/java/to/bitkit/ui/screens/shop/shopWebView/ShopWebViewScreen.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fun ShopWebViewScreen(
6565
this.webViewClient = webViewClient
6666
configureForBasicWebContent()
6767
addJavascriptInterface(webViewInterface, "Android")
68-
loadUrl(Env.buildBitrefillUri(page = page))
68+
loadUrl(bitrefillUrlOf(page))
6969
webView = this
7070
}
7171
},
@@ -95,10 +95,18 @@ private fun Preview() {
9595
ShopWebViewScreen(
9696
onClose = {},
9797
onBack = {},
98-
onPaymentIntent = { uri ->
99-
},
98+
onPaymentIntent = {},
10099
page = "esims",
101100
title = "Gift Cards"
102101
)
103102
}
104103
}
104+
105+
private fun bitrefillUrlOf(page: String) = "${Env.BITREFILL_URL}/$page/$BITREFILL_PARAMS"
106+
107+
private const val PAYMENT_METHOD = "bitcoin" // Payment method "bitcoin" gives a unified invoice
108+
private const val THEME = "dark"
109+
private const val BITREFILL_PARAMS = "?ref=${Env.BITREFILL_REF}" +
110+
"&paymentMethod=${PAYMENT_METHOD}" +
111+
"&theme=$THEME" +
112+
"&utm_source=${Env.BITREFILL_APP}"

0 commit comments

Comments
 (0)