TF-3260 Load & Display App Grid Linagora Ecosystem
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
+13
-1
@@ -1,3 +1,4 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/linagora_ecosystem/empty_linagora_ecosystem.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/linagora_ecosystem/linagora_ecosystem_properties.dart';
|
||||
@@ -11,7 +12,7 @@ class AppLinagoraEcosystem extends LinagoraEcosystemProperties {
|
||||
final String? androidPackageId;
|
||||
final String? iosUrlScheme;
|
||||
final String? iosAppStoreLink;
|
||||
final String? webLink;
|
||||
final Uri? webLink;
|
||||
|
||||
AppLinagoraEcosystem({
|
||||
this.appName,
|
||||
@@ -34,6 +35,17 @@ class AppLinagoraEcosystem extends LinagoraEcosystemProperties {
|
||||
}
|
||||
}
|
||||
|
||||
String? getIconPath(ImagePaths imagePaths) => logoURL;
|
||||
|
||||
Uri? get appRedirectLink => webLink;
|
||||
|
||||
bool get isAppIOSEnabled => iosUrlScheme?.isNotEmpty == true ||
|
||||
iosAppStoreLink?.isNotEmpty == true ||
|
||||
appRedirectLink != null;
|
||||
|
||||
bool get isAppAndroidEnabled => androidPackageId?.isNotEmpty == true ||
|
||||
appRedirectLink != null;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
appName,
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/linagora_ecosystem/app_linagora_ecosystem.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/linagora_ecosystem/converters/linagora_ecosystem_converter.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/linagora_ecosystem/linagora_ecosystem_identifier.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/linagora_ecosystem/linagora_ecosystem_properties.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/linagora_ecosystem/mobile_apps_linagora_ecosystem.dart';
|
||||
|
||||
class LinagoraEcosystem with EquatableMixin {
|
||||
final Map<LinagoraEcosystemIdentifier, LinagoraEcosystemProperties?>? properties;
|
||||
@@ -15,4 +17,31 @@ class LinagoraEcosystem with EquatableMixin {
|
||||
|
||||
@override
|
||||
List<Object?> get props => [properties];
|
||||
}
|
||||
|
||||
extension LinagoraEcosystemExtension on LinagoraEcosystem {
|
||||
List<AppLinagoraEcosystem> get listAppLinagoraEcosystem {
|
||||
if (properties == null) return [];
|
||||
|
||||
final listWebAppLinagora = properties
|
||||
!.values
|
||||
.whereType<AppLinagoraEcosystem>()
|
||||
.toList();
|
||||
|
||||
final listMobileAppLinagora = (properties![LinagoraEcosystemIdentifier.mobileApps] as MobileAppsLinagoraEcosystem?)
|
||||
?.apps
|
||||
?.values
|
||||
.whereType<AppLinagoraEcosystem>()
|
||||
.toList() ?? [];
|
||||
|
||||
return listWebAppLinagora + listMobileAppLinagora;
|
||||
}
|
||||
|
||||
List<AppLinagoraEcosystem> get listAppLinagoraEcosystemOnIOS {
|
||||
return listAppLinagoraEcosystem.where((app) => app.isAppIOSEnabled).toList();
|
||||
}
|
||||
|
||||
List<AppLinagoraEcosystem> get listAppLinagoraEcosystemOnAndroid {
|
||||
return listAppLinagoraEcosystem.where((app) => app.isAppAndroidEnabled).toList();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user