Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Commit f9ab478

Browse files
authored
[feat] Send isoCountryCode to location in putLocation request (#1280)
* ✨ feat: send isoCountryCode to location in putLocation request * 🥅 feat: catch API request error * ➖ chore: remove location and s2geometry dependencies * 🔥 chore: remove additional location permission artifacts * 💚 chore: remove dependencies from en lock files
1 parent daa0c0e commit f9ab478

11 files changed

Lines changed: 11 additions & 186 deletions

File tree

client/app_en/ios/Podfile.lock

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ PODS:
9999
- GoogleUtilities/Logger
100100
- GoogleUtilities/UserDefaults (6.5.2):
101101
- GoogleUtilities/Logger
102-
- location (0.0.1):
103-
- Flutter
104-
- location_web (0.0.1):
105-
- Flutter
106102
- nanopb (0.3.9011):
107103
- nanopb/decode (= 0.3.9011)
108104
- nanopb/encode (= 0.3.9011)
@@ -142,8 +138,6 @@ DEPENDENCIES:
142138
- firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`)
143139
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
144140
- Flutter (from `Flutter`)
145-
- location (from `.symlinks/plugins/location/ios`)
146-
- location_web (from `.symlinks/plugins/location_web/ios`)
147141
- notification_permissions (from `.symlinks/plugins/notification_permissions/ios`)
148142
- package_info (from `.symlinks/plugins/package_info/ios`)
149143
- path_provider (from `.symlinks/plugins/path_provider/ios`)
@@ -190,10 +184,6 @@ EXTERNAL SOURCES:
190184
:path: ".symlinks/plugins/firebase_messaging/ios"
191185
Flutter:
192186
:path: Flutter
193-
location:
194-
:path: ".symlinks/plugins/location/ios"
195-
location_web:
196-
:path: ".symlinks/plugins/location_web/ios"
197187
notification_permissions:
198188
:path: ".symlinks/plugins/notification_permissions/ios"
199189
package_info:
@@ -241,8 +231,6 @@ SPEC CHECKSUMS:
241231
GoogleDataTransport: b29a21d813e906014ca16c00897827e40e4a24ab
242232
GoogleDataTransportCCTSupport: 6f15a89b0ca35d6fa523e1f752ef818588885988
243233
GoogleUtilities: ad0f3b691c67909d03a3327cc205222ab8f42e0e
244-
location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740
245-
location_web: b94e7433cfe28c0f7c8923c2ee482824b32e55a7
246234
nanopb: 18003b5e52dab79db540fe93fe9579f399bd1ccd
247235
notification_permissions: b74860c2967c1579243a675e63cd55e0ae75cef7
248236
package_info: 48b108e75b8802c2d5e126f208ef540561c98aef

client/app_en/pubspec.lock

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -217,34 +217,6 @@ packages:
217217
url: "https://pub.dartlang.org"
218218
source: hosted
219219
version: "0.16.1"
220-
js:
221-
dependency: transitive
222-
description:
223-
name: js
224-
url: "https://pub.dartlang.org"
225-
source: hosted
226-
version: "0.6.1+1"
227-
location:
228-
dependency: transitive
229-
description:
230-
name: location
231-
url: "https://pub.dartlang.org"
232-
source: hosted
233-
version: "3.0.2"
234-
location_platform_interface:
235-
dependency: transitive
236-
description:
237-
name: location_platform_interface
238-
url: "https://pub.dartlang.org"
239-
source: hosted
240-
version: "1.0.0"
241-
location_web:
242-
dependency: transitive
243-
description:
244-
name: location_web
245-
url: "https://pub.dartlang.org"
246-
source: hosted
247-
version: "1.0.0"
248220
matcher:
249221
dependency: transitive
250222
description:
@@ -357,13 +329,6 @@ packages:
357329
url: "https://pub.dartlang.org"
358330
source: hosted
359331
version: "2.1.3"
360-
s2geometry:
361-
dependency: transitive
362-
description:
363-
name: s2geometry
364-
url: "https://pub.dartlang.org"
365-
source: hosted
366-
version: "0.1.1"
367332
share:
368333
dependency: transitive
369334
description:

client/flutter/android/app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
In most cases you can leave this as-is, but you if you want to provide
66
additional functionality it is fine to subclass or reimplement
77
FlutterApplication and put your custom class here. -->
8-
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
98
<application android:name="io.flutter.app.FlutterApplication" android:label="COVID-19" android:icon="@mipmap/ic_launcher">
109
<activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
1110
<!-- Specifies an Android theme to apply to this Activity as soon as

client/flutter/ios/Podfile.lock

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ PODS:
9797
- GoogleUtilities/Logger
9898
- GoogleUtilities/UserDefaults (6.5.2):
9999
- GoogleUtilities/Logger
100-
- location (0.0.1):
101-
- Flutter
102-
- location_web (0.0.1):
103-
- Flutter
104100
- nanopb (0.3.9011):
105101
- nanopb/decode (= 0.3.9011)
106102
- nanopb/encode (= 0.3.9011)
@@ -139,8 +135,6 @@ DEPENDENCIES:
139135
- firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`)
140136
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
141137
- Flutter (from `Flutter`)
142-
- location (from `.symlinks/plugins/location/ios`)
143-
- location_web (from `.symlinks/plugins/location_web/ios`)
144138
- notification_permissions (from `.symlinks/plugins/notification_permissions/ios`)
145139
- package_info (from `.symlinks/plugins/package_info/ios`)
146140
- path_provider (from `.symlinks/plugins/path_provider/ios`)
@@ -185,10 +179,6 @@ EXTERNAL SOURCES:
185179
:path: ".symlinks/plugins/firebase_messaging/ios"
186180
Flutter:
187181
:path: Flutter
188-
location:
189-
:path: ".symlinks/plugins/location/ios"
190-
location_web:
191-
:path: ".symlinks/plugins/location_web/ios"
192182
notification_permissions:
193183
:path: ".symlinks/plugins/notification_permissions/ios"
194184
package_info:
@@ -235,8 +225,6 @@ SPEC CHECKSUMS:
235225
GoogleDataTransport: b29a21d813e906014ca16c00897827e40e4a24ab
236226
GoogleDataTransportCCTSupport: 6f15a89b0ca35d6fa523e1f752ef818588885988
237227
GoogleUtilities: ad0f3b691c67909d03a3327cc205222ab8f42e0e
238-
location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740
239-
location_web: b94e7433cfe28c0f7c8923c2ee482824b32e55a7
240228
nanopb: 18003b5e52dab79db540fe93fe9579f399bd1ccd
241229
notification_permissions: b74860c2967c1579243a675e63cd55e0ae75cef7
242230
package_info: 48b108e75b8802c2d5e126f208ef540561c98aef

