Skip to content

Commit

Permalink
fix for cloudreve V3.8.0: thumb update
Browse files Browse the repository at this point in the history
  • Loading branch information
xkeyC committed Jul 2, 2023
1 parent 74cb264 commit 9d2383a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
28 changes: 21 additions & 7 deletions lib/data/file/cloudreve_file_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ class CloudreveFileData {
objects?.add(CloudreveFileObjectsData.fromJson(v));
});
}
policy = json['policy'] != null
? CloudreveFilePolicyData.fromJson(json['policy'])
: null;
policy = json['policy'] != null ? CloudreveFilePolicyData.fromJson(json['policy']) : null;
}

String? parent;
Expand All @@ -35,6 +33,12 @@ class CloudreveFileData {
}
}

/// id : "o2fK"
/// name : "Default storage policy"
/// type : "local"
/// max_size : 0
/// file_type : []
class CloudreveFilePolicyData {
CloudreveFilePolicyData({
this.id,
Expand Down Expand Up @@ -76,12 +80,22 @@ class CloudreveFilePolicyData {
}
}

/// id : "m7Yu5"
/// name : "VRChat_2023-03-20_00-40-59.651_7680x4320.png"
/// path : "/图片/vrchat/2023-03"
/// thumb : false
/// size : 41144367
/// type : "file"
/// date : "2023-03-20T01:27:42.788506345+08:00"
/// create_date : "2023-03-20T01:11:41.236619094+08:00"
/// source_enabled : true
class CloudreveFileObjectsData {
CloudreveFileObjectsData({
this.id,
this.name,
this.path,
this.pic,
this.thumb,
this.size,
this.type,
this.date,
Expand All @@ -93,7 +107,7 @@ class CloudreveFileObjectsData {
id = json['id'];
name = json['name'];
path = json['path'];
pic = json['pic'];
thumb = json['thumb'];
size = json['size'];
type = json['type'];
date = json['date'];
Expand All @@ -104,7 +118,7 @@ class CloudreveFileObjectsData {
String? id;
String? name;
String? path;
String? pic;
bool? thumb;
num? size;
String? type;
String? date;
Expand All @@ -116,7 +130,7 @@ class CloudreveFileObjectsData {
map['id'] = id;
map['name'] = name;
map['path'] = path;
map['pic'] = pic;
map['thumb'] = thumb;
map['size'] = size;
map['type'] = type;
map['date'] = date;
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/file/file_menu_bottom_sheet_ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class FileMenuBottomSheetUI extends BaseUI<FileMenuBottomSheetUIModel> {

if (filesInfo.length == 1) {
final fileInfo = filesInfo[0];
if (fileInfo.pic != "") {
if (fileInfo.thumb == true) {
return CacheImage(
"${AppAccountManager.workingAccount?.workingUrl}/api/v3/file/thumb/${fileInfo.id}",
loaderSize: size,
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/home/home_file_ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class HomeFileUI extends BaseUI<HomeFileUIModel> {
top: 6, bottom: model.isInSelectMode ? 64 : 0),
itemBuilder: (BuildContext context, int index) {
final file = model.files!.objects![index];
final isPic = file.pic?.isNotEmpty ?? false;
final isPic = file.thumb == true;
return model.isCardFileList
? makeCardItem(context, model, file, isPic, cardWidth)
: makeListItem(context, model, file, isPic);
Expand Down

0 comments on commit 9d2383a

Please sign in to comment.