TF-32 Add domain layer of download attachment for android platform

This commit is contained in:
dab246
2021-09-16 09:07:11 +07:00
committed by Dat H. Pham
parent 9b43417ac8
commit ddf8a32e66
16 changed files with 214 additions and 13 deletions
@@ -1,4 +1,6 @@
import 'package:core/core.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:get/get.dart';
import 'package:tmail_ui_user/features/login/domain/state/get_credential_state.dart';
import 'package:tmail_ui_user/features/login/domain/usecases/get_credential_interactor.dart';
@@ -14,9 +16,18 @@ class HomeController extends GetxController {
@override
void onReady() {
super.onReady();
_initFlutterDownloader();
_getCredentialAction();
}
void _initFlutterDownloader() {
FlutterDownloader
.initialize(debug: kDebugMode)
.then((_) => FlutterDownloader.registerCallback(downloadCallback));
}
static void downloadCallback(String id, DownloadTaskStatus status, int progress) {}
void _getCredentialAction() async {
await _getCredentialInteractor.execute()
.then((response) => response.fold(