2023-07-27 18:45:09 +00:00
|
|
|
import 'package:pigeon/pigeon.dart';
|
|
|
|
|
|
|
|
@ConfigurePigeon(
|
|
|
|
PigeonOptions(
|
2023-07-27 22:46:19 +00:00
|
|
|
dartOut: 'packages/moxplatform_platform_interface/lib/src/api.g.dart',
|
2023-07-27 18:45:09 +00:00
|
|
|
//kotlinOut: 'packages/moxplatform_android/android/src/main/java/me/polynom/moxplatform_android/Notifications.g.kt',
|
|
|
|
//kotlinOptions: KotlinOptions(
|
|
|
|
// package: 'me.polynom.moxplatform_android',
|
|
|
|
//),
|
2023-07-27 22:46:19 +00:00
|
|
|
javaOut: 'packages/moxplatform_android/android/src/main/java/me/polynom/moxplatform_android/Api.java',
|
2023-07-27 18:45:09 +00:00
|
|
|
javaOptions: JavaOptions(
|
|
|
|
package: 'me.polynom.moxplatform_android',
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
2023-08-03 19:19:11 +00:00
|
|
|
enum CipherAlgorithm {
|
|
|
|
aes128GcmNoPadding,
|
|
|
|
aes256GcmNoPadding,
|
|
|
|
aes256CbcPkcs7;
|
|
|
|
}
|
|
|
|
|
|
|
|
class CryptographyResult {
|
|
|
|
const CryptographyResult(this.plaintextHash, this.ciphertextHash);
|
|
|
|
final Uint8List plaintextHash;
|
|
|
|
final Uint8List ciphertextHash;
|
|
|
|
}
|
|
|
|
|
2023-08-03 19:27:13 +00:00
|
|
|
// The type of icon to use when no avatar path is provided.
|
|
|
|
enum FallbackIconType {
|
|
|
|
none,
|
|
|
|
person,
|
|
|
|
notes;
|
|
|
|
}
|
|
|
|
|
2023-07-27 18:45:09 +00:00
|
|
|
@HostApi()
|
2023-07-27 22:46:19 +00:00
|
|
|
abstract class MoxplatformApi {
|
2023-08-03 19:19:11 +00:00
|
|
|
/// Platform APIs
|
2023-07-27 22:46:19 +00:00
|
|
|
String getPersistentDataPath();
|
|
|
|
String getCacheDataPath();
|
2023-08-04 22:04:49 +00:00
|
|
|
void openBatteryOptimisationSettings();
|
|
|
|
bool isIgnoringBatteryOptimizations();
|
2023-08-03 19:19:11 +00:00
|
|
|
|
2023-08-03 19:27:13 +00:00
|
|
|
/// Contacts APIs
|
|
|
|
void recordSentMessage(String name, String jid, String? avatarPath, FallbackIconType fallbackIcon);
|
|
|
|
|
2023-08-03 19:19:11 +00:00
|
|
|
/// Cryptography APIs
|
|
|
|
@async CryptographyResult? encryptFile(String sourcePath, String destPath, Uint8List key, Uint8List iv, CipherAlgorithm algorithm, String hashSpec);
|
|
|
|
@async CryptographyResult? decryptFile(String sourcePath, String destPath, Uint8List key, Uint8List iv, CipherAlgorithm algorithm, String hashSpec);
|
|
|
|
@async Uint8List? hashFile(String sourcePath, String hashSpec);
|
|
|
|
|
2023-08-24 18:06:31 +00:00
|
|
|
/// Media APIs
|
|
|
|
bool generateVideoThumbnail(String src, String dest, int maxWidth);
|
2023-07-27 18:45:09 +00:00
|
|
|
}
|