import 'dart:io';

import 'package:path_provider/path_provider.dart';
import 'package:vitalapp/architecture/defines.dart';

import 'state.dart';

class AdminController extends FControllerBase {
  final state = AdminState();

  @override
  void onReady() {
    // TODO: implement onReady
    super.onReady();
  }

  void cpDbFileLoki() async {
    var sPath = "/data/user/0/com.vinno.vitalapp/databases/vital.db";
    final directory = await getExternalStorageDirectory();
    final path = directory?.path;
    final sourceFile = File(sPath);
    final destFile = File('$path/vital.db');

    await destFile.create(recursive: true);
    await sourceFile.copy(destFile.path);
  }

  void cpDbFileFinlay() async {
    var sPath = "/data/user/0/com.vinno.vitalapp/databases/vital.db";
    final directory = await getExternalStorageDirectory();
    final path = directory?.path;
    final destFile = File('$path/vital.db');
    final sourceFile = File(sPath);
    await destFile.copy(sourceFile.path);
  }
}
