version 0.1.3
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"flutter": "3.24.0",
|
"flutter": "3.27.4",
|
||||||
"flavors": {}
|
"flavors": {}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,10 @@
|
|||||||
|
## 0.1.3
|
||||||
|
|
||||||
|
- [Android]: Use intent to get peers when requestPeers() returns empty
|
||||||
|
- Update README: add Video section
|
||||||
|
- Use Flutter 3.27.4
|
||||||
|
- Upgrade AGP to 8.2.1 in examples
|
||||||
|
|
||||||
## 0.1.2
|
## 0.1.2
|
||||||
|
|
||||||
- [Android]: Improve files management and connection
|
- [Android]: Improve files management and connection
|
||||||
|
|||||||
@@ -19,6 +19,15 @@ The package does not support communication between Android and IOS devices, the
|
|||||||
Your feedback and suggestions would be greatly
|
Your feedback and suggestions would be greatly
|
||||||
appreciated! [You can leave your opinion here](https://forms.gle/FbAtW2dG5RYCxb1DA)
|
appreciated! [You can leave your opinion here](https://forms.gle/FbAtW2dG5RYCxb1DA)
|
||||||
|
|
||||||
|
## Video
|
||||||
|
|
||||||
|
Watch a quick demonstration in MP4 format:
|
||||||
|
- [Android](https://drive.google.com/file/d/1nxdzDjBC6pMmT5GEyf4u88X5Q77khCWy/view?usp=drive_link)
|
||||||
|
- [iOS](https://drive.google.com/file/d/1MDyDxMJ5jjU9lr-wGeqcAY1uEEHNHTZ_/view?usp=drive_link)
|
||||||
|
|
||||||
|
Or find the GIF demo at the end of the README:
|
||||||
|
- [Demo](#demo)
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
- [About](#about)
|
- [About](#about)
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ group 'com.xenikii.nearby_service'
|
|||||||
version '1.0-SNAPSHOT'
|
version '1.0-SNAPSHOT'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.7.10'
|
ext.kotlin_version = '2.1.20'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.3.1'
|
classpath 'com.android.tools.build:gradle:8.1.0'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,8 @@ apply plugin: 'com.android.library'
|
|||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdk 33
|
compileSdk 35
|
||||||
|
namespace 'com.xenikii.nearby_service'
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
package="com.xenikii.nearby_service">
|
|
||||||
<!-- required to use Wi-fi Direct on Android 13+ -->
|
<!-- required to use Wi-fi Direct on Android 13+ -->
|
||||||
<uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES" />
|
<uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES" />
|
||||||
<!-- required to use Wi-fi Direct -->
|
<!-- required to use Wi-fi Direct -->
|
||||||
|
|||||||
+10
-3
@@ -14,6 +14,7 @@ import android.os.Build
|
|||||||
/**
|
/**
|
||||||
* Receiver of [WifiP2pManager] changes.
|
* Receiver of [WifiP2pManager] changes.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
class NearbyServiceBroadcastReceiver(
|
class NearbyServiceBroadcastReceiver(
|
||||||
private val wifiManager: WifiP2pManager,
|
private val wifiManager: WifiP2pManager,
|
||||||
private val wifiChannel: Channel,
|
private val wifiChannel: Channel,
|
||||||
@@ -34,7 +35,7 @@ class NearbyServiceBroadcastReceiver(
|
|||||||
}
|
}
|
||||||
|
|
||||||
WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION -> {
|
WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION -> {
|
||||||
writeDevices()
|
writeDevices { intent.getParcelableExtra(WifiP2pManager.EXTRA_P2P_DEVICE_LIST) }
|
||||||
}
|
}
|
||||||
|
|
||||||
WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION -> {
|
WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION -> {
|
||||||
@@ -76,13 +77,19 @@ class NearbyServiceBroadcastReceiver(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun writeDevices() {
|
private fun writeDevices(deviceListSupplier: (() -> WifiP2pDeviceList?)? = null) {
|
||||||
try {
|
try {
|
||||||
wifiManager.requestPeers(
|
wifiManager.requestPeers(
|
||||||
wifiChannel
|
wifiChannel
|
||||||
) { newPeers: WifiP2pDeviceList ->
|
) { data: WifiP2pDeviceList ->
|
||||||
val list: MutableList<String> = mutableListOf()
|
val list: MutableList<String> = mutableListOf()
|
||||||
|
|
||||||
|
val newPeers =
|
||||||
|
if (data.deviceList.isEmpty() && deviceListSupplier != null) {
|
||||||
|
deviceListSupplier() ?: data
|
||||||
|
} else {
|
||||||
|
data
|
||||||
|
}
|
||||||
if (newPeers.deviceList.isEmpty() && connectedDevice != null) {
|
if (newPeers.deviceList.isEmpty() && connectedDevice != null) {
|
||||||
connectedDevice = null
|
connectedDevice = null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,11 @@
|
|||||||
*.swp
|
*.swp
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.atom/
|
.atom/
|
||||||
|
.build/
|
||||||
.buildlog/
|
.buildlog/
|
||||||
.history
|
.history
|
||||||
.svn/
|
.svn/
|
||||||
|
.swiftpm/
|
||||||
migrate_working_dir/
|
migrate_working_dir/
|
||||||
|
|
||||||
# IntelliJ related
|
# IntelliJ related
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
namespace "com.xenikii.nearby_service_example"
|
namespace "com.xenikii.nearby_service_example"
|
||||||
compileSdk 34
|
compileSdk 35
|
||||||
ndkVersion flutter.ndkVersion
|
ndkVersion flutter.ndkVersion
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.9.22'
|
ext.kotlin_version = '2.1.20'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.4.2'
|
classpath 'com.android.tools.build:gradle:8.2.1'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
org.gradle.jvmargs=-Xmx1536M
|
org.gradle.jvmargs=-Xmx1536M
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
android.defaults.buildfeatures.buildconfig=true
|
||||||
|
android.nonTransitiveRClass=false
|
||||||
|
android.nonFinalResIds=false
|
||||||
|
|||||||
@@ -2,4 +2,6 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ environment:
|
|||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
provider: ^6.1.1
|
provider: ^6.1.1
|
||||||
file_picker: ^6.1.1
|
file_picker: ^10.0.0
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ dependencies:
|
|||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_lints: ^3.0.1
|
flutter_lints: ^5.0.0
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|||||||
@@ -5,9 +5,11 @@
|
|||||||
*.swp
|
*.swp
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.atom/
|
.atom/
|
||||||
|
.build/
|
||||||
.buildlog/
|
.buildlog/
|
||||||
.history
|
.history
|
||||||
.svn/
|
.svn/
|
||||||
|
.swiftpm/
|
||||||
migrate_working_dir/
|
migrate_working_dir/
|
||||||
|
|
||||||
# IntelliJ related
|
# IntelliJ related
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.7.10'
|
ext.kotlin_version = '2.1.20'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
org.gradle.jvmargs=-Xmx4G
|
org.gradle.jvmargs=-Xmx4G
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
android.defaults.buildfeatures.buildconfig=true
|
||||||
|
android.nonTransitiveRClass=false
|
||||||
|
android.nonFinalResIds=false
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ pluginManagement {
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||||
id "com.android.application" version "7.3.0" apply false
|
id "com.android.application" version '8.2.2' apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
include ":app"
|
include ":app"
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class DevicePreview extends StatelessWidget {
|
|||||||
final color = device.status.isConnected ? kGreenColor : kGreyColor;
|
final color = device.status.isConnected ? kGreenColor : kGreyColor;
|
||||||
|
|
||||||
final avatar = CircleAvatar(
|
final avatar = CircleAvatar(
|
||||||
backgroundColor: kBlueColor.withOpacity(0.7),
|
backgroundColor: kBlueColor.withValues(alpha: 0.7),
|
||||||
foregroundColor: kWhiteColor,
|
foregroundColor: kWhiteColor,
|
||||||
maxRadius: largeView ? 100 : 30,
|
maxRadius: largeView ? 100 : 30,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class _InfoChip extends StatelessWidget {
|
|||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
blurRadius: 2,
|
blurRadius: 2,
|
||||||
color: Theme.of(context).shadowColor.withOpacity(0.4),
|
color: Theme.of(context).shadowColor.withValues(alpha: 0.4),
|
||||||
offset: const Offset(0, 1),
|
offset: const Offset(0, 1),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -133,13 +133,16 @@ class _InfoChip extends StatelessWidget {
|
|||||||
'$label: ',
|
'$label: ',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 12,
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Flexible(
|
||||||
value,
|
child: Text(
|
||||||
style: TextStyle(
|
value,
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class ActionButton extends StatelessWidget {
|
|||||||
maximumSize: const Size(150, 50),
|
maximumSize: const Size(150, 50),
|
||||||
minimumSize: const Size(70, 50),
|
minimumSize: const Size(70, 50),
|
||||||
elevation: 2,
|
elevation: 2,
|
||||||
surfaceTintColor: type.color.withOpacity(0.05),
|
surfaceTintColor: type.color.withValues(alpha: 0.05),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
title,
|
title,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ environment:
|
|||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
provider: ^6.1.1
|
provider: ^6.1.1
|
||||||
file_picker: ^6.1.1
|
file_picker: ^10.0.0
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ dependencies:
|
|||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_lints: ^3.0.1
|
flutter_lints: ^5.0.0
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
name: nearby_service
|
name: nearby_service
|
||||||
description: Nearby Service Flutter Plugin is used to create connections in a P2P network. Supports sending text messages and files.
|
description: Nearby Service Flutter Plugin is used to create connections in a P2P network. Supports sending text messages and files.
|
||||||
version: 0.1.2
|
version: 0.1.3
|
||||||
homepage: https://github.com/ksenia312/nearby_service
|
homepage: https://github.com/ksenia312/nearby_service
|
||||||
repository: https://github.com/ksenia312/nearby_service
|
repository: https://github.com/ksenia312/nearby_service
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user