Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita547df1

Browse files
fix: Location service crash on custom devices [WPB-18457] 🍒 (#4101)
Co-authored-by: Mohamad Jaara <mohamad.jaara@wire.com>
1 parentad0355f commita547df1

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

‎app/src/nonfree/kotlin/com/wire/android/ui/home/messagecomposer/location/LocationPickerHelperFlavor.kt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,30 @@ class LocationPickerHelperFlavor @Inject constructor(
5252
* https://developer.android.com/develop/sensors-and-location/location/retrieve-current#BestEstimate
5353
*/
5454
@SuppressLint("MissingPermission")
55+
@Suppress("TooGenericExceptionCaught")
5556
privatesuspendfungetLocationWithGms(onSuccess: (GeoLocatedAddress)->Unit,onError: ()->Unit) {
5657
if (locationPickerHelper.isLocationServicesEnabled()) {
5758
AppJsonStyledLogger.log(
5859
level=KaliumLogLevel.INFO,
5960
leadingMessage="GetLocation",
6061
jsonStringKeyValues=mapOf("isUsingGms" totrue)
6162
)
62-
val locationProvider=LocationServices.getFusedLocationProviderClient(context)
63-
val currentLocation=
64-
locationProvider.getCurrentLocation(Priority.PRIORITY_HIGH_ACCURACY,CancellationTokenSource().token).await()
65-
onSuccess(geocoderHelper.getGeoLocatedAddress(currentLocation))
63+
try {
64+
val locationProvider=LocationServices.getFusedLocationProviderClient(context)
65+
val currentLocation=
66+
locationProvider.getCurrentLocation(Priority.PRIORITY_HIGH_ACCURACY,CancellationTokenSource().token).await()
67+
onSuccess(geocoderHelper.getGeoLocatedAddress(currentLocation))
68+
}catch (e:Exception) {
69+
AppJsonStyledLogger.log(
70+
level=KaliumLogLevel.WARN,
71+
leadingMessage="GetLocation",
72+
jsonStringKeyValues=mapOf(
73+
"isUsingGms" totrue,
74+
"error" to"Location services are not available"
75+
)
76+
)
77+
onError()
78+
}
6679
}else {
6780
AppJsonStyledLogger.log(
6881
level=KaliumLogLevel.WARN,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp