Merge branch 'krille/fix-android-download' into 'main'
fix: Android Download See merge request ChristianPauly/fluffychat-flutter!246
This commit is contained in:
commit
c221e497bb
|
@ -44,7 +44,7 @@ android {
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "chat.fluffy.fluffychat"
|
applicationId "chat.fluffy.fluffychat"
|
||||||
minSdkVersion 18
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
|
@ -87,6 +87,4 @@ dependencies {
|
||||||
implementation "net.zetetic:android-database-sqlcipher:4.4.0" // needed for moor_ffi w/ sqlcipher
|
implementation "net.zetetic:android-database-sqlcipher:4.4.0" // needed for moor_ffi w/ sqlcipher
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file("google-services.json").exists() || System.getenv('CI')){
|
apply plugin: 'com.google.gms.google-services'
|
||||||
apply plugin: 'com.google.gms.google-services'
|
|
||||||
}
|
|
|
@ -1,11 +1,14 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:famedlysdk/famedlysdk.dart';
|
import 'package:famedlysdk/famedlysdk.dart';
|
||||||
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:open_file/open_file.dart';
|
import 'package:open_file/open_file.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:universal_html/prefer_universal/html.dart' as html;
|
import 'package:universal_html/prefer_universal/html.dart' as html;
|
||||||
import 'package:mime_type/mime_type.dart';
|
import 'package:mime_type/mime_type.dart';
|
||||||
|
import 'package:downloads_path_provider_28/downloads_path_provider_28.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
|
||||||
extension MatrixFileExtension on MatrixFile {
|
extension MatrixFileExtension on MatrixFile {
|
||||||
void open() async {
|
void open() async {
|
||||||
|
@ -24,8 +27,11 @@ extension MatrixFileExtension on MatrixFile {
|
||||||
element.click();
|
element.click();
|
||||||
element.remove();
|
element.remove();
|
||||||
} else {
|
} else {
|
||||||
final downloadsDir = Platform.isAndroid
|
if (!(await Permission.storage.request()).isGranted) return;
|
||||||
? (await getExternalStorageDirectory())
|
final downloadsDir = PlatformInfos.isDesktop
|
||||||
|
? (await getDownloadsDirectory())
|
||||||
|
: Platform.isAndroid
|
||||||
|
? (await DownloadsPathProvider.downloadsDirectory)
|
||||||
: (await getApplicationDocumentsDirectory());
|
: (await getApplicationDocumentsDirectory());
|
||||||
|
|
||||||
final file = File(downloadsDir.path + '/' + name.split('/').last);
|
final file = File(downloadsDir.path + '/' + name.split('/').last);
|
||||||
|
|
|
@ -11,5 +11,8 @@ abstract class PlatformInfos {
|
||||||
static bool get isBetaDesktop =>
|
static bool get isBetaDesktop =>
|
||||||
!kIsWeb && (Platform.isWindows || Platform.isLinux);
|
!kIsWeb && (Platform.isWindows || Platform.isLinux);
|
||||||
|
|
||||||
|
static bool get isDesktop =>
|
||||||
|
!kIsWeb && (Platform.isLinux || Platform.isWindows || Platform.isMacOS);
|
||||||
|
|
||||||
static bool get usesTouchscreen => !isMobile;
|
static bool get usesTouchscreen => !isMobile;
|
||||||
}
|
}
|
||||||
|
|
21
pubspec.lock
21
pubspec.lock
|
@ -183,6 +183,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.0.3"
|
version: "0.0.3"
|
||||||
|
downloads_path_provider_28:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: downloads_path_provider_28
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.0"
|
||||||
encrypt:
|
encrypt:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -683,6 +690,20 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.0-nullsafety.1"
|
version: "1.10.0-nullsafety.1"
|
||||||
|
permission_handler:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: permission_handler
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "5.0.1+1"
|
||||||
|
permission_handler_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_platform_interface
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.1"
|
||||||
petitparser:
|
petitparser:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -39,6 +39,8 @@ dependencies:
|
||||||
# desktop_notifications: ^0.0.0-dev.4 // Currently blocked by: https://github.com/canonical/desktop_notifications.dart/issues/5
|
# desktop_notifications: ^0.0.0-dev.4 // Currently blocked by: https://github.com/canonical/desktop_notifications.dart/issues/5
|
||||||
matrix_link_text: ^0.3.1
|
matrix_link_text: ^0.3.1
|
||||||
path_provider: ^1.5.1
|
path_provider: ^1.5.1
|
||||||
|
downloads_path_provider_28: ^0.1.0
|
||||||
|
permission_handler: ^5.0.1+1
|
||||||
webview_flutter: ^0.3.19+9
|
webview_flutter: ^0.3.19+9
|
||||||
share: ^0.6.3+5
|
share: ^0.6.3+5
|
||||||
flutter_secure_storage: ^3.3.5
|
flutter_secure_storage: ^3.3.5
|
||||||
|
|
Loading…
Reference in a new issue