removed huawei flavor

This commit is contained in:
Thibault Deckers 2024-07-09 23:54:10 +02:00
parent 5577657eee
commit eb9a001919
23 changed files with 6 additions and 953 deletions

View file

@ -49,9 +49,6 @@ jobs:
cp build/app/outputs/bundle/playRelease/*.aab outputs
./flutterw build apk -t lib/main_play.dart --flavor play --bundle-sksl-path shaders.sksl.json
cp build/app/outputs/apk/play/release/*.apk outputs
scripts/apply_flavor_huawei.sh
./flutterw build apk -t lib/main_huawei.dart --flavor huawei --bundle-sksl-path shaders.sksl.json
cp build/app/outputs/apk/huawei/release/*.apk outputs
scripts/apply_flavor_izzy.sh
./flutterw build apk -t lib/main_izzy.dart --flavor izzy --split-per-abi
cp build/app/outputs/apk/izzy/release/*.apk outputs
@ -65,7 +62,6 @@ jobs:
AVES_KEY_ALIAS: ${{ secrets.AVES_KEY_ALIAS }}
AVES_KEY_PASSWORD: ${{ secrets.AVES_KEY_PASSWORD }}
AVES_GOOGLE_API_KEY: ${{ secrets.AVES_GOOGLE_API_KEY }}
AVES_HUAWEI_API_KEY: ${{ secrets.AVES_HUAWEI_API_KEY }}
- name: Create a release with the APK and App Bundle.
uses: ncipollo/release-action@v1

View file

@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
## <a id="unreleased"></a>[Unreleased]
### Removed
- `huawei` app flavor
## <a id="v1.11.4"></a>[v1.11.4] - 2024-07-09
### Added

View file

@ -40,7 +40,6 @@ if (keystorePropertiesFile.exists()) {
keystoreProperties["keyAlias"] = System.getenv("AVES_KEY_ALIAS") ?: "<NONE>"
keystoreProperties["keyPassword"] = System.getenv("AVES_KEY_PASSWORD") ?: "<NONE>"
keystoreProperties["googleApiKey"] = System.getenv("AVES_GOOGLE_API_KEY") ?: "<NONE>"
keystoreProperties["huaweiApiKey"] = System.getenv("AVES_HUAWEI_API_KEY") ?: "<NONE>"
}
android {
@ -70,8 +69,7 @@ android {
targetSdk 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
manifestPlaceholders = [googleApiKey: keystoreProperties["googleApiKey"] ?: "<NONE>",
huaweiApiKey: keystoreProperties["huaweiApiKey"] ?: "<NONE>"]
manifestPlaceholders = [googleApiKey: keystoreProperties["googleApiKey"] ?: "<NONE>"]
multiDexEnabled true
}
@ -94,13 +92,6 @@ android {
ext.useNdkAbiFilters = true
}
huawei {
// Huawei AppGallery
dimension "store"
// generate a universal APK without x86 native libs
ext.useNdkAbiFilters = true
}
izzy {
// IzzyOnDroid
// check offending libraries with `scanapk`
@ -221,9 +212,6 @@ dependencies {
implementation 'com.github.deckerst.mp4parser:muxer:4cc0c5d06c'
implementation 'com.github.deckerst:pixymeta-android:9ec7097f17'
// huawei flavor only
huaweiImplementation "com.huawei.agconnect:agconnect-core:$huawei_agconnect_version"
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
kapt 'androidx.annotation:annotation:1.8.0'
@ -237,8 +225,3 @@ if (useCrashlytics) {
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
}
if (useHms) {
println("Building flavor with HMS plugin")
apply plugin: 'com.huawei.agconnect'
}

View file

@ -313,9 +313,6 @@
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${googleApiKey}" />
<meta-data
android:name="deckers.thibault.aves.huawei.API_KEY"
android:value="${huaweiApiKey}" />
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />

View file

@ -1,38 +1,21 @@
buildscript {
ext {
agp_version = '8.5.0' // same as `settings.ext.agp_version` in `/android/settings.gradle`
glide_version = '4.16.0'
// AppGallery Connect plugin versions: https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-sdk-changenotes-0000001058732550
huawei_agconnect_version = '1.9.1.300'
abiCodes = ['armeabi-v7a': 1, 'arm64-v8a': 2, 'x86': 3, 'x86_64': 4]
useCrashlytics = gradle.startParameter.taskNames.any { task -> task.containsIgnoreCase("play") }
useHms = gradle.startParameter.taskNames.any { task -> task.containsIgnoreCase("huawei") }
}
repositories {
google()
mavenCentral()
if (useHms) {
// HMS (used by some flavors only)
maven { url 'https://developer.huawei.com/repo/' }
}
}
dependencies {
// necessary when applying plugin `com.huawei.agconnect`
classpath "com.android.tools.build:gradle:$agp_version"
if (useCrashlytics) {
// GMS & Firebase Crashlytics (used by some flavors only)
classpath 'com.google.gms:google-services:4.4.1'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
}
if (useHms) {
// HMS (used by some flavors only)
classpath "com.huawei.agconnect:agcp:$huawei_agconnect_version"
}
}
}
@ -40,11 +23,6 @@ allprojects {
repositories {
google()
mavenCentral()
if (useHms) {
// HMS (used by some flavors only)
maven { url 'https://developer.huawei.com/repo/' }
}
}
// gradle.projectsEvaluated {

View file

@ -20,7 +20,3 @@ android.nonFinalResIds=false
# full mode is too aggressive and removes essential code
# of `metadata-extractor` even when adding `-keep class com.drew.**{ *; }`
android.enableR8.fullMode=false
# fix for AppGallery Connect plugin which does not support yet Gradle 8
# cf https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-common-faq-0000001063210244#section17273113244910
apmsInstrumentationEnabled=false

View file

@ -3,4 +3,3 @@ storePassword=<KEYSTORE_PASSWORD>
keyAlias=<KEY_ALIAS>
keyPassword=<KEY_PASSWORD>
googleApiKey=<GOOGLE_API_KEY>
huaweiApiKey=<HUAWEI_API_KEY>

View file

@ -1,11 +1,10 @@
enum AppFlavor { play, huawei, izzy, libre }
enum AppFlavor { play, izzy, libre }
extension ExtraAppFlavor on AppFlavor {
bool get canEnableErrorReporting {
switch (this) {
case AppFlavor.play:
return true;
case AppFlavor.huawei:
case AppFlavor.izzy:
case AppFlavor.libre:
return false;
@ -15,7 +14,6 @@ extension ExtraAppFlavor on AppFlavor {
bool get hasMapStyleDefault {
switch (this) {
case AppFlavor.play:
case AppFlavor.huawei:
return true;
case AppFlavor.izzy:
case AppFlavor.libre:

View file

@ -238,8 +238,6 @@
"mapStyleGoogleNormal": "Google Maps",
"mapStyleGoogleHybrid": "Google Maps (Hybrid)",
"mapStyleGoogleTerrain": "Google Maps (Terrain)",
"mapStyleHuaweiNormal": "Petal Maps",
"mapStyleHuaweiTerrain": "Petal Maps (Terrain)",
"mapStyleOsmHot": "Humanitarian OSM",
"mapStyleStamenWatercolor": "Stamen Watercolor",

View file

@ -1,11 +0,0 @@
import 'package:aves/app_flavor.dart';
import 'package:aves/main_common.dart';
import 'package:aves/widget_common.dart';
const _flavor = AppFlavor.huawei;
@pragma('vm:entry-point')
void main() => mainCommon(_flavor);
@pragma('vm:entry-point')
void widgetMain() => widgetMainCommon(_flavor);

View file

@ -169,19 +169,6 @@ class Dependencies {
),
];
static const List<Dependency> _huaweiMobileServices = [
Dependency(
name: 'Huawei Mobile Services (Availability, Map)',
license: apache2,
licenseUrl: 'https://github.com/HMS-Core/hms-flutter-plugin/blob/master/LICENCE',
sourceUrl: 'https://github.com/HMS-Core/hms-flutter-plugin',
),
];
static const List<Dependency> _flutterPluginsHuaweiOnly = [
..._huaweiMobileServices,
];
static const List<Dependency> _flutterPluginsIzzyOnly = [
..._googleMobileServices,
];
@ -199,7 +186,6 @@ class Dependencies {
static List<Dependency> flutterPlugins(AppFlavor flavor) => [
..._flutterPluginsCommon,
if (flavor == AppFlavor.huawei) ..._flutterPluginsHuaweiOnly,
if (flavor == AppFlavor.izzy) ..._flutterPluginsIzzyOnly,
if (flavor == AppFlavor.libre) ..._flutterPluginsLibreOnly,
if (flavor == AppFlavor.play) ..._flutterPluginsPlayOnly,

View file

@ -6,8 +6,6 @@ extension ExtraEntryMapStyle on EntryMapStyle {
case EntryMapStyle.googleNormal:
case EntryMapStyle.googleHybrid:
case EntryMapStyle.googleTerrain:
case EntryMapStyle.hmsNormal:
case EntryMapStyle.hmsTerrain:
return true;
default:
return false;

View file

@ -68,8 +68,6 @@ extension ExtraEntryMapStyleView on EntryMapStyle {
EntryMapStyle.googleNormal => l10n.mapStyleGoogleNormal,
EntryMapStyle.googleHybrid => l10n.mapStyleGoogleHybrid,
EntryMapStyle.googleTerrain => l10n.mapStyleGoogleTerrain,
EntryMapStyle.hmsNormal => l10n.mapStyleHuaweiNormal,
EntryMapStyle.hmsTerrain => l10n.mapStyleHuaweiTerrain,
EntryMapStyle.osmHot => l10n.mapStyleOsmHot,
EntryMapStyle.stamenWatercolor => l10n.mapStyleStamenWatercolor,
};

View file

@ -167,8 +167,6 @@ class _GeoMapState extends State<GeoMap> {
case EntryMapStyle.googleNormal:
case EntryMapStyle.googleHybrid:
case EntryMapStyle.googleTerrain:
case EntryMapStyle.hmsNormal:
case EntryMapStyle.hmsTerrain:
child = mobileServices.buildMap<AvesEntry>(
controller: controller,
clusterListenable: _clusterChangeNotifier,

View file

@ -3,9 +3,6 @@ enum EntryMapStyle {
googleNormal,
googleHybrid,
googleTerrain,
// Huawei
hmsNormal,
hmsTerrain,
// Leaflet
// browse providers at https://leaflet-extras.github.io/leaflet-providers/preview/
osmHot,

View file

@ -1,30 +0,0 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
#/pubspec.lock
**/doc/api/
.dart_tool/
.packages
build/

