Skip to content

Commit 62257c2

Browse files
authored
Fix web. Platform Image Validation & Map Focus Style Fix (#94)
* Move image extension assert into platform code * Adjust prevent blue border on focus css rule
1 parent 528be3a commit 62257c2

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

arcgis_map_sdk_android/android/src/main/kotlin/dev/fluttercommunity/arcgis_map_sdk_android/util/GraphicsParser.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ class GraphicsParser(private val binding: FlutterPluginBinding) {
125125

126126
// return local asset in case its a local path
127127
if (!payload.assetUri.isWebUrl()) {
128+
if (!payload.assetUri.endsWith(".png", ignoreCase = true)) {
129+
throw IllegalArgumentException("Local assetUri must have type .png. Got ${payload.assetUri}")
130+
}
128131
return PictureMarkerSymbol.createWithImage(getBitmapFromAssetPath(payload.assetUri)!!)
129132
.apply {
130133
width = payload.width.toFloat()

arcgis_map_sdk_ios/ios/arcgis_map_sdk_ios/Sources/arcgis_map_sdk_ios/GraphicsParser.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,13 @@ class GraphicsParser {
136136
return symbol
137137
}
138138

139-
private func parsePictureMarkerSymbol(_ dictionary: [String: Any]) -> Symbol {
139+
private func parsePictureMarkerSymbol(_ dictionary: [String: Any]) throws -> Symbol {
140140
let payload: PictureMarkerSymbolPayload = try! JsonUtil.objectOfJson(dictionary)
141141

142142
if(!payload.assetUri.isWebUrl()) {
143+
if !payload.assetUri.lowercased().hasSuffix(".png") {
144+
throw ParseException(message: "Local assetUri must have type .png. Got \(payload.assetUri)")
145+
}
143146
let uiImage = getFlutterUiImage(payload.assetUri)
144147
let symbol = PictureMarkerSymbol(image: uiImage!)
145148
symbol.width = payload.width

arcgis_map_sdk_platform_interface/lib/src/types/symbol.dart

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,7 @@ class PictureMarkerSymbol extends Symbol {
9797
required this.height,
9898
this.xOffset = 0,
9999
this.yOffset = 0,
100-
}) : assert(
101-
assertLocalAssetIsPng(assetUri),
102-
"Local assetUri must have type .png. Got $assetUri.",
103-
);
100+
});
104101

105102
/// Add a [assetUri] of an image to display it as a marker in the whole feature layer
106103
/// This can be a url or a local path in which the image is stored locally.
@@ -111,13 +108,6 @@ class PictureMarkerSymbol extends Symbol {
111108
final double height;
112109
final int xOffset;
113110
final int yOffset;
114-
115-
static bool assertLocalAssetIsPng(String assetUri) {
116-
if (assetUri.startsWith("https://") || assetUri.startsWith("http://")) {
117-
return true;
118-
}
119-
return assetUri.endsWith(".png");
120-
}
121111
}
122112

123113
/// Set the [fillColor] and other attributes of the polygon displayed in the map
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/* This override is used to disable the blue border shown when interacting with the map*/
2+
/* According to https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-4-remove-blue-frame-outline-around/td-p/311767 */
23
@import"../arcgis_js_api_custom_build/assets/esri/css/main.css";
3-
body .esri-view .esri-view-surface--inset-outline:focus::after {outline: none !important;}
4+
body .esri-view .esri-view-surface--touch-none:focus::after { outline: none !important;}

0 commit comments

Comments
 (0)