fix(recordings): open folder with android picker
This commit is contained in:
@@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:geocoding/geocoding.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
@@ -23,6 +24,10 @@ enum OrdenEmisoras { nombre, calidad }
|
||||
|
||||
/// Estado global de la app con ChangeNotifier (Provider).
|
||||
class EstadoRadio extends ChangeNotifier {
|
||||
static const MethodChannel _fileActionsChannel = MethodChannel(
|
||||
'pluriwave/file_actions',
|
||||
);
|
||||
|
||||
EstadoRadio({
|
||||
ServicioAudio? audio,
|
||||
ServicioFavoritos? favoritos,
|
||||
@@ -626,6 +631,13 @@ class EstadoRadio extends ChangeNotifier {
|
||||
Future<bool> abrirDirectorioGrabacion() async {
|
||||
final ruta = await directorioGrabacionEfectivo();
|
||||
await Directory(ruta).create(recursive: true);
|
||||
if (!kIsWeb && Platform.isAndroid) {
|
||||
final abierto = await _fileActionsChannel.invokeMethod<bool>(
|
||||
'openDirectory',
|
||||
{'path': ruta},
|
||||
);
|
||||
return abierto ?? false;
|
||||
}
|
||||
final uri = Uri.directory(ruta);
|
||||
return launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user