File tree Expand file tree Collapse file tree 4 files changed +9
-11
lines changed
android/src/main/java/com/rngooglemapsplus Expand file tree Collapse file tree 4 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ class MapMarkerBuilder(
178178 }
179179
180180 if (! prev.markerStyleEquals(next)) {
181- buildIconAsync(marker.id, next) { icon ->
181+ buildIconAsync(next) { icon ->
182182 marker.setIcon(icon)
183183 if (! prev.anchorEquals(next)) {
184184 marker.setAnchor(
@@ -242,11 +242,10 @@ class MapMarkerBuilder(
242242 }
243243
244244 fun buildIconAsync (
245- id : String ,
246245 m : RNMarker ,
247246 onReady : (BitmapDescriptor ? ) -> Unit ,
248247 ) {
249- jobsById[id]?.cancel()
248+ jobsById[m. id]?.cancel()
250249
251250 m.iconSvg ? : return onReady(null )
252251
@@ -275,11 +274,11 @@ class MapMarkerBuilder(
275274 iconCache.evictAll()
276275 } catch (_: Throwable ) {
277276 } finally {
278- jobsById.remove(id)
277+ jobsById.remove(m. id)
279278 }
280279 }
281280
282- jobsById[id] = job
281+ jobsById[m. id] = job
283282 }
284283
285284 fun cancelIconJob (id : String ) {
Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ class RNGoogleMapsPlusView(
151151 val prev = prevById[id]
152152 when {
153153 prev == null ->
154- markerBuilder.buildIconAsync(id, next) { icon ->
154+ markerBuilder.buildIconAsync(next) { icon ->
155155 view.addMarker(
156156 id,
157157 markerBuilder.build(next, icon),
Original file line number Diff line number Diff line change @@ -142,11 +142,10 @@ final class MapMarkerBuilder {
142142
143143 @MainActor
144144 func buildIconAsync(
145- _ id: String ,
146145 _ m: RNMarker ,
147146 onReady: @escaping ( UIImage ? ) -> Void
148147 ) {
149- tasks [ id] ? . cancel ( )
148+ tasks [ m . id] ? . cancel ( )
150149
151150 if m. iconSvg == nil {
152151 onReady ( nil )
@@ -161,7 +160,7 @@ final class MapMarkerBuilder {
161160
162161 let task = Task ( priority: . userInitiated) { [ weak self] in
163162 guard let self else { return }
164- defer { self . tasks. removeValue ( forKey: id) }
163+ defer { self . tasks. removeValue ( forKey: m . id) }
165164
166165 let scale = UIScreen . main. scale
167166 let img = await self . renderUIImage ( m, scale)
@@ -175,7 +174,7 @@ final class MapMarkerBuilder {
175174 }
176175 }
177176
178- tasks [ id] = task
177+ tasks [ m . id] = task
179178 }
180179
181180 @MainActor
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ final class RNGoogleMapsPlusView: HybridRNGoogleMapsPlusViewSpec {
146146 }
147147 }
148148 } else {
149- self . markerBuilder. buildIconAsync ( next. id , next ) { icon in
149+ self . markerBuilder. buildIconAsync ( next) { icon in
150150 let marker = self . markerBuilder. build ( next, icon: icon)
151151 self . impl. addMarker ( id: id, marker: marker)
152152 }
You can’t perform that action at this time.
0 commit comments