Horváth Gergely b7b3a37b52 - data backup
- I can't test it because I'm stuck on the login screen.
2024-05-02 01:41:04 +02:00

43 lines
1.3 KiB
Dart

import 'dart:async';
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
class PlatformChannel {
static const MethodChannel _channel = MethodChannel('hu.refilc/liveactivity');
static Future<void> createLiveActivity(
Map<String, dynamic> activityData) async {
if (Platform.isIOS) {
try {
debugPrint("creating...");
await _channel.invokeMethod('createLiveActivity', activityData);
} on PlatformException catch (e) {
debugPrint("Hiba történt a Live Activity létrehozásakor: ${e.message}");
}
}
}
static Future<void> updateLiveActivity(
Map<String, dynamic> activityData) async {
if (Platform.isIOS) {
try {
debugPrint("updating...");
await _channel.invokeMethod('updateLiveActivity', activityData);
} on PlatformException catch (e) {
debugPrint("Hiba történt a Live Activity frissítésekor: ${e.message}");
}
}
}
static Future<void> endLiveActivity() async {
if (Platform.isIOS) {
try {
debugPrint("finishing...");
await _channel.invokeMethod('endLiveActivity');
} on PlatformException catch (e) {
debugPrint("Hiba történt a Live Activity befejezésekor: ${e.message}");
}
}
}
}