Browse Source

harbour: Add uploading from camera

pull/23/head
jld3103 2 years ago
parent
commit
8f94f01eba
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 1
      packages/harbour/lib/l10n/en.arb
  2. 6
      packages/harbour/lib/l10n/localizations.dart
  3. 3
      packages/harbour/lib/l10n/localizations_en.dart
  4. 1
      packages/harbour/lib/src/apps/files/app.dart
  5. 18
      packages/harbour/lib/src/apps/files/dialogs/choose_create.dart
  6. 3
      packages/harbour/lib/src/platforms/abstract.dart
  7. 1
      packages/harbour/lib/src/platforms/android.dart
  8. 1
      packages/harbour/lib/src/platforms/linux.dart
  9. 42
      packages/harbour/pubspec.lock
  10. 1
      packages/harbour/pubspec.yaml

1
packages/harbour/lib/l10n/en.arb

@ -102,6 +102,7 @@
"filesName": "Files",
"filesUploadFiles": "Upload files",
"filesUploadImages": "Upload images",
"filesUploadCamera": "Upload from camera",
"filesCreateFolder": "Create folder",
"filesFolderName": "Folder name",
"filesRenameFolder": "Rename folder",

6
packages/harbour/lib/l10n/localizations.dart

@ -455,6 +455,12 @@ abstract class AppLocalizations {
/// **'Upload images'**
String get filesUploadImages;
/// No description provided for @filesUploadCamera.
///
/// In en, this message translates to:
/// **'Upload from camera'**
String get filesUploadCamera;
/// No description provided for @filesCreateFolder.
///
/// In en, this message translates to:

3
packages/harbour/lib/l10n/localizations_en.dart

@ -200,6 +200,9 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get filesUploadImages => 'Upload images';
@override
String get filesUploadCamera => 'Upload from camera';
@override
String get filesCreateFolder => 'Create folder';

1
packages/harbour/lib/src/apps/files/app.dart

@ -13,6 +13,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_rx_bloc/flutter_rx_bloc.dart';
import 'package:harbour/src/apps/files/blocs/browser.dart';
import 'package:harbour/src/harbour.dart';
import 'package:image_picker/image_picker.dart';
import 'package:intersperse/intersperse.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:nextcloud/nextcloud.dart';

18
packages/harbour/lib/src/apps/files/dialogs/choose_create.dart

@ -49,6 +49,24 @@ class FilesChooseCreateDialog extends StatelessWidget {
await upload(FileType.image);
},
),
if (Provider.of<HarbourPlatform>(context, listen: false).canUseCamera) ...[
ListTile(
leading: Icon(
MdiIcons.cameraPlus,
color: Theme.of(context).colorScheme.primary,
),
title: Text(AppLocalizations.of(context).filesUploadCamera),
onTap: () async {
Navigator.of(context).pop();
final picker = ImagePicker();
final result = await picker.pickImage(source: ImageSource.camera);
if (result != null) {
bloc.uploadFile([...basePath, result.name], result.path);
}
},
),
],
ListTile(
leading: Icon(
MdiIcons.folderPlus,

3
packages/harbour/lib/src/platforms/abstract.dart

@ -7,6 +7,7 @@ abstract class HarbourPlatform {
required this.canUseQuickActions,
required this.canUseSystemTray,
required this.canUseWindowManager,
required this.canUseCamera,
required this.getApplicationCachePath,
required this.getUserAccessibleAppDataPath,
this.init,
@ -22,6 +23,8 @@ abstract class HarbourPlatform {
final bool canUseWindowManager;
final bool canUseCamera;
final Future<String> Function() getApplicationCachePath;
final Future<String> Function() getUserAccessibleAppDataPath;

1
packages/harbour/lib/src/platforms/android.dart

@ -8,6 +8,7 @@ class AndroidHarbourPlatform extends HarbourPlatform {
canUseQuickActions: true,
canUseSystemTray: false,
canUseWindowManager: false,
canUseCamera: true,
getApplicationCachePath: () async => (await getTemporaryDirectory()).absolute.path,
getUserAccessibleAppDataPath: () async {
if (!await Permission.storage.request().isGranted) {

1
packages/harbour/lib/src/platforms/linux.dart

@ -8,6 +8,7 @@ class LinuxHarbourPlatform extends HarbourPlatform {
canUseQuickActions: false,
canUseSystemTray: true,
canUseWindowManager: true,
canUseCamera: false,
getApplicationCachePath: () async => p.join(
xdg.cacheHome.absolute.path,
'de.provokateurin.harbour',

42
packages/harbour/pubspec.lock

@ -148,6 +148,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
cross_file:
dependency: transitive
description:
name: cross_file
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.3+1"
crypto:
dependency: "direct main"
description:
@ -345,6 +352,41 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.0"
image_picker:
dependency: "direct main"
description:
name: image_picker
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.5+3"
image_picker_android:
dependency: transitive
description:
name: image_picker_android
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.5+1"
image_picker_for_web:
dependency: transitive
description:
name: image_picker_for_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.8"
image_picker_ios:
dependency: transitive
description:
name: image_picker_ios
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.5+6"
image_picker_platform_interface:
dependency: transitive
description:
name: image_picker_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
intersperse:
dependency: "direct main"
description:

1
packages/harbour/pubspec.yaml

@ -26,6 +26,7 @@ dependencies:
flutter_svg: ^1.0.3
html: ^0.15.0
http: ^0.13.4
image_picker: ^0.8.5+3
intersperse: ^2.0.0
intl: ^0.17.0
json_annotation: ^4.5.0

Loading…
Cancel
Save