Merge branch 'spike/block2-derisking'
This commit is contained in:
commit
552f1737bf
17 changed files with 428 additions and 108 deletions
|
|
@ -20,16 +20,13 @@ class GeolocatorCoarseLocation implements CoarseLocationProvider {
|
|||
if (permission == LocationPermission.denied) {
|
||||
permission = await Geolocator.requestPermission();
|
||||
}
|
||||
// Give the user a way out of a permanent denial.
|
||||
if (permission == LocationPermission.deniedForever) {
|
||||
await Geolocator.openAppSettings();
|
||||
return null;
|
||||
}
|
||||
if (permission == LocationPermission.denied) return null;
|
||||
if (!await Geolocator.isLocationServiceEnabled()) {
|
||||
await Geolocator.openLocationSettings();
|
||||
// Denied (or turned off): return null quietly — the UI shows an actionable
|
||||
// message. We don't yank the user into system settings.
|
||||
if (permission == LocationPermission.denied ||
|
||||
permission == LocationPermission.deniedForever) {
|
||||
return null;
|
||||
}
|
||||
if (!await Geolocator.isLocationServiceEnabled()) return null;
|
||||
|
||||
// A fresh coarse fix can take a while (or never come indoors); fall back
|
||||
// to the last known position so the button stays responsive.
|
||||
|
|
|
|||
|
|
@ -9,12 +9,21 @@ class ProfileStore {
|
|||
final SecretStore _store;
|
||||
static const _nameKey = 'tane.social.profile.name';
|
||||
static const _aboutKey = 'tane.social.profile.about';
|
||||
static const _g1Key = 'tane.social.profile.g1';
|
||||
|
||||
Future<String> name() async => (await _store.read(_nameKey)) ?? '';
|
||||
Future<String> about() async => (await _store.read(_aboutKey)) ?? '';
|
||||
|
||||
Future<void> save({required String name, required String about}) async {
|
||||
/// Your Ğ1 (Duniter) address, if you chose to share one.
|
||||
Future<String> g1() async => (await _store.read(_g1Key)) ?? '';
|
||||
|
||||
Future<void> save({
|
||||
required String name,
|
||||
required String about,
|
||||
String g1 = '',
|
||||
}) async {
|
||||
await _store.write(_nameKey, name.trim());
|
||||
await _store.write(_aboutKey, about.trim());
|
||||
await _store.write(_g1Key, g1.trim());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue