1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 04:49:21 +00:00

Fix a few notices

This commit is contained in:
Pierre HUBERT 2022-03-11 17:13:54 +01:00
parent 41446f0e5b
commit 48c9ee37b6
15 changed files with 21 additions and 82 deletions

View File

@ -1,5 +1,3 @@
/// Simple friendship status /// Simple friendship status
/// ///
/// @author Pierre HUBERT /// @author Pierre HUBERT
@ -17,11 +15,7 @@ class FriendStatus {
required this.sentRequest, required this.sentRequest,
required this.receivedRequest, required this.receivedRequest,
required this.following, required this.following,
}) : assert(userID != null), });
assert(areFriend != null),
assert(sentRequest != null),
assert(receivedRequest != null),
assert(following != null);
bool get noRequestExchanged => !areFriend && !sentRequest && !receivedRequest; bool get noRequestExchanged => !areFriend && !sentRequest && !receivedRequest;
} }

View File

@ -33,16 +33,5 @@ class GeneralSettings {
required this.personalWebsite, required this.personalWebsite,
required this.publicNote, required this.publicNote,
required this.location, required this.location,
}) : assert(email != null), });
assert(firstName != null),
assert(lastName != null),
assert(pageVisibility != null),
assert(allowComments != null),
assert(allowPostsFromFriends != null),
assert(allowComunicEmails != null),
assert(publicFriendsList != null),
assert(publicEmail != null),
assert(virtualDirectory != null),
assert(personalWebsite != null),
assert(publicNote != null);
} }

View File

@ -28,7 +28,6 @@ String membershipToText(GroupMembershipLevel level) {
case GroupMembershipLevel.VISITOR: case GroupMembershipLevel.VISITOR:
return tr("Visitor")!; return tr("Visitor")!;
} }
throw new Exception("Unreachable statement!");
} }
enum GroupVisibilityLevel { OPEN, PRIVATE, SECRETE } enum GroupVisibilityLevel { OPEN, PRIVATE, SECRETE }
@ -60,15 +59,7 @@ class Group implements Comparable<Group> {
required this.postCreationLevel, required this.postCreationLevel,
required this.virtualDirectory, required this.virtualDirectory,
required this.following, required this.following,
}) : assert(id != null), });
assert(name != null),
assert(iconURL != null),
assert(numberMembers != null),
assert(membershipLevel != null),
assert(visibilityLevel != null),
assert(registrationLevel != null),
assert(postCreationLevel != null),
assert(following != null);
get displayName => this.name; get displayName => this.name;

View File

@ -15,10 +15,7 @@ class GroupMembership {
required this.groupID, required this.groupID,
required this.timeCreate, required this.timeCreate,
required this.level, required this.level,
}) : assert(userID != null), });
assert(groupID != null),
assert(timeCreate != null),
assert(level != null);
String get membershipText => membershipToText(level); String get membershipText => membershipToText(level);

View File

@ -18,22 +18,19 @@ class Membership {
: type = MembershipType.CONVERSATION, : type = MembershipType.CONVERSATION,
friend = null, friend = null,
groupID = null, groupID = null,
groupLastActive = null, groupLastActive = null;
assert(conversation != null);
Membership.friend(Friend this.friend) Membership.friend(Friend this.friend)
: type = MembershipType.FRIEND, : type = MembershipType.FRIEND,
conversation = null, conversation = null,
groupID = null, groupID = null,
groupLastActive = null, groupLastActive = null;
assert(friend != null);
Membership.group({required int this.groupID, required int this.groupLastActive}) Membership.group(
{required int this.groupID, required int this.groupLastActive})
: type = MembershipType.GROUP, : type = MembershipType.GROUP,
conversation = null, conversation = null,
friend = null, friend = null;
assert(groupID != null),
assert(groupLastActive != null);
int? get lastActive { int? get lastActive {
switch (type) { switch (type) {

View File

@ -1,5 +1,3 @@
/// New account information container /// New account information container
/// ///
/// @author Pierre HUBERT /// @author Pierre HUBERT
@ -15,8 +13,5 @@ class NewAccount {
required this.lastName, required this.lastName,
required this.email, required this.email,
required this.password, required this.password,
}) : assert(firstName != null), });
assert(lastName != null),
assert(email != null),
assert(password != null);
} }

View File

