Skip to content

Commit

Permalink
fix some bugs with freeze transition
Browse files Browse the repository at this point in the history
  • Loading branch information
lamarios committed Dec 11, 2023
1 parent 66c0fee commit 297ea6f
Show file tree
Hide file tree
Showing 7 changed files with 376 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/settings/states/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class SettingsCubit extends Cubit<SettingsState> {

getPackageInfo() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
packageInfo = packageInfo;
emit(state.copyWith(packageInfo: packageInfo));
}

toggleBlackBackground(bool value) {
Expand Down
3 changes: 2 additions & 1 deletion lib/settings/views/screens/search_history_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SearchHistorySettingsScreen extends StatelessWidget {
},
),
TextButton(
child: Text(locals.ok, style: const TextStyle(color: Colors.red)),
child: Text(locals.ok),
onPressed: () {
db.clearSearchHistory();
Navigator.of(context).pop();
Expand Down Expand Up @@ -64,6 +64,7 @@ class SearchHistorySettingsScreen extends StatelessWidget {
title: Text(locals.enableSearchHistory),
),
SettingsTile(
enabled: _.useSearchHistory,
title: Text(locals.searchHistoryLimit),
description: Text(locals.searchHistoryLimitDescription),
trailing: Row(
Expand Down
7 changes: 7 additions & 0 deletions lib/videos/models/base_video.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:copy_with_extension/copy_with_extension.dart';
import 'package:invidious/videos/models/video_in_list.dart';
import 'package:json_annotation/json_annotation.dart';

Expand All @@ -6,12 +7,15 @@ import '../../settings/models/db/video_filter.dart';
import '../../utils/models/image_object.dart';
import '../../utils/models/sharelink.dart';

part 'base_video.g.dart';

abstract class IdedVideo {
String videoId;

IdedVideo(this.videoId);
}

@CopyWith(constructor: '_')
class BaseVideo extends IdedVideo implements ShareLinks {
String title;
int lengthSeconds;
Expand All @@ -35,6 +39,9 @@ class BaseVideo extends IdedVideo implements ShareLinks {

BaseVideo(this.title, String videoId, this.lengthSeconds, this.author, this.authorId, this.authorUrl, this.videoThumbnails) : super(videoId);

BaseVideo._(super.videoId, this.title, this.lengthSeconds, this.author, this.authorId, this.authorUrl, this.videoThumbnails, this.filtered, this.matchedFilters, this.filterHide, this.deArrowed,
this.deArrowThumbnailUrl);

@override
String getInvidiousLink(Server server, int? timestamp) {
String link = '${server.url}/watch?v=$videoId';
Expand Down
181 changes: 181 additions & 0 deletions lib/videos/models/base_video.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions lib/videos/models/video_in_list.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:copy_with_extension/copy_with_extension.dart';
import 'package:invidious/videos/models/base_video.dart';
import 'package:json_annotation/json_annotation.dart';

Expand All @@ -6,6 +7,7 @@ import '../../utils/models/image_object.dart';
part 'video_in_list.g.dart';

@JsonSerializable()
@CopyWith(constructor: '_')
class VideoInList extends BaseVideo {
int? viewCount;

Expand All @@ -21,4 +23,8 @@ class VideoInList extends BaseVideo {
factory VideoInList.fromJson(Map<String, dynamic> json) => _$VideoInListFromJson(json);

Map<String, dynamic> toJson() => _$VideoInListToJson(this);

VideoInList._(
super.videoId, super.title, super.lengthSeconds, super.author, super.authorId, super.authorUrl, super.videoThumbnails,
this.viewCount, this.published, this.index, this.indexId, this.publishedText);
}
Loading

0 comments on commit 297ea6f

Please sign in to comment.