View file

@ -1,10 +0,0 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: 5464c5bac742001448fe4fc0597be939379f88ea
channel: stable
project_type: package

View file

@ -1 +0,0 @@
include: ../../analysis_options.yaml

View file

@ -1,89 +0,0 @@
library aves_services_platform;
import 'package:aves_map/aves_map.dart';
import 'package:aves_platform_meta/aves_platform_meta_platform_interface.dart';
import 'package:aves_services/aves_services.dart';
import 'package:aves_services_platform/src/map.dart';
import 'package:flutter/widgets.dart';
import 'package:huawei_hmsavailability/huawei_hmsavailability.dart';
import 'package:huawei_map/huawei_map.dart' as hmap;
import 'package:latlong2/latlong.dart';
class PlatformMobileServices extends MobileServices {
// cf https://developer.huawei.com/consumer/en/doc/development/hmscore-common-References/huaweiapiavailability-0000001050121134#section9492524178
static const int _hmsCoreAvailable = 0;
static const manifestApiKey = 'deckers.thibault.aves.huawei.API_KEY';
bool _isAvailable = false;
@override
Future<void> init() async {
try {
final result = await HmsApiAvailability().isHMSAvailable();
_isAvailable = result == _hmsCoreAvailable;
} on Exception catch (e, stack) {
debugPrint('Failed to check services availability with exception=$e, stack=$stack');
}
debugPrint('Device has Huawei Mobile Services=$_isAvailable');
final apiKey = await AvesPlatformMetaPlatform.instance.getMetadata(manifestApiKey);
hmap.HuaweiMapInitializer.setApiKey(apiKey: apiKey ?? '');
hmap.HuaweiMapInitializer.initializeMap();
}
@override
bool get isServiceAvailable => _isAvailable;
@override
EntryMapStyle get defaultMapStyle => EntryMapStyle.hmsNormal;
@override
List<EntryMapStyle> get mapStyles => isServiceAvailable
? [
EntryMapStyle.hmsNormal,
EntryMapStyle.hmsTerrain,
]
: [];
@override
Widget buildMap<T>({
required AvesMapController? controller,
required Listenable clusterListenable,
required ValueNotifier<ZoomedBounds> boundsNotifier,
required EntryMapStyle style,
required TransitionBuilder decoratorBuilder,
required ButtonPanelBuilder buttonPanelBuilder,
required MarkerClusterBuilder<T> markerClusterBuilder,
required MarkerWidgetBuilder<T> markerWidgetBuilder,
required MarkerImageReadyChecker<T> markerImageReadyChecker,
required ValueNotifier<LatLng?>? dotLocationNotifier,
required ValueNotifier<double>? overlayOpacityNotifier,
required MapOverlay? overlayEntry,
required UserZoomChangeCallback? onUserZoomChange,
required MapTapCallback? onMapTap,
required MarkerTapCallback<T>? onMarkerTap,
required MarkerLongPressCallback<T>? onMarkerLongPress,
}) {
return EntryHmsMap<T>(
controller: controller,
clusterListenable: clusterListenable,
boundsNotifier: boundsNotifier,
minZoom: 3,
maxZoom: 20,
style: style,
decoratorBuilder: decoratorBuilder,
buttonPanelBuilder: buttonPanelBuilder,
markerClusterBuilder: markerClusterBuilder,
markerWidgetBuilder: markerWidgetBuilder,
markerImageReadyChecker: markerImageReadyChecker,
dotLocationNotifier: dotLocationNotifier,
overlayOpacityNotifier: overlayOpacityNotifier,
overlayEntry: overlayEntry,
onUserZoomChange: onUserZoomChange,
onMapTap: onMapTap,
onMarkerTap: onMarkerTap,
onMarkerLongPress: onMarkerLongPress,
);
}
}

