Skip to content

Conversation

@jvsena42
Copy link
Member

@jvsena42 jvsena42 commented Nov 18, 2025

Description

This PR adds setup to disable geoblocking checks entirely via GEO bool environment variable with value true or false.
Also fixes some flows when geoblocked

When using GEO=false, geoblocking checks via API are bypassed.
Defaults to true, preserving current default functionality.

Linked Issues/Tasks

Closes #182
Figma

Screenshot / Video

Test cases:

  • To all cases you need to set a VPN to USA or Canada
  • Setting isGeoblockingEnabled = false makes the app ignore geoblock check
  • The app should display a warning about geoblock on onboarding
No Lightning channels

  1. Saving -> Transfer to spending button not visible
  2. Qr sheet -> Spending balance -> click on receive on spending balance button -> display a toast error

no-ln-channels.mp4
Only Blocktant channels

  1. Saving -> Transfer to spending button not visible
  2. Qr sheet -> Should not display Unified QR
  3. Qr sheet -> Spending balance -> click on receive on spending balance button -> display a toast error
  4. Scan lightning QR code -> should not be able to send

only-lsp-channels.mp4
Blocktank + external peer channels

  1. Saving -> Transfer to spending button not visible
  2. Qr sheet -> Should display Unified QR
  3. Qr sheet -> Spending balance -> Should display qr
  4. Scan Lightning QR code -> should be able to send according the outbound with the external node

lsp-and-external.mp4
onboarding.mp4

@jvsena42 jvsena42 self-assigned this Nov 18, 2025
@jvsena42
Copy link
Member Author

CJIT is not blocked, fixing

@jvsena42 jvsena42 changed the title Add geoblock env variable Geoblock improvements Nov 19, 2025
@jvsena42 jvsena42 marked this pull request as ready for review November 20, 2025 09:39
@jvsena42 jvsena42 requested a review from Copilot November 20, 2025 09:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a centralized geoblocking management system through a new GeoService singleton, replacing the previous scattered isGeoBlocked property in AppViewModel. The implementation adds support for disabling geoblocking via the GEO environment variable and enforces geoblocking restrictions by filtering out Blocktank LSP channels when users are in restricted regions, while still allowing Lightning operations through external peer channels.

Key changes:

  • Created GeoService as single source of truth for geoblocking state
  • Added GEO environment variable support with compilation-time and runtime configuration
  • Implemented LSP channel filtering throughout the app to restrict Blocktank usage when geoblocked

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
Bitkit/Services/GeoService.swift New singleton service managing geoblocking state with async status checking
Bitkit/Services/CoreService.swift Added environment variable check to bypass geo API when GEO=false
Bitkit/Constants/Env.swift Added isGeoblockingEnabled configuration with compilation and runtime support
Bitkit/ViewModels/AppViewModel.swift Removed isGeoBlocked property, delegated to GeoService
Bitkit/ViewModels/WalletViewModel.swift Added methods to calculate non-LSP inbound capacity and check for non-LSP channels
Bitkit/Services/LightningService.swift Added LSP peer filtering and external peer validation for geoblocked users
Bitkit/Services/TransferService.swift Added validation to block LSP transfers when geoblocked
Bitkit/Views/Wallets/SavingsWalletView.swift Updated to use GeoService for transfer button visibility
Bitkit/Views/Wallets/Receive/ReceiveQr.swift Implemented LSP channel filtering for tab visibility and CJIT onboarding
Bitkit/Views/Wallets/Receive/ReceiveEdit.swift Updated inbound capacity calculation to exclude LSP channels when geoblocked
Bitkit/Views/Transfer/FundingOptions.swift Replaced AppViewModel geo checks with GeoService
Bitkit/Views/Onboarding/OnboardingSlider.swift Updated disclaimer text to use GeoService
Bitkit.xcodeproj/project.pbxproj Added GeoService to build targets and configured GEO compilation flag
.github/workflows/e2e-tests.yml Set GEO=false for E2E tests to bypass geoblocking

@jvsena42
Copy link
Member Author

Drafted to investigate CI

@jvsena42 jvsena42 marked this pull request as draft November 20, 2025 15:11
@jvsena42 jvsena42 marked this pull request as ready for review November 20, 2025 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to toggle geoblocking via an env var for e2e tests

2 participants