fixes, added locales to report info
This commit is contained in:
parent
d7a7e8124c
commit
290465ba17
4 changed files with 45 additions and 19 deletions
|
@ -9,6 +9,7 @@ import io.flutter.plugin.common.MethodChannel.MethodCallHandler
|
|||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
|
||||
// as of 2021/03/10, geocoding packages exist but:
|
||||
|
@ -50,6 +51,10 @@ class GeocodingHandler(private val context: Context) : MethodCallHandler {
|
|||
|
||||
val addresses = try {
|
||||
geocoder!!.getFromLocation(latitude, longitude, maxResults) ?: ArrayList()
|
||||
} catch (e: IOException) {
|
||||
// `grpc failed`, etc.
|
||||
result.error("getAddress-network", "failed to get address because of network issues", e.message)
|
||||
return
|
||||
} catch (e: Exception) {
|
||||
result.error("getAddress-exception", "failed to get address", e.message)
|
||||
return
|
||||
|
|
|
@ -80,6 +80,14 @@ object StorageUtils {
|
|||
return pathSteps.iterator()
|
||||
}
|
||||
|
||||
private fun appSpecificVolumePath(file: File?): String? {
|
||||
file ?: return null
|
||||
val appSpecificPath = file.absolutePath
|
||||
val relativePathStartIndex = appSpecificPath.indexOf("Android/data")
|
||||
if (relativePathStartIndex < 0) return null
|
||||
return appSpecificPath.substring(0, relativePathStartIndex)
|
||||
}
|
||||
|
||||
private fun findPrimaryVolumePath(context: Context): String? {
|
||||
// we want:
|
||||
// /storage/emulated/0/
|
||||
|
@ -87,10 +95,7 @@ object StorageUtils {
|
|||
// /storage/emulated/0
|
||||
// `context.getExternalFilesDir(null)` yields:
|
||||
// /storage/emulated/0/Android/data/{package_name}/files
|
||||
return context.getExternalFilesDir(null)?.let {
|
||||
val appSpecificPath = it.absolutePath
|
||||
return appSpecificPath.substring(0, appSpecificPath.indexOf("Android/data"))
|
||||
}
|
||||
return appSpecificVolumePath(context.getExternalFilesDir(null))
|
||||
}
|
||||
|
||||
private fun findVolumePaths(context: Context): Array<String> {
|
||||
|
@ -119,11 +124,7 @@ object StorageUtils {
|
|||
}
|
||||
}
|
||||
} while (!validFiles)
|
||||
for (file in files) {
|
||||
val appSpecificAbsolutePath = file.absolutePath
|
||||
val emulatedRootPath = appSpecificAbsolutePath.substring(0, appSpecificAbsolutePath.indexOf("Android/data"))
|
||||
paths.add(emulatedRootPath)
|
||||
}
|
||||
paths.addAll(files.mapNotNull(::appSpecificVolumePath))
|
||||
} else {
|
||||
// Primary physical SD-CARD (not emulated)
|
||||
val rawExternalStorage = System.getenv("EXTERNAL_STORAGE") ?: ""
|
||||
|
|
|
@ -22,7 +22,7 @@ class GeocodingService {
|
|||
});
|
||||
return (result as List).cast<Map>().map((map) => Address.fromMap(map)).toList();
|
||||
} on PlatformException catch (e, stack) {
|
||||
if (e.code != 'getAddress-empty') {
|
||||
if (e.code != 'getAddress-empty' && e.code != 'getAddress-network') {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'dart:typed_data';
|
|||
|
||||
import 'package:aves/app_flavor.dart';
|
||||
import 'package:aves/flutter_version.dart';
|
||||
import 'package:aves/model/settings/settings.dart';
|
||||
import 'package:aves/ref/mime_types.dart';
|
||||
import 'package:aves/services/common/services.dart';
|
||||
import 'package:aves/theme/durations.dart';
|
||||
|
@ -71,7 +72,6 @@ class _BugReportState extends State<BugReport> with FeedbackMixin {
|
|||
final info = snapshot.data;
|
||||
if (info == null) return const SizedBox();
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade800,
|
||||
border: Border.all(
|
||||
|
@ -79,8 +79,26 @@ class _BugReportState extends State<BugReport> with FeedbackMixin {
|
|||
),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||
),
|
||||
constraints: const BoxConstraints(maxHeight: 100),
|
||||
margin: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: SelectableText(info));
|
||||
child: Theme(
|
||||
data: Theme.of(context).copyWith(
|
||||
scrollbarTheme: const ScrollbarThemeData(
|
||||
isAlwaysShown: true,
|
||||
radius: Radius.circular(16),
|
||||
crossAxisMargin: 6,
|
||||
mainAxisMargin: 6,
|
||||
interactive: true,
|
||||
),
|
||||
),
|
||||
child: Scrollbar(
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(start: 8, end: 16),
|
||||
child: SelectableText(info),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
_buildStep(3, l10n.aboutBugReportInstruction, l10n.aboutBugReportButton, _goToGithub),
|
||||
|
@ -136,6 +154,8 @@ class _BugReportState extends State<BugReport> with FeedbackMixin {
|
|||
'Android build: ${androidInfo.display}',
|
||||
'Device: ${androidInfo.manufacturer} ${androidInfo.model}',
|
||||
'Google Play services: ${hasPlayServices ? 'ready' : 'not available'}',
|
||||
'System locales: ${WidgetsBinding.instance!.window.locales.join(', ')}',
|
||||
'Aves locale: ${settings.locale} -> ${settings.appliedLocale}',
|
||||
].join('\n');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue