mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-21 19:28:27 +08:00
@@ -7,6 +7,7 @@ import 'package:PiliPlus/models/model_avatar.dart';
|
||||
import 'package:PiliPlus/models/model_owner.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_feed_index/watched_show.dart';
|
||||
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
|
||||
import 'package:PiliPlus/utils/parse_string.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
|
||||
@@ -429,7 +430,7 @@ class ModuleAuthorModel extends Avatar {
|
||||
pendant = null;
|
||||
}
|
||||
isTop = json['is_top'];
|
||||
badgeText = _parseString(json['icon_badge']?['text']);
|
||||
badgeText = noneNullOrEmptyString(json['icon_badge']?['text']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -682,7 +683,9 @@ class Vote {
|
||||
Vote.fromJson(Map<String, dynamic> json) {
|
||||
joinNum = Utils.safeToInt(json['join_num']);
|
||||
voteId = Utils.safeToInt(json['vote_id']);
|
||||
title = _parseString(json['title']) ?? _parseString(json['desc']);
|
||||
title =
|
||||
noneNullOrEmptyString(json['title']) ??
|
||||
noneNullOrEmptyString(json['desc']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1170,18 +1173,13 @@ class Emoji {
|
||||
|
||||
Emoji.fromJson(Map<String, dynamic> json) {
|
||||
url =
|
||||
_parseString(json['webp_url']) ??
|
||||
_parseString(json['gif_url']) ??
|
||||
_parseString(json['icon_url']);
|
||||
noneNullOrEmptyString(json['webp_url']) ??
|
||||
noneNullOrEmptyString(json['gif_url']) ??
|
||||
noneNullOrEmptyString(json['icon_url']);
|
||||
size = json['size'] ?? 1;
|
||||
}
|
||||
}
|
||||
|
||||
String? _parseString(String? value) {
|
||||
if (value == null || value.isEmpty) return null;
|
||||
return value;
|
||||
}
|
||||
|
||||
class DynamicNoneModel {
|
||||
DynamicNoneModel({
|
||||
this.tips,
|
||||
@@ -1297,7 +1295,7 @@ class ModuleTag {
|
||||
String? text;
|
||||
|
||||
ModuleTag.fromJson(Map<String, dynamic> json) {
|
||||
text = _parseString(json['text']);
|
||||
text = noneNullOrEmptyString(json['text']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user