feat(interface,android): Allow passing an initial locale to the service
This commit is contained in:
@@ -52,8 +52,9 @@ Future<void> androidEntrypoint() async {
|
||||
final srv = AndroidBackgroundService();
|
||||
GetIt.I.registerSingleton<BackgroundService>(srv);
|
||||
srv.init(
|
||||
entrypoint! as Future<void> Function(),
|
||||
entrypoint! as Future<void> Function(String),
|
||||
handleUIEvent! as Future<void> Function(Map<String, dynamic>? data),
|
||||
data['initialLocale']! as String,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -80,9 +81,10 @@ class AndroidIsolateHandler extends IsolateHandler {
|
||||
|
||||
@override
|
||||
Future<void> start(
|
||||
Future<void> Function() entrypoint,
|
||||
Future<void> Function(String initialLocale) entrypoint,
|
||||
Future<void> Function(Map<String, dynamic>? data) handleUIEvent,
|
||||
Future<void> Function(Map<String, dynamic>? data) handleIsolateEvent,
|
||||
String initialLocale,
|
||||
) async {
|
||||
_log.finest('Called start');
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
@@ -96,7 +98,8 @@ class AndroidIsolateHandler extends IsolateHandler {
|
||||
'genericEntrypoint':
|
||||
PluginUtilities.getCallbackHandle(entrypoint)!.toRawHandle(),
|
||||
'eventHandle':
|
||||
PluginUtilities.getCallbackHandle(handleUIEvent)!.toRawHandle()
|
||||
PluginUtilities.getCallbackHandle(handleUIEvent)!.toRawHandle(),
|
||||
'initialLocale': initialLocale,
|
||||
}),
|
||||
]);
|
||||
|
||||
|
||||
@@ -24,7 +24,10 @@ class AndroidPlatformImplementation extends PlatformImplementation {
|
||||
|
||||
@override
|
||||
Future<bool> generateVideoThumbnail(
|
||||
String src, String dest, int width) async {
|
||||
String src,
|
||||
String dest,
|
||||
int width,
|
||||
) async {
|
||||
return MoxplatformInterface.api.generateVideoThumbnail(src, dest, width);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,9 @@ class AndroidBackgroundService extends BackgroundService {
|
||||
|
||||
@override
|
||||
void init(
|
||||
Future<void> Function() entrypoint,
|
||||
Future<void> Function(String initialLocale) entrypoint,
|
||||
Future<void> Function(Map<String, dynamic>? data) handleEvent,
|
||||
String initialLocale,
|
||||
) {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
@@ -58,6 +59,6 @@ class AndroidBackgroundService extends BackgroundService {
|
||||
|
||||
_log.finest('Running...');
|
||||
|
||||
entrypoint();
|
||||
entrypoint(initialLocale);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user