feat: Add an API for creating direct share shortcuts
This commit is contained in:
32
packages/moxplatform_android/lib/src/contacts_android.dart
Normal file
32
packages/moxplatform_android/lib/src/contacts_android.dart
Normal file
@@ -0,0 +1,32 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:moxplatform_platform_interface/moxplatform_platform_interface.dart';
|
||||
|
||||
class AndroidContactsImplementation extends ContactsImplementation {
|
||||
final _methodChannel = const MethodChannel('me.polynom.moxplatform_android');
|
||||
|
||||
@override
|
||||
Future<void> recordSentMessage(
|
||||
String name,
|
||||
String jid, {
|
||||
String? avatarPath,
|
||||
FallbackIconType fallbackIcon = FallbackIconType.none,
|
||||
}) async {
|
||||
// Ensure we always have an icon
|
||||
if (avatarPath != null) {
|
||||
assert(
|
||||
fallbackIcon != FallbackIconType.none,
|
||||
'If no avatar is specified, then a fallbackIcon must be set',
|
||||
);
|
||||
}
|
||||
|
||||
await _methodChannel.invokeMethod<void>(
|
||||
'recordSentMessage',
|
||||
[
|
||||
name,
|
||||
jid,
|
||||
avatarPath,
|
||||
fallbackIcon.id,
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:moxplatform_android/src/contacts_android.dart';
|
||||
import 'package:moxplatform_android/src/crypto_android.dart';
|
||||
import 'package:moxplatform_android/src/isolate_android.dart';
|
||||
import 'package:moxplatform_android/src/media_android.dart';
|
||||
@@ -7,9 +8,10 @@ class MoxplatformAndroidPlugin extends MoxplatformInterface {
|
||||
static void registerWith() {
|
||||
// ignore: avoid_print
|
||||
print('MoxplatformAndroidPlugin: Registering implementation');
|
||||
MoxplatformInterface.contacts = AndroidContactsImplementation();
|
||||
MoxplatformInterface.crypto = AndroidCryptographyImplementation();
|
||||
MoxplatformInterface.handler = AndroidIsolateHandler();
|
||||
MoxplatformInterface.media = AndroidMediaScannerImplementation();
|
||||
MoxplatformInterface.crypto = AndroidCryptographyImplementation();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user