From 4036fb4dd3e578b5bc46f9998d8db7d4f7e6b3cd Mon Sep 17 00:00:00 2001 From: RUPESH <89046490+rupesh031@users.noreply.github.com> Date: Fri, 10 Mar 2023 20:57:50 +0530 Subject: [PATCH] migrated to v2 --- android/app/build.gradle | 18 ++++++++++++++---- android/app/src/debug/AndroidManifest.xml | 2 +- android/app/src/main/AndroidManifest.xml | 8 +++++--- android/app/src/profile/AndroidManifest.xml | 2 +- android/build.gradle | 6 +++--- android/gradle.properties | 1 - .../gradle/wrapper/gradle-wrapper.properties | 3 +-- lib/encyption/rsa.dart | 19 +++++++++---------- lib/main.dart | 14 ++++---------- lib/pages/ChatListScreen.dart | 6 +++--- lib/pages/DeviceListScreen.dart | 6 +++--- pubspec.yaml | 1 + 12 files changed, 45 insertions(+), 41 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 21d8ad5..dcfffa5 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,7 +26,17 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 30 + compileSdkVersion 33 + ndkVersion flutter.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -38,9 +48,9 @@ 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 - targetSdkVersion 30 + applicationId "com.example.flutter_nearby_connections_example" + minSdkVersion 23 + targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName multiDexEnabled true diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index dbeeef6..1bb5d25 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.example.flutter_nearby_connections_example"> diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 59d3fa1..ea47f4f 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,18 +1,20 @@ + package="com.example.flutter_nearby_connections_example"> + - diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml index dbeeef6..1bb5d25 100644 --- a/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.example.flutter_nearby_connections_example"> diff --git a/android/build.gradle b/android/build.gradle index 1aff911..6e11b1e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,14 +1,14 @@ buildscript { - ext.kotlin_version = '1.5.10' + ext.kotlin_version = '1.8.10' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.3' -// classpath 'com.android.tools.build:gradle:3.3.3' + classpath 'com.android.tools.build:gradle:7.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + // classpath 'com.google.gms:google-services:4.3.15' } } diff --git a/android/gradle.properties b/android/gradle.properties index 38c8d45..94adc3a 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,4 +1,3 @@ org.gradle.jvmargs=-Xmx1536M -android.enableR8=true android.useAndroidX=true android.enableJetifier=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 3a1d81b..cb24abd 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Mon Nov 09 14:57:25 ICT 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip diff --git a/lib/encyption/rsa.dart b/lib/encyption/rsa.dart index c755ad9..3696e3d 100644 --- a/lib/encyption/rsa.dart +++ b/lib/encyption/rsa.dart @@ -2,20 +2,19 @@ import 'package:rsa_encrypt/rsa_encrypt.dart'; import 'package:pointycastle/api.dart' as crypto; //Future to hold our KeyPair -Future futureKeyPair; +late Future futureKeyPair; //to store the KeyPair once we get data from our future -crypto.AsymmetricKeyPair keyPair; +late crypto.AsymmetricKeyPair keyPair; -Future> getKeyPair() -{ +Future> + getKeyPair() { var helper = RsaKeyHelper(); return helper.computeRSAKeyPair(helper.getSecureRandom()); } -void createPair (){ - futureKeyPair=getKeyPair(); - futureKeyPair.then((value) => keyPair=value); - var x=encodePrivateKeyToPemPKCS1(keyPair.privateKey); - -} \ No newline at end of file +void createPair() { + futureKeyPair = getKeyPair(); + futureKeyPair.then((value) => keyPair = value); + //var x=encodePrivateKeyToPemPKCS1(keyPair.privateKey); +} diff --git a/lib/main.dart b/lib/main.dart index e5a5e40..8656fc1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,21 +1,17 @@ - import 'package:flutter/material.dart'; -import 'package:p2p/pages/ChatListScreen.dart'; +import 'pages/ChatListScreen.dart'; import 'pages/Profile.dart'; + void main() { runApp(MyApp()); } - Route generateRoute(RouteSettings settings) { - return MaterialPageRoute( - builder: (_) => Profile()); + return MaterialPageRoute(builder: (_) => Profile()); } class MyApp extends StatelessWidget { - void initState(){ - - } + void initState() {} @override Widget build(BuildContext context) { return MaterialApp( @@ -24,5 +20,3 @@ class MyApp extends StatelessWidget { ); } } - - 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..519904a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -21,6 +21,7 @@ dependencies: intl: ^0.17.0 rsa_encrypt: ^2.0.0 pointycastle: ^3.0.1 + p2p_client_dart: ^1.0.4 dev_dependencies: