Allow users to register via the app

This commit is contained in:
Roland Geider
2021-02-11 12:14:15 +01:00
parent c0759c913e
commit e9c9ae93d6
11 changed files with 161 additions and 68 deletions

View File

@@ -25,12 +25,35 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
// Keys for the android play store
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('app/key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
// Key for wger.de REST API
def wgerProperties = new Properties()
def localMapsPropertiesFile = rootProject.file('app/wger.properties')
if (localMapsPropertiesFile.exists()) {
project.logger.info('Load maps properties from local file')
localMapsPropertiesFile.withReader('UTF-8') { reader ->
wgerProperties.load(reader)
}
} else {
project.logger.info('Load maps properties from environment')
try {
wgerProperties['WGER_API_KEY'] = System.getenv('WGER_API_KEY')
} catch(NullPointerException e) {
project.logger.warn('Failed to load WGER_API_KEY from environment.', e)
}
}
def wgerApiKey = wgerProperties.getProperty('WGER_API_KEY')
if(wgerApiKey == null){
wgerApiKey = ""
project.logger.error('Wger Api Key not configured. Set it in `app/wger.properties` or in the environment variable `WGER_API_KEY`')
}
android {
compileSdkVersion 29
@@ -49,6 +72,7 @@ android {
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
manifestPlaceholders = [WGER_API_KEY: wgerApiKey]
}
signingConfigs {

View File

@@ -11,6 +11,9 @@
android:name="io.flutter.app.FlutterApplication"
android:label="wger"
android:icon="@mipmap/ic_launcher">
<meta-data android:name="wger.api_key" android:value="${WGER_API_KEY}" />
<activity
android:name=".MainActivity"
android:launchMode="singleTop"