diff --git a/android/app/build.gradle b/android/app/build.gradle index f07e217..5911407 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -71,7 +71,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "io.igrant.data4diabetes" - minSdkVersion 21 + minSdkVersion 24 targetSdkVersion 33 versionCode flutterVersionCode.toInteger() versionName flutterVersionName @@ -130,8 +130,9 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "com.google.android.gms:play-services-mlkit-barcode-scanning:18.0.0" - - implementation 'com.github.decentralised-dataexchange:ama-android-sdk:2.5.2' + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'com.google.android.material:material:1.3.0' + implementation "com.github.L3-iGrant:data_wallet:2024.4.1" implementation platform('com.google.firebase:firebase-bom:28.0.1') implementation 'com.google.firebase:firebase-dynamic-links-ktx' @@ -142,4 +143,28 @@ dependencies { implementation 'com.github.markomilos:paginate:1.0.0' implementation 'com.github.marlonlom:timeago:4.0.3' + implementation 'org.hyperledger:indy:1.16.0' + implementation 'net.java.dev.jna:jna:5.6.0' + implementation 'org.apache.commons:commons-lang3:3.7' + implementation 'commons-io:commons-io:2.8.0' + //retrofit + //retrofit and services + implementation('com.squareup.retrofit2:retrofit:2.7.1') { + exclude module: 'okhttp' + } + implementation 'com.squareup.retrofit2:converter-gson:2.7.1' + implementation 'com.squareup.okhttp3:okhttp:4.3.1' + implementation 'com.squareup.okhttp3:logging-interceptor:4.3.1' + implementation 'com.google.code.gson:gson:2.8.6' + implementation 'com.dlazaro66.qrcodereaderview:qrcodereaderview:2.0.3' + implementation 'com.github.bumptech.glide:glide:4.11.0' + annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' + implementation 'com.airbnb.android:lottie:3.5.0' + implementation 'org.greenrobot:eventbus:3.1.1' + annotationProcessor "org.greenrobot:eventbus-annotation-processor:3.1.1" + implementation 'com.github.koushikcse:LoadingButton:1.7' + implementation 'com.github.mediapark-pk:Base58-android:0.1' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2' + implementation 'com.tbuonomo:dotsindicator:4.2' + implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' } diff --git a/android/app/src/main/kotlin/io/igrant/data4diabetes/MainActivity.kt b/android/app/src/main/kotlin/io/igrant/data4diabetes/MainActivity.kt index 1473d62..10b0885 100644 --- a/android/app/src/main/kotlin/io/igrant/data4diabetes/MainActivity.kt +++ b/android/app/src/main/kotlin/io/igrant/data4diabetes/MainActivity.kt @@ -1,5 +1,6 @@ package io.igrant.data4diabetes +import android.util.Log import com.github.privacyDashboard.PrivacyDashboard import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.engine.FlutterEngine @@ -7,6 +8,7 @@ import io.flutter.plugin.common.MethodChannel import io.igrant.data_wallet.indy.LedgerNetworkType import io.igrant.data_wallet.utils.DataWallet import io.igrant.data_wallet.utils.DataWalletConfigurations +import io.igrant.data_wallet.utils.DeleteWalletResult import io.igrant.data_wallet.utils.InitializeWalletCallback import io.igrant.data_wallet.utils.InitializeWalletState import io.igrant.data_wallet.utils.dataAgreement.DataAgreementUtils @@ -20,27 +22,7 @@ class MainActivity : FlutterActivity() { override fun configureFlutterEngine(flutterEngine: FlutterEngine) { super.configureFlutterEngine(flutterEngine) - DataWallet.initializeSdk( - this, - object : InitializeWalletCallback { - override fun progressUpdate(progress: Int) { - when (progress) { - InitializeWalletState.INITIALIZE_WALLET_STARTED -> { - - } - InitializeWalletState.INITIALIZE_WALLET_EXTERNAL_FILES_LOADED -> { - - } - InitializeWalletState.POOL_CREATED -> { - } - InitializeWalletState.WALLET_OPENED -> { - DataWalletConfigurations.registerForSubscription(this@MainActivity) - } - } - } - }, LedgerNetworkType.getSelectedNetwork(this) - ) methodChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL) @@ -194,9 +176,50 @@ class MainActivity : FlutterActivity() { } } + "InitWallet"->{ + initializeWallet() + } + "DeleteWallet"->{ + val response = DataWallet.deleteWallet() + when (response) { + is DeleteWalletResult.Success -> { + // Show success message or perform any other action + DataWallet.releaseSdk() + Log.d("Success","${response.message}") + } + is DeleteWalletResult.Error -> { + // error message + Log.d("Error","${response.errorMessage}") + } + } + } } } } + + private fun initializeWallet() { + DataWallet.initializeSdk( + this, + object : InitializeWalletCallback { + override fun progressUpdate(progress: Int) { + when (progress) { + InitializeWalletState.INITIALIZE_WALLET_STARTED -> { + + } + InitializeWalletState.INITIALIZE_WALLET_EXTERNAL_FILES_LOADED -> { + + } + InitializeWalletState.POOL_CREATED -> { + + } + InitializeWalletState.WALLET_OPENED -> { + DataWalletConfigurations.registerForSubscription(this@MainActivity) + } + } + } + }, LedgerNetworkType.getSelectedNetwork(this) + ) + } } diff --git a/android/build.gradle b/android/build.gradle index f4dec82..4f5238a 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -24,6 +24,14 @@ allprojects { jcenter() maven { url "https://jitpack.io" } maven { url 'https://repo.sovrin.org/repository/maven-public'} + maven { + name = "GitHubPackages" + url "https://maven.pkg.github.com/L3-iGrant/ama-android-sdk" + credentials { + username = "L3-iGrant" + password = "xxxxxxxxxxxxxxxxx" + } + } } } diff --git a/lib/app/modules/otp/controllers/otp_controller.dart b/lib/app/modules/otp/controllers/otp_controller.dart index a22984e..fadec97 100644 --- a/lib/app/modules/otp/controllers/otp_controller.dart +++ b/lib/app/modules/otp/controllers/otp_controller.dart @@ -5,6 +5,7 @@ import 'package:Data4Diabetes/app/modules/Register/controllers/register_controll import 'package:Data4Diabetes/app/modules/login/controllers/login_controller.dart'; import 'package:Data4Diabetes/app/network/exceptions/api_exception.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:get/get.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -43,7 +44,9 @@ class OtpController extends BaseController { hideLoading(); verifyOtpController.clear(); - + var platform = const MethodChannel('io.igrant.data4diabetes.channel'); + // initialize wallet + platform.invokeMethod('InitWallet'); Get.offAll(MainView()); } } catch (e) { diff --git a/lib/app/modules/settings/controllers/settings_controller.dart b/lib/app/modules/settings/controllers/settings_controller.dart index 81edd8b..38296b6 100644 --- a/lib/app/modules/settings/controllers/settings_controller.dart +++ b/lib/app/modules/settings/controllers/settings_controller.dart @@ -53,6 +53,8 @@ class SettingsController extends BaseController { await _prefs.remove(key); } } + //delete wallet + platform.invokeMethod('DeleteWallet'); Get.offAll(const LauncherView()); } @@ -70,6 +72,8 @@ class SettingsController extends BaseController { color: Colors.green); SharedPreferences _prefs = await SharedPreferences.getInstance(); _prefs.clear(); + // delete wallet + platform.invokeMethod('DeleteWallet'); Get.offAll(const LauncherView()); } else { GetSnackToast(message: appLocalization.settingsDeleteAccountFail); diff --git a/lib/app/my_app.dart b/lib/app/my_app.dart index d4dee96..c166368 100644 --- a/lib/app/my_app.dart +++ b/lib/app/my_app.dart @@ -31,6 +31,9 @@ class _MyAppState extends State { super.initState(); _initLocale(); _initPrivacyDashboard(); + var platform = const MethodChannel('io.igrant.data4diabetes.channel'); + // initialize wallet + platform.invokeMethod('InitWallet'); } Future _initLocale() async {