TF-2667 Create ApplicationVersionWidget to display app version

This commit is contained in:
dab246
2024-03-06 11:14:33 +07:00
committed by Dat H. Pham
parent c9fed1fa41
commit 61687b60e0
20 changed files with 233 additions and 143 deletions
@@ -207,7 +207,6 @@ class ComposerBindings extends BaseBindings {
Get.lazyPut(() => UploadController(Get.find<UploadAttachmentInteractor>()));
Get.lazyPut(() => RichTextWebController());
Get.lazyPut(() => ComposerController(
Get.find<DeviceInfoPlugin>(),
Get.find<LocalFilePickerInteractor>(),
Get.find<LocalImagePickerInteractor>(),
Get.find<GetEmailContentInteractor>(),
@@ -10,7 +10,6 @@ import 'package:device_info_plus/device_info_plus.dart';
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:file_picker/file_picker.dart';
import 'package:filesize/filesize.dart';
import 'package:fk_user_agent/fk_user_agent.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -123,7 +122,6 @@ class ComposerController extends BaseController with DragDropFileMixin {
final LocalFilePickerInteractor _localFilePickerInteractor;
final LocalImagePickerInteractor _localImagePickerInteractor;
final DeviceInfoPlugin _deviceInfoPlugin;
final GetEmailContentInteractor _getEmailContentInteractor;
final GetAllIdentitiesInteractor _getAllIdentitiesInteractor;
final UploadController uploadController;
@@ -189,7 +187,6 @@ class ComposerController extends BaseController with DragDropFileMixin {
late bool _isEmailBodyLoaded;
ComposerController(
this._deviceInfoPlugin,
this._localFilePickerInteractor,
this._localImagePickerInteractor,
this._getEmailContentInteractor,
@@ -209,11 +206,7 @@ class ComposerController extends BaseController with DragDropFileMixin {
createFocusNodeInput();
scrollControllerEmailAddress.addListener(_scrollControllerEmailAddressListener);
_listenStreamEvent();
if (PlatformInfo.isMobile) {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
await FkUserAgent.init();
});
} else {
if (PlatformInfo.isWeb) {
WidgetsBinding.instance.addPostFrameCallback((_) {
_listenBrowserEventAction();
});
@@ -244,9 +237,6 @@ class ComposerController extends BaseController with DragDropFileMixin {
_subscriptionOnDragOver?.cancel();
_subscriptionOnDragLeave?.cancel();
_subscriptionOnDrop?.cancel();
if (PlatformInfo.isMobile) {
FkUserAgent.release();
}
super.onClose();
}
@@ -729,7 +719,7 @@ class ComposerController extends BaseController with DragDropFileMixin {
attachments.addAll(listInlineEmailBodyPart);
}
final userAgent = await userAgentPlatform;
final userAgent = await applicationManager.getUserAgent();
log('ComposerController::_generateEmail(): userAgent: $userAgent');
Map<MailboxId, bool> mailboxIds = {};
@@ -814,21 +804,6 @@ class ComposerController extends BaseController with DragDropFileMixin {
}
}
Future<String> get userAgentPlatform async {
String userAgent;
try {
if (kIsWeb) {
final webBrowserInfo = await _deviceInfoPlugin.webBrowserInfo;
userAgent = webBrowserInfo.userAgent ?? '';
} else {
userAgent = FkUserAgent.userAgent ?? '';
}
} catch (e) {
userAgent = '';
}
return 'Team-Mail/${mailboxDashBoardController.appInformation.value?.version} $userAgent';
}
void validateInformationBeforeSending(BuildContext context) async {
if (isSendEmailLoading.isTrue) {
return;