View file

@ -1,341 +0,0 @@
import 'dart:async';
import 'dart:typed_data';
import 'package:aves_map/aves_map.dart';
import 'package:aves_utils/aves_utils.dart';
import 'package:flutter/material.dart';
import 'package:huawei_map/huawei_map.dart';
import 'package:latlong2/latlong.dart' as ll;
import 'package:provider/provider.dart';
class EntryHmsMap<T> extends StatefulWidget {
final AvesMapController? controller;
final Listenable clusterListenable;
final ValueNotifier<ZoomedBounds> boundsNotifier;
final double? minZoom, maxZoom;
final EntryMapStyle style;
final TransitionBuilder decoratorBuilder;
final ButtonPanelBuilder buttonPanelBuilder;
final MarkerClusterBuilder<T> markerClusterBuilder;
final MarkerWidgetBuilder<T> markerWidgetBuilder;
final MarkerImageReadyChecker<T> markerImageReadyChecker;
final ValueNotifier<ll.LatLng?>? dotLocationNotifier;
final ValueNotifier<double>? overlayOpacityNotifier;
final MapOverlay? overlayEntry;
final UserZoomChangeCallback? onUserZoomChange;
final MapTapCallback? onMapTap;
final MarkerTapCallback<T>? onMarkerTap;
final MarkerLongPressCallback<T>? onMarkerLongPress;
const EntryHmsMap({
super.key,
this.controller,
required this.clusterListenable,
required this.boundsNotifier,
this.minZoom,
this.maxZoom,
required this.style,
required this.decoratorBuilder,
required this.buttonPanelBuilder,
required this.markerClusterBuilder,
required this.markerWidgetBuilder,
required this.markerImageReadyChecker,
required this.dotLocationNotifier,
this.overlayOpacityNotifier,
this.overlayEntry,
this.onUserZoomChange,
this.onMapTap,
this.onMarkerTap,
this.onMarkerLongPress,
});
@override
State<StatefulWidget> createState() => _EntryHmsMapState<T>();
}
class _EntryHmsMapState<T> extends State<EntryHmsMap<T>> {
HuaweiMapController? _serviceMapController;
final List<StreamSubscription> _subscriptions = [];
Map<MarkerKey<T>, GeoEntry<T>> _geoEntryByMarkerKey = {};
final Map<MarkerKey<T>, Uint8List> _markerBitmaps = {};
final StreamController<MarkerKey<T>> _markerBitmapReadyStreamController = StreamController.broadcast();
Uint8List? _dotMarkerBitmap;
ValueNotifier<ZoomedBounds> get boundsNotifier => widget.boundsNotifier;
ZoomedBounds get bounds => boundsNotifier.value;
static const uninitializedLatLng = LatLng(0, 0);
@override
void initState() {
super.initState();
_registerWidget(widget);
}
@override
void didUpdateWidget(covariant EntryHmsMap<T> oldWidget) {
super.didUpdateWidget(oldWidget);
_unregisterWidget(oldWidget);
_registerWidget(widget);
}
@override
void dispose() {
_unregisterWidget(widget);
super.dispose();
}
void _registerWidget(EntryHmsMap<T> widget) {
final avesMapController = widget.controller;
if (avesMapController != null) {
_subscriptions.add(avesMapController.moveCommands.listen((event) => _moveTo(_toServiceLatLng(event.latLng))));
_subscriptions.add(avesMapController.zoomCommands.listen((event) => _zoomBy(event.delta)));
}
widget.clusterListenable.addListener(_updateMarkers);
}
void _unregisterWidget(EntryHmsMap<T> widget) {
widget.clusterListenable.removeListener(_updateMarkers);
_subscriptions
..forEach((sub) => sub.cancel())
..clear();
}
@override
Widget build(BuildContext context) {
return Stack(
children: [
MarkerGeneratorWidget<Key>(
markers: const [DotMarker(key: Key('dot'))],
isReadyToRender: (key) => true,
onRendered: (key, bitmap) => _dotMarkerBitmap = bitmap,
),
MarkerGeneratorWidget<MarkerKey<T>>(
markers: _geoEntryByMarkerKey.keys.map(widget.markerWidgetBuilder).toList(),
isReadyToRender: widget.markerImageReadyChecker,
onRendered: (key, bitmap) {
_markerBitmaps[key] = bitmap;
_markerBitmapReadyStreamController.add(key);
},
),
widget.decoratorBuilder(context, _buildMap()),
widget.buttonPanelBuilder(_resetRotation),
],
);
}
Widget _buildMap() {
final _onMarkerLongPress = widget.onMarkerLongPress;
return StreamBuilder(
stream: _markerBitmapReadyStreamController.stream,
builder: (context, _) {
final markers = <Marker>{};
_geoEntryByMarkerKey.forEach((markerKey, geoEntry) {
final bytes = _markerBitmaps[markerKey];
if (bytes != null) {
final point = LatLng(geoEntry.latitude!, geoEntry.longitude!);
markers.add(Marker(
markerId: MarkerId(geoEntry.markerId!),
clickable: true,
icon: BitmapDescriptor.fromBytes(bytes),
position: point,
onClick: () => widget.onMarkerTap?.call(geoEntry),
));
}
});
final interactive = context.select<MapThemeData, bool>((v) => v.interactive);
// final overlayEntry = widget.overlayEntry;
return NullableValueListenableBuilder<ll.LatLng?>(
valueListenable: widget.dotLocationNotifier,
builder: (context, dotLocation, child) {
return NullableValueListenableBuilder<double>(
valueListenable: widget.overlayOpacityNotifier,
builder: (context, value, child) {
// final double overlayOpacity = value ?? 1.0;
return HuaweiMap(
initialCameraPosition: CameraPosition(
bearing: bounds.rotation,
target: _toServiceLatLng(bounds.projectedCenter),
zoom: bounds.zoom,
),
mapType: _toMapType(widget.style),
// compass disabled to use provider agnostic controls
compassEnabled: false,
mapToolbarEnabled: false,
minMaxZoomPreference: MinMaxZoomPreference(
widget.minZoom ?? MinMaxZoomPreference.unbounded.minZoom,
widget.maxZoom ?? MinMaxZoomPreference.unbounded.maxZoom,
),
// `allGesturesEnabled`, if defined overrides specific gesture settings
rotateGesturesEnabled: interactive,
scrollGesturesEnabled: interactive,
// zoom controls disabled to use provider agnostic controls
zoomControlsEnabled: false,
zoomGesturesEnabled: interactive,
// tilt disabled to match leaflet
tiltGesturesEnabled: false,
myLocationEnabled: false,
myLocationButtonEnabled: false,
trafficEnabled: false,
isScrollGesturesEnabledDuringRotateOrZoom: true,
markers: {
...markers,
if (dotLocation != null && _dotMarkerBitmap != null)
Marker(
markerId: const MarkerId('dot'),
anchor: const Offset(.5, .5),
clickable: true,
icon: BitmapDescriptor.fromBytes(_dotMarkerBitmap!),
position: _toServiceLatLng(dotLocation),
zIndex: 1,
)
},
// TODO TLAD [hms] GeoTIFF ground overlay
// groundOverlays: {
// if (overlayEntry != null && overlayEntry.canOverlay)
// GroundOverlay(
// groundOverlayId: GroundOverlayId('overlay'),
// // Google Maps API allows defining overlay either via
// // 1) position, anchor and width/height (in meters)
// // 2) bounds
// // Huawei requires width/height (in meters?), but also allows bounds...
// width: 42,
// height: 42,
// imageDescriptor: BitmapDescriptor.defaultMarker,
// position: _toServiceLatLng(overlayEntry.center!),
// ),
// },
// TODO TLAD [hms] dynamic tile provider from current bounds,
// tileOverlays: {
// if (overlayEntry != null && overlayEntry.canOverlay)
// TileOverlay(
// tileOverlayId: TileOverlayId(overlayEntry.entry.uri),
// // `tileProvider` is `RepetitiveTile`, `UrlTile` or List<Tile>
// // tileProvider: <Tile>[
// // Tile(
// // x: x,
// // y: y,
// // zoom: zoom,
// // imageData: imageData,
// // ),
// // ],
// transparency: 1 - overlayOpacity,
// ),
// },
onMapCreated: (controller) async {
_serviceMapController = controller;
final zoom = await controller.getZoomLevel();
await _updateVisibleRegion(zoom: zoom ?? bounds.zoom, rotation: bounds.rotation);
if (mounted) {
setState(() {});
}
},
onCameraMove: (position) => _updateVisibleRegion(zoom: position.zoom, rotation: position.bearing),
onCameraIdle: _onIdle,
onClick: (v) => widget.onMapTap?.call(_fromServiceLatLng(v)),
onLongPress: _onMarkerLongPress != null
? (v) {
final pressLocation = _fromServiceLatLng(v);
final markers = _geoEntryByMarkerKey.values.toSet();
final geoEntry = ImageMarker.markerMatch(pressLocation, bounds.zoom, markers);
if (geoEntry != null) {
_onMarkerLongPress(geoEntry, pressLocation);
}
}
: null,
onPoiClick: (poi) {
final poiPosition = poi.latLng;
if (poiPosition != null) {
widget.onMapTap?.call(_fromServiceLatLng(poiPosition));
}
},
logoPadding: const EdgeInsets.all(8),
// lite mode disabled because it is not interactive
liteMode: false,
);
},
);
},
);
},
);
}
void _onIdle() {
if (!mounted) return;
widget.controller?.notifyIdle(bounds);
_updateMarkers();
}
void _updateMarkers() {
setState(() => _geoEntryByMarkerKey = widget.markerClusterBuilder());
}
Future<void> _updateVisibleRegion({required double zoom, required double rotation}) async {
if (!mounted) return;
final bounds = await _serviceMapController?.getVisibleRegion();
if (bounds != null && (bounds.northeast != uninitializedLatLng || bounds.southwest != uninitializedLatLng)) {
final sw = bounds.southwest;
final ne = bounds.northeast;
boundsNotifier.value = ZoomedBounds(
sw: _fromServiceLatLng(sw),
ne: _fromServiceLatLng(ne),
zoom: zoom,
rotation: rotation,
);
} else {
// the visible region is sometimes uninitialized when queried right after creation,
// so we query it again next frame
WidgetsBinding.instance.addPostFrameCallback((_) {
_updateVisibleRegion(zoom: zoom, rotation: rotation);
});
}
}
Future<void> _resetRotation() async {
final controller = _serviceMapController;
if (controller == null) return;
await controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(
target: _toServiceLatLng(bounds.projectedCenter),
zoom: bounds.zoom,
)));
}
Future<void> _zoomBy(double amount) async {
final controller = _serviceMapController;
if (controller == null) return;
final zoom = await controller.getZoomLevel();
if (zoom == null) return;
widget.onUserZoomChange?.call(zoom + amount);
await controller.animateCamera(CameraUpdate.zoomBy(amount));
}
Future<void> _moveTo(LatLng point) async {
final controller = _serviceMapController;
if (controller == null) return;
await controller.animateCamera(CameraUpdate.newLatLng(point));
}
// `LatLng` used by `google_maps_flutter` is not the one from `latlong2` package
LatLng _toServiceLatLng(ll.LatLng location) => LatLng(location.latitude, location.longitude);
ll.LatLng _fromServiceLatLng(LatLng location) => ll.LatLng(location.lat, location.lng);
MapType _toMapType(EntryMapStyle style) {
switch (style) {
case EntryMapStyle.hmsNormal:
return MapType.normal;
case EntryMapStyle.hmsTerrain:
return MapType.terrain;
default:
return MapType.none;
}
}
}

