Skip to content

Commit

Permalink
chore(app): Update to latest flutter, gradle and java version. (#823)
Browse files Browse the repository at this point in the history
chore(app): Update to latest gradle and java version. Replace qr scanning library

Signed-off-by: Talwinder Kaur <[email protected]>
  • Loading branch information
talwinder50 authored Nov 7, 2024
1 parent 18186b9 commit 6cd8b9c
Show file tree
Hide file tree
Showing 16 changed files with 172 additions and 202 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ jobs:
uses: flutter-actions/setup-flutter@v2
with:
channel: stable
version: 3.10.6
version: 3.19.5
- name: Install flutter app dependencies
run: make install-flutter-dependencies
- name: Run iOS Simulator
Expand Down Expand Up @@ -320,12 +320,12 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
java-version: '21'
- name: Setup Flutter SDK
uses: flutter-actions/setup-flutter@v2
with:
channel: stable
version: 3.10.6
version: 3.19.5
- name: Install flutter app dependencies
run: make install-flutter-dependencies
- name: Build APK in Debug mode
Expand Down
15 changes: 12 additions & 3 deletions demo/app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 34
ndkVersion flutter.ndkVersion
ndkVersion "25.1.8937393"

compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Expand All @@ -56,11 +57,10 @@ android {
applicationId "dev.trustbloc.wallet"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 22
minSdkVersion 24
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Expand All @@ -71,12 +71,20 @@ android {
signingConfig signingConfigs.debug
}

debug {
// fix Failed to transform firebase-auth-22.3.1.aar
minifyEnabled false
multiDexEnabled true
signingConfig signingConfigs.debug
}

buildTypes.each {
it.buildConfigField 'String', 'INITIATE_ISSUANCE_URL', '"' + INITIATE_ISSUANCE_URL + '"'
it.buildConfigField 'String', 'INITIATE_VERIFICATION_URL', '"' + INITIATE_VERIFICATION_URL + '"'
it.buildConfigField 'String', 'INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW', '"' + INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW + '"'
}
}
namespace 'dev.trustbloc.wallet'
}

flutter {
Expand All @@ -101,4 +109,5 @@ dependencies {
androidTestImplementation "androidx.test:runner:1.2.0"
androidTestUtil "androidx.test:orchestrator:1.4.2"
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.0'
}
3 changes: 2 additions & 1 deletion demo/app/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.trustbloc.wallet">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.android.com/apk/res/android ">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
3 changes: 1 addition & 2 deletions demo/app/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.trustbloc.wallet">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="TrustBloc"
android:name="${applicationName}"
Expand Down
3 changes: 1 addition & 2 deletions demo/app/android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.trustbloc.wallet">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
13 changes: 12 additions & 1 deletion demo/app/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath 'com.android.tools.build:gradle:8.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
if (walletSdkPkgUsr != null) {
classpath "dev.trustbloc:vc-wallet-sdk:$walletSdkPkgVer"
Expand Down Expand Up @@ -74,6 +74,17 @@ allprojects {
}

rootProject.buildDir = '../build'
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android {
if (namespace == null) {
namespace project.group
}
}
}
}
}
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
Expand Down
6 changes: 5 additions & 1 deletion demo/app/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
;
; SPDX-License-Identifier: Apache-2.0

org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx4608m
android.useAndroidX=true
android.enableJetifier=true
INITIATE_ISSUANCE_URL=
INITIATE_VERIFICATION_URL=
INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW=
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
android.enableR8=true
2 changes: 1 addition & 1 deletion demo/app/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
90 changes: 0 additions & 90 deletions demo/app/ios/Podfile.lock

This file was deleted.

