Skip to content

Commit b5d14c0

Browse files
committed
[mob][photos] Wrapped service last changes (#8217)
## Description Wrapped service last changes (cherry picked from commit 8eadc86)
1 parent 8087c88 commit b5d14c0

File tree

10 files changed

+261
-90
lines changed

10 files changed

+261
-90
lines changed

mobile/apps/photos/android/app/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ android {
9595
buildTypes {
9696
release {
9797
signingConfig signingConfigs.release
98+
minifyEnabled true
99+
proguardFiles getDefaultProguardFile(
100+
"proguard-android-optimize.txt",
101+
), "proguard-rules.pro"
98102
}
99103
debug {
100104
applicationIdSuffix '.debug'

mobile/apps/photos/android/app/proguard-rules.pro

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,12 @@
44
-keepattributes LineNumberTable,SourceFile
55

66
-keep class org.chromium.net.** { *; }
7-
-keep class org.xmlpull.v1.** { *; }
7+
-keep class org.xmlpull.v1.** { *; }
8+
9+
# Preserve ExoPlayer/Media3 and just_audio classes used for asset playback.
10+
-keep class androidx.media3.** { *; }
11+
-dontwarn androidx.media3.**
12+
-keep class com.google.android.exoplayer2.** { *; }
13+
-dontwarn com.google.android.exoplayer2.**
14+
-keep class com.ryanheise.just_audio.** { *; }
15+
-dontwarn com.ryanheise.just_audio.**
-235 Bytes
Binary file not shown.

mobile/apps/photos/lib/services/wake_lock_service.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ enum WakeLockFor {
66
fasterBackupsOniOSByKeepingScreenAwake,
77
machineLearningSettingsScreen,
88
handlingMediaKitEdgeCase,
9+
rewindViewer,
910
}
1011

1112
/// Use this wrapper to use wakelock. This class makes sure that the wakelock

mobile/apps/photos/lib/services/wrapped/wrapped_service.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ class WrappedService {
110110
);
111111
updateResult(cached);
112112
if (_shouldScheduleDailyRecompute(cached)) {
113-
_logger
114-
.info("Scheduling daily Wrapped recompute for $_kWrappedYear");
113+
_logger.info("Scheduling daily Wrapped recompute for $_kWrappedYear");
115114
unawaited(
116115
_runCompute(reason: "daily", bypassFlag: false),
117116
);
@@ -260,7 +259,8 @@ class WrappedService {
260259
return false;
261260
}
262261
final DateTime now = DateTime.now();
263-
if (_dateOnly(now).isBefore(_dateOnly(_kAvailabilityStart))) {
262+
if (!flagService.internalUser &&
263+
_dateOnly(now).isBefore(_dateOnly(_kAvailabilityStart))) {
264264
return false;
265265
}
266266
final DateTime generatedDate = _dateOnly(result.generatedAt.toLocal());

mobile/apps/photos/lib/ui/tools/similar_images_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ class _LoadingScreenState extends State<_LoadingScreen> {
13151315
super.initState();
13161316
_analysisAnimationLoader = rive.FileLoader.fromAsset(
13171317
'assets/ducky_analyze_files.riv',
1318-
riveFactory: rive.Factory.rive,
1318+
riveFactory: rive.Factory.flutter,
13191319
);
13201320
_startTextCycling();
13211321
}

mobile/apps/photos/lib/ui/wrapped/cards/badge_card_content.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class _BadgeCardContent extends StatelessWidget {
3131
final _BadgeVisuals visuals = _badgeVisualsFor(card);
3232
final _WrappedViewerPageState? viewerState =
3333
context.findAncestorStateOfType<_WrappedViewerPageState>();
34-
final GlobalKey? shareKey = viewerState?.shareButtonKey;
3534
final bool hideSharePill = viewerState?.hideBadgeSharePill ?? false;
3635

3736
final _BadgeLayoutConstants layout = _BadgeLayoutConstants(
@@ -164,7 +163,7 @@ class _BadgeCardContent extends StatelessWidget {
164163
onTap: viewerState == null
165164
? null
166165
: () => unawaited(viewerState.shareCurrentCard()),
167-
shareButtonKey: shareKey,
166+
shareButtonKey: null,
168167
size: Size(metrics.shareWidth, metrics.shareHeight),
169168
),
170169
),

mobile/apps/photos/lib/ui/wrapped/cards/story_card.dart

Lines changed: 114 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -70,55 +70,22 @@ class _StoryCard extends StatelessWidget {
7070
color: Colors.transparent,
7171
borderRadius: BorderRadius.circular(24),
7272
clipBehavior: Clip.antiAlias,
73-
child: isBadge
74-
? Padding(
75-
padding: EdgeInsets.zero,
76-
child: _CardContent(
77-
card: card,
78-
colorScheme: colorScheme,
79-
textTheme: textTheme,
80-
),
81-
)
82-
: Stack(
83-
fit: StackFit.expand,
84-
children: [
85-
_StoryCardBackground(
86-
card: card,
87-
colorScheme: colorScheme,
88-
),
89-
if (showMeshGradient)
90-
_MeshGradientOverlay(
91-
variantIndex: gradientVariantIndex,
92-
),
93-
Positioned.fill(
94-
child: DecoratedBox(
95-
decoration: BoxDecoration(
96-
gradient: LinearGradient(
97-
begin: Alignment.topCenter,
98-
end: Alignment.bottomCenter,
99-
colors: [
100-
colorScheme.backgroundElevated
101-
.withValues(alpha: 0.45),
102-
colorScheme.backgroundElevated
103-
.withValues(alpha: 0.2),
104-
colorScheme.backgroundElevated
105-
.withValues(alpha: 0.08),
106-
],
107-
stops: const <double>[0.0, 0.6, 1.0],
108-
),
109-
),
110-
),
111-
),
112-
Padding(
113-
padding: _kStoryCardInnerPadding,
114-
child: _CardContent(
115-
card: card,
116-
colorScheme: colorScheme,
117-
textTheme: textTheme,
118-
),
119-
),
120-
],
73+
child: LayoutBuilder(
74+
builder: (BuildContext context, BoxConstraints constraints) {
75+
return FittedBox(
76+
fit: BoxFit.scaleDown,
77+
alignment: Alignment.bottomCenter,
78+
child: _StoryDesignSurface(
79+
isBadge: isBadge,
80+
showMeshGradient: showMeshGradient,
81+
gradientVariantIndex: gradientVariantIndex,
82+
card: card,
83+
colorScheme: colorScheme,
84+
textTheme: textTheme,
12185
),
86+
);
87+
},
88+
),
12289
),
12390
),
12491
);
@@ -412,3 +379,102 @@ class _GenericCardContent extends StatelessWidget {
412379
);
413380
}
414381
}
382+
383+
class _StoryDesignSurface extends StatelessWidget {
384+
const _StoryDesignSurface({
385+
required this.isBadge,
386+
required this.showMeshGradient,
387+
required this.gradientVariantIndex,
388+
required this.card,
389+
required this.colorScheme,
390+
required this.textTheme,
391+
});
392+
393+
final bool isBadge;
394+
final bool showMeshGradient;
395+
final int gradientVariantIndex;
396+
final WrappedCard card;
397+
final EnteColorScheme colorScheme;
398+
final EnteTextTheme textTheme;
399+
400+
@override
401+
Widget build(BuildContext context) {
402+
return SizedBox(
403+
width: _kStoryDesignWidth,
404+
height: _kStoryDesignHeight + _kStoryControlReserveHeight,
405+
child: isBadge
406+
? Column(
407+
children: [
408+
Expanded(
409+
child: _CardContent(
410+
card: card,
411+
colorScheme: colorScheme,
412+
textTheme: textTheme,
413+
),
414+
),
415+
const SizedBox(
416+
height:
417+
_kStoryControlReserveHeight - _kStoryControlBottomPadding,
418+
),
419+
const SizedBox(height: _kStoryControlBottomPadding),
420+
],
421+
)
422+
: ClipRRect(
423+
borderRadius: BorderRadius.circular(24),
424+
child: Stack(
425+
fit: StackFit.expand,
426+
children: [
427+
_StoryCardBackground(
428+
card: card,
429+
colorScheme: colorScheme,
430+
),
431+
if (showMeshGradient)
432+
_MeshGradientOverlay(
433+
variantIndex: gradientVariantIndex,
434+
),
435+
Positioned.fill(
436+
child: DecoratedBox(
437+
decoration: BoxDecoration(
438+
gradient: LinearGradient(
439+
begin: Alignment.topCenter,
440+
end: Alignment.bottomCenter,
441+
colors: [
442+
colorScheme.backgroundElevated
443+
.withValues(alpha: 0.45),
444+
colorScheme.backgroundElevated
445+
.withValues(alpha: 0.2),
446+
colorScheme.backgroundElevated
447+
.withValues(alpha: 0.08),
448+
],
449+
stops: const <double>[0.0, 0.6, 1.0],
450+
),
451+
),
452+
),
453+
),
454+
Positioned.fill(
455+
child: Column(
456+
children: [
457+
Expanded(
458+
child: Padding(
459+
padding: _kStoryCardInnerPadding,
460+
child: _CardContent(
461+
card: card,
462+
colorScheme: colorScheme,
463+
textTheme: textTheme,
464+
),
465+
),
466+
),
467+
const SizedBox(
468+
height: _kStoryControlReserveHeight -
469+
_kStoryControlBottomPadding,
470+
),
471+
const SizedBox(height: _kStoryControlBottomPadding),
472+
],
473+
),
474+
),
475+
],
476+
),
477+
),
478+
);
479+
}
480+
}

mobile/apps/photos/lib/ui/wrapped/wrapped_rewind_banner_button.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class _WrappedRewindBannerButtonState extends State<WrappedRewindBannerButton> {
3131
super.initState();
3232
_riveFileLoader = rive.FileLoader.fromAsset(
3333
"assets/ente_rewind_banner.riv",
34-
riveFactory: rive.Factory.rive,
34+
riveFactory: rive.Factory.flutter,
3535
);
3636
}
3737

0 commit comments

Comments
 (0)