fix(mobile): resolve fake gallery item urls with their main photo path (uploads/kontrakan and uploads/Laundry) instead of forcing uploads/galeri path
This commit is contained in:
parent
ebddf558d3
commit
00dc5b4a96
|
|
@ -61,10 +61,13 @@ class Kontrakan {
|
||||||
if (galleryList.isEmpty &&
|
if (galleryList.isEmpty &&
|
||||||
json['foto'] != null &&
|
json['foto'] != null &&
|
||||||
json['foto'].toString().isNotEmpty) {
|
json['foto'].toString().isNotEmpty) {
|
||||||
|
final resolved = json['foto_url'] != null && json['foto_url'].toString().isNotEmpty
|
||||||
|
? json['foto_url'].toString()
|
||||||
|
: _resolveKontrakanPhotoPath(json['foto'].toString());
|
||||||
galleryList.add(
|
galleryList.add(
|
||||||
Galeri(
|
Galeri(
|
||||||
id: json['id'] ?? 0,
|
id: json['id'] ?? 0,
|
||||||
foto: json['foto'].toString(),
|
foto: resolved,
|
||||||
isPrimary: true,
|
isPrimary: true,
|
||||||
urutan: 0,
|
urutan: 0,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -98,10 +98,15 @@ class Laundry {
|
||||||
if (galleryList.isEmpty &&
|
if (galleryList.isEmpty &&
|
||||||
json['foto'] != null &&
|
json['foto'] != null &&
|
||||||
json['foto'].toString().isNotEmpty) {
|
json['foto'].toString().isNotEmpty) {
|
||||||
|
final resolved = json['foto_url'] != null && json['foto_url'].toString().isNotEmpty
|
||||||
|
? json['foto_url'].toString()
|
||||||
|
: (json['foto'].toString().startsWith('http')
|
||||||
|
? json['foto'].toString()
|
||||||
|
: '${AppConfig.serverUrl}/uploads/Laundry/${json['foto']}');
|
||||||
galleryList.add(
|
galleryList.add(
|
||||||
GaleriLaundry(
|
GaleriLaundry(
|
||||||
id: json['id'] ?? 0,
|
id: json['id'] ?? 0,
|
||||||
foto: json['foto'].toString(),
|
foto: resolved,
|
||||||
isPrimary: true,
|
isPrimary: true,
|
||||||
urutan: 0,
|
urutan: 0,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -612,6 +612,7 @@ class _KontrakanDetailScreenState extends State<KontrakanDetailScreen> {
|
||||||
final imageUrl = galleryItems.isEmpty
|
final imageUrl = galleryItems.isEmpty
|
||||||
? _kontrakan.primaryPhoto
|
? _kontrakan.primaryPhoto
|
||||||
: galleryItems[index].photoUrl;
|
: galleryItems[index].photoUrl;
|
||||||
|
debugPrint('KONTRAKAN DETAIL IMAGE URL: $imageUrl');
|
||||||
|
|
||||||
return CachedNetworkImage(
|
return CachedNetworkImage(
|
||||||
imageUrl: imageUrl,
|
imageUrl: imageUrl,
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ class _LaundryDetailScreenState extends State<LaundryDetailScreen> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
debugPrint('LAUNDRY DETAIL IMAGE URL: ${widget.laundry.primaryPhoto}');
|
||||||
_checkFavorite();
|
_checkFavorite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue