Skip to content

Commit

Permalink
refactor(ios): remove exceptions in RemoteImage.
Browse files Browse the repository at this point in the history
  • Loading branch information
GerardPaligot committed Dec 22, 2023
1 parent 2ea9584 commit 73caf4b
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 108 deletions.
Binary file not shown.

This file was deleted.

Binary file not shown.
21 changes: 0 additions & 21 deletions iosApp/iosApp/Assets.xcassets/azfalte.imageset/Contents.json

This file was deleted.

Binary file not shown.
21 changes: 0 additions & 21 deletions iosApp/iosApp/Assets.xcassets/cgi.imageset/Contents.json

This file was deleted.

Binary file removed iosApp/iosApp/Assets.xcassets/cgi.imageset/cgi.png
Binary file not shown.
21 changes: 0 additions & 21 deletions iosApp/iosApp/Assets.xcassets/elosi.imageset/Contents.json

This file was deleted.

Binary file not shown.
32 changes: 8 additions & 24 deletions iosApp/iosApp/components/structures/RemoteImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,23 @@ struct RemoteImage: View {
let url: String
let description: String?
let id: String?
private let isException: Bool
// Need to be removed after the Devfest Lille event
private let exceptions: [String: String] = [
"hw0KkSyFq1FaTh8hz57C": "adeo-leroymerlin",
"K8aq8RSjQy8vqHAd6uHZ": "azfalte",
"PHwo6wyY149snPikjCxA": "cgi",
"C6cfJWrlr1XZHit4eMPK": "elosi"
]

init(url: String, description: String?, id: String? = nil) {
self.url = url
self.description = description
self.id = id
self.isException = id != nil && exceptions.keys.contains(id!)
}

var body: some View {
Group {
if (self.isException) {
Image(exceptions[id!]!)
.resizable()
} else {
WebImage(url: URL(string: url)!)
.placeholder(content: {
Text("...")
})
.resizable()
WebImage(url: URL(string: url)!)
.placeholder(content: {
Text("...")
})
.resizable()
.scaledToFit()
.if(description != nil) { view in
view.accessibilityLabel(description!)
}
}
.scaledToFit()
.if(description != nil) { view in
view.accessibilityLabel(description!)
}
}
}

Expand Down

0 comments on commit 73caf4b

Please sign in to comment.