Skip to content

Commit

Permalink
feat!: Remove android and maplibre native specific options for the us…
Browse files Browse the repository at this point in the history
…er interface. (#141)

- [X] Remove android and maplibre native specific options

Closes a task of #113

---------

Co-authored-by: Joscha <[email protected]>
  • Loading branch information
gabbopalma and josxha authored Nov 14, 2024
1 parent d2deb99 commit aba6de7
Show file tree
Hide file tree
Showing 16 changed files with 15 additions and 244 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ class MapLibreMapController(
val options =
MapLibreMapOptions
.createFromAttributes(context)
.attributionEnabled(mapOptions.attribution)
.logoEnabled(mapOptions.logo)
.attributionEnabled(false)
.logoEnabled(false)
// TODO: textureMode comes at a significant performance penalty, https://maplibre.org/maplibre-native/android/api/-map-libre%20-native%20-android/org.maplibre.android.maps/-map-libre-map-options/texture-mode.html
.textureMode(mapOptions.androidTextureMode)
.compassEnabled(mapOptions.compass)
.compassEnabled(false)
.minZoomPreference(mapOptions.minZoom)
.maxZoomPreference(mapOptions.maxZoom)
.minPitchPreference(mapOptions.minPitch)
Expand Down
16 changes: 2 additions & 14 deletions android/src/main/kotlin/com/github/josxha/maplibre/Pigeon.g.kt
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,6 @@ data class MapOptions (
val maxPitch: Double,
/** The map gestures. */
val gestures: MapGestures,
/** Toggle the MapLibre Native compass. */
val compass: Boolean,
/** Toggle the MapLibre Native logo. */
val logo: Boolean,
/** Toggle the MapLibre Native attribution. */
val attribution: Boolean,
/** Toggle the texture mode on android. */
val androidTextureMode: Boolean
)
Expand All @@ -146,11 +140,8 @@ data class MapOptions (
val minPitch = pigeonVar_list[8] as Double
val maxPitch = pigeonVar_list[9] as Double
val gestures = pigeonVar_list[10] as MapGestures
val compass = pigeonVar_list[11] as Boolean
val logo = pigeonVar_list[12] as Boolean
val attribution = pigeonVar_list[13] as Boolean
val androidTextureMode = pigeonVar_list[14] as Boolean
return MapOptions(style, zoom, pitch, bearing, center, maxBounds, minZoom, maxZoom, minPitch, maxPitch, gestures, compass, logo, attribution, androidTextureMode)
val androidTextureMode = pigeonVar_list[11] as Boolean
return MapOptions(style, zoom, pitch, bearing, center, maxBounds, minZoom, maxZoom, minPitch, maxPitch, gestures, androidTextureMode)
}
}
fun toList(): List<Any?> {
Expand All @@ -166,9 +157,6 @@ data class MapOptions (
minPitch,
maxPitch,
gestures,
compass,
logo,
attribution,
androidTextureMode,
)
}
Expand Down
1 change: 0 additions & 1 deletion example/lib/styled_map_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class _StyledMapPageState extends State<StyledMapPage> {
initStyle: Theme.of(context).brightness == Brightness.light
? StyledMapPage.styleUrl
: StyledMapPage.styleUrlDark,
attribution: false,
),
children: const [SourceAttribution()],
),
Expand Down
3 changes: 0 additions & 3 deletions example/lib/user_interface_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ class _UserInterfacePageState extends State<UserInterfacePage> {
initStyle: Theme.of(context).brightness == Brightness.light
? StyledMapPage.styleUrl
: StyledMapPage.styleUrlDark,
attribution: false,
nativeCompass: false,
nativeLogo: false,
),
children: const [
MapScalebar(),
Expand Down
3 changes: 0 additions & 3 deletions example/lib/widget_layer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ class _WidgetLayerPageState extends State<WidgetLayerPage> {
options: MapOptions(
initZoom: 3,
initCenter: Position(0, 0),
attribution: false,
nativeCompass: false,
nativeLogo: false,
),
children: [
WidgetLayer(
Expand Down
17 changes: 1 addition & 16 deletions ios/Classes/Pigeon.g.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,6 @@ struct MapOptions {
var maxPitch: Double
/// The map gestures.
var gestures: MapGestures
/// Toggle the MapLibre Native compass.
var compass: Bool
/// Toggle the MapLibre Native logo.
var logo: Bool
/// Toggle the MapLibre Native attribution.
var attribution: Bool
/// Toggle the texture mode on android.
var androidTextureMode: Bool

Expand All @@ -147,10 +141,7 @@ struct MapOptions {
let minPitch = pigeonVar_list[8] as! Double
let maxPitch = pigeonVar_list[9] as! Double
let gestures = pigeonVar_list[10] as! MapGestures
let compass = pigeonVar_list[11] as! Bool
let logo = pigeonVar_list[12] as! Bool
let attribution = pigeonVar_list[13] as! Bool
let androidTextureMode = pigeonVar_list[14] as! Bool
let androidTextureMode = pigeonVar_list[11] as! Bool

return MapOptions(
style: style,
Expand All @@ -164,9 +155,6 @@ struct MapOptions {
minPitch: minPitch,
maxPitch: maxPitch,
gestures: gestures,
compass: compass,
logo: logo,
attribution: attribution,
androidTextureMode: androidTextureMode
)
}
Expand All @@ -183,9 +171,6 @@ struct MapOptions {
minPitch,
maxPitch,
gestures,
compass,
logo,
attribution,
androidTextureMode,
]
}
Expand Down
12 changes: 0 additions & 12 deletions lib/src/map_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ class MapOptions {
this.maxPitch = 60,
this.maxBounds,
this.gestures = const MapGestures.all(),
this.nativeCompass = true,
this.nativeLogo = true,
this.attribution = true,
this.androidTextureMode = true,
this.androidMode = AndroidPlatformViewMode.tlhc_vd,
}) : initPitch = pitch ?? initPitch;
Expand Down Expand Up @@ -79,15 +76,6 @@ class MapOptions {
/// Enable and disable some or all map gestures.
final MapGestures gestures;

/// Toggle the MapLibre Native compass.
final bool nativeCompass;

/// Toggle the MapLibre Native logo.
final bool nativeLogo;

/// Toggle the MapLibre Native logo.
final bool attribution;

/// The platform view type used on android.
///
/// https://docs.flutter.dev/platform-integration/android/platform-views
Expand Down
3 changes: 0 additions & 3 deletions lib/src/platform/android/widget_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,6 @@ final class MapLibreMapStateAndroid extends MapLibreMapState
zoom: _options.gestures.zoom,
tilt: _options.gestures.pitch,
),
compass: _options.nativeCompass,
logo: _options.nativeLogo,
attribution: _options.attribution,
androidTextureMode: _options.androidTextureMode,
);

Expand Down
20 changes: 1 addition & 19 deletions lib/src/platform/pigeon.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ class MapOptions {
required this.minPitch,
required this.maxPitch,
required this.gestures,
required this.compass,
required this.logo,
required this.attribution,
required this.androidTextureMode,
});

Expand Down Expand Up @@ -113,15 +110,6 @@ class MapOptions {
/// The map gestures.
MapGestures gestures;

/// Toggle the MapLibre Native compass.
bool compass;

/// Toggle the MapLibre Native logo.
bool logo;

/// Toggle the MapLibre Native attribution.
bool attribution;

/// Toggle the texture mode on android.
bool androidTextureMode;

Expand All @@ -138,9 +126,6 @@ class MapOptions {
minPitch,
maxPitch,
gestures,
compass,
logo,
attribution,
androidTextureMode,
];
}
Expand All @@ -159,10 +144,7 @@ class MapOptions {
minPitch: result[8]! as double,
maxPitch: result[9]! as double,
gestures: result[10]! as MapGestures,
compass: result[11]! as bool,
logo: result[12]! as bool,
attribution: result[13]! as bool,
androidTextureMode: result[14]! as bool,
androidTextureMode: result[11]! as bool,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/platform/web/widget_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ final class MapLibreMapStateWeb extends MapLibreMapState {
center: options.initCenter?.toLngLat(),
bearing: options.initBearing,
pitch: options.initPitch,
attributionControl: options.attribution,
attributionControl: false,
),
);

Expand Down
36 changes: 3 additions & 33 deletions linux/pigeon.g.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ struct _MaplibreMapOptions {
double min_pitch;
double max_pitch;
MaplibreMapGestures* gestures;
gboolean compass;
gboolean logo;
gboolean attribution;
gboolean android_texture_mode;
};

Expand All @@ -41,7 +38,7 @@ static void maplibre_map_options_class_init(MaplibreMapOptionsClass* klass) {
G_OBJECT_CLASS(klass)->dispose = maplibre_map_options_dispose;
}

MaplibreMapOptions* maplibre_map_options_new(const gchar* style, double zoom, double pitch, double bearing, MaplibreLngLat* center, MaplibreLngLatBounds* max_bounds, double min_zoom, double max_zoom, double min_pitch, double max_pitch, MaplibreMapGestures* gestures, gboolean compass, gboolean logo, gboolean attribution, gboolean android_texture_mode) {
MaplibreMapOptions* maplibre_map_options_new(const gchar* style, double zoom, double pitch, double bearing, MaplibreLngLat* center, MaplibreLngLatBounds* max_bounds, double min_zoom, double max_zoom, double min_pitch, double max_pitch, MaplibreMapGestures* gestures, gboolean android_texture_mode) {
MaplibreMapOptions* self = MAPLIBRE_MAP_OPTIONS(g_object_new(maplibre_map_options_get_type(), nullptr));
self->style = g_strdup(style);
self->zoom = zoom;
Expand All @@ -64,9 +61,6 @@ MaplibreMapOptions* maplibre_map_options_new(const gchar* style, double zoom, do
self->min_pitch = min_pitch;
self->max_pitch = max_pitch;
self->gestures = MAPLIBRE_MAP_GESTURES(g_object_ref(gestures));
self->compass = compass;
self->logo = logo;
self->attribution = attribution;
self->android_texture_mode = android_texture_mode;
return self;
}
Expand Down Expand Up @@ -126,21 +120,6 @@ MaplibreMapGestures* maplibre_map_options_get_gestures(MaplibreMapOptions* self)
return self->gestures;
}

gboolean maplibre_map_options_get_compass(MaplibreMapOptions* self) {
g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), FALSE);
return self->compass;
}

gboolean maplibre_map_options_get_logo(MaplibreMapOptions* self) {
g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), FALSE);
return self->logo;
}

