huawei: api key via manifest;

upgraded Flutter to beta v3.1.0-9.0.pre
This commit is contained in:
Thibault Deckers 2022-07-10 01:00:30 +02:00
parent 5d546e67d9
commit e7f9537220
34 changed files with 594 additions and 59 deletions

View file

@ -17,8 +17,8 @@ jobs:
# Available versions may lag behind https://github.com/flutter/flutter.git
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.0.4'
channel: 'stable'
flutter-version: '3.1.0-9.0.pre'
channel: 'beta'
- name: Clone the repository.
uses: actions/checkout@v2

View file

@ -19,8 +19,8 @@ jobs:
# Available versions may lag behind https://github.com/flutter/flutter.git
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.0.4'
channel: 'stable'
flutter-version: '3.1.0-9.0.pre'
channel: 'beta'
# Workaround for this Android Gradle Plugin issue (supposedly fixed in AGP 4.1):
# https://issuetracker.google.com/issues/144111441
@ -56,15 +56,15 @@ jobs:
rm release.keystore.asc
mkdir outputs
(cd scripts/; ./apply_flavor_play.sh)
flutter build appbundle -t lib/main_play.dart --flavor play --bundle-sksl-path shaders_3.0.4.sksl.json
flutter build appbundle -t lib/main_play.dart --flavor play --bundle-sksl-path shaders_3.1.0-9.0.pre.sksl.json
cp build/app/outputs/bundle/playRelease/*.aab outputs
flutter build apk -t lib/main_play.dart --flavor play --bundle-sksl-path shaders_3.0.4.sksl.json
flutter build apk -t lib/main_play.dart --flavor play --bundle-sksl-path shaders_3.1.0-9.0.pre.sksl.json
cp build/app/outputs/apk/play/release/*.apk outputs
(cd scripts/; ./apply_flavor_huawei.sh)
flutter build apk -t lib/main_huawei.dart --flavor huawei --bundle-sksl-path shaders_3.0.4.sksl.json
flutter build apk -t lib/main_huawei.dart --flavor huawei --bundle-sksl-path shaders_3.1.0-9.0.pre.sksl.json
cp build/app/outputs/apk/huawei/release/*.apk outputs
(cd scripts/; ./apply_flavor_izzy.sh)
flutter build apk -t lib/main_izzy.dart --flavor izzy --split-per-abi --bundle-sksl-path shaders_3.0.4.sksl.json
flutter build apk -t lib/main_izzy.dart --flavor izzy --split-per-abi --bundle-sksl-path shaders_3.1.0-9.0.pre.sksl.json
cp build/app/outputs/apk/izzy/release/*.apk outputs
rm $AVES_STORE_FILE
env:

View file

@ -12,7 +12,7 @@ All notable changes to this project will be documented in this file.
### Changed
- upgraded Flutter to stable v3.0.4
- upgraded Flutter to beta v3.1.0-9.0.pre
## <a id="v1.6.9"></a>[v1.6.9] - 2022-06-18

View file

@ -5,18 +5,25 @@
"DE":"connect-dre.dbankcloud.cn",
"DE_back":"connect-dre.hispace.hicloud.com",
"RU":"connect-drru.hispace.dbankcloud.ru",
"RU_back":"connect-drru.hispace.dbankcloud.ru",
"RU_back":"connect-drru.hispace.dbankcloud.cn",
"SG":"connect-dra.dbankcloud.cn",
"SG_back":"connect-dra.hispace.hicloud.com"
},
"websocketgw_all":{
"CN":"connect-ws-drcn.hispace.dbankcloud.cn",
"CN_back":"connect-ws-drcn.hispace.dbankcloud.com",
"DE":"connect-ws-dre.hispace.dbankcloud.cn",
"DE_back":"connect-ws-dre.hispace.dbankcloud.com",
"RU":"connect-ws-drru.hispace.dbankcloud.ru",
"RU_back":"connect-ws-drru.hispace.dbankcloud.cn",
"SG":"connect-ws-dra.hispace.dbankcloud.cn",
"SG_back":"connect-ws-dra.hispace.dbankcloud.com"
},
"client":{
"cp_id":"2640082000020010713",
"product_id":"99536292102197525",
"client_id":"874325707927340288",
"client_secret":"DCAFAE5C0440ABDBD6DDB2B6EBD7D9B0870C10FCA64759CCD63020D168803AB5",
"project_id":"99536292102197525",
"app_id":"106014023",
"api_key":"DAEDAEzScQA5ri36P2NEiVPSFrOJeYZ0DbEJZMGJrBadW+QudBr5BGHD3vO0tsL1VeBy0RPZefPic3hAWUijcBxCv0zRv0iBjQEptQ==",
"package_name":"deckers.thibault.aves"
},
"oauth_client":{
@ -30,17 +37,17 @@
"configuration_version":"3.0",
"appInfos":[
{
"package_name":"deckers.thibault.aves.profile",
"package_name":"deckers.thibault.aves",
"client":{
"app_id":"106031461"
"app_id":"106014023"
},
"app_info":{
"package_name":"deckers.thibault.aves.profile",
"app_id":"106031461"
"package_name":"deckers.thibault.aves",
"app_id":"106014023"
},
"oauth_client":{
"client_type":1,
"client_id":"106031461"
"client_id":"106014023"
}
},
{
@ -58,17 +65,17 @@
}
},
{
"package_name":"deckers.thibault.aves",
"package_name":"deckers.thibault.aves.profile",
"client":{
"app_id":"106014023"
"app_id":"106031461"
},
"app_info":{
"package_name":"deckers.thibault.aves",
"app_id":"106014023"
"package_name":"deckers.thibault.aves.profile",
"app_id":"106031461"
},
"oauth_client":{
"client_type":1,
"client_id":"106014023"
"client_id":"106031461"
}
}
]

View file

@ -38,6 +38,7 @@ if (keystorePropertiesFile.exists()) {
keystoreProperties['keyAlias'] = System.getenv('AVES_KEY_ALIAS')
keystoreProperties['keyPassword'] = System.getenv('AVES_KEY_PASSWORD')
keystoreProperties['googleApiKey'] = System.getenv('AVES_GOOGLE_API_KEY')
keystoreProperties['huaweiApiKey'] = System.getenv('AVES_HUAWEI_API_KEY')
}
android {
@ -60,7 +61,8 @@ android {
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
manifestPlaceholders = [googleApiKey: keystoreProperties['googleApiKey']]
manifestPlaceholders = [googleApiKey: keystoreProperties['googleApiKey'],
huaweiApiKey: keystoreProperties['huaweiApiKey']]
multiDexEnabled true
resValue 'string', 'search_provider', "${appId}.search_provider"
}

View file

@ -206,6 +206,9 @@ This change eventually prevents building the app with Flutter v3.0.2.
<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

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

View file

@ -1,4 +1,4 @@
import 'dart:ui' as ui show Codec;
import 'dart:ui' as ui;
import 'package:aves/services/common/services.dart';
import 'package:equatable/equatable.dart';
@ -27,7 +27,7 @@ class AppIconImage extends ImageProvider<AppIconImageKey> {
}
@override
ImageStreamCompleter load(AppIconImageKey key, DecoderCallback decode) {
ImageStreamCompleter loadBuffer(AppIconImageKey key, DecoderBufferCallback decode) {
return MultiFrameImageStreamCompleter(
codec: _loadAsync(key, decode),
scale: key.scale,
@ -37,10 +37,11 @@ class AppIconImage extends ImageProvider<AppIconImageKey> {
);
}
Future<ui.Codec> _loadAsync(AppIconImageKey key, DecoderCallback decode) async {
Future<ui.Codec> _loadAsync(AppIconImageKey key, DecoderBufferCallback decode) async {
try {
final bytes = await androidAppService.getAppIcon(key.packageName, key.size);
return await decode(bytes.isEmpty ? kTransparentImage : bytes);
final buffer = await ui.ImmutableBuffer.fromUint8List(bytes.isEmpty ? kTransparentImage : bytes);
return await decode(buffer);
} catch (error) {
debugPrint('$runtimeType _loadAsync failed with packageName=$packageName, error=$error');
throw StateError('$packageName app icon decoding failed');

View file

@ -1,6 +1,6 @@
import 'dart:async';
import 'dart:math';
import 'dart:ui' as ui show Codec;
import 'dart:ui' as ui;
import 'package:aves/services/common/services.dart';
import 'package:equatable/equatable.dart';
@ -18,7 +18,7 @@ class RegionProvider extends ImageProvider<RegionProviderKey> {
}
@override
ImageStreamCompleter load(RegionProviderKey key, DecoderCallback decode) {
ImageStreamCompleter loadBuffer(RegionProviderKey key, DecoderBufferCallback decode) {
return MultiFrameImageStreamCompleter(
codec: _loadAsync(key, decode),
scale: 1.0,
@ -28,7 +28,7 @@ class RegionProvider extends ImageProvider<RegionProviderKey> {
);
}
Future<ui.Codec> _loadAsync(RegionProviderKey key, DecoderCallback decode) async {
Future<ui.Codec> _loadAsync(RegionProviderKey key, DecoderBufferCallback decode) async {
final uri = key.uri;
final mimeType = key.mimeType;
final pageId = key.pageId;
@ -47,7 +47,8 @@ class RegionProvider extends ImageProvider<RegionProviderKey> {
if (bytes.isEmpty) {
throw StateError('$uri ($mimeType) region loading failed');
}
return await decode(bytes);
final buffer = await ui.ImmutableBuffer.fromUint8List(bytes);
return await decode(buffer);
} catch (error) {
// loading may fail if the provided MIME type is incorrect (e.g. the Media Store may report a JPEG as a TIFF)
debugPrint('$runtimeType _loadAsync failed with mimeType=$mimeType, uri=$uri, error=$error');

View file

@ -1,4 +1,4 @@
import 'dart:ui' as ui show Codec;
import 'dart:ui' as ui;
import 'package:aves/services/common/services.dart';
import 'package:equatable/equatable.dart';
@ -19,7 +19,7 @@ class ThumbnailProvider extends ImageProvider<ThumbnailProviderKey> {
}
@override
ImageStreamCompleter load(ThumbnailProviderKey key, DecoderCallback decode) {
ImageStreamCompleter loadBuffer(ThumbnailProviderKey key, DecoderBufferCallback decode) {
return MultiFrameImageStreamCompleter(
codec: _loadAsync(key, decode),
scale: 1.0,
@ -30,7 +30,7 @@ class ThumbnailProvider extends ImageProvider<ThumbnailProviderKey> {
);
}
Future<ui.Codec> _loadAsync(ThumbnailProviderKey key, DecoderCallback decode) async {
Future<ui.Codec> _loadAsync(ThumbnailProviderKey key, DecoderBufferCallback decode) async {
final uri = key.uri;
final mimeType = key.mimeType;
final pageId = key.pageId;
@ -48,7 +48,8 @@ class ThumbnailProvider extends ImageProvider<ThumbnailProviderKey> {
if (bytes.isEmpty) {
throw StateError('$uri ($mimeType) loading failed');
}
return await decode(bytes);
final buffer = await ui.ImmutableBuffer.fromUint8List(bytes);
return await decode(buffer);
} catch (error) {
// loading may fail if the provided MIME type is incorrect (e.g. the Media Store may report a JPEG as a TIFF)
debugPrint('$runtimeType _loadAsync failed with mimeType=$mimeType, uri=$uri, error=$error');

View file

@ -1,5 +1,5 @@
import 'dart:async';
import 'dart:ui' as ui show Codec;
import 'dart:ui' as ui;
import 'package:aves/services/common/services.dart';
import 'package:equatable/equatable.dart';
@ -32,7 +32,7 @@ class UriImage extends ImageProvider<UriImage> with EquatableMixin {
}
@override
ImageStreamCompleter load(UriImage key, DecoderCallback decode) {
ImageStreamCompleter loadBuffer(UriImage key, DecoderBufferCallback decode) {
final chunkEvents = StreamController<ImageChunkEvent>();
return MultiFrameImageStreamCompleter(
@ -45,7 +45,7 @@ class UriImage extends ImageProvider<UriImage> with EquatableMixin {
);
}
Future<ui.Codec> _loadAsync(UriImage key, DecoderCallback decode, StreamController<ImageChunkEvent> chunkEvents) async {
Future<ui.Codec> _loadAsync(UriImage key, DecoderBufferCallback decode, StreamController<ImageChunkEvent> chunkEvents) async {
assert(key == this);
try {
@ -66,7 +66,8 @@ class UriImage extends ImageProvider<UriImage> with EquatableMixin {
if (bytes.isEmpty) {
throw StateError('$uri ($mimeType) loading failed');
}
return await decode(bytes);
final buffer = await ui.ImmutableBuffer.fromUint8List(bytes);
return await decode(buffer);
} catch (error) {
// loading may fail if the provided MIME type is incorrect (e.g. the Media Store may report a JPEG as a TIFF)
debugPrint('$runtimeType _loadAsync failed with mimeType=$mimeType, uri=$uri, error=$error');

View file

@ -1,15 +1,15 @@
import 'package:collection/collection.dart';
extension ExtraMapNullableKey<K extends Object, V> on Map<K?, V> {
Map<K, V> whereNotNullKey() => <K, V>{for (var v in keys.whereNotNull()) v: this[v]!};
Map<K, V> whereNotNullKey() => <K, V>{for (var v in keys.whereNotNull()) v: this[v] as V};
}
extension ExtraMapNullableValue<K extends Object, V> on Map<K, V?> {
Map<K, V> whereNotNullValue() => <K, V>{for (var kv in entries.where((kv) => kv.value != null)) kv.key: kv.value!};
Map<K, V> whereNotNullValue() => <K, V>{for (var kv in entries.where((kv) => kv.value != null)) kv.key: kv.value as V};
}
extension ExtraMapNullableKeyValue<K extends Object, V> on Map<K?, V?> {
Map<K, V?> whereNotNullKey() => <K, V?>{for (var v in keys.whereNotNull()) v: this[v]};
Map<K?, V> whereNotNullValue() => <K?, V>{for (var kv in entries.where((kv) => kv.value != null)) kv.key: kv.value!};
Map<K?, V> whereNotNullValue() => <K?, V>{for (var kv in entries.where((kv) => kv.value != null)) kv.key: kv.value as V};
}

30
plugins/aves_platform_meta/.gitignore vendored Normal file
View file

@ -0,0 +1,30 @@
# 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

@ -0,0 +1,30 @@
# 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.
version:
revision: 85684f9300908116a78138ea4c6036c35c9a1236
channel: stable
project_type: plugin
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
- platform: android
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'

View file

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

View file

@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.cxx

View file

@ -0,0 +1,50 @@
group 'deckers.thibault.aves.aves_platform_meta'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
rootProject.allprojects {
repositories {
google()
mavenCentral()
}
}
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 33
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
minSdkVersion 16
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

Binary file not shown.

View file

@ -0,0 +1,6 @@
#Thu Oct 22 10:54:33 KST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip

160
plugins/aves_platform_meta/android/gradlew vendored Executable file
View file

@ -0,0 +1,160 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

View file

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View file

@ -0,0 +1 @@
rootProject.name = 'aves_platform_meta'

View file

@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="deckers.thibault.aves.aves_platform_meta">
</manifest>

View file

@ -0,0 +1,52 @@
package deckers.thibault.aves.aves_platform_meta
import android.content.Context
import android.content.pm.PackageManager
import androidx.annotation.NonNull
import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
class AvesPlatformMetaPlugin : FlutterPlugin, MethodCallHandler {
private var context: Context? = null
private lateinit var channel: MethodChannel
override fun onAttachedToEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
context = binding.applicationContext
channel = MethodChannel(binding.binaryMessenger, "deckers.thibault/aves/aves_platform_meta")
channel.setMethodCallHandler(this)
}
override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
context = null
channel.setMethodCallHandler(null)
}
override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: MethodChannel.Result) {
if (call.method == "getMetadata") {
getMetadata(call, result)
} else {
result.notImplemented()
}
}
private fun getMetadata(@NonNull call: MethodCall, @NonNull result: MethodChannel.Result) {
val key = call.argument<String>("key")
if (key == null) {
result.error("getMetadata-args", "missing arguments", null)
return
}
val ctx = context
if (ctx == null) {
result.error("getMetadata-context", "no context", null)
return
}
val metadata = ctx.packageManager.getApplicationInfoCompat(ctx.packageName, PackageManager.GET_META_DATA).metaData
val value = metadata.getString(key)
result.success(value)
}
}

View file

@ -0,0 +1,14 @@
package deckers.thibault.aves.aves_platform_meta
import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
import android.os.Build
fun PackageManager.getApplicationInfoCompat(packageName: String, flags: Int): ApplicationInfo {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
getApplicationInfo(packageName, PackageManager.ApplicationInfoFlags.of(flags.toLong()))
} else {
@Suppress("deprecation")
getApplicationInfo(packageName, flags)
}
}

View file

@ -0,0 +1,7 @@
import 'aves_platform_meta_platform_interface.dart';
class AvesPlatformMeta {
Future<String?> getMetadata(String key) {
return AvesPlatformMetaPlatform.instance.getMetadata(key);
}
}

View file

@ -0,0 +1,16 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'aves_platform_meta_platform_interface.dart';
class MethodChannelAvesPlatformMeta extends AvesPlatformMetaPlatform {
@visibleForTesting
final methodChannel = const MethodChannel('deckers.thibault/aves/aves_platform_meta');
@override
Future<String?> getMetadata(String key) {
return methodChannel.invokeMethod<String>('getMetadata', <String, dynamic>{
'key': key,
});
}
}

View file

@ -0,0 +1,22 @@
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'aves_platform_meta_method_channel.dart';
abstract class AvesPlatformMetaPlatform extends PlatformInterface {
AvesPlatformMetaPlatform() : super(token: _token);
static final Object _token = Object();
static AvesPlatformMetaPlatform _instance = MethodChannelAvesPlatformMeta();
static AvesPlatformMetaPlatform get instance => _instance;
static set instance(AvesPlatformMetaPlatform instance) {
PlatformInterface.verifyToken(instance, _token);
_instance = instance;
}
Future<String?> getMetadata(String key) {
throw UnimplementedError('platformVersion() has not been implemented.');
}
}

View file

@ -0,0 +1,21 @@
name: aves_platform_meta
version: 0.0.1
publish_to: none
environment:
sdk: ">=2.17.5 <3.0.0"
dependencies:
flutter:
sdk: flutter
plugin_platform_interface:
dev_dependencies:
flutter_lints:
flutter:
plugin:
platforms:
android:
package: deckers.thibault.aves.aves_platform_meta
pluginClass: AvesPlatformMetaPlugin

View file

@ -1,16 +1,20 @@
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/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
@ -18,6 +22,10 @@ class PlatformMobileServices extends MobileServices {
final result = await HmsApiAvailability().isHMSAvailable();
_isAvailable = result == _hmsCoreAvailable;
debugPrint('Device has Huawei Mobile Services=$_isAvailable');
final apiKey = await AvesPlatformMetaPlatform.instance.getMetadata(manifestApiKey);
hmap.HuaweiMapInitializer.setApiKey(apiKey: apiKey ?? '');
hmap.HuaweiMapInitializer.initializeMap();
}
@override

View file

@ -10,14 +10,12 @@ dependencies:
sdk: flutter
aves_map:
path: ../aves_map
aves_platform_meta:
path: ../aves_platform_meta
aves_services:
path: ../aves_services
huawei_hmsavailability:
huawei_map:
git:
url: https://github.com/deckerst/hms-flutter-plugin.git
path: flutter-hms-map
ref: aves
latlong2:
provider:

View file

@ -35,7 +35,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
version: "2.9.0"
aves_map:
dependency: "direct main"
description:
@ -91,7 +91,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
charcode:
dependency: transitive
description:
@ -189,14 +189,14 @@ packages:
name: coverage
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.2"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
version: "3.0.2"
custom_rounded_rectangle_border:
dependency: transitive
description:
@ -601,7 +601,7 @@ packages:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.1.5"
material_design_icons_flutter:
dependency: "direct main"
description:
@ -615,7 +615,7 @@ packages:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
mgrs_dart:
dependency: transitive
description:
@ -736,7 +736,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
path_parsing:
dependency: transitive
description:
@ -1051,7 +1051,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
version: "1.9.0"
sqflite:
dependency: "direct main"
description:
@ -1102,7 +1102,7 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
sync_http:
dependency: transitive
description:
@ -1165,7 +1165,7 @@ packages:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
unicode:
dependency: transitive
description:
@ -1242,7 +1242,7 @@ packages:
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
version: "8.2.2"
version: "8.3.0"
watcher:
dependency: transitive
description:

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long