From b1a8880c21cbc062363c13b9b1728c11f6cce124 Mon Sep 17 00:00:00 2001 From: Joymakwana2003 Date: Mon, 20 Mar 2023 19:12:35 +0530 Subject: [PATCH] Successfully migrated to V2 --- android/app/build.gradle | 14 ++++++++++++-- android/app/src/main/AndroidManifest.xml | 2 +- .../src/main/kotlin/com/aossie/p2p/MainActivity.kt | 2 +- android/build.gradle | 4 ++-- android/gradle/wrapper/gradle-wrapper.properties | 3 ++- lib/encyption/rsa.dart | 5 ++--- lib/main.dart | 2 +- lib/pages/ChatListScreen.dart | 6 +++--- lib/pages/DeviceListScreen.dart | 6 +++--- pubspec.yaml | 2 +- 10 files changed, 28 insertions(+), 18 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 21d8ad5..7873f8a 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,7 +26,12 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 30 + compileSdkVersion 33 + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -39,7 +44,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.nankai.flutter_nearby_connections_example" - minSdkVersion 16 + minSdkVersion 21 targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName @@ -63,5 +68,10 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'com.android.support:multidex:1.0.3' + implementation 'androidx.core:core-ktx:1.6.0' + implementation 'androidx.appcompat:appcompat:1.3.1' + implementation 'com.google.android.gms:play-services-nearby:18.0.0' + implementation 'io.flutter:flutter_embedding_debug:1.0.0-rc.8' + implementation 'com.google.android.material:material:1.2.1' } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 59d3fa1..9df17d1 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -6,7 +6,7 @@ additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> futureKeyPair; +late Future futureKeyPair; //to store the KeyPair once we get data from our future -crypto.AsymmetricKeyPair keyPair; +late crypto.AsymmetricKeyPair keyPair; Future> getKeyPair() { @@ -16,6 +16,5 @@ Future> getKeyPair void createPair (){ futureKeyPair=getKeyPair(); futureKeyPair.then((value) => keyPair=value); - var x=encodePrivateKeyToPemPKCS1(keyPair.privateKey); } \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index e5a5e40..e82ca14 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:p2p/pages/ChatListScreen.dart'; +import 'pages/ChatListScreen.dart'; import 'pages/Profile.dart'; void main() { runApp(MyApp()); diff --git a/lib/pages/ChatListScreen.dart b/lib/pages/ChatListScreen.dart index 582ebc5..0de4390 100644 --- a/lib/pages/ChatListScreen.dart +++ b/lib/pages/ChatListScreen.dart @@ -58,15 +58,15 @@ class _ChatListScreenState extends State { items: [ BottomNavigationBarItem( icon: Icon(Icons.message), - title: Text("Chats"), + label: "Chats", ), BottomNavigationBarItem( icon: Icon(Icons.group_work), - title: Text("Available"), + label: "Available", ), BottomNavigationBarItem( icon: Icon(Icons.account_box), - title: Text("Profile"), + label: "Profile", ), ], ), diff --git a/lib/pages/DeviceListScreen.dart b/lib/pages/DeviceListScreen.dart index db8c3c0..7213576 100644 --- a/lib/pages/DeviceListScreen.dart +++ b/lib/pages/DeviceListScreen.dart @@ -91,15 +91,15 @@ class _DevicesListScreenState extends State { items: [ BottomNavigationBarItem( icon: Icon(Icons.message), - title: Text("Chats"), + label: "Chats", ), BottomNavigationBarItem( icon: Icon(Icons.group_work), - title: Text("Available"), + label: "Available", ), BottomNavigationBarItem( icon: Icon(Icons.account_box), - title: Text("Profile"), + label: "Profile", ), ], currentIndex: _selectedIndex, diff --git a/pubspec.yaml b/pubspec.yaml index 81deefd..3221dba 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -21,7 +21,7 @@ dependencies: intl: ^0.17.0 rsa_encrypt: ^2.0.0 pointycastle: ^3.0.1 - + p2p_client_dart: ^1.0.4 dev_dependencies: flutter_test: