Compare commits

...
1 Commits
Author SHA1 Message Date
RarDog f983e3c8c0 feat: исключение дублирования в текстовых публикациях и вкладки зеркал (v3.3.1)
Build and Release / Build Windows x64 (push) Has been cancelled
2026-09-05 10:40:14 +03:00
7 changed files with 183 additions and 80 deletions
+1 -1
View File
@@ -10,7 +10,7 @@
</p> </p>
<p align="center"> <p align="center">
<a href="https://github.com/RarDog/Lunaris/releases"><img src="https://img.shields.io/badge/Version-3.3.0-8A2BE2?style=for-the-badge&logo=semver&logoColor=white" alt="Version 3.3.0" /></a> <a href="https://github.com/RarDog/Lunaris/releases"><img src="https://img.shields.io/badge/Version-3.3.1-8A2BE2?style=for-the-badge&logo=semver&logoColor=white" alt="Version 3.3.1" /></a>
<img src="https://img.shields.io/badge/Flutter-3.47+-02569B?style=for-the-badge&logo=flutter&logoColor=white" alt="Flutter" /> <img src="https://img.shields.io/badge/Flutter-3.47+-02569B?style=for-the-badge&logo=flutter&logoColor=white" alt="Flutter" />
<img src="https://img.shields.io/badge/Platform-Android%20%7C%20Linux%20%7C%20Windows-00C853?style=for-the-badge" alt="Platforms" /> <img src="https://img.shields.io/badge/Platform-Android%20%7C%20Linux%20%7C%20Windows-00C853?style=for-the-badge" alt="Platforms" />
<a href="https://github.com/RarDog/Lunaris/wiki"><img src="https://img.shields.io/badge/Wiki-Documentation-FF6F00?style=for-the-badge&logo=gitbook&logoColor=white" alt="Wiki" /></a> <a href="https://github.com/RarDog/Lunaris/wiki"><img src="https://img.shields.io/badge/Wiki-Documentation-FF6F00?style=for-the-badge&logo=gitbook&logoColor=white" alt="Wiki" /></a>
+2 -2
View File
@@ -1,3 +1,3 @@
const appDisplayVersion = '3.3.0'; const appDisplayVersion = '3.3.1';
const appBuildNumber = 72; const appBuildNumber = 73;
const appReleaseChannel = 'Stable'; const appReleaseChannel = 'Stable';
+9
View File
@@ -1,4 +1,13 @@
const lunarisChangelog = [ const lunarisChangelog = [
LunarisChange(
version: '3.3.1',
title: 'Улучшенное разделение текстовых постов и облачных зеркал',
bullets: [
'Исключение дублирования в текстовых публикациях: для текстовых постов (без медиа) убрана лишняя плашка «Облачные диски и зеркала», исключая повторный вывод того же текста внизу экрана.',
'Вкладки «Зеркала» и «Описание»: для постов с фото, видео и GIF в блоке облачных дисков теперь доступны удобные переключаемые вкладки, позволяющие отдельно просматривать список ссылок на хранилища и авторское описание.',
'Чистый и нативный вид карточек: если у медиапоста есть только ссылки или только описание, отображается аккуратная монолитная секция с соответствующим заголовком и иконкой без лишних переключателей.',
],
),
LunarisChange( LunarisChange(
version: '3.3.0', version: '3.3.0',
title: 'Редизайн личных сообщений и рассылок артиста, нативная поддержка текстовых публикаций', title: 'Редизайн личных сообщений и рассылок артиста, нативная поддержка текстовых публикаций',
@@ -110,6 +110,16 @@ class PostDetailsScreen extends ConsumerWidget {
t.status == DownloadTaskStatus.queued), t.status == DownloadTaskStatus.queued),
) ?? ) ??
false; false;
final isTextOnly = post.fileType == 'text' ||
(post.previewUrl.isEmpty &&
post.sampleUrl.isEmpty &&
post.fileUrl.isEmpty &&
!MediaUrlSelector.isVideo(post));
final shouldShowCloudCard = isTextOnly
? post.cloudLinks.isNotEmpty
: (post.cloudLinks.isNotEmpty ||
(post.commentary != null &&
post.commentary!.trim().isNotEmpty));
if (Responsive.isMobile(context)) { if (Responsive.isMobile(context)) {
if (currentIndex >= 0 && feedPosts.length > 1) { if (currentIndex >= 0 && feedPosts.length > 1) {
@@ -341,14 +351,12 @@ class PostDetailsScreen extends ConsumerWidget {
localMedia: localMedia, localMedia: localMedia,
fileSizeBytes: fileSizeBytes, fileSizeBytes: fileSizeBytes,
), ),
if (post.cloudLinks.isNotEmpty || if (shouldShowCloudCard) ...[
(post.commentary != null &&
post.commentary!.trim().isNotEmpty)) ...[
const SizedBox(height: 16), const SizedBox(height: 16),
CloudMirrorsCard( CloudMirrorsCard(
links: post.cloudLinks, links: post.cloudLinks,
strings: strings, strings: strings,
commentary: post.commentary, commentary: isTextOnly ? null : post.commentary,
onPlayStream: (streamUrl) => launchUrl( onPlayStream: (streamUrl) => launchUrl(
Uri.parse(streamUrl), Uri.parse(streamUrl),
mode: LaunchMode.externalApplication, mode: LaunchMode.externalApplication,
@@ -438,6 +446,16 @@ class PostDetailsScreen extends ConsumerWidget {
t.status == DownloadTaskStatus.queued), t.status == DownloadTaskStatus.queued),
) ?? ) ??
false; false;
final isTextOnly = post.fileType == 'text' ||
(post.previewUrl.isEmpty &&
post.sampleUrl.isEmpty &&
post.fileUrl.isEmpty &&
!MediaUrlSelector.isVideo(post));
final shouldShowCloudCard = isTextOnly
? post.cloudLinks.isNotEmpty
: (post.cloudLinks.isNotEmpty ||
(post.commentary != null &&
post.commentary!.trim().isNotEmpty));
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.translucent, behavior: HitTestBehavior.translucent,
@@ -562,14 +580,12 @@ class PostDetailsScreen extends ConsumerWidget {
localMedia: localMedia, localMedia: localMedia,
fileSizeBytes: fileSizeBytes, fileSizeBytes: fileSizeBytes,
), ),
if (post.cloudLinks.isNotEmpty || if (shouldShowCloudCard) ...[
(post.commentary != null &&
post.commentary!.trim().isNotEmpty)) ...[
const SizedBox(height: 12), const SizedBox(height: 12),
CloudMirrorsCard( CloudMirrorsCard(
links: post.cloudLinks, links: post.cloudLinks,
strings: strings, strings: strings,
commentary: post.commentary, commentary: isTextOnly ? null : post.commentary,
onPlayStream: (streamUrl) => launchUrl( onPlayStream: (streamUrl) => launchUrl(
Uri.parse(streamUrl), Uri.parse(streamUrl),
mode: LaunchMode.externalApplication, mode: LaunchMode.externalApplication,
@@ -7,7 +7,7 @@ import '../../../../backend/models/cloud_media_link.dart';
import '../../../../backend/models/creator_link.dart'; import '../../../../backend/models/creator_link.dart';
import '../../../../shared/widgets/formatted_content_text.dart'; import '../../../../shared/widgets/formatted_content_text.dart';
class CloudMirrorsCard extends StatelessWidget { class CloudMirrorsCard extends StatefulWidget {
const CloudMirrorsCard({ const CloudMirrorsCard({
super.key, super.key,
required this.links, required this.links,
@@ -25,9 +25,21 @@ class CloudMirrorsCard extends StatelessWidget {
final ValueChanged<String>? onDownloadStream; final ValueChanged<String>? onDownloadStream;
final bool initiallyExpanded; final bool initiallyExpanded;
@override
State<CloudMirrorsCard> createState() => _CloudMirrorsCardState();
}
class _CloudMirrorsCardState extends State<CloudMirrorsCard> {
int _selectedTab = 0; // 0: mirrors, 1: commentary
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (links.isEmpty && (commentary == null || commentary!.trim().isEmpty)) { final links = widget.links;
final commentary = widget.commentary;
final hasLinks = links.isNotEmpty;
final hasCommentary = commentary != null && commentary.trim().isNotEmpty;
if (!hasLinks && !hasCommentary) {
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
@@ -37,6 +49,14 @@ class CloudMirrorsCard extends StatelessWidget {
.whereType<String>() .whereType<String>()
.firstWhere((p) => p.isNotEmpty, orElse: () => ''); .firstWhere((p) => p.isNotEmpty, orElse: () => '');
final cardTitle = hasLinks
? (widget.strings.ru
? 'Облачные диски и зеркала (${links.length})'
: 'Cloud Mirrors & Drives (${links.length})')
: (widget.strings.ru ? 'Описание от автора' : 'Artist Commentary');
final cardIcon = hasLinks ? Icons.cloud_sync_rounded : Icons.notes_rounded;
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: theme.colorScheme.surfaceContainerLow, color: theme.colorScheme.surfaceContainerLow,
@@ -49,20 +69,18 @@ class CloudMirrorsCard extends StatelessWidget {
child: ExpansionTile( child: ExpansionTile(
tilePadding: const EdgeInsets.symmetric(horizontal: 14, vertical: 2), tilePadding: const EdgeInsets.symmetric(horizontal: 14, vertical: 2),
childrenPadding: const EdgeInsets.fromLTRB(14, 0, 14, 14), childrenPadding: const EdgeInsets.fromLTRB(14, 0, 14, 14),
initiallyExpanded: initiallyExpanded, initiallyExpanded: widget.initiallyExpanded,
shape: const Border(), shape: const Border(),
collapsedShape: const Border(), collapsedShape: const Border(),
leading: Icon( leading: Icon(
Icons.cloud_sync_rounded, cardIcon,
color: theme.colorScheme.primary, color: theme.colorScheme.primary,
), ),
title: Row( title: Row(
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
strings.ru cardTitle,
? 'Облачные диски и зеркала (${links.length})'
: 'Cloud Mirrors & Drives (${links.length})',
style: theme.textTheme.titleSmall?.copyWith( style: theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -77,7 +95,8 @@ class CloudMirrorsCard extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.green.withValues(alpha: 0.15), color: Colors.green.withValues(alpha: 0.15),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.green.withValues(alpha: 0.4)), border:
Border.all(color: Colors.green.withValues(alpha: 0.4)),
), ),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@@ -86,7 +105,7 @@ class CloudMirrorsCard extends StatelessWidget {
size: 13, color: Colors.green), size: 13, color: Colors.green),
const SizedBox(width: 4), const SizedBox(width: 4),
Text( Text(
strings.ru ? 'Плеер' : 'Stream', widget.strings.ru ? 'Плеер' : 'Stream',
style: theme.textTheme.labelSmall?.copyWith( style: theme.textTheme.labelSmall?.copyWith(
color: Colors.green, color: Colors.green,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@@ -116,7 +135,9 @@ class CloudMirrorsCard extends StatelessWidget {
Expanded( Expanded(
child: Text.rich( child: Text.rich(
TextSpan( TextSpan(
text: strings.ru ? 'Пароль к архиву: ' : 'Archive Password: ', text: widget.strings.ru
? 'Пароль к архиву: '
: 'Archive Password: ',
style: theme.textTheme.bodySmall?.copyWith( style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurface, color: theme.colorScheme.onSurface,
), ),
@@ -135,13 +156,15 @@ class CloudMirrorsCard extends StatelessWidget {
IconButton( IconButton(
icon: const Icon(Icons.copy_rounded, size: 16), icon: const Icon(Icons.copy_rounded, size: 16),
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
tooltip: strings.ru ? 'Копировать пароль' : 'Copy Password', tooltip: widget.strings.ru
? 'Копировать пароль'
: 'Copy Password',
onPressed: () { onPressed: () {
Clipboard.setData(ClipboardData(text: detectedPassword)); Clipboard.setData(ClipboardData(text: detectedPassword));
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text( content: Text(
strings.ru widget.strings.ru
? 'Пароль скопирован: $detectedPassword' ? 'Пароль скопирован: $detectedPassword'
: 'Password copied: $detectedPassword', : 'Password copied: $detectedPassword',
), ),
@@ -157,63 +180,111 @@ class CloudMirrorsCard extends StatelessWidget {
const SizedBox(height: 10), const SizedBox(height: 10),
], ],
// Links list if (hasLinks && hasCommentary) ...[
if (links.isNotEmpty) ...[ Padding(
...links.map((link) => _buildLinkTile(context, link, strings)), padding: const EdgeInsets.only(bottom: 12),
], child: SizedBox(
width: double.infinity,
// Commentary / Description child: SegmentedButton<int>(
if (commentary != null && commentary!.trim().isNotEmpty) ...[ segments: [
const SizedBox(height: 10), ButtonSegment(
Divider( value: 0,
color: theme.colorScheme.outlineVariant.withValues(alpha: 0.4), icon: const Icon(Icons.cloud_queue_rounded, size: 16),
height: 1, label: Text(
), widget.strings.ru
const SizedBox(height: 10), ? 'Зеркала (${links.length})'
Row( : 'Mirrors (${links.length})',
children: [ ),
Icon( ),
Icons.notes_rounded, ButtonSegment(
size: 16, value: 1,
color: theme.colorScheme.primary, icon: const Icon(Icons.notes_rounded, size: 16),
label: Text(
widget.strings.ru ? 'Описание' : 'Description',
),
),
],
selected: {_selectedTab},
onSelectionChanged: (set) =>
setState(() => _selectedTab = set.first),
), ),
const SizedBox(width: 6),
Text(
strings.ru ? 'Описание от автора' : 'Artist Commentary',
style: theme.textTheme.labelLarge?.copyWith(
fontWeight: FontWeight.bold,
color: theme.colorScheme.primary,
),
),
],
),
const SizedBox(height: 8),
FormattedContentText(
text: commentary!.trim(),
style: theme.textTheme.bodySmall?.copyWith(
height: 1.45,
color: theme.colorScheme.onSurfaceVariant,
), ),
), ),
Builder( IndexedStack(
builder: (context) { index: _selectedTab,
final creatorLinks = CreatorLink.extractLinks(commentary); children: [
if (creatorLinks.isEmpty) return const SizedBox.shrink(); Column(
return Padding( crossAxisAlignment: CrossAxisAlignment.start,
padding: const EdgeInsets.only(top: 10), children: links
child: CreatorLinkChips( .map((link) => _buildLinkTile(
links: creatorLinks, context,
title: strings.ru ? 'Ссылки автора' : 'Author Links', link,
), widget.strings,
); ))
}, .toList(),
),
_buildCommentarySection(context, commentary, theme),
],
), ),
] else if (hasLinks) ...[
...links.map((link) => _buildLinkTile(
context,
link,
widget.strings,
)),
] else if (hasCommentary) ...[
_buildCommentarySection(context, commentary, theme),
], ],
], ],
), ),
); );
} }
Widget _buildCommentarySection(
BuildContext context,
String text,
ThemeData theme,
) {
final creatorLinks = CreatorLink.extractLinks(text);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(
Icons.notes_rounded,
size: 16,
color: theme.colorScheme.primary,
),
const SizedBox(width: 6),
Text(
widget.strings.ru ? 'Описание от автора' : 'Artist Commentary',
style: theme.textTheme.labelLarge?.copyWith(
fontWeight: FontWeight.bold,
color: theme.colorScheme.primary,
),
),
],
),
const SizedBox(height: 8),
FormattedContentText(
text: text.trim(),
style: theme.textTheme.bodySmall?.copyWith(
height: 1.45,
color: theme.colorScheme.onSurfaceVariant,
),
),
if (creatorLinks.isNotEmpty) ...[
const SizedBox(height: 10),
CreatorLinkChips(
links: creatorLinks,
title: widget.strings.ru ? 'Ссылки автора' : 'Author Links',
),
],
],
);
}
Widget _buildLinkTile( Widget _buildLinkTile(
BuildContext context, BuildContext context,
CloudMediaLink link, CloudMediaLink link,
@@ -303,7 +374,7 @@ class CloudMirrorsCard extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
// Play button (if streamable) // Play button (if streamable)
if (link.isStreamable && onPlayStream != null) ...[ if (link.isStreamable && widget.onPlayStream != null) ...[
FilledButton.tonalIcon( FilledButton.tonalIcon(
style: FilledButton.styleFrom( style: FilledButton.styleFrom(
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
@@ -313,7 +384,7 @@ class CloudMirrorsCard extends StatelessWidget {
label: Text(strings.ru ? 'Смотреть' : 'Play'), label: Text(strings.ru ? 'Смотреть' : 'Play'),
onPressed: () { onPressed: () {
final target = link.directStreamUrl ?? link.url; final target = link.directStreamUrl ?? link.url;
onPlayStream!(target); widget.onPlayStream!(target);
}, },
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
@@ -321,12 +392,13 @@ class CloudMirrorsCard extends StatelessWidget {
// Download button (if direct streamable and callback exists) // Download button (if direct streamable and callback exists)
if (link.isStreamable && if (link.isStreamable &&
link.directStreamUrl != null && link.directStreamUrl != null &&
onDownloadStream != null) ...[ widget.onDownloadStream != null) ...[
IconButton.filledTonal( IconButton.filledTonal(
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
tooltip: strings.download, tooltip: strings.download,
icon: const Icon(Icons.download_rounded, size: 16), icon: const Icon(Icons.download_rounded, size: 16),
onPressed: () => onDownloadStream!(link.directStreamUrl!), onPressed: () =>
widget.onDownloadStream!(link.directStreamUrl!),
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
], ],
+1 -1
View File
@@ -1,7 +1,7 @@
name: gel_rule_app name: gel_rule_app
description: Local backend/core layer for a Flutter booru browser app. description: Local backend/core layer for a Flutter booru browser app.
publish_to: "none" publish_to: "none"
version: 3.3.0+72 version: 3.3.1+73
environment: environment:
sdk: ">=3.3.0 <4.0.0" sdk: ">=3.3.0 <4.0.0"
+11 -5
View File
@@ -55,15 +55,21 @@ void main() {
expect(find.text('Google Drive'), findsOneWidget); expect(find.text('Google Drive'), findsOneWidget);
expect(find.text('Google Drive Stream'), findsOneWidget); expect(find.text('Google Drive Stream'), findsOneWidget);
// Verify commentary // Verify play button triggers callback on mirrors tab
expect(find.text('Описание от автора'), findsOneWidget);
expect(find.text('Special Patreon bonus animation for all patrons.'), findsOneWidget);
// Verify play button triggers callback
final playBtn = find.text('Смотреть'); final playBtn = find.text('Смотреть');
expect(playBtn, findsOneWidget); expect(playBtn, findsOneWidget);
await tester.tap(playBtn); await tester.tap(playBtn);
expect(playedStream, 'https://drive.google.com/uc?export=download&id=123'); expect(playedStream, 'https://drive.google.com/uc?export=download&id=123');
// Switch to description tab and verify commentary
final descTab = find.text('Описание');
expect(descTab, findsOneWidget);
await tester.tap(descTab);
await tester.pumpAndSettle();
// Verify commentary
expect(find.text('Описание от автора'), findsOneWidget);
expect(find.text('Special Patreon bonus animation for all patrons.'), findsOneWidget);
}); });
testWidgets('CloudMirrorsCard renders nothing if no links and no commentary', (tester) async { testWidgets('CloudMirrorsCard renders nothing if no links and no commentary', (tester) async {