@ -13,9 +13,9 @@ class NewComment {
required this.postID, required this.postID,
required this.content, required this.content,
required this.image, required this.image,
}) : assert(postID != null); });
bool get hasContent => content != null && content.length > 0; bool get hasContent => content.length > 0;
bool get hasImage => image != null; bool get hasImage => image != null;
} }

View File

@ -19,9 +19,6 @@ class NewConversationsSettings {
required this.name, required this.name,
required this.canEveryoneAddMembers, required this.canEveryoneAddMembers,
required this.color, required this.color,
}) : assert(convID != null), }) : assert(convID > 0),
assert(convID > 0),
assert(following != null),
assert(isComplete != null),
assert(!isComplete || canEveryoneAddMembers != null); assert(!isComplete || canEveryoneAddMembers != null);
} }

View File

@ -11,6 +11,5 @@ class NewEmoji {
const NewEmoji({ const NewEmoji({
required this.shortcut, required this.shortcut,
required this.image, required this.image,
}) : assert(shortcut != null), });
assert(image != null);
} }

View File

@ -14,7 +14,5 @@ class NewGroupConversation {
required this.groupID, required this.groupID,
required this.name, required this.name,
required this.minMembershipLevel, required this.minMembershipLevel,
}) : assert(groupID != null), });
assert(name != null),
assert(minMembershipLevel != null);
} }

View File

@ -17,9 +17,7 @@ class NewSurvey {
required this.question, required this.question,
required this.answers, required this.answers,
required this.allowNewChoicesCreation, required this.allowNewChoicesCreation,
}) : assert(question != null), }) : assert(answers.length > 1);
assert(answers.length > 1),
assert(allowNewChoicesCreation != null);
} }
class NewPost { class NewPost {
@ -47,11 +45,7 @@ class NewPost {
required this.timeEnd, required this.timeEnd,
required this.survey, required this.survey,
required this.youtubeId, required this.youtubeId,
}) : assert(target != null), }) : assert(kind != PostKind.TEXT || content.length > 3),
assert(targetID != null),
assert(visibility != null),
assert(content != null),
assert(kind != PostKind.TEXT || content.length > 3),
assert(kind != PostKind.IMAGE || image != null), assert(kind != PostKind.IMAGE || image != null),
assert(kind != PostKind.WEB_LINK || url != null), assert(kind != PostKind.WEB_LINK || url != null),
assert(kind != PostKind.PDF || pdf != null), assert(kind != PostKind.PDF || pdf != null),

View File

@ -1,5 +1,3 @@
/// Notification model /// Notification model
/// ///
/// @author Pierre HUBERT /// @author Pierre HUBERT
@ -58,11 +56,5 @@ class Notification {
required this.type, required this.type,
required this.fromContainerId, required this.fromContainerId,
required this.fromContainerType, required this.fromContainerType,
}) : assert(id != null), });
assert(timeCreate != null),
assert(seen != null),
assert(fromUser != null),
assert(onElemId != null),
assert(onElemType != null),
assert(type != null);
} }

View File

@ -1,5 +1,3 @@
/// Notifications settings /// Notifications settings
/// ///
/// @author Pierre Hubert /// @author Pierre Hubert
@ -11,6 +9,5 @@ class NotificationsSettings {
NotificationsSettings({ NotificationsSettings({
required this.allowConversations, required this.allowConversations,
required this.allowNotificationsSound, required this.allowNotificationsSound,
}) : assert(allowConversations != null), });
assert(allowNotificationsSound != null);
} }

View File

@ -12,8 +12,7 @@ class NotificationsPolicy {
const NotificationsPolicy({ const NotificationsPolicy({
required this.hasFirebase, required this.hasFirebase,
required this.hasIndependent, required this.hasIndependent,
}) : assert(hasFirebase != null), });
assert(hasIndependent != null);
} }
class PasswordPolicy { class PasswordPolicy {

View File

@ -19,7 +19,7 @@ class TextRichContentWidget extends StatelessWidget {
this.text, { this.text, {
this.textAlign, this.textAlign,
this.style, this.style,
}) : assert(text != null); });
/// Parse the text and return it as a list of span elements /// Parse the text and return it as a list of span elements
static List<TextSpan> _parse(String text, TextStyle? style) { static List<TextSpan> _parse(String text, TextStyle? style) {