Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CHATWOOT_API: ${{ secrets.CHATWOOT_API }}
E2E: true
GEO: false
run: ./gradlew assembleDevDebug

- name: Rename APK
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ Simply pass `E2E=true` as environment variable and build any flavor.
E2E=true ./gradlew assembleDevRelease
```

#### Disable Geoblocking Checks

By default, geoblocking checks via API are enabled. To disable at build time, use the `GEO` environment variable:

```sh
GEO=false E2E=true ./gradlew assembleDevRelease
```

### Build for Release

**Prerequisites**
Expand Down
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ android {
useSupportLibrary = true
}
buildConfigField("boolean", "E2E", System.getenv("E2E")?.toBoolean()?.toString() ?: "false")
buildConfigField("boolean", "GEO", System.getenv("GEO")?.toBoolean()?.toString() ?: "true")
}

flavorDimensions += "network"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/to/bitkit/env/Env.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import kotlin.io.path.Path
internal object Env {
val isDebug = BuildConfig.DEBUG
const val isE2eTest = BuildConfig.E2E
const val isGeoblockingEnabled = BuildConfig.GEO
val network = Network.valueOf(BuildConfig.NETWORK)
val walletSyncIntervalSecs = 10_uL // TODO review
val platform = "Android ${Build.VERSION.RELEASE} (API ${Build.VERSION.SDK_INT})"
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/to/bitkit/services/CoreService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ class CoreService @Inject constructor(
}
}

@Suppress("KotlinConstantConditions")
private suspend fun isGeoBlocked(): Boolean {
if (!Env.isGeoblockingEnabled) {
Logger.verbose("Geoblocking disabled via build config", context = "GeoCheck")
return false
}

return ServiceQueue.CORE.background {
runCatching {
Logger.verbose("Checking geo status…", context = "GeoCheck")
Expand Down
Loading