mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-01-11 22:40:36 +00:00
Refactor imageUrl assignment in updateMangaDetail to handle null and HTTP checks
This commit is contained in:
parent
1f27c129a5
commit
7c47d19a70
1 changed files with 7 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ import 'package:mangayomi/models/update.dart';
|
|||
import 'package:mangayomi/models/manga.dart';
|
||||
import 'package:mangayomi/services/get_detail.dart';
|
||||
import 'package:mangayomi/utils/extensions/others.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
import 'package:mangayomi/utils/utils.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
|
@ -42,8 +43,13 @@ Future<dynamic> updateMangaDetail(
|
|||
[];
|
||||
final tempName = getManga.name?.trim().trimLeft().trimRight();
|
||||
final tempLink = getManga.link?.trim().trimLeft().trimRight();
|
||||
final imgUrl = getManga.imageUrl ?? manga.imageUrl;
|
||||
manga
|
||||
..imageUrl = getManga.imageUrl ?? manga.imageUrl
|
||||
..imageUrl = imgUrl == null
|
||||
? null
|
||||
: imgUrl.startsWith('http')
|
||||
? imgUrl
|
||||
: '${source.baseUrl ?? ''}/${imgUrl.getUrlWithoutDomain}'
|
||||
..name = tempName != null && tempName.isNotEmpty ? tempName : manga.name
|
||||
..genre = (genre.isEmpty ? null : genre) ?? manga.genre ?? []
|
||||
..author =
|
||||
|
|
|
|||
Loading…
Reference in a new issue