Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
deckerst committed Jun 17, 2024
2 parents ce11587 + 44eecd2 commit 90fa60d
Show file tree
Hide file tree
Showing 49 changed files with 238 additions and 123 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

## <a id="unreleased"></a>[Unreleased]

## <a id="v1.11.3"></a>[v1.11.3] - 2024-06-17

### Added

- handle `MediaStore.ACTION_REVIEW` intent

## <a id="v1.11.2"></a>[v1.11.2] - 2024-06-11

### Added
Expand Down
2 changes: 2 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
<action android:name="android.intent.action.PICK" />
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.VIEW" />
<action android:name="android.provider.action.REVIEW" />
<action android:name="com.android.camera.action.REVIEW" />
<action android:name="com.android.camera.action.SPLIT_SCREEN_REVIEW" />

Expand All @@ -161,6 +162,7 @@
<action android:name="android.intent.action.PICK" />
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.VIEW" />
<action android:name="android.provider.action.REVIEW" />
<action android:name="com.android.camera.action.REVIEW" />
<action android:name="com.android.camera.action.SPLIT_SCREEN_REVIEW" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.provider.MediaStore
import android.util.Log
import androidx.annotation.RequiresApi
import androidx.core.content.pm.ShortcutInfoCompat
Expand Down Expand Up @@ -299,6 +300,7 @@ open class MainActivity : FlutterFragmentActivity() {

Intent.ACTION_VIEW,
Intent.ACTION_SEND,
MediaStore.ACTION_REVIEW,
"com.android.camera.action.REVIEW",
"com.android.camera.action.SPLIT_SCREEN_REVIEW" -> {
(intent.data ?: intent.getParcelableExtraCompat<Uri>(Intent.EXTRA_STREAM))?.let { uri ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ class EmbeddedDataHandler(private val context: Context) : MethodCallHandler {
}

ioScope.launch {
provider.fetchSingle(context, uri, mimeType, object : ImageProvider.ImageOpCallback {
provider.fetchSingle(context, uri, mimeType, false, object : ImageProvider.ImageOpCallback {
override fun onSuccess(fields: FieldMap) {
resultFields.putAll(fields)
result.success(resultFields)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class MediaFetchObjectHandler(private val context: Context) : MethodCallHandler
private fun getEntry(call: MethodCall, result: MethodChannel.Result) {
val mimeType = call.argument<String>("mimeType") // MIME type is optional
val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
val allowUnsized = call.argument<Boolean>("allowUnsized") ?: false
if (uri == null) {
result.error("getEntry-args", "missing arguments", null)
return
Expand All @@ -40,7 +41,7 @@ class MediaFetchObjectHandler(private val context: Context) : MethodCallHandler
return
}

provider.fetchSingle(context, uri, mimeType, object : ImageOpCallback {
provider.fetchSingle(context, uri, mimeType, allowUnsized, object : ImageOpCallback {
override fun onSuccess(fields: FieldMap) = result.success(fields)
override fun onFailure(throwable: Throwable) = result.error("getEntry-failure", "failed to get entry for uri=$uri mimeType=$mimeType", throwable.message)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import deckers.thibault.aves.utils.LogUtils
import java.io.File

internal class FileImageProvider : ImageProvider() {
override fun fetchSingle(context: Context, uri: Uri, sourceMimeType: String?, callback: ImageOpCallback) {
override fun fetchSingle(context: Context, uri: Uri, sourceMimeType: String?, allowUnsized: Boolean, callback: ImageOpCallback) {
var mimeType = sourceMimeType

if (mimeType == null) {
Expand Down Expand Up @@ -54,7 +54,7 @@ internal class FileImageProvider : ImageProvider() {
}
entry.fillPreCatalogMetadata(context)

if (entry.isSized || entry.isSvg || entry.isVideo) {
if (allowUnsized || entry.isSized || entry.isSvg || entry.isVideo) {
callback.onSuccess(entry.toMap())
} else {
callback.onFailure(Exception("entry has no size"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import java.util.TimeZone
import kotlin.math.absoluteValue

abstract class ImageProvider {
open fun fetchSingle(context: Context, uri: Uri, sourceMimeType: String?, callback: ImageOpCallback) {
open fun fetchSingle(context: Context, uri: Uri, sourceMimeType: String?, allowUnsized: Boolean, callback: ImageOpCallback) {
callback.onFailure(UnsupportedOperationException("`fetchSingle` is not supported by this image provider"))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class MediaStoreImageProvider : ImageProvider() {
// the provided URI can point to the wrong media collection,
// e.g. a GIF image with the URI `content://media/external/video/media/[ID]`
// so the effective entry URI may not match the provided URI
override fun fetchSingle(context: Context, uri: Uri, sourceMimeType: String?, callback: ImageOpCallback) {
override fun fetchSingle(context: Context, uri: Uri, sourceMimeType: String?, allowUnsized: Boolean, callback: ImageOpCallback) {
var found = false
val fetched = arrayListOf<FieldMap>()
val id = uri.tryParseId()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ open class UnknownContentProvider : ImageProvider() {
open val reliableProviderMimeType: Boolean
get() = false

override fun fetchSingle(context: Context, uri: Uri, sourceMimeType: String?, callback: ImageOpCallback) {
override fun fetchSingle(context: Context, uri: Uri, sourceMimeType: String?, allowUnsized: Boolean, callback: ImageOpCallback) {
var mimeType = sourceMimeType
if (sourceMimeType == null || !reliableProviderMimeType) {
// source MIME type may be incorrect, so we get a second opinion if possible
Expand Down Expand Up @@ -71,7 +71,7 @@ open class UnknownContentProvider : ImageProvider() {
}

val entry = SourceEntry(fields).fillPreCatalogMetadata(context)
if (entry.isSized || entry.isSvg || entry.isVideo) {
if (allowUnsized || entry.isSized || entry.isSvg || entry.isVideo) {
callback.onSuccess(entry.toMap())
} else {
callback.onFailure(Exception("entry has no size"))
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
ext {
agp_version = '8.4.1' // same as `settings.ext.agp_version` in `/android/settings.gradle`
agp_version = '8.5.0' // same as `settings.ext.agp_version` in `/android/settings.gradle`
glide_version = '4.16.0'
// AppGallery Connect plugin versions: https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-sdk-changenotes-0000001058732550
huawei_agconnect_version = '1.9.1.300'
Expand Down
2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pluginManagement {

settings.ext.kotlin_version = '1.9.24'
settings.ext.ksp_version = "$kotlin_version-1.0.20"
settings.ext.agp_version = '8.4.1'
settings.ext.agp_version = '8.5.0'

includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")

Expand Down
3 changes: 3 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/122.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
In v1.11.3:
- show selected albums together in Collection
Full changelog available on GitHub
3 changes: 3 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/12201.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
In v1.11.3:
- show selected albums together in Collection
Full changelog available on GitHub
2 changes: 1 addition & 1 deletion lib/model/source/media_store_source.dart
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ class MediaStoreSource extends CollectionSource {
existingDirectories.add(existingDirectory);
}
} else {
final sourceEntry = await mediaFetchService.getEntry(uri, null);
final sourceEntry = await mediaFetchService.getEntry(uri, null, allowUnsized: true);
if (sourceEntry != null) {
newEntries.add(sourceEntry.copyWith(
id: metadataDb.nextId,
Expand Down
2 changes: 1 addition & 1 deletion lib/model/source/trash.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ mixin TrashMixin on SourceBase {
await metadataDb.updateTrash(id, entry.trashDetails);
} else {
// there is no matching entry
final sourceEntry = await mediaFetchService.getEntry(uri, null);
final sourceEntry = await mediaFetchService.getEntry(uri, null, allowUnsized: true);
if (sourceEntry != null) {
final id = metadataDb.nextId;
sourceEntry.id = id;
Expand Down
2 changes: 1 addition & 1 deletion lib/model/vaults/vaults.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class Vaults extends ChangeNotifier {
debugPrint('Recovering ${untrackedPaths.length} untracked vault items');
await Future.forEach(untrackedPaths, (untrackedPath) async {
final uri = Uri.file(untrackedPath).toString();
final sourceEntry = await mediaFetchService.getEntry(uri, null);
final sourceEntry = await mediaFetchService.getEntry(uri, null, allowUnsized: true);
if (sourceEntry != null) {
sourceEntry.id = metadataDb.nextId;
sourceEntry.origin = EntryOrigins.vault;
Expand Down
5 changes: 3 additions & 2 deletions lib/services/media/media_fetch_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import 'package:flutter/services.dart';
import 'package:streams_channel/streams_channel.dart';

abstract class MediaFetchService {
Future<AvesEntry?> getEntry(String uri, String? mimeType);
Future<AvesEntry?> getEntry(String uri, String? mimeType, {bool allowUnsized = false});

Future<Uint8List> getSvg(
String uri,
Expand Down Expand Up @@ -75,11 +75,12 @@ class PlatformMediaFetchService implements MediaFetchService {
static const double _thumbnailDefaultSize = 64.0;

@override
Future<AvesEntry?> getEntry(String uri, String? mimeType) async {
Future<AvesEntry?> getEntry(String uri, String? mimeType, {bool allowUnsized = false}) async {
try {
final result = await _platformObject.invokeMethod('getEntry', <String, dynamic>{
'uri': uri,
'mimeType': mimeType,
'allowUnsized': allowUnsized,
}) as Map;
return AvesEntry.fromMap(result);
} on PlatformException catch (e, stack) {
Expand Down
7 changes: 5 additions & 2 deletions lib/widgets/about/translators.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class _RandomTextSpanHighlighter extends StatefulWidget {

class _RandomTextSpanHighlighterState extends State<_RandomTextSpanHighlighter> with SingleTickerProviderStateMixin {
late final AnimationController _controller;
late final CurvedAnimation _animation;
late final Animation<TextStyle> _animatedStyle;
late final TextStyle _baseStyle;
int _highlightedIndex = 0;
Expand Down Expand Up @@ -90,14 +91,16 @@ class _RandomTextSpanHighlighterState extends State<_RandomTextSpanHighlighter>
}
})
..repeat(reverse: true);
_animatedStyle = ShadowedTextStyleTween(begin: _baseStyle, end: highlightStyle).animate(CurvedAnimation(
_animation = CurvedAnimation(
parent: _controller,
curve: Curves.easeInOutCubic,
));
);
_animatedStyle = ShadowedTextStyleTween(begin: _baseStyle, end: highlightStyle).animate(_animation);
}

@override
void dispose() {
_animation.dispose();
_controller.dispose();
super.dispose();
}
Expand Down
4 changes: 3 additions & 1 deletion lib/widgets/collection/collection_grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,13 @@ class _CollectionGridContent extends StatefulWidget {
class _CollectionGridContentState extends State<_CollectionGridContent> {
final ValueNotifier<AvesEntry?> _focusedItemNotifier = ValueNotifier(null);
final ValueNotifier<bool> _isScrollingNotifier = ValueNotifier(false);
final ValueNotifier<AppMode> _selectingAppModeNotifier = ValueNotifier(AppMode.pickFilteredMediaInternal);

@override
void dispose() {
_focusedItemNotifier.dispose();
_isScrollingNotifier.dispose();
_selectingAppModeNotifier.dispose();
super.dispose();
}

Expand Down Expand Up @@ -252,7 +254,7 @@ class _CollectionGridContentState extends State<_CollectionGridContent> {
if (selection.isSelecting) {
child = MultiProvider(
providers: [
ListenableProvider<ValueNotifier<AppMode>>.value(value: ValueNotifier(AppMode.pickFilteredMediaInternal)),
ListenableProvider<ValueNotifier<AppMode>>.value(value: _selectingAppModeNotifier),
ChangeNotifierProvider<Selection<AvesEntry>>.value(value: selection),
],
child: child,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class ChooserQuickButton<T> extends StatefulWidget {

abstract class ChooserQuickButtonState<T extends ChooserQuickButton<U>, U> extends State<T> with SingleTickerProviderStateMixin {
AnimationController? _animationController;
Animation<double>? _animation;
CurvedAnimation? _animation;
OverlayEntry? _chooserOverlayEntry;
final ValueNotifier<U?> _chooserValueNotifier = ValueNotifier(null);
final StreamController<LongPressMoveUpdateDetails> _moveUpdateStreamController = StreamController.broadcast();
Expand All @@ -47,6 +47,7 @@ abstract class ChooserQuickButtonState<T extends ChooserQuickButton<U>, U> exten

@override
void dispose() {
_animation?.dispose();
_animationController?.dispose();
_clearChooserOverlayEntry();
_chooserValueNotifier.dispose();
Expand Down
14 changes: 9 additions & 5 deletions lib/widgets/common/action_mixins/feedback.dart
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class ReportOverlay<T> extends StatefulWidget {
class _ReportOverlayState<T> extends State<ReportOverlay<T>> with SingleTickerProviderStateMixin {
final processed = <T>{};
late AnimationController _animationController;
late Animation<double> _animation;
late CurvedAnimation _animation;

Stream<T> get opStream => widget.opStream;

Expand Down Expand Up @@ -212,6 +212,7 @@ class _ReportOverlayState<T> extends State<ReportOverlay<T>> with SingleTickerPr

@override
void dispose() {
_animation.dispose();
_animationController.dispose();
super.dispose();
}
Expand Down Expand Up @@ -317,6 +318,7 @@ class _FeedbackMessage extends StatefulWidget {

class _FeedbackMessageState extends State<_FeedbackMessage> with SingleTickerProviderStateMixin {
AnimationController? _animationController;
CurvedAnimation? _animation;
Animation<int>? _remainingDurationMillis;
int? _totalDurationMillis;

Expand All @@ -333,19 +335,21 @@ class _FeedbackMessageState extends State<_FeedbackMessage> with SingleTickerPro
duration: effectiveDuration,
vsync: this,
);
_animation = CurvedAnimation(
parent: _animationController!,
curve: Curves.linear,
);
_remainingDurationMillis = IntTween(
begin: effectiveDuration.inMilliseconds,
end: 0,
).animate(CurvedAnimation(
parent: _animationController!,
curve: Curves.linear,
));
).animate(_animation!);
_animationController!.forward();
}
}

@override
void dispose() {
_animation?.dispose();
_animationController?.dispose();
super.dispose();
}
Expand Down
Loading

0 comments on commit 90fa60d

Please sign in to comment.