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