gboolean maplibre_map_options_get_attribution(MaplibreMapOptions* self) {
g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), FALSE);
return self->attribution;
}

gboolean maplibre_map_options_get_android_texture_mode(MaplibreMapOptions* self) {
g_return_val_if_fail(MAPLIBRE_IS_MAP_OPTIONS(self), FALSE);
return self->android_texture_mode;
Expand All @@ -159,9 +138,6 @@ static FlValue* maplibre_map_options_to_list(MaplibreMapOptions* self) {
fl_value_append_take(values, fl_value_new_float(self->min_pitch));
fl_value_append_take(values, fl_value_new_float(self->max_pitch));
fl_value_append_take(values, fl_value_new_custom_object(133, G_OBJECT(self->gestures)));
fl_value_append_take(values, fl_value_new_bool(self->compass));
fl_value_append_take(values, fl_value_new_bool(self->logo));
fl_value_append_take(values, fl_value_new_bool(self->attribution));
fl_value_append_take(values, fl_value_new_bool(self->android_texture_mode));
return values;
}
Expand Down Expand Up @@ -196,14 +172,8 @@ static MaplibreMapOptions* maplibre_map_options_new_from_list(FlValue* values) {
FlValue* value10 = fl_value_get_list_value(values, 10);
MaplibreMapGestures* gestures = MAPLIBRE_MAP_GESTURES(fl_value_get_custom_value_object(value10));
FlValue* value11 = fl_value_get_list_value(values, 11);
gboolean compass = fl_value_get_bool(value11);
FlValue* value12 = fl_value_get_list_value(values, 12);
gboolean logo = fl_value_get_bool(value12);
FlValue* value13 = fl_value_get_list_value(values, 13);
gboolean attribution = fl_value_get_bool(value13);
FlValue* value14 = fl_value_get_list_value(values, 14);
gboolean android_texture_mode = fl_value_get_bool(value14);
return maplibre_map_options_new(style, zoom, pitch, bearing, center, max_bounds, min_zoom, max_zoom, min_pitch, max_pitch, gestures, compass, logo, attribution, android_texture_mode);
gboolean android_texture_mode = fl_value_get_bool(value11);
return maplibre_map_options_new(style, zoom, pitch, bearing, center, max_bounds, min_zoom, max_zoom, min_pitch, max_pitch, gestures, android_texture_mode);
}

struct _MaplibreMapGestures {
Expand Down
35 changes: 1 addition & 34 deletions linux/pigeon.g.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,13 @@ G_DECLARE_FINAL_TYPE(MaplibreMapOptions, maplibre_map_options, MAPLIBRE, MAP_OPT
* min_pitch: field in this object.
* max_pitch: field in this object.
* gestures: field in this object.
* compass: field in this object.
* logo: field in this object.
* attribution: field in this object.
* android_texture_mode: field in this object.
*
* Creates a new #MapOptions object.
*
* Returns: a new #MaplibreMapOptions
*/
MaplibreMapOptions* maplibre_map_options_new(const gchar* style, double zoom, double pitch, double bearing, MaplibreLngLat* center, MaplibreLngLatBounds* max_bounds, double min_zoom, double max_zoom, double min_pitch, double max_pitch, MaplibreMapGestures* gestures, gboolean compass, gboolean logo, gboolean attribution, gboolean android_texture_mode);
MaplibreMapOptions* maplibre_map_options_new(const gchar* style, double zoom, double pitch, double bearing, MaplibreLngLat* center, MaplibreLngLatBounds* max_bounds, double min_zoom, double max_zoom, double min_pitch, double max_pitch, MaplibreMapGestures* gestures, gboolean android_texture_mode);

/**
* maplibre_map_options_get_style
Expand Down Expand Up @@ -199,36 +196,6 @@ double maplibre_map_options_get_max_pitch(MaplibreMapOptions* object);
*/
MaplibreMapGestures* maplibre_map_options_get_gestures(MaplibreMapOptions* object);

/**
* maplibre_map_options_get_compass
* @object: a #MaplibreMapOptions.
*
* Toggle the MapLibre Native compass.
*
* Returns: the field value.
*/
gboolean maplibre_map_options_get_compass(MaplibreMapOptions* object);

/**
* maplibre_map_options_get_logo
* @object: a #MaplibreMapOptions.
*
* Toggle the MapLibre Native logo.
*
* Returns: the field value.
*/
gboolean maplibre_map_options_get_logo(MaplibreMapOptions* object);

/**
* maplibre_map_options_get_attribution
* @object: a #MaplibreMapOptions.
*
* Toggle the MapLibre Native attribution.
*
* Returns: the field value.
*/
gboolean maplibre_map_options_get_attribution(MaplibreMapOptions* object);

/**
* maplibre_map_options_get_android_texture_mode
* @object: a #MaplibreMapOptions.
Expand Down
17 changes: 1 addition & 16 deletions macos/Classes/Pigeon.g.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,6 @@ struct MapOptions {
var maxPitch: Double
/// The map gestures.
var gestures: MapGestures
/// Toggle the MapLibre Native compass.
var compass: Bool
/// Toggle the MapLibre Native logo.
var logo: Bool
/// Toggle the MapLibre Native attribution.
var attribution: Bool
/// Toggle the texture mode on android.
var androidTextureMode: Bool

Expand All @@ -147,10 +141,7 @@ struct MapOptions {
let minPitch = pigeonVar_list[8] as! Double
let maxPitch = pigeonVar_list[9] as! Double
let gestures = pigeonVar_list[10] as! MapGestures
let compass = pigeonVar_list[11] as! Bool
let logo = pigeonVar_list[12] as! Bool
let attribution = pigeonVar_list[13] as! Bool
let androidTextureMode = pigeonVar_list[14] as! Bool
let androidTextureMode = pigeonVar_list[11] as! Bool

return MapOptions(
style: style,
Expand All @@ -164,9 +155,6 @@ struct MapOptions {
minPitch: minPitch,
maxPitch: maxPitch,
gestures: gestures,
compass: compass,
logo: logo,
attribution: attribution,
androidTextureMode: androidTextureMode
)
}
Expand All @@ -183,9 +171,6 @@ struct MapOptions {
minPitch,
maxPitch,
gestures,
compass,
logo,
attribution,
androidTextureMode,
]
}
Expand Down
Loading

0 comments on commit aba6de7

Please sign in to comment.