feat: Move over the service/background service API
This commit is contained in:
@@ -1,7 +1,18 @@
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:moxxy_native/moxxy_native.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
Future<void> entrypoint() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
print('CALLED FROM NEW FLUTTERENGINE');
|
||||
final extra = await MoxxyBackgroundServiceApi().getExtraData();
|
||||
print('EXTRA DATA: $extra');
|
||||
}
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
@@ -96,6 +107,32 @@ class MyAppState extends State<MyApp> {
|
||||
child: const Text('Test cryptography'),
|
||||
),
|
||||
if (imagePath != null) Image.file(File(imagePath!)),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
// Create channel
|
||||
await MoxxyNotificationsApi().createNotificationChannels(
|
||||
[
|
||||
NotificationChannel(
|
||||
id: 'foreground_service',
|
||||
title: 'Foreground service',
|
||||
description: 'lol',
|
||||
importance: NotificationChannelImportance.MIN,
|
||||
showBadge: false,
|
||||
vibration: false,
|
||||
enableLights: false,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
await Permission.notification.request();
|
||||
|
||||
final handle = PluginUtilities.getCallbackHandle(entrypoint)!
|
||||
.toRawHandle();
|
||||
final api = MoxxyServiceApi();
|
||||
await api.configure(handle, 'lol');
|
||||
await api.start();
|
||||
},
|
||||
child: const Text('Start foreground service')),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -130,6 +130,54 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.8.2"
|
||||
permission_handler:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: permission_handler
|
||||
sha256: bc56bfe9d3f44c3c612d8d393bd9b174eb796d706759f9b495ac254e4294baa5
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.4.5"
|
||||
permission_handler_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_android
|
||||
sha256: "59c6322171c29df93a22d150ad95f3aa19ed86542eaec409ab2691b8f35f9a47"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.3.6"
|
||||
permission_handler_apple:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_apple
|
||||
sha256: "99e220bce3f8877c78e4ace901082fb29fa1b4ebde529ad0932d8d664b34f3f5"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.1.4"
|
||||
permission_handler_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_platform_interface
|
||||
sha256: f2343e9fa9c22ae4fd92d4732755bfe452214e7189afcc097380950cf567b4b2
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.11.5"
|
||||
permission_handler_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_windows
|
||||
sha256: cc074aace208760f1eee6aa4fae766b45d947df85bc831cde77009cdb4720098
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: plugin_platform_interface
|
||||
sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.6"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@@ -193,4 +241,4 @@ packages:
|
||||
version: "2.1.4"
|
||||
sdks:
|
||||
dart: ">=2.19.6 <3.0.0"
|
||||
flutter: ">=2.5.0"
|
||||
flutter: ">=2.8.0"
|
||||
|
||||
@@ -28,6 +28,7 @@ dependencies:
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.2
|
||||
permission_handler: ^10.4.5
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user