Init model module
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
# Miscellaneous
|
||||
*.class
|
||||
*.lock
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# Visual Studio Code related
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
||||
.vscode/
|
||||
|
||||
# Flutter repo-specific
|
||||
/bin/cache/
|
||||
/bin/mingit/
|
||||
/dev/benchmarks/mega_gallery/
|
||||
/dev/bots/.recipe_deps
|
||||
/dev/bots/android_tools/
|
||||
/dev/devicelab/ABresults*.json
|
||||
/dev/docs/doc/
|
||||
/dev/docs/flutter.docs.zip
|
||||
/dev/docs/lib/
|
||||
/dev/docs/pubspec.yaml
|
||||
/dev/integration_tests/**/xcuserdata
|
||||
/dev/integration_tests/**/Pods
|
||||
/packages/flutter/coverage/
|
||||
version
|
||||
analysis_benchmark.json
|
||||
|
||||
# packages file containing multi-root paths
|
||||
.packages.generated
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
**/doc/api/
|
||||
.dart_tool/
|
||||
.flutter-plugins
|
||||
.flutter-plugins-dependencies
|
||||
**/generated_plugin_registrant.dart
|
||||
.packages
|
||||
.pub-cache/
|
||||
.pub/
|
||||
build/
|
||||
flutter_*.png
|
||||
linked_*.ds
|
||||
unlinked.ds
|
||||
unlinked_spec.ds
|
||||
|
||||
# Android related
|
||||
**/android/.gradle
|
||||
**/android/captures/
|
||||
**/android/local.properties
|
||||
**/android/**/GeneratedPluginRegistrant.java
|
||||
**/android/key.properties
|
||||
*.jks
|
||||
|
||||
# iOS/XCode related
|
||||
**/ios/**/*.mode1v3
|
||||
**/ios/**/*.mode2v3
|
||||
**/ios/**/*.moved-aside
|
||||
**/ios/**/*.pbxuser
|
||||
**/ios/**/*.perspectivev3
|
||||
**/ios/**/*sync/
|
||||
**/ios/**/.sconsign.dblite
|
||||
**/ios/**/.tags*
|
||||
**/ios/**/.vagrant/
|
||||
**/ios/**/DerivedData/
|
||||
**/ios/**/Icon?
|
||||
**/ios/**/Pods/
|
||||
**/ios/**/.symlinks/
|
||||
**/ios/**/profile
|
||||
**/ios/**/xcuserdata
|
||||
**/ios/.generated/
|
||||
**/ios/Flutter/.last_build_id
|
||||
**/ios/Flutter/App.framework
|
||||
**/ios/Flutter/Flutter.framework
|
||||
**/ios/Flutter/Flutter.podspec
|
||||
**/ios/Flutter/Generated.xcconfig
|
||||
**/ios/Flutter/app.flx
|
||||
**/ios/Flutter/app.zip
|
||||
**/ios/Flutter/flutter_assets/
|
||||
**/ios/Flutter/flutter_export_environment.sh
|
||||
**/ios/ServiceDefinitions.json
|
||||
**/ios/Runner/GeneratedPluginRegistrant.*
|
||||
|
||||
# macOS
|
||||
**/macos/Flutter/GeneratedPluginRegistrant.swift
|
||||
**/macos/Flutter/Flutter-Debug.xcconfig
|
||||
**/macos/Flutter/Flutter-Release.xcconfig
|
||||
**/macos/Flutter/Flutter-Profile.xcconfig
|
||||
|
||||
# Coverage
|
||||
coverage/
|
||||
|
||||
# Symbols
|
||||
app.*.symbols
|
||||
|
||||
# Exceptions to above rules.
|
||||
!**/ios/**/default.mode1v3
|
||||
!**/ios/**/default.mode2v3
|
||||
!**/ios/**/default.pbxuser
|
||||
!**/ios/**/default.perspectivev3
|
||||
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
|
||||
!/dev/ci/**/Gemfile.lock
|
||||
|
||||
#generated file
|
||||
*.g.dart
|
||||
messages_all.dart
|
||||
messages_en.dart
|
||||
messages_fr.dart
|
||||
messages_messages.dart
|
||||
messages_ru.dart
|
||||
messages_vi.dart
|
||||
@@ -0,0 +1,10 @@
|
||||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: d79295af24c3ed621c33713ecda14ad196fd9c31
|
||||
channel: stable
|
||||
|
||||
project_type: module
|
||||
@@ -0,0 +1,11 @@
|
||||
# model
|
||||
|
||||
A model module contains entities
|
||||
|
||||
## Getting Started
|
||||
|
||||
For help getting started with Flutter, view our online
|
||||
[documentation](https://flutter.dev/).
|
||||
|
||||
For instructions integrating Flutter modules to your existing applications,
|
||||
see the [add-to-app documentation](https://flutter.dev/docs/development/add-to-app).
|
||||
@@ -0,0 +1,10 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class Password with EquatableMixin {
|
||||
final String value;
|
||||
|
||||
Password(this.value);
|
||||
|
||||
@override
|
||||
List<Object> get props => [value];
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class UserName with EquatableMixin {
|
||||
final String userName;
|
||||
|
||||
UserName(this.userName);
|
||||
|
||||
@override
|
||||
List<Object> get props => [userName];
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
enum ExpandMode { COLLAPSE, EXPAND }
|
||||
@@ -0,0 +1,63 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox_rights.dart';
|
||||
import 'package:model/mailbox/select_mode.dart';
|
||||
|
||||
class PresentationMailbox with EquatableMixin {
|
||||
|
||||
final MailboxId id;
|
||||
final MailboxName? name;
|
||||
final MailboxId? parentId;
|
||||
final Role? role;
|
||||
final SortOrder? sortOrder;
|
||||
final TotalEmails? totalEmails;
|
||||
final UnreadEmails? unreadEmails;
|
||||
final TotalThreads? totalThreads;
|
||||
final UnreadThreads? unreadThreads;
|
||||
final MailboxRights? myRights;
|
||||
final IsSubscribed? isSubscribed;
|
||||
final SelectMode selectMode;
|
||||
|
||||
PresentationMailbox(
|
||||
this.id,
|
||||
{
|
||||
this.name,
|
||||
this.parentId,
|
||||
this.role,
|
||||
this.sortOrder,
|
||||
this.totalEmails,
|
||||
this.unreadEmails,
|
||||
this.totalThreads,
|
||||
this.unreadThreads,
|
||||
this.myRights,
|
||||
this.isSubscribed,
|
||||
this.selectMode = SelectMode.INACTIVE
|
||||
}
|
||||
);
|
||||
|
||||
bool hasParentId() => parentId != null && parentId!.id.value.isNotEmpty;
|
||||
|
||||
bool hasRole() => role != null && role!.value.isNotEmpty;
|
||||
|
||||
String getCountUnReadEmails() {
|
||||
if (unreadEmails == null) {
|
||||
return '';
|
||||
} else {
|
||||
if (unreadEmails!.value.value <= 0) {
|
||||
return '';
|
||||
} else {
|
||||
return unreadEmails!.value.value <= 999
|
||||
? '${unreadEmails!.value.value}'
|
||||
: '999+';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
id,
|
||||
name,
|
||||
parentId,
|
||||
role
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
enum SelectMode { ACTIVE, INACTIVE }
|
||||
@@ -0,0 +1,13 @@
|
||||
library model;
|
||||
|
||||
// Account
|
||||
export 'account/user_name.dart';
|
||||
export 'account/password.dart';
|
||||
|
||||
// User
|
||||
export 'user/user_id.dart';
|
||||
export 'user/user.dart';
|
||||
// Mailbox
|
||||
export 'mailbox/presentation_mailbox.dart';
|
||||
export 'mailbox/select_mode.dart';
|
||||
export 'mailbox/expand_mode.dart';
|
||||
@@ -0,0 +1,22 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:model/user/user_id.dart';
|
||||
|
||||
class User with EquatableMixin {
|
||||
|
||||
final UserId userId;
|
||||
final String firstName;
|
||||
final String lastName;
|
||||
|
||||
User(
|
||||
this.userId,
|
||||
this.firstName,
|
||||
this.lastName,
|
||||
);
|
||||
|
||||
@override
|
||||
List<Object> get props => [
|
||||
userId,
|
||||
firstName,
|
||||
lastName,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class UserId with EquatableMixin {
|
||||
final String id;
|
||||
|
||||
UserId(this.id);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id];
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
name: model
|
||||
description: A model module contains entities
|
||||
|
||||
# The following defines the version and build number for your application.
|
||||
# A version number is three numbers separated by dots, like 1.2.43
|
||||
# followed by an optional build number separated by a +.
|
||||
# Both the version and the builder number may be overridden in flutter
|
||||
# build by specifying --build-name and --build-number, respectively.
|
||||
# In Android, build-name is used as versionName while build-number used as versionCode.
|
||||
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
|
||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
#
|
||||
# This version is used _only_ for the Runner app, which is used if you just do
|
||||
# a `flutter run` or a `flutter make-host-app-editable`. It has no impact
|
||||
# on any other native host app that you embed your Flutter project into.
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.2
|
||||
|
||||
# equatable
|
||||
equatable: 2.0.3
|
||||
|
||||
# quiver
|
||||
quiver: 3.0.1
|
||||
|
||||
# jmap_dart_client
|
||||
jmap_dart_client:
|
||||
git:
|
||||
url: git://github.com/hoangdat/jmap-dart-client.git
|
||||
ref: serialize
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
build_runner: 2.0.5
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
flutter:
|
||||
# The following line ensures that the Material Icons font is
|
||||
# included with your application, so that you can use the icons in
|
||||
# the material Icons class.
|
||||
uses-material-design: true
|
||||
|
||||
# To add Flutter specific assets to your application, add an assets section,
|
||||
# like this:
|
||||
# assets:
|
||||
# - images/a_dot_burr.jpeg
|
||||
# - images/a_dot_ham.jpeg
|
||||
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/assets-and-images/#resolution-aware.
|
||||
|
||||
# For details regarding adding assets from package dependencies, see
|
||||
# https://flutter.dev/assets-and-images/#from-packages
|
||||
|
||||
# To add Flutter specific custom fonts to your application, add a fonts
|
||||
# section here, in this "flutter" section. Each entry in this list should
|
||||
# have a "family" key with the font family name, and a "fonts" key with a
|
||||
# list giving the asset and other descriptors for the font. For
|
||||
# example:
|
||||
# fonts:
|
||||
# - family: Schyler
|
||||
# fonts:
|
||||
# - asset: fonts/Schyler-Regular.ttf
|
||||
# - asset: fonts/Schyler-Italic.ttf
|
||||
# style: italic
|
||||
# - family: Trajan Pro
|
||||
# fonts:
|
||||
# - asset: fonts/TrajanPro.ttf
|
||||
# - asset: fonts/TrajanPro_Bold.ttf
|
||||
# weight: 700
|
||||
#
|
||||
# For details regarding fonts from package dependencies,
|
||||
# see https://flutter.dev/custom-fonts/#from-packages
|
||||
|
||||
|
||||
# This section identifies your Flutter project as a module meant for
|
||||
# embedding in a native host app. These identifiers should _not_ ordinarily
|
||||
# be changed after generation - they are used to ensure that the tooling can
|
||||
# maintain consistency when adding or modifying assets and plugins.
|
||||
# They also do not have any bearing on your native host application's
|
||||
# identifiers, which may be completely independent or the same as these.
|
||||
module:
|
||||
androidX: true
|
||||
androidPackage: com.linagora.android.tmail.model
|
||||
iosBundleIdentifier: com.linagora.android.tmail.model
|
||||
Reference in New Issue
Block a user