feat(lib, android, ios): permissions clean up, add id to files pack
This commit is contained in:
@@ -7,12 +7,14 @@ import 'package:nearby_service/nearby_service.dart';
|
||||
///
|
||||
class ReceivedNearbyFilesPack implements NearbyReceivedInterface {
|
||||
const ReceivedNearbyFilesPack({
|
||||
required this.id,
|
||||
required this.sender,
|
||||
required this.files,
|
||||
});
|
||||
|
||||
factory ReceivedNearbyFilesPack.fromJson(Map<String, dynamic>? json) {
|
||||
return ReceivedNearbyFilesPack(
|
||||
id: json?['id'],
|
||||
sender: NearbyDeviceInfo.fromJson(json?['sender']),
|
||||
files: [
|
||||
...?(json?['files'] as List?)?.map(
|
||||
@@ -30,8 +32,14 @@ class ReceivedNearbyFilesPack implements NearbyReceivedInterface {
|
||||
///
|
||||
final List<NearbyFileInfo> files;
|
||||
|
||||
///
|
||||
/// ID of the files pack
|
||||
///
|
||||
final String id;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'sender': sender.toJson(),
|
||||
'files': [
|
||||
...files.map((e) => e.toJson()),
|
||||
@@ -45,13 +53,14 @@ class ReceivedNearbyFilesPack implements NearbyReceivedInterface {
|
||||
other is ReceivedNearbyFilesPack &&
|
||||
runtimeType == other.runtimeType &&
|
||||
sender == other.sender &&
|
||||
files == other.files;
|
||||
files == other.files &&
|
||||
id == other.id;
|
||||
|
||||
@override
|
||||
int get hashCode => sender.hashCode ^ files.hashCode;
|
||||
int get hashCode => sender.hashCode ^ files.hashCode ^ id.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'NearbyFilesPack{sender: $sender, files: $files}';
|
||||
return 'ReceivedNearbyFilesPack{sender: $sender, files: $files, id: $id}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,6 +177,6 @@ final class NearbyMessageFilesResponse extends NearbyMessageContent {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'NearbyMessageFileResponse{response: $isAccepted, id: $id}';
|
||||
return 'NearbyMessageFileResponse{isAccepted: $isAccepted, id: $id}';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user