Skip to content
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
Binary file modified android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
33 changes: 20 additions & 13 deletions android/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions android/gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.Registrar;
import io.flutter.plugin.common.EventChannel;

/**
Expand All @@ -50,39 +48,16 @@
public class NearbyConnectionsPlugin implements MethodCallHandler, FlutterPlugin, ActivityAware {
private Activity activity;
private static final String SERVICE_ID = "com.pkmnapps.nearby_connections";
private static MethodChannel channel;
private static EventChannel eventChannel;
private static PluginRegistry.Registrar pluginRegistrar;
private static EventChannel.EventSink eventSink;
private MethodChannel channel;
private EventChannel eventChannel;
private EventChannel.EventSink eventSink;
private NearbyConnectionsPlugin(Activity activity) {
this.activity = activity;
}

public NearbyConnectionsPlugin() {
}

/**
* Legacy Plugin registration.
*/

public static void registerWith(Registrar registrar) {
pluginRegistrar = registrar;
channel = new MethodChannel(registrar.messenger(), "nearby_connections");
channel.setMethodCallHandler(new NearbyConnectionsPlugin(registrar.activity()));
eventChannel=new EventChannel(registrar.messenger(), "nearby_connections/events");
eventChannel.setStreamHandler(
new EventChannel.StreamHandler() {
@Override
public void onListen(Object arguments, EventChannel.EventSink events) {
eventSink=events;
}
@Override
public void onCancel(Object arguments) {
eventSink=null;
}
});
}

@Override
public void onMethodCall(MethodCall call, final Result result) {

Expand Down Expand Up @@ -297,6 +272,7 @@ public void onConnectionInitiated(@NonNull String endpointId, @NonNull Connectio
args.put("endpointId", endpointId);
args.put("endpointName", connectionInfo.getEndpointName());
args.put("authenticationToken", connectionInfo.getAuthenticationToken());
args.put("authenticationDigits", connectionInfo.getAuthenticationDigits());
args.put("isIncomingConnection", connectionInfo.isIncomingConnection());
// channel.invokeMethod("ad.onConnectionInitiated", args);
args.put("method", "ad.onConnectionInitiated");
Expand Down Expand Up @@ -350,6 +326,7 @@ public void onConnectionInitiated(@NonNull String endpointId, @NonNull Connectio
args.put("endpointId", endpointId);
args.put("endpointName", connectionInfo.getEndpointName());
args.put("authenticationToken", connectionInfo.getAuthenticationToken());
args.put("authenticationDigits", connectionInfo.getAuthenticationDigits());
args.put("isIncomingConnection", connectionInfo.isIncomingConnection());
//channel.invokeMethod("dis.onConnectionInitiated", args);
args.put("method", "dis.onConnectionInitiated");
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ class _MyBodyState extends State<Body> {
child: Column(
children: <Widget>[
Text("id: $id"),
Text("Token: ${info.authenticationToken}"),
Text("Token: ${info.authenticationDigits}"),
Text("Name${info.endpointName}"),
Text("Incoming: ${info.isIncomingConnection}"),
ElevatedButton(
Expand Down
46 changes: 23 additions & 23 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ packages:
dependency: transitive
description:
name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
url: "https://pub.dev"
source: hosted
version: "2.11.0"
version: "2.12.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
characters:
dependency: transitive
description:
Expand All @@ -29,10 +29,10 @@ packages:
dependency: transitive
description:
name: clock
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b
url: "https://pub.dev"
source: hosted
version: "1.1.1"
version: "1.1.2"
collection:
dependency: transitive
description:
Expand All @@ -53,10 +53,10 @@ packages:
dependency: transitive
description:
name: fake_async
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
url: "https://pub.dev"
source: hosted
version: "1.3.1"
version: "1.3.2"
ffi:
dependency: transitive
description:
Expand Down Expand Up @@ -132,10 +132,10 @@ packages:
dependency: transitive
description:
name: http
sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010
sha256: fe7ab022b76f3034adc518fb6ea04a82387620e19977665ea18d30a1cf43442f
url: "https://pub.dev"
source: hosted
version: "1.2.2"
version: "1.3.0"
http_parser:
dependency: transitive
description:
Expand Down Expand Up @@ -188,10 +188,10 @@ packages:
dependency: transitive
description:
name: image_picker_macos
sha256: "3f5ad1e8112a9a6111c46d0b57a7be2286a9a07fc6e1976fdf5be2bd31d4ff62"
sha256: "1b90ebbd9dcf98fb6c1d01427e49a55bd96b5d67b8c67cf955d60a5de74207c1"
url: "https://pub.dev"
source: hosted
version: "0.2.1+1"
version: "0.2.1+2"
image_picker_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -220,18 +220,18 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
url: "https://pub.dev"
source: hosted
version: "10.0.7"
version: "10.0.8"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
url: "https://pub.dev"
source: hosted
version: "3.0.8"
version: "3.0.9"
leak_tracker_testing:
dependency: transitive
description:
Expand Down Expand Up @@ -310,15 +310,15 @@ packages:
path: ".."
relative: true
source: path
version: "4.1.1"
version: "4.2.0"
path:
dependency: transitive
description:
name: path
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
url: "https://pub.dev"
source: hosted
version: "1.9.0"
version: "1.9.1"
path_provider:
dependency: "direct main"
description:
Expand Down Expand Up @@ -464,10 +464,10 @@ packages:
dependency: transitive
description:
name: string_scanner
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
sha256: "0bd04f5bb74fcd6ff0606a888a30e917af9bd52820b178eaa464beb11dca84b6"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
version: "1.4.0"
term_glyph:
dependency: transitive
description:
Expand Down Expand Up @@ -504,10 +504,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
url: "https://pub.dev"
source: hosted
version: "14.3.0"
version: "14.3.1"
web:
dependency: transitive
description:
Expand Down
12 changes: 7 additions & 5 deletions lib/src/classes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ class PayloadTransferUpdate {
///
/// [endPointName] is userNickName of requester
///
/// [authenticationToken] can be used to check the connection security
/// it must be same on both devices
/// [authenticationDigits] can be used to check the connection security,
/// it will be the same on both devices.
class ConnectionInfo {
String endpointName, authenticationToken;
@Deprecated('Use authenticationDigits instead')
String authenticationToken;
String endpointName, authenticationDigits;
bool isIncomingConnection;

ConnectionInfo(
this.endpointName, this.authenticationToken, this.isIncomingConnection);
ConnectionInfo(this.endpointName, this.authenticationToken,
this.isIncomingConnection, this.authenticationDigits);
}
Loading