Merge branch 'krille-chan:main' into scanqr
This commit is contained in:
commit
ccbe032351
9 changed files with 133 additions and 121 deletions
|
|
@ -86,3 +86,7 @@ dependencies {
|
|||
//implementation 'com.google.firebase:firebase-messaging:19.0.1' // Workaround for https://github.com/microg/android_packages_apps_GmsCore/issues/313#issuecomment-617651698
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
exclude group: 'com.google.android.gms'
|
||||
}
|
||||
|
|
@ -2805,5 +2805,6 @@
|
|||
"serverInformation": "Server information:",
|
||||
"name": "Name",
|
||||
"version": "Version",
|
||||
"website": "Website"
|
||||
"website": "Website",
|
||||
"compressBeforeSending": "Compress before sending"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class SendFileDialog extends StatefulWidget {
|
|||
}
|
||||
|
||||
class SendFileDialogState extends State<SendFileDialog> {
|
||||
bool origImage = false;
|
||||
bool compress = true;
|
||||
|
||||
/// Images smaller than 20kb don't need compression.
|
||||
static const int minSizeToCompress = 20 * 1024;
|
||||
|
|
@ -60,7 +60,7 @@ class SendFileDialogState extends State<SendFileDialog> {
|
|||
mimeType != null &&
|
||||
mimeType.startsWith('video') &&
|
||||
length > minSizeToCompress &&
|
||||
!origImage) {
|
||||
compress) {
|
||||
scaffoldMessenger.showLoadingSnackBar(l10n.compressVideo);
|
||||
file = await xfile.resizeVideo();
|
||||
scaffoldMessenger.showLoadingSnackBar(l10n.generatingVideoThumbnail);
|
||||
|
|
@ -70,7 +70,7 @@ class SendFileDialogState extends State<SendFileDialog> {
|
|||
file = MatrixFile(
|
||||
bytes: await xfile.readAsBytes(),
|
||||
name: xfile.name,
|
||||
mimeType: xfile.mimeType,
|
||||
mimeType: mimeType,
|
||||
).detectFileType;
|
||||
}
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ class SendFileDialogState extends State<SendFileDialog> {
|
|||
await widget.room.sendFileEvent(
|
||||
file,
|
||||
thumbnail: thumbnail,
|
||||
shrinkImageMaxDimension: origImage ? null : 1600,
|
||||
shrinkImageMaxDimension: compress ? 1600 : null,
|
||||
);
|
||||
} on MatrixException catch (e) {
|
||||
final retryAfterMs = e.retryAfterMs;
|
||||
|
|
@ -117,7 +117,7 @@ class SendFileDialogState extends State<SendFileDialog> {
|
|||
await widget.room.sendFileEvent(
|
||||
file,
|
||||
thumbnail: thumbnail,
|
||||
shrinkImageMaxDimension: origImage ? null : 1600,
|
||||
shrinkImageMaxDimension: compress ? null : 1600,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -156,6 +156,11 @@ class SendFileDialogState extends State<SendFileDialog> {
|
|||
final fileName = widget.files.length == 1
|
||||
? widget.files.single.name
|
||||
: L10n.of(context).countFiles(widget.files.length.toString());
|
||||
final fileTypes = widget.files
|
||||
.map((file) => file.name.split('.').last)
|
||||
.toSet()
|
||||
.join(', ')
|
||||
.toUpperCase();
|
||||
|
||||
if (uniqueMimeType?.startsWith('image') ?? false) {
|
||||
sendStr = L10n.of(context).sendImage;
|
||||
|
|
@ -171,98 +176,86 @@ class SendFileDialogState extends State<SendFileDialog> {
|
|||
final sizeString =
|
||||
snapshot.data ?? L10n.of(context).calculatingFileSize;
|
||||
|
||||
Widget contentWidget;
|
||||
if (uniqueMimeType?.startsWith('image') ?? false) {
|
||||
contentWidget = Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: Material(
|
||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||
elevation: theme.appBarTheme.scrolledUnderElevation ?? 4,
|
||||
shadowColor: theme.appBarTheme.shadowColor,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: kIsWeb
|
||||
? Image.network(
|
||||
widget.files.first.path,
|
||||
fit: BoxFit.contain,
|
||||
height: 256,
|
||||
)
|
||||
: Image.file(
|
||||
File(widget.files.first.path),
|
||||
fit: BoxFit.contain,
|
||||
height: 256,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// Workaround for SwitchListTile.adaptive crashes in CupertinoDialog
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
CupertinoSwitch(
|
||||
value: origImage,
|
||||
onChanged: (v) => setState(() => origImage = v),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
L10n.of(context).sendOriginal,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
Text(sizeString),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
final fileNameParts = fileName.split('.');
|
||||
contentWidget = SizedBox(
|
||||
return AlertDialog.adaptive(
|
||||
title: Text(sendStr),
|
||||
content: SizedBox(
|
||||
width: 256,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
uniqueMimeType == null
|
||||
? Icons.description_outlined
|
||||
: uniqueMimeType.startsWith('video')
|
||||
? Icons.video_file_outlined
|
||||
: uniqueMimeType.startsWith('audio')
|
||||
? Icons.audio_file_outlined
|
||||
: Icons.description_outlined,
|
||||
const SizedBox(height: 12),
|
||||
if (uniqueMimeType?.startsWith('image') ?? false)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16.0),
|
||||
child: Material(
|
||||
borderRadius:
|
||||
BorderRadius.circular(AppConfig.borderRadius / 2),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: kIsWeb
|
||||
? Image.network(
|
||||
widget.files.first.path,
|
||||
fit: BoxFit.contain,
|
||||
height: 156,
|
||||
)
|
||||
: Image.file(
|
||||
File(widget.files.first.path),
|
||||
fit: BoxFit.contain,
|
||||
height: 156,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
fileNameParts.first,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
if (uniqueMimeType?.startsWith('image') != true ||
|
||||
widget.files.length > 1)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
uniqueMimeType == null
|
||||
? Icons.description_outlined
|
||||
: uniqueMimeType.startsWith('video')
|
||||
? Icons.video_file_outlined
|
||||
: uniqueMimeType.startsWith('audio')
|
||||
? Icons.audio_file_outlined
|
||||
: Icons.description_outlined,
|
||||
size: 32,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
fileName,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Text(
|
||||
'$sizeString - $fileTypes',
|
||||
style: theme.textTheme.labelSmall,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (fileNameParts.length > 1)
|
||||
Text('.${fileNameParts.last}'),
|
||||
Text(' ($sizeString)'),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Workaround for SwitchListTile.adaptive crashes in CupertinoDialog
|
||||
if (uniqueMimeType != null &&
|
||||
uniqueMimeType.startsWith('video') &&
|
||||
PlatformInfos.isMobile)
|
||||
(uniqueMimeType.startsWith('image') ||
|
||||
uniqueMimeType.startsWith('video')))
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
CupertinoSwitch(
|
||||
value: origImage,
|
||||
onChanged: (v) => setState(() => origImage = v),
|
||||
value: compress,
|
||||
onChanged: uniqueMimeType.startsWith('video') &&
|
||||
!PlatformInfos.isMobile
|
||||
? null
|
||||
: (v) => setState(() => compress = v),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
|
|
@ -271,11 +264,10 @@ class SendFileDialogState extends State<SendFileDialog> {
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
L10n.of(context).sendOriginal,
|
||||
style:
|
||||
const TextStyle(fontWeight: FontWeight.bold),
|
||||
L10n.of(context).compressBeforeSending,
|
||||
style: theme.textTheme.labelMedium,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(sizeString),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -283,11 +275,7 @@ class SendFileDialogState extends State<SendFileDialog> {
|
|||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
return AlertDialog.adaptive(
|
||||
title: Text(sendStr),
|
||||
content: contentWidget,
|
||||
),
|
||||
actions: <Widget>[
|
||||
AdaptiveDialogAction(
|
||||
onPressed: () =>
|
||||
|
|
|
|||
|
|
@ -57,13 +57,17 @@ class SendLocationDialogState extends State<SendLocationDialog> {
|
|||
Position position;
|
||||
try {
|
||||
position = await Geolocator.getCurrentPosition(
|
||||
desiredAccuracy: LocationAccuracy.best,
|
||||
timeLimit: const Duration(seconds: 30),
|
||||
locationSettings: const LocationSettings(
|
||||
accuracy: LocationAccuracy.best,
|
||||
timeLimit: Duration(seconds: 30),
|
||||
),
|
||||
);
|
||||
} on TimeoutException {
|
||||
position = await Geolocator.getCurrentPosition(
|
||||
desiredAccuracy: LocationAccuracy.medium,
|
||||
timeLimit: const Duration(seconds: 30),
|
||||
locationSettings: const LocationSettings(
|
||||
accuracy: LocationAccuracy.medium,
|
||||
timeLimit: Duration(seconds: 30),
|
||||
),
|
||||
);
|
||||
}
|
||||
setState(() => this.position = position);
|
||||
|
|
|
|||
32
pubspec.lock
32
pubspec.lock
|
|
@ -801,42 +801,50 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: geolocator
|
||||
sha256: b8f520252c5c66851295bcc263bc8ae7555501938427f72216ba7688702e261d
|
||||
sha256: "0ec58b731776bc43097fcf751f79681b6a8f6d3bc737c94779fe9f1ad73c1a81"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.7.1"
|
||||
version: "13.0.1"
|
||||
geolocator_android:
|
||||
dependency: "direct overridden"
|
||||
dependency: transitive
|
||||
description:
|
||||
name: geolocator_android
|
||||
sha256: a4834a98fab5124f2d5b881e62a40ebb4a71d6aad6ad577e047a3ffb69b67dac
|
||||
url: "https://hanntech-gmbh.gitlab.io/free2pass/flutter-geolocator-floss/"
|
||||
sha256: "7aefc530db47d90d0580b552df3242440a10fe60814496a979aa67aa98b1fd47"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
version: "4.6.1"
|
||||
geolocator_apple:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: geolocator_apple
|
||||
sha256: "1e8e398cc92151d946a4bbd34e2075885333e42d35ca33e418e7ce7b0a29991e"
|
||||
sha256: bc2aca02423ad429cb0556121f56e60360a2b7d694c8570301d06ea0c00732fd
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.2"
|
||||
version: "2.3.7"
|
||||
geolocator_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: geolocator_platform_interface
|
||||
sha256: "9d6f34a8a4b704d504f34acc5e52d880a7d2caedd99739902d6319179b0336d4"
|
||||
sha256: "386ce3d9cce47838355000070b1d0b13efb5bc430f8ecda7e9238c8409ace012"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.6"
|
||||
version: "4.2.4"
|
||||
geolocator_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: geolocator_web
|
||||
sha256: "0b9e0ec13ce2211085cae0055b3516c975bd6cfe2878a20c8f13611f1a259855"
|
||||
sha256: "2ed69328e05cd94e7eb48bb0535f5fc0c0c44d1c4fa1e9737267484d05c29b5e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.6"
|
||||
version: "4.1.1"
|
||||
geolocator_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: geolocator_windows
|
||||
sha256: "53da08937d07c24b0d9952eb57a3b474e29aae2abf9dd717f7e1230995f13f0e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.3"
|
||||
get_it:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ dependencies:
|
|||
flutter_typeahead: ^5.2.0
|
||||
flutter_web_auth_2: ^4.0.1
|
||||
flutter_webrtc: ^0.11.7
|
||||
geolocator: ^7.6.2
|
||||
geolocator: ^13.0.1
|
||||
go_router: ^14.3.0
|
||||
handy_window: ^0.4.0
|
||||
hive: ^2.2.3
|
||||
|
|
@ -153,9 +153,6 @@ msix_config:
|
|||
install_certificate: false
|
||||
|
||||
dependency_overrides:
|
||||
geolocator_android:
|
||||
hosted: https://hanntech-gmbh.gitlab.io/free2pass/flutter-geolocator-floss
|
||||
version: ^1.0.1
|
||||
# waiting for null safety
|
||||
# Upstream pull request: https://github.com/AntoineMarcel/keyboard_shortcuts/pull/13
|
||||
keyboard_shortcuts:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
diff --git a/android/app/build.gradle b/android/app/build.gradle
|
||||
index 7520ff2a..ae376d9d 100644
|
||||
index f92f73f3..6d389efb 100644
|
||||
--- a/android/app/build.gradle
|
||||
+++ b/android/app/build.gradle
|
||||
@@ -2,7 +2,7 @@ plugins {
|
||||
|
|
@ -11,7 +11,7 @@ index 7520ff2a..ae376d9d 100644
|
|||
}
|
||||
|
||||
def localProperties = new Properties()
|
||||
@@ -83,6 +83,6 @@ flutter {
|
||||
@@ -83,10 +83,10 @@ flutter {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
@ -19,6 +19,12 @@ index 7520ff2a..ae376d9d 100644
|
|||
+ implementation 'com.google.firebase:firebase-messaging:19.0.1' // Workaround for https://github.com/microg/android_packages_apps_GmsCore/issues/313#issuecomment-617651698
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
- exclude group: 'com.google.android.gms'
|
||||
+ //exclude group: 'com.google.android.gms'
|
||||
}
|
||||
\ No newline at end of file
|
||||
diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro
|
||||
index d0e0fbc9..0a546da0 100644
|
||||
--- a/android/app/proguard-rules.pro
|
||||
|
|
@ -100,10 +106,10 @@ index b2fd960a..fdb01a4d 100644
|
|||
include ":app"
|
||||
\ No newline at end of file
|
||||
diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart
|
||||
index 039dde89..1cefdd71 100644
|
||||
index 1ba2659a..989f458e 100644
|
||||
--- a/lib/utils/background_push.dart
|
||||
+++ b/lib/utils/background_push.dart
|
||||
@@ -38,7 +38,7 @@ import '../config/setting_keys.dart';
|
||||
@@ -39,7 +39,7 @@ import '../config/setting_keys.dart';
|
||||
import '../widgets/matrix.dart';
|
||||
import 'platform_infos.dart';
|
||||
|
||||
|
|
@ -112,7 +118,7 @@ index 039dde89..1cefdd71 100644
|
|||
|
||||
class NoTokenException implements Exception {
|
||||
String get cause => 'Cannot get firebase token';
|
||||
@@ -63,7 +63,7 @@ class BackgroundPush {
|
||||
@@ -64,7 +64,7 @@ class BackgroundPush {
|
||||
|
||||
final pendingTests = <String, Completer<void>>{};
|
||||
|
||||
|
|
@ -122,7 +128,7 @@ index 039dde89..1cefdd71 100644
|
|||
DateTime? lastReceivedPush;
|
||||
|
||||
diff --git a/pubspec.yaml b/pubspec.yaml
|
||||
index 69c80d6e..efd32d89 100644
|
||||
index fb3e3ca4..039b2ccc 100644
|
||||
--- a/pubspec.yaml
|
||||
+++ b/pubspec.yaml
|
||||
@@ -25,7 +25,7 @@ dependencies:
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include <file_selector_windows/file_selector_windows.h>
|
||||
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
||||
#include <flutter_webrtc/flutter_web_r_t_c_plugin.h>
|
||||
#include <geolocator_windows/geolocator_windows.h>
|
||||
#include <pasteboard/pasteboard_plugin.h>
|
||||
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
||||
#include <record_windows/record_windows_plugin_c_api.h>
|
||||
|
|
@ -36,6 +37,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
|
|||
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
|
||||
FlutterWebRTCPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("FlutterWebRTCPlugin"));
|
||||
GeolocatorWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("GeolocatorWindows"));
|
||||
PasteboardPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("PasteboardPlugin"));
|
||||
PermissionHandlerWindowsPluginRegisterWithRegistrar(
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
|||
file_selector_windows
|
||||
flutter_secure_storage_windows
|
||||
flutter_webrtc
|
||||
geolocator_windows
|
||||
pasteboard
|
||||
permission_handler_windows
|
||||
record_windows
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue