FCM kinda works [does not receive notifications]
This commit is contained in:
@@ -38,33 +38,18 @@ class Channel {
|
||||
}
|
||||
}
|
||||
|
||||
class ChannelWithSubscription extends Channel {
|
||||
class ChannelWithSubscription {
|
||||
final Channel channel;
|
||||
final Subscription subscription;
|
||||
|
||||
ChannelWithSubscription({
|
||||
required super.channelID,
|
||||
required super.ownerUserID,
|
||||
required super.internalName,
|
||||
required super.displayName,
|
||||
required super.descriptionName,
|
||||
required super.subscribeKey,
|
||||
required super.timestampCreated,
|
||||
required super.timestampLastSent,
|
||||
required super.messagesSent,
|
||||
required this.channel,
|
||||
required this.subscription,
|
||||
});
|
||||
|
||||
factory ChannelWithSubscription.fromJson(Map<String, dynamic> json) {
|
||||
return ChannelWithSubscription(
|
||||
channelID: json['channel_id'] as String,
|
||||
ownerUserID: json['owner_user_id'] as String,
|
||||
internalName: json['internal_name'] as String,
|
||||
displayName: json['display_name'] as String,
|
||||
descriptionName: json['description_name'] as String?,
|
||||
subscribeKey: json['subscribe_key'] as String?,
|
||||
timestampCreated: json['timestamp_created'] as String,
|
||||
timestampLastSent: json['timestamp_lastsent'] as String?,
|
||||
messagesSent: json['messages_sent'] as int,
|
||||
channel: Channel.fromJson(json),
|
||||
subscription: Subscription.fromJson(json['subscription'] as Map<String, dynamic>),
|
||||
);
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ class Client {
|
||||
timestampCreated: json['timestamp_created'] as String,
|
||||
agentModel: json['agent_model'] as String,
|
||||
agentVersion: json['agent_version'] as String,
|
||||
descriptionName: json['description_name'] as String?,
|
||||
descriptionName: json.containsKey('description_name') ? (json['description_name'] as String?) : null, //TODO change once API is updated / branch is merged
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,11 @@
|
||||
class KeyTokenAuth {
|
||||
final String userId;
|
||||
final String token;
|
||||
final String tokenAdmin;
|
||||
final String tokenSend;
|
||||
|
||||
KeyTokenAuth({required this.userId, required this.token});
|
||||
KeyTokenAuth({
|
||||
required this.userId,
|
||||
required this.tokenAdmin,
|
||||
required this.tokenSend,
|
||||
});
|
||||
}
|
||||
|
@@ -1,3 +1,5 @@
|
||||
import 'package:simplecloudnotifier/models/client.dart';
|
||||
|
||||
class User {
|
||||
final String userID;
|
||||
final String? username;
|
||||
@@ -62,3 +64,29 @@ class User {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class UserWithClientsAndKeys {
|
||||
final User user;
|
||||
final List<Client> clients;
|
||||
final String sendKey;
|
||||
final String readKey;
|
||||
final String adminKey;
|
||||
|
||||
UserWithClientsAndKeys({
|
||||
required this.user,
|
||||
required this.clients,
|
||||
required this.sendKey,
|
||||
required this.readKey,
|
||||
required this.adminKey,
|
||||
});
|
||||
|
||||
factory UserWithClientsAndKeys.fromJson(Map<String, dynamic> json) {
|
||||
return UserWithClientsAndKeys(
|
||||
user: User.fromJson(json),
|
||||
clients: Client.fromJsonArray(json['clients'] as List<dynamic>),
|
||||
sendKey: json['send_key'] as String,
|
||||
readKey: json['read_key'] as String,
|
||||
adminKey: json['admin_key'] as String,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user