1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-12-25 04:18:51 +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
///
/// @author Pierre HUBERT
@ -17,11 +15,7 @@ class FriendStatus {
required this.sentRequest,
required this.receivedRequest,
required this.following,
}) : assert(userID != null),
assert(areFriend != null),
assert(sentRequest != null),
assert(receivedRequest != null),
assert(following != null);
});
bool get noRequestExchanged => !areFriend && !sentRequest && !receivedRequest;
}

View File

@ -33,16 +33,5 @@ class GeneralSettings {
required this.personalWebsite,
required this.publicNote,
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:
return tr("Visitor")!;
}
throw new Exception("Unreachable statement!");
}
enum GroupVisibilityLevel { OPEN, PRIVATE, SECRETE }
@ -60,15 +59,7 @@ class Group implements Comparable<Group> {
required this.postCreationLevel,
required this.virtualDirectory,
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;

View File

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

View File

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

View File

@ -1,5 +1,3 @@
/// New account information container
///
/// @author Pierre HUBERT
@ -15,8 +13,5 @@ class NewAccount {
required this.lastName,
required this.email,
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.content,
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;
}

View File

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

View File

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

View File

@ -14,7 +14,5 @@ class NewGroupConversation {
required this.groupID,
required this.name,
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.answers,
required this.allowNewChoicesCreation,
}) : assert(question != null),
assert(answers.length > 1),
assert(allowNewChoicesCreation != null);
}) : assert(answers.length > 1);
}
class NewPost {
@ -47,11 +45,7 @@ class NewPost {
required this.timeEnd,
required this.survey,
required this.youtubeId,
}) : assert(target != null),
assert(targetID != null),
assert(visibility != null),
assert(content != null),
assert(kind != PostKind.TEXT || content.length > 3),
}) : assert(kind != PostKind.TEXT || content.length > 3),
assert(kind != PostKind.IMAGE || image != null),
assert(kind != PostKind.WEB_LINK || url != null),
assert(kind != PostKind.PDF || pdf != null),

View File

@ -1,5 +1,3 @@
/// Notification model
///
/// @author Pierre HUBERT
@ -58,11 +56,5 @@ class Notification {
required this.type,
required this.fromContainerId,
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
///
/// @author Pierre Hubert
@ -11,6 +9,5 @@ class NotificationsSettings {
NotificationsSettings({
required this.allowConversations,
required this.allowNotificationsSound,
}) : assert(allowConversations != null),
assert(allowNotificationsSound != null);
});
}

View File

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

View File

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