4 changes: 2 additions & 2 deletions demo/app/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
Expand Down Expand Up @@ -66,7 +68,5 @@
<false/>
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion demo/app/lib/views/credential_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class CredentialDetailsState extends State<CredentialDetails> {
title: const Text('Credential Details',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18, fontStyle: FontStyle.normal, fontWeight: FontWeight.w700, fontFamily: 'SF Pro')),
fontSize: 18, fontStyle: FontStyle.normal, fontWeight: FontWeight.w700, fontFamily: 'SF Pro', color: Colors.white)),
backgroundColor: const Color(0xff261131),
),
body: SingleChildScrollView(
Expand Down
1 change: 1 addition & 0 deletions demo/app/lib/views/credential_shared.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class CredentialSharedState extends State<CredentialShared> {
_navigateToDashboard();
},
icon: const Icon(Icons.close),
color: Colors.white,
),
],
flexibleSpace: Container(
Expand Down
46 changes: 16 additions & 30 deletions demo/app/lib/views/scanner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ Copyright Gen Digital Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/

import 'dart:async';
import 'dart:developer';
import 'package:app/scenarios/handle_openid_url.dart';
import 'package:app/widgets/common_title_appbar.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:qr_code_scanner/qr_code_scanner.dart';
import 'package:mobile_scanner/mobile_scanner.dart';
import 'package:safe_device/safe_device.dart';

import 'package:app/widgets/primary_button.dart';
Expand All @@ -24,11 +25,15 @@ class QRScanner extends StatefulWidget {
}

class QRScannerState extends State<QRScanner> {
QRViewController? controller;
final GlobalKey qrKey = GlobalKey(debugLabel: 'QR');
final textController = TextEditingController();
bool isRealDevice = false;

final MobileScannerController controller = MobileScannerController(
detectionSpeed: DetectionSpeed.noDuplicates,
returnImage: true
);

@override
void initState() {
super.initState();
Expand All @@ -51,18 +56,15 @@ class QRScannerState extends State<QRScanner> {
addCloseIcon: true,
height: 50,
),
body: QRView(
key: qrKey,
onQRViewCreated: _onQRViewCreated,
overlay: QrScannerOverlayShape(
borderColor: const Color(0xffE74577),
borderRadius: 24,
borderLength: 30,
borderWidth: 10,
cutOutSize: 256,
),
onPermissionSet: (ctrl, p) => _onPermissionSet(context, ctrl, p),
),
body: MobileScanner(
controller: controller,
onDetect: (capture) {
final List<Barcode> barcodes = capture.barcodes;
for (final barcode in barcodes) {
handleOpenIDUrl(context, barcode.rawValue ?? 'No Data found in QR');
}
controller.dispose();
}),
)
: Scaffold(
appBar: const CustomTitleAppBar(
Expand Down Expand Up @@ -107,20 +109,4 @@ class QRScannerState extends State<QRScanner> {
));
}

void _onQRViewCreated(QRViewController controller) {
this.controller = controller;
controller.scannedDataStream.listen((scanData) async {
controller.dispose();
handleOpenIDUrl(context, scanData.code!);
});
}

void _onPermissionSet(BuildContext context, QRViewController ctrl, bool p) {
log('${DateTime.now().toIso8601String()}_onPermissionSet $p');
if (!p) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('no Permission')),
);
}
}
}
3 changes: 2 additions & 1 deletion demo/app/lib/widgets/common_title_appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ class CustomTitleAppBar extends StatelessWidget implements PreferredSizeWidget {
title: Text(pageTitle!,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 18, fontStyle: FontStyle.normal, fontWeight: FontWeight.w700, fontFamily: 'SF Pro')),
fontSize: 18, fontStyle: FontStyle.normal, fontWeight: FontWeight.w700, fontFamily: 'SF Pro', color: Colors.white)),
backgroundColor: const Color(0xffEEEAEE),
actions: addCloseIcon == true
? [
IconButton(
onPressed: () =>
Navigator.of(context).push(MaterialPageRoute(builder: (context) => const Dashboard())),
icon: const Icon(Icons.close),
color: Colors.white,
),
]
: [],
Expand Down
Loading

0 comments on commit 6cd8b9c

Please sign in to comment.