version 0.1.3

This commit is contained in:
ksenia312
2025-04-01 13:38:08 +02:00
parent 4a42db7e12
commit c391cc5f26
22 changed files with 68 additions and 28 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
{
"flutter": "3.24.0",
"flutter": "3.27.4",
"flavors": {}
}
+7
View File
@@ -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
- [Android]: Improve files management and connection
+9
View File
@@ -19,6 +19,15 @@ The package does not support communication between Android and IOS devices, the
Your feedback and suggestions would be greatly
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
- [About](#about)
+4 -3
View File
@@ -2,14 +2,14 @@ group 'com.xenikii.nearby_service'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '2.1.20'
repositories {
google()
mavenCentral()
}
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"
}
}
@@ -25,7 +25,8 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
compileSdk 33
compileSdk 35
namespace 'com.xenikii.nearby_service'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
+1 -2
View File
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xenikii.nearby_service">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- required to use Wi-fi Direct on Android 13+ -->
<uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES" />
<!-- required to use Wi-fi Direct -->
@@ -14,6 +14,7 @@ import android.os.Build
/**
* Receiver of [WifiP2pManager] changes.
*/
@Suppress("DEPRECATION")
class NearbyServiceBroadcastReceiver(
private val wifiManager: WifiP2pManager,
private val wifiChannel: Channel,
@@ -34,7 +35,7 @@ class NearbyServiceBroadcastReceiver(
}
WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION -> {
writeDevices()
writeDevices { intent.getParcelableExtra(WifiP2pManager.EXTRA_P2P_DEVICE_LIST) }
}
WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION -> {
@@ -76,13 +77,19 @@ class NearbyServiceBroadcastReceiver(
}
}
private fun writeDevices() {
private fun writeDevices(deviceListSupplier: (() -> WifiP2pDeviceList?)? = null) {
try {
wifiManager.requestPeers(
wifiChannel
) { newPeers: WifiP2pDeviceList ->
) { data: WifiP2pDeviceList ->
val list: MutableList<String> = mutableListOf()
val newPeers =
if (data.deviceList.isEmpty() && deviceListSupplier != null) {
deviceListSupplier() ?: data
} else {
data
}
if (newPeers.deviceList.isEmpty() && connectedDevice != null) {
connectedDevice = null
}
+2
View File
@@ -5,9 +5,11 @@
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/
# IntelliJ related
+1 -1
View File
@@ -27,7 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
namespace "com.xenikii.nearby_service_example"
compileSdk 34
compileSdk 35
ndkVersion flutter.ndkVersion
compileOptions {
+2 -2
View File
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.9.22'
ext.kotlin_version = '2.1.20'
repositories {
google()
mavenCentral()
}
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"
}
}
+3
View File
@@ -1,3 +1,6 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
+3 -1
View File
@@ -2,4 +2,6 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
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
+2 -2
View File
@@ -9,7 +9,7 @@ environment:
dependencies:
provider: ^6.1.1
file_picker: ^6.1.1
file_picker: ^10.0.0
flutter:
sdk: flutter
@@ -22,7 +22,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^3.0.1
flutter_lints: ^5.0.0
flutter:
uses-material-design: true
+2
View File
@@ -5,9 +5,11 @@
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/
# IntelliJ related
+1 -1
View File
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '2.1.20'
repositories {
google()
mavenCentral()
+3
View File
@@ -1,3 +1,6 @@
org.gradle.jvmargs=-Xmx4G
android.useAndroidX=true
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
+1 -1
View File
@@ -23,7 +23,7 @@ pluginManagement {
plugins {
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"
@@ -19,7 +19,7 @@ class DevicePreview extends StatelessWidget {
final color = device.status.isConnected ? kGreenColor : kGreyColor;
final avatar = CircleAvatar(
backgroundColor: kBlueColor.withOpacity(0.7),
backgroundColor: kBlueColor.withValues(alpha: 0.7),
foregroundColor: kWhiteColor,
maxRadius: largeView ? 100 : 30,
child: Padding(
@@ -120,7 +120,7 @@ class _InfoChip extends StatelessWidget {
boxShadow: [
BoxShadow(
blurRadius: 2,
color: Theme.of(context).shadowColor.withOpacity(0.4),
color: Theme.of(context).shadowColor.withValues(alpha: 0.4),
offset: const Offset(0, 1),
),
],
@@ -133,15 +133,18 @@ class _InfoChip extends StatelessWidget {
'$label: ',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 12,
color: Theme.of(context).colorScheme.onSurface,
),
),
Text(
Flexible(
child: Text(
value,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
),
),
),
],
),
);
+1 -1
View File
@@ -33,7 +33,7 @@ class ActionButton extends StatelessWidget {
maximumSize: const Size(150, 50),
minimumSize: const Size(70, 50),
elevation: 2,
surfaceTintColor: type.color.withOpacity(0.05),
surfaceTintColor: type.color.withValues(alpha: 0.05),
),
child: Text(
title,
+2 -2
View File
@@ -7,7 +7,7 @@ environment:
dependencies:
provider: ^6.1.1
file_picker: ^6.1.1
file_picker: ^10.0.0
flutter:
sdk: flutter
@@ -20,7 +20,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^3.0.1
flutter_lints: ^5.0.0
flutter:
uses-material-design: true
+1 -1
View File
@@ -1,6 +1,6 @@
name: nearby_service
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
repository: https://github.com/ksenia312/nearby_service