feat: Improve notifications, add donation button, improved asn form field

This commit is contained in:
Anton Stubenbord
2023-03-06 22:21:14 +01:00
parent bd891a8658
commit 1172e54199
37 changed files with 985 additions and 305 deletions

View File

@@ -0,0 +1,11 @@
import 'package:json_annotation/json_annotation.dart';
enum NotificationResponseButtonAction {
openCreatedDocument,
acknowledgeCreatedDocument;
}
@JsonEnum()
enum NotificationResponseOpenAction {
openDownloadedDocumentPath;
}

View File

@@ -0,0 +1,9 @@
enum NotificationChannel {
task("task_channel", "Paperless tasks"),
documentDownload("document_download_channel", "Document downloads");
final String id;
final String name;
const NotificationChannel(this.id, this.name);
}

View File

@@ -0,0 +1,15 @@
import 'package:json_annotation/json_annotation.dart';
part 'create_document_success_payload.g.dart';
@JsonSerializable()
class CreateDocumentSuccessPayload {
final int documentId;
CreateDocumentSuccessPayload(this.documentId);
factory CreateDocumentSuccessPayload.fromJson(Map<String, dynamic> json) =>
_$CreateDocumentSuccessPayloadFromJson(json);
Map<String, dynamic> toJson() => _$CreateDocumentSuccessPayloadToJson(this);
}

View File

@@ -0,0 +1,8 @@
import 'package:paperless_mobile/features/notifications/models/notification_actions.dart';
abstract class NotificationTapResponsePayload {
final NotificationResponseOpenAction type;
Map<String, dynamic> toJson();
NotificationTapResponsePayload({required this.type});
}

View File

@@ -0,0 +1,19 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:paperless_mobile/features/notifications/models/notification_actions.dart';
import 'package:paperless_mobile/features/notifications/models/notification_payloads/notification_tap/notification_tap_response_payload.dart';
part 'open_downloaded_document_payload.g.dart';
@JsonSerializable()
class OpenDownloadedDocumentPayload extends NotificationTapResponsePayload {
final String filePath;
OpenDownloadedDocumentPayload({
required this.filePath,
super.type = NotificationResponseOpenAction.openDownloadedDocumentPath,
});
factory OpenDownloadedDocumentPayload.fromJson(Map<String, dynamic> json) =>
_$OpenDownloadedDocumentPayloadFromJson(json);
@override
Map<String, dynamic> toJson() => _$OpenDownloadedDocumentPayloadToJson(this);
}