Skip to content

Commit

Permalink
Merge pull request #1390 from ardriveapp/dev
Browse files Browse the repository at this point in the history
PE-4690: Release v2.16.0
  • Loading branch information
kunstmusik authored Sep 27, 2023
2 parents 7cf495e + 2aa99ea commit 00bb7e6
Show file tree
Hide file tree
Showing 16 changed files with 876 additions and 128 deletions.
2 changes: 2 additions & 0 deletions android/fastlane/metadata/android/en-US/changelogs/64.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- New Audio Preview available when selecting audio files
- Prevent synchronization when creating new Snapshots
3 changes: 2 additions & 1 deletion assets/config/dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"allowedDataItemSizeForTurbo": 500000,
"enableQuickSyncAuthoring": true,
"enableMultipleFileDownload": true,
"enableVideoPreview": false,
"enableVideoPreview": true,
"enableAudioPreview": true,
"stripePublishableKey": "pk_test_51JUAtwC8apPOWkDLh2FPZkQkiKZEkTo6wqgLCtQoClL6S4l2jlbbc5MgOdwOUdU9Tn93NNvqAGbu115lkJChMikG00XUfTmo2z",
"enablePins": true
}
1 change: 1 addition & 0 deletions assets/config/prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"enableQuickSyncAuthoring": true,
"enableMultipleFileDownload": true,
"enableVideoPreview": false,
"enableAudioPreview": true,
"stripePublishableKey": "pk_live_51JUAtwC8apPOWkDLMQqNF9sPpfneNSPnwX8YZ8y1FNDl6v94hZIwzgFSYl27bWE4Oos8CLquunUswKrKcaDhDO6m002Yj9AeKj",
"enablePins": true
}
1 change: 1 addition & 0 deletions assets/config/staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"enableQuickSyncAuthoring": true,
"enableMultipleFileDownload": true,
"enableVideoPreview": false,
"enableAudioPreview": true,
"stripePublishableKey": "pk_live_51JUAtwC8apPOWkDLMQqNF9sPpfneNSPnwX8YZ8y1FNDl6v94hZIwzgFSYl27bWE4Oos8CLquunUswKrKcaDhDO6m002Yj9AeKj",
"enablePins": true
}
42 changes: 41 additions & 1 deletion lib/blocs/fs_entry_preview/fs_entry_preview_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ class FsEntryPreviewCubit extends Cubit<FsEntryPreviewState> {
}

break;

case 'audio':
_previewAudio(
fileKey != null,
selectedItem,
previewUrl,
);
break;

