feat: Add an API for creating direct share shortcuts

This commit is contained in:
2023-07-21 13:04:44 +02:00
parent 3bc880079c
commit 052a4e4700
26 changed files with 368 additions and 36 deletions

View File

@@ -1,5 +1,7 @@
library moxplatform_platform_interface;
export 'src/contacts.dart';
export 'src/contacts_stub.dart';
export 'src/crypto.dart';
export 'src/crypto_stub.dart';
export 'src/interface.dart';

View File

@@ -0,0 +1,22 @@
// The type of icon to use when no avatar path is provided.
enum FallbackIconType {
none(-1),
person(0),
notes(1);
const FallbackIconType(this.id);
// The ID of the fallback icon.
final int id;
}
// Wrapper around various contact APIs.
// ignore: one_member_abstracts
abstract class ContactsImplementation {
Future<void> recordSentMessage(
String name,
String jid, {
String? avatarPath,
FallbackIconType fallbackIcon = FallbackIconType.none,
});
}

View File

@@ -0,0 +1,11 @@
import 'package:moxplatform_platform_interface/src/contacts.dart';
class StubContactsImplementation extends ContactsImplementation {
@override
Future<void> recordSentMessage(
String name,
String jid, {
String? avatarPath,
FallbackIconType fallbackIcon = FallbackIconType.none,
}) async {}
}

View File

@@ -1,3 +1,5 @@
import 'package:moxplatform_platform_interface/src/contacts.dart';
import 'package:moxplatform_platform_interface/src/contacts_stub.dart';
import 'package:moxplatform_platform_interface/src/crypto.dart';
import 'package:moxplatform_platform_interface/src/crypto_stub.dart';
import 'package:moxplatform_platform_interface/src/isolate.dart';
@@ -14,6 +16,7 @@ abstract class MoxplatformInterface extends PlatformInterface {
static IsolateHandler handler = StubIsolateHandler();
static MediaScannerImplementation media = StubMediaScannerImplementation();
static CryptographyImplementation crypto = StubCryptographyImplementation();
static ContactsImplementation contacts = StubContactsImplementation();
/// Return the current platform name.
Future<String?> getPlatformName();