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

Successfully migrated to V2 #7

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
14 changes: 12 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand All @@ -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'

}
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:name="io.flutter.embedding.android.FlutterApplication"
android:label="flutter_nearby_connections_example"
android:icon="@mipmap/ic_launcher">
<activity
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/kotlin/com/aossie/p2p/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ package com.aossie.p2p
import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}
}
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.5.10'
ext.kotlin_version = '1.8.0'
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.android.tools.build:gradle:7.1.2'
// classpath 'com.android.tools.build:gradle:3.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Expand Down
3 changes: 2 additions & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ 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.2-all.zip

5 changes: 2 additions & 3 deletions lib/encyption/rsa.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ 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()
{
Expand All @@ -16,6 +16,5 @@ Future<crypto.AsymmetricKeyPair<crypto.PublicKey, crypto.PrivateKey>> getKeyPair
void createPair (){
futureKeyPair=getKeyPair();
futureKeyPair.then((value) => keyPair=value);
var x=encodePrivateKeyToPemPKCS1(keyPair.privateKey);

}
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
@@ -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());
Expand Down
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
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down