client/flutter/ios/Runner/Info.plist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212
<string>6.0</string>
1313
<key>CFBundleName</key>
1414
<string>WHO COVID-19</string>
15-
<key>NSLocationWhenInUseUsageDescription</key>
16-
<string>Your location is used to deliver you the most relevant information and push notifications to your area.</string>
17-
<key>NSLocationAlwaysUsageDescription</key>
18-
<string>Your location is used to deliver you the most relevant information and push notifications to your area.</string>
19-
<key>NSLocationAlwaysAndWhenInUsageDescription</key>
20-
<string>Your location is used to deliver you the most relevant information and push notifications to your area.</string>
2115
<key>CFBundleDisplayName</key>
2216
<string>COVID–19</string>
2317
<key>CFBundlePackageType</key>

client/flutter/lib/api/who_service.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class WhoService {
2323
}
2424

2525
/// Put location
26-
static Future<bool> putLocation({String s2CellIdToken}) async {
26+
static Future<bool> putLocation({String isoCountryCode}) async {
2727
Map<String, String> headers = await _getHeaders();
2828
var postBody = jsonEncode({
29-
"s2CellIdToken": s2CellIdToken,
29+
"isoCountryCode": isoCountryCode,
3030
});
3131
var url = '$serviceUrl/putLocation';
3232
var response = await http.post(url, headers: headers, body: postBody);

client/flutter/lib/main.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ void mainImpl({@required Map<String, WidgetBuilder> routes}) async {
3737
final bool onboardingComplete =
3838
await UserPreferences().getOnboardingCompleted();
3939

40+
// Comment the above lines out and uncomment this to force onboarding in development
41+
// final bool onboardingComplete = false;
42+
4043
// Set `enableInDevMode` to true to see reports while in debug mode
4144
// This is only to be used for confirming that reports are being
4245
// submitted as expected. It is not intended to be used for everyday

client/flutter/lib/pages/onboarding/location_sharing_page.dart

Lines changed: 0 additions & 81 deletions
This file was deleted.

client/flutter/lib/pages/onboarding/onboarding_page.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:who_app/api/iso_country.dart';
22
import 'package:who_app/api/user_preferences.dart';
3+
import 'package:who_app/api/who_service.dart';
34
import 'package:who_app/pages/onboarding/country_list_page.dart';
45
import 'package:who_app/pages/onboarding/country_select_page.dart';
56
import 'package:who_app/pages/onboarding/legal_landing_page.dart';
@@ -103,6 +104,11 @@ class _OnboardingPageState extends State<OnboardingPage> {
103104
_showCountryListPage = false;
104105
});
105106
await _toNextPage();
107+
try {
108+
await WhoService.putLocation(isoCountryCode: _selectedCountry.alpha2Code);
109+
} catch (error) {
110+
print('Error sending location to API: $error');
111+
}
106112
}
107113

108114
Future<void> _onLegalDone() async {

client/flutter/pubspec.lock

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -210,34 +210,6 @@ packages:
210210
url: "https://pub.dartlang.org"
211211
source: hosted
212212
version: "0.16.1"
213-
js:
214-
dependency: transitive
215-
description:
216-
name: js
217-
url: "https://pub.dartlang.org"
218-
source: hosted
219-
version: "0.6.1+1"
220-
location:
221-
dependency: "direct main"
222-
description:
223-
name: location
224-
url: "https://pub.dartlang.org"
225-
source: hosted
226-
version: "3.0.2"
227-
location_platform_interface:
228-
dependency: transitive
229-
description:
230-
name: location_platform_interface
231-
url: "https://pub.dartlang.org"
232-
source: hosted
233-
version: "1.0.0"
234-
location_web:
235-
dependency: transitive
236-
description:
237-
name: location_web
238-
url: "https://pub.dartlang.org"
239-
source: hosted
240-
version: "1.0.0"
241213
matcher:
242214
dependency: transitive
243215
description:
@@ -350,13 +322,6 @@ packages:
350322
url: "https://pub.dartlang.org"
351323
source: hosted
352324
version: "2.1.3"
353-
s2geometry:
354-
dependency: "direct main"
355-
description:
356-
name: s2geometry
357-
url: "https://pub.dartlang.org"
358-
source: hosted
359-
version: "0.1.1"
360325
share:
361326
dependency: "direct main"
362327
description:

0 commit comments

Comments
 (0)