Skip to content

Commit 4e3e76d

Browse files
committed
fix(mobile): address gallery review feedback
Signed-off-by: kenny lopez <[email protected]>
1 parent ffaebf5 commit 4e3e76d

11 files changed

Lines changed: 605 additions & 389 deletions

File tree

‎mobile/android/app/src/main/AndroidManifest.xml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
22
<uses-permission android:name="android.permission.INTERNET" />
33
<uses-permission android:name="android.permission.CAMERA" />
4+
<uses-permission
5+
android:name="android.permission.READ_EXTERNAL_STORAGE"
6+
android:maxSdkVersion="28" />
7+
<uses-permission
8+
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
9+
android:maxSdkVersion="28" />
410
<application
511
android:label="@string/app_name"
612
android:name="${applicationName}"

‎mobile/android/app/src/main/kotlin/xyz/block/buzz/mobile/MainActivity.kt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ class MainActivity : FlutterActivity() {
9797
TRANSCODE_VIDEO_TO_MP4_METHOD -> {
9898
handleTranscodeVideoToMp4(call.arguments, result)
9999
}
100+
REQUIRES_LEGACY_MEDIA_STORAGE_PERMISSION_METHOD -> {
101+
result.success(Build.VERSION.SDK_INT <= Build.VERSION_CODES.P)
102+
}
100103
else -> result.notImplemented()
101104
}
102105
}
@@ -284,5 +287,7 @@ class MainActivity : FlutterActivity() {
284287
private const val SANITIZE_IMAGE_FOR_UPLOAD_METHOD = "sanitizeImageForUpload"
285288
private const val TRANSCODE_IMAGE_TO_JPEG_METHOD = "transcodeImageToJpeg"
286289
private const val TRANSCODE_VIDEO_TO_MP4_METHOD = "transcodeVideoToMp4"
290+
private const val REQUIRES_LEGACY_MEDIA_STORAGE_PERMISSION_METHOD =
291+
"requiresLegacyMediaStoragePermission"
287292
}
288293
}

‎mobile/ios/Runner/Info.plist‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
<string>Buzz needs camera access so you can take photos to attach to messages and scan QR codes for device pairing.</string>
4848
<key>NSPhotoLibraryUsageDescription</key>
4949
<string>Buzz needs photo library access so you can attach images to messages.</string>
50+
<key>NSPhotoLibraryAddUsageDescription</key>
51+
<string>Buzz needs permission to save images to your photo library.</string>
5052
<key>UIApplicationSceneManifest</key>
5153
<dict>
5254
<key>UIApplicationSupportsMultipleScenes</key>
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import 'package:flutter/material.dart';
2+
3+
/// Keeps image-viewer shared-element motion consistent at every source.
4+
class MediaViewerHero extends StatelessWidget {
5+
/// The identity shared by the inline image and full-screen image.
6+
final Object tag;
7+
8+
/// The image rendered during and after the shared-element transition.
9+
final Widget child;
10+
11+
/// Creates an image-viewer shared element.
12+
const MediaViewerHero({super.key, required this.tag, required this.child});
13+
14+
@override
15+
Widget build(BuildContext context) {
16+
return Hero(
17+
tag: tag,
18+
createRectTween: (begin, end) => RectTween(begin: begin, end: end),
19+
flightShuttleBuilder:
20+
(
21+
flightContext,
22+
animation,
23+
flightDirection,
24+
fromHeroContext,
25+
toHeroContext,
26+
) {
27+
final sourceHero = fromHeroContext.widget;
28+
final destinationHero = toHeroContext.widget;
29+
final sourceChild = sourceHero is Hero ? sourceHero.child : child;
30+
final destinationChild = destinationHero is Hero
31+
? destinationHero.child
32+
: child;
33+
return _MediaViewerHeroFlight(
34+
animation: animation,
35+
sourceChild: sourceChild,
36+
destinationChild: destinationChild,
37+
);
38+
},
39+
child: child,
40+
);
41+
}
42+
}
43+
44+
class _MediaViewerHeroFlight extends StatelessWidget {
45+
final Animation<double> animation;
46+
final Widget sourceChild;
47+
final Widget destinationChild;
48+
49+
const _MediaViewerHeroFlight({
50+
required this.animation,
51+
required this.sourceChild,
52+
required this.destinationChild,
53+
});
54+
55+
@override
56+
Widget build(BuildContext context) {
57+
final destinationOpacity = CurvedAnimation(
58+
parent: animation,
59+
curve: const Interval(0.18, 0.82, curve: Curves.easeInOutCubic),
60+
);
61+
return Stack(
62+
fit: StackFit.expand,
63+
children: [
64+
FadeTransition(
65+
opacity: ReverseAnimation(destinationOpacity),
66+
child: sourceChild,
67+
),
68+
FadeTransition(opacity: destinationOpacity, child: destinationChild),
69+
],
70+
);
71+
}
72+
}

0 commit comments

Comments
 (0)