Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrated to v2 #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nankai.flutter_nearby_connections_example">
package="com.example.flutter_nearby_connections_example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
8 changes: 5 additions & 3 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nankai.flutter_nearby_connections_example">
package="com.example.flutter_nearby_connections_example">
<!-- package="com.nankai.flutter_nearby_connections_example"> -->
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
<application
android:name="${applicationName}"
android:label="flutter_nearby_connections_example"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:exported="true"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nankai.flutter_nearby_connections_example">
package="com.example.flutter_nearby_connections_example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
}
}

Expand Down
1 change: 0 additions & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
3 changes: 1 addition & 2 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
19 changes: 9 additions & 10 deletions lib/encyption/rsa.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ import 'package:rsa_encrypt/rsa_encrypt.dart';
import 'package:pointycastle/api.dart' as crypto;

//Future to hold our KeyPair
Future<crypto.AsymmetricKeyPair> futureKeyPair;
late Future<crypto.AsymmetricKeyPair> futureKeyPair;

//to store the KeyPair once we get data from our future
crypto.AsymmetricKeyPair keyPair;
late crypto.AsymmetricKeyPair keyPair;

Future<crypto.AsymmetricKeyPair<crypto.PublicKey, crypto.PrivateKey>> getKeyPair()
{
Future<crypto.AsymmetricKeyPair<crypto.PublicKey, crypto.PrivateKey>>
getKeyPair() {
var helper = RsaKeyHelper();
return helper.computeRSAKeyPair(helper.getSecureRandom());
}

void createPair (){
futureKeyPair=getKeyPair();
futureKeyPair.then((value) => keyPair=value);
var x=encodePrivateKeyToPemPKCS1(keyPair.privateKey);

}
void createPair() {
futureKeyPair = getKeyPair();
futureKeyPair.then((value) => keyPair = value);
//var x=encodePrivateKeyToPemPKCS1(keyPair.privateKey);
}
14 changes: 4 additions & 10 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -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<dynamic> 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(
Expand All @@ -24,5 +20,3 @@ class MyApp extends StatelessWidget {
);
}
}


6 changes: 3 additions & 3 deletions lib/pages/ChatListScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ class _ChatListScreenState extends State<ChatListScreen> {
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",
),
],
),
Expand Down
6 changes: 3 additions & 3 deletions lib/pages/DeviceListScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ class _DevicesListScreenState extends State<DevicesListScreen> {
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,
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down