View file

@ -1,341 +0,0 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.dev"
source: hosted
version: "2.11.0"
aves_map:
dependency: "direct main"
description:
path: "../aves_map"
relative: true
source: path
version: "0.0.1"
aves_platform_meta:
dependency: "direct main"
description:
path: "../aves_platform_meta"
relative: true
source: path
version: "0.0.1"
aves_services:
dependency: "direct main"
description:
path: "../aves_services"
relative: true
source: path
version: "0.0.1"
aves_ui:
dependency: transitive
description:
path: "../aves_ui"
relative: true
source: path
version: "0.0.1"
aves_utils:
dependency: "direct main"
description:
path: "../aves_utils"
relative: true
source: path
version: "0.0.1"
characters:
dependency: transitive
description:
name: characters
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
clock:
dependency: transitive
description:
name: clock
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
url: "https://pub.dev"
source: hosted
version: "1.1.1"
collection:
dependency: transitive
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.18.0"
custom_rounded_rectangle_border:
dependency: transitive
description:
name: custom_rounded_rectangle_border
sha256: "3e8ca0c26b8d22d5d3842bab59dfd209995f8e42af7c2eef03da70642c040819"
url: "https://pub.dev"
source: hosted
version: "0.3.0"
dart_earcut:
dependency: transitive
description:
name: dart_earcut
sha256: "41b493147e30a051efb2da1e3acb7f38fe0db60afba24ac1ea5684cee272721e"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
equatable:
dependency: transitive
description:
name: equatable
sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2
url: "https://pub.dev"
source: hosted
version: "2.0.5"
fluster:
dependency: transitive
description:
name: fluster
sha256: "3807f5d088b7798f0416b8578498046338af98bb4fb922a70e2810b8293963f6"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
flutter_map:
dependency: transitive
description:
name: flutter_map
sha256: "2ecb34619a4be19df6f40c2f8dce1591675b4eff7a6857bd8f533706977385da"
url: "https://pub.dev"
source: hosted
version: "7.0.2"
http:
dependency: transitive
description:
name: http
sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
url: "https://pub.dev"
source: hosted
version: "1.2.1"
http_parser:
dependency: transitive
description:
name: http_parser
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
url: "https://pub.dev"
source: hosted
version: "4.0.2"
huawei_hmsavailability:
dependency: "direct main"
description:
path: flutter-hms-availability
ref: agp8-compat
resolved-ref: "031b7aa2553dfb71c2791c918f535b5d4e6a82be"
url: "https://github.com/deckerst/hms-flutter-plugin.git"
source: git
version: "6.6.0+300"
huawei_map:
dependency: "direct main"
description:
path: flutter-hms-map
ref: agp8-compat
resolved-ref: "031b7aa2553dfb71c2791c918f535b5d4e6a82be"
url: "https://github.com/deckerst/hms-flutter-plugin.git"
source: git
version: "6.11.0+304"
intl:
dependency: transitive
description:
name: intl
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
url: "https://pub.dev"
source: hosted
version: "0.19.0"
latlong2:
dependency: "direct main"
description:
name: latlong2
sha256: "98227922caf49e6056f91b6c56945ea1c7b166f28ffcd5fb8e72fc0b453cc8fe"
url: "https://pub.dev"
source: hosted
version: "0.9.1"
lints:
dependency: transitive
description:
name: lints
sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
lists:
dependency: transitive
description:
name: lists
sha256: "4ca5c19ae4350de036a7e996cdd1ee39c93ac0a2b840f4915459b7d0a7d4ab27"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
logger:
dependency: transitive
description:
name: logger
sha256: af05cc8714f356fd1f3888fb6741cbe9fbe25cdb6eedbab80e1a6db21047d4a4
url: "https://pub.dev"
source: hosted
version: "2.3.0"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted
version: "1.12.0"
mgrs_dart:
dependency: transitive
description:
name: mgrs_dart
sha256: fb89ae62f05fa0bb90f70c31fc870bcbcfd516c843fb554452ab3396f78586f7
url: "https://pub.dev"
source: hosted
version: "2.0.0"
nested:
dependency: transitive
description:
name: nested
sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
path:
dependency: transitive
description:
name: path
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.9.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.dev"
source: hosted
version: "2.1.8"
polylabel:
dependency: transitive
description:
name: polylabel
sha256: "41b9099afb2aa6c1730bdd8a0fab1400d287694ec7615dd8516935fa3144214b"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
proj4dart:
dependency: transitive
description:
name: proj4dart
sha256: c8a659ac9b6864aa47c171e78d41bbe6f5e1d7bd790a5814249e6b68bc44324e
url: "https://pub.dev"
source: hosted
version: "2.1.0"
provider:
dependency: "direct main"
description:
name: provider
sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c
url: "https://pub.dev"
source: hosted
version: "6.1.2"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_span:
dependency: transitive
description:
name: source_span
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev"
source: hosted
version: "1.10.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
url: "https://pub.dev"
source: hosted
version: "1.2.1"
typed_data:
dependency: transitive
description:
name: typed_data
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
url: "https://pub.dev"
source: hosted
version: "1.3.2"
unicode:
dependency: transitive
description:
name: unicode
sha256: "0f69e46593d65245774d4f17125c6084d2c20b4e473a983f6e21b7d7762218f1"
url: "https://pub.dev"
source: hosted
version: "0.3.1"
vector_math:
dependency: transitive
description:
name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.dev"
source: hosted
version: "2.1.4"
web:
dependency: transitive
description:
name: web
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
url: "https://pub.dev"
source: hosted
version: "0.5.1"
wkt_parser:
dependency: transitive
description:
name: wkt_parser
sha256: "8a555fc60de3116c00aad67891bcab20f81a958e4219cc106e3c037aa3937f13"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
sdks:
dart: ">=3.4.1 <4.0.0"
flutter: ">=3.10.0"

View file

@ -1,37 +0,0 @@
name: aves_services_platform
version: 0.0.1
publish_to: none
environment:
sdk: '>=3.4.1 <4.0.0'
dependencies:
flutter:
sdk: flutter
aves_map:
path: ../aves_map
aves_platform_meta:
path: ../aves_platform_meta
aves_services:
path: ../aves_services
aves_utils:
path: ../aves_utils
# cf https://github.com/HMS-Core/hms-flutter-plugin/pull/296
huawei_hmsavailability:
git:
url: https://github.com/deckerst/hms-flutter-plugin.git
ref: agp8-compat
path: flutter-hms-availability
# cf https://github.com/HMS-Core/hms-flutter-plugin/pull/296
huawei_map:
git:
url: https://github.com/deckerst/hms-flutter-plugin.git
ref: agp8-compat
path: flutter-hms-map
latlong2:
provider:
dev_dependencies:
flutter_lints:
flutter:

View file

@ -1,13 +0,0 @@
#!/bin/bash
if [ ! -d "scripts" ]; then
cd ..
fi
PUBSPEC_PATH="pubspec.yaml"
./flutterw clean
sed -i 's|plugins/aves_services_.*|plugins/aves_services_huawei|g' "$PUBSPEC_PATH"
sed -i 's|plugins/aves_report_.*|plugins/aves_report_console|g' "$PUBSPEC_PATH"
./flutterw pub get