celo-org / celo-org/minipay

Feature: support navigator.geolocation inside MiniPay mini apps (iOS)

Open
#44 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7
Forks
8
PR merge metrics
No merged PRs in 30d

Description

## What

`navigator.geolocation.getCurrentPosition()` and `watchPosition()` hang silently inside MiniPay's iOS WebView, never firing the success or error callback. The same code works in MetaMask's iOS in-app browser, in Safari, and (per testing) in MiniPay Android.

## Why it matters

Location-based mini apps (running, walking, delivery, POI discovery, local discovery) need device location to function. Today they don't work in MiniPay iOS at all, which is a significant subset of the user base.

## Concrete example

[MiniKlaim](https://www.miniklaim.fun) is a territory-capture running game built for Celo Proof of Ship. Inside MiniPay iOS the user sees "Waiting for GPS..." forever. The same URL opened in MetaMask mobile on the same phone works immediately, and Android MiniPay testing also resolves the fix normally.

Tested with:

- iOS location permission granted to MiniPay at OS level (verified in Settings -> Privacy -> Location Services -> MiniPay)
- Multiple permutations of `enableHighAccuracy` true/false, `timeout` between 5s and 30s, `maximumAge` 0 to 60s
- An eager `getCurrentPosition` primer fired before any other async work to preserve the iOS user-gesture context
- None of these produced a callback in MiniPay iOS

## Suggested resolution

Either of:

1. Bridge the standard Web Geolocation API inside the iOS WKWebView delegate. The relevant handlers are `webView(_:requestMediaCapturePermissionFor:initiatedByFrame:type:decisionHandler:)` plus the geolocation-specific permission callbacks added in iOS 15+. The Android WebView side appears to already work.

2. Add a custom RPC method such as `minipay_requestLocation` consistent with the existing `minipay_scanQrCode` and `minipay_requestContact` pattern. Returning `{ lat, lng, accuracy }` from a one-shot request would unblock most use cases; a streaming variant could come later.

## Reproduction

1. Open https://www.miniklaim.fun/run from a MiniPay iOS device, location permission granted at OS level
2. Tap Start
3. Banner shows "Waiting for GPS..." indefinitely, no console errors
4. Same URL opened in MetaMask mobile on the same device, same network: GPS fix returns within 1-2 seconds

Happy to provide more logs or a minimal repro if useful.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing minipay_scanQrCode and minipay_requestContact bridges, then inspect the iOS WKWebView delegate and the geolocation permission callbacks added in iOS 15+. Reproduce the issue at https://www.miniklaim.fun/run on MiniPay iOS with location permission enabled. Done means geolocation callbacks work in the WebView or a documented minipay_requestLocation RPC returns location data.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, javascript
Domain
mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.