case 'video':
_previewVideo(
fileKey != null,
Expand Down Expand Up @@ -175,6 +184,16 @@ class FsEntryPreviewCubit extends Cubit<FsEntryPreviewState> {
case 'image':
emitImagePreview(file, previewUrl);
break;

case 'audio':
_previewAudio(
(selectedItem as FileDataTableItem).pinnedDataOwnerAddress ==
null &&
drive.isPrivate,
selectedItem,
previewUrl,
);
break;
case 'video':
_previewVideo(
drive.isPrivate,
Expand All @@ -193,6 +212,23 @@ class FsEntryPreviewCubit extends Cubit<FsEntryPreviewState> {
}
}

void _previewAudio(
bool isPrivate, FileDataTableItem selectedItem, previewUrl) {
if (_configService.config.enableAudioPreview) {
if (isPrivate) {
emit(FsEntryPreviewUnavailable());
return;
}

emit(FsEntryPreviewAudio(
filename: selectedItem.name, previewUrl: previewUrl));

return;
}

emit(FsEntryPreviewUnavailable());
}

void _previewVideo(
bool isPrivate, FileDataTableItem selectedItem, previewUrl) {
if (_configService.config.enableVideoPreview) {
Expand All @@ -201,7 +237,8 @@ class FsEntryPreviewCubit extends Cubit<FsEntryPreviewState> {
return;
}

emit(FsEntryPreviewVideo(previewUrl: previewUrl));
emit(FsEntryPreviewVideo(
filename: selectedItem.name, previewUrl: previewUrl));

return;
}
Expand Down Expand Up @@ -298,6 +335,9 @@ class FsEntryPreviewCubit extends Cubit<FsEntryPreviewState> {
case 'image':
return supportedImageTypesInFilePreview
.any((element) => element.contains(fileExtension));
case 'audio':
return audioContentTypes
.any((element) => element.contains(fileExtension));
case 'video':
return videoContentTypes
.any((element) => element.contains(fileExtension));
Expand Down
14 changes: 9 additions & 5 deletions lib/blocs/fs_entry_preview/fs_entry_preview_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,25 @@ class FsEntryPreviewImage extends FsEntryPreviewSuccess {
}

class FsEntryPreviewAudio extends FsEntryPreviewSuccess {
const FsEntryPreviewAudio({
required String previewUrl,
}) : super(previewUrl: previewUrl);
final String filename;
const FsEntryPreviewAudio(
{required String previewUrl, required this.filename})
: super(previewUrl: previewUrl);

@override
List<Object> get props => [previewUrl];
List<Object> get props => [previewUrl, filename];
}

class FsEntryPreviewVideo extends FsEntryPreviewSuccess {
final String filename;

const FsEntryPreviewVideo({
required String previewUrl,
required this.filename,
}) : super(previewUrl: previewUrl);

@override
List<Object> get props => [previewUrl];
List<Object> get props => [previewUrl, filename];
}

class FsEntryPreviewMemory extends FsEntryPreviewSuccess {
Expand Down
35 changes: 19 additions & 16 deletions lib/components/create_snapshot_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:ardrive/blocs/profile/profile_cubit.dart';
import 'package:ardrive/components/components.dart';
import 'package:ardrive/entities/string_types.dart';
import 'package:ardrive/models/models.dart';
import 'package:ardrive/pages/user_interaction_wrapper.dart';
import 'package:ardrive/services/arweave/arweave.dart';
import 'package:ardrive/services/pst/pst.dart';
import 'package:ardrive/theme/theme.dart';
Expand All @@ -21,22 +22,24 @@ Future<void> promptToCreateSnapshot(
BuildContext context,
Drive drive,
) async {
return showAnimatedDialog(
context,
barrierDismissible: false,
content: BlocProvider(
create: (_) => CreateSnapshotCubit(
arweave: context.read<ArweaveService>(),
driveDao: context.read<DriveDao>(),
profileCubit: context.read<ProfileCubit>(),
pst: context.read<PstService>(),
tabVisibility: TabVisibilitySingleton(),
),
child: CreateSnapshotDialog(
drive: drive,
),
),
);
return showModalDialog(
context,
() => showAnimatedDialog(
context,
barrierDismissible: false,
content: BlocProvider(
create: (_) => CreateSnapshotCubit(
arweave: context.read<ArweaveService>(),
driveDao: context.read<DriveDao>(),
profileCubit: context.read<ProfileCubit>(),
pst: context.read<PstService>(),
tabVisibility: TabVisibilitySingleton(),
),
child: CreateSnapshotDialog(
drive: drive,
),
),
));
}

class CreateSnapshotDialog extends StatelessWidget {
Expand Down
14 changes: 14 additions & 0 deletions lib/dev_tools/app_dev_tools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,19 @@ class AppConfigWindowManagerState extends State<AppConfigWindowManager> {
type: ArDriveDevToolOptionType.bool,
);

ArDriveDevToolOption enableAudioPreviewOption = ArDriveDevToolOption(
name: 'enableAudioPreview',
value: settings.enableAudioPreview,
onChange: (value) {
setState(() {
configService.updateAppConfig(
settings.copyWith(enableAudioPreview: value),
);
});
},
type: ArDriveDevToolOptionType.bool,
);

ArDriveDevToolOption autoSyncIntervalInSecondsOption = ArDriveDevToolOption(
name: 'autoSyncIntervalInSeconds',
value: settings.autoSyncIntervalInSeconds,
Expand Down Expand Up @@ -323,6 +336,7 @@ class AppConfigWindowManagerState extends State<AppConfigWindowManager> {
enableQuickSyncAuthoringOption,
enableMultipleFileDownloadOption,
enableVideoPreviewOption,
enableAudioPreviewOption,
enableSeedPhreaseLogin,
allowedDataItemSizeForTurboOption,
defaultArweaveGatewayUrlOption,
Expand Down
4 changes: 4 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,10 @@
"@noOneWillSee": {
"description": "Indicates that private content won't reach to the wrong hands"
},
"normal": "Normal",
"@normal": {
"description": "Menu entry for \"Normal\" speed playback on Audio and Video previews."
},
"noSubscriptions": "No subscriptions are needed!",
"@noSubscriptions": {
"description": "Payment philosophy"
Expand Down
Loading

0 comments on commit 00bb7e6

Please sign in to comment.