mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 00:05:16 +00:00
Fix a few notices
This commit is contained in:
@ -58,22 +58,13 @@ class Post implements LikeElement {
|
||||
required this.access,
|
||||
required this.comments,
|
||||
required this.survey})
|
||||
: assert(id != null),
|
||||
assert(userID != null),
|
||||
assert(userPageID != 0 || groupID != 0),
|
||||
assert(timeSent != null),
|
||||
assert(kind != PostKind.TEXT || content != null),
|
||||
assert(visibilityLevel != null),
|
||||
assert(kind != null),
|
||||
: assert(userPageID != 0 || groupID != 0),
|
||||
assert(kind != PostKind.COUNTDOWN || timeEnd != null),
|
||||
assert(kind != PostKind.SURVEY || survey != null),
|
||||
assert(likes != null),
|
||||
assert(userLike != null),
|
||||
assert(access != null);
|
||||
assert(kind != PostKind.SURVEY || survey != null);
|
||||
|
||||
bool get isGroupPost => groupID != null && groupID! > 0;
|
||||
|
||||
bool get hasContent => content != null && !content.isNull;
|
||||
bool get hasContent => !content.isNull && !content.isEmpty;
|
||||
|
||||
bool get hasComments => comments != null;
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
/// Check password reset token result
|
||||
///
|
||||
/// @author Pierre Hubert
|
||||
@ -13,7 +11,5 @@ class ResCheckPasswordToken {
|
||||
required this.firstName,
|
||||
required this.lastName,
|
||||
required this.email,
|
||||
}) : assert(firstName != null),
|
||||
assert(lastName != null),
|
||||
assert(email != null);
|
||||
});
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
/// Single search result
|
||||
///
|
||||
/// @author Pierre Hubert
|
||||
@ -13,6 +11,5 @@ class SearchResult {
|
||||
SearchResult({
|
||||
required this.id,
|
||||
required this.kind,
|
||||
}) : assert(id != null),
|
||||
assert(kind != null);
|
||||
});
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
/// Security settings of the user
|
||||
///
|
||||
/// @author Pierre HUBERT
|
||||
@ -15,8 +13,5 @@ class SecuritySettings {
|
||||
required this.securityAnswer1,
|
||||
required this.securityQuestion2,
|
||||
required this.securityAnswer2,
|
||||
}) : assert(securityQuestion1 != null),
|
||||
assert(securityAnswer1 != null),
|
||||
assert(securityQuestion2 != null),
|
||||
assert(securityAnswer2 != null);
|
||||
});
|
||||
}
|
||||
|
@ -35,14 +35,7 @@ class PasswordPolicy {
|
||||
required this.minNumberDigits,
|
||||
required this.minNumberSpecialCharacters,
|
||||
required this.minCategoriesPresence,
|
||||
}) : assert(allowMailInPassword != null),
|
||||
assert(allowNameInPassword != null),
|
||||
assert(minPasswordLength != null),
|
||||
assert(minNumberUpperCaseLetters != null),
|
||||
assert(minNumberLowerCaseLetters != null),
|
||||
assert(minNumberDigits != null),
|
||||
assert(minNumberSpecialCharacters != null),
|
||||
assert(minCategoriesPresence != null);
|
||||
});
|
||||
}
|
||||
|
||||
class ServerDataConservationPolicy {
|
||||
@ -60,12 +53,7 @@ class ServerDataConservationPolicy {
|
||||
required this.minPostsLifetime,
|
||||
required this.minConversationMessagesLifetime,
|
||||
required this.minLikesLifetime,
|
||||
}) : assert(minInactiveAccountLifetime != null),
|
||||
assert(minNotificationLifetime != null),
|
||||
assert(minCommentsLifetime != null),
|
||||
assert(minPostsLifetime != null),
|
||||
assert(minConversationMessagesLifetime != null),
|
||||
assert(minLikesLifetime != null);
|
||||
});
|
||||
}
|
||||
|
||||
class ConversationsPolicy {
|
||||
@ -97,19 +85,7 @@ class ConversationsPolicy {
|
||||
required this.maxThumbnailHeight,
|
||||
required this.maxLogoWidth,
|
||||
required this.maxLogoHeight,
|
||||
}) : assert(maxConversationNameLen != null),
|
||||
assert(minMessageLen != null),
|
||||
assert(maxMessageLen != null),
|
||||
assert(allowedFilesType != null),
|
||||
assert(filesMaxSize != null),
|
||||
assert(writingEventInterval != null),
|
||||
assert(writingEventLifetime != null),
|
||||
assert(maxMessageImageWidth != null),
|
||||
assert(maxMessageImageHeight != null),
|
||||
assert(maxThumbnailWidth != null),
|
||||
assert(maxThumbnailHeight != null),
|
||||
assert(maxLogoWidth != null),
|
||||
assert(maxLogoHeight != null);
|
||||
});
|
||||
}
|
||||
|
||||
class AccountInformationPolicy {
|
||||
@ -125,11 +101,7 @@ class AccountInformationPolicy {
|
||||
required this.minLastNameLength,
|
||||
required this.maxLastNameLength,
|
||||
required this.maxLocationLength,
|
||||
}) : assert(minFirstNameLength != null),
|
||||
assert(maxFirstNameLength != null),
|
||||
assert(minLastNameLength != null),
|
||||
assert(maxLastNameLength != null),
|
||||
assert(maxLocationLength != null);
|
||||
});
|
||||
}
|
||||
|
||||
enum BannerNature { Information, Warning, Success }
|
||||
@ -161,9 +133,7 @@ class Banner {
|
||||
required this.nature,
|
||||
required this.message,
|
||||
required this.link,
|
||||
}) : assert(enabled != null),
|
||||
assert(nature != null),
|
||||
assert(message != null);
|
||||
});
|
||||
|
||||
bool get visible => enabled && (expire == null || expire! > time());
|
||||
}
|
||||
@ -195,15 +165,5 @@ class ServerConfig {
|
||||
required this.dataConservationPolicy,
|
||||
required this.conversationsPolicy,
|
||||
required this.accountInformationPolicy,
|
||||
}) : assert(minSupportedMobileVersion != null),
|
||||
assert(termsURL != null),
|
||||
assert(privacyPolicyURL != null),
|
||||
assert(contactEmail != null),
|
||||
assert(playStoreURL != null),
|
||||
assert(androidDirectDownloadURL != null),
|
||||
assert(notificationsPolicy != null),
|
||||
assert(passwordPolicy != null),
|
||||
assert(dataConservationPolicy != null),
|
||||
assert(conversationsPolicy != null),
|
||||
assert(accountInformationPolicy != null);
|
||||
});
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
/// Single survey choice
|
||||
///
|
||||
/// @author Pierre HUBERT
|
||||
@ -13,7 +11,5 @@ class SurveyChoice {
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.responses,
|
||||
}) : assert(id != null),
|
||||
assert(name != null),
|
||||
assert(responses != null);
|
||||
});
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ class UnreadConversation {
|
||||
const UnreadConversation({
|
||||
required this.conv,
|
||||
required this.message,
|
||||
}) : assert(conv != null),
|
||||
assert(message != null);
|
||||
});
|
||||
}
|
||||
|
@ -13,9 +13,7 @@ class WsMessage {
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.data,
|
||||
}) : assert(id != null),
|
||||
assert(title != null),
|
||||
assert(title.length > 0);
|
||||
}) : assert(title.length > 0);
|
||||
|
||||
/// Construct a message from a JSON document (messages coming from the server)
|
||||
static WsMessage fromJSON(final Map<dynamic, dynamic> m) {
|
||||
@ -23,12 +21,11 @@ class WsMessage {
|
||||
}
|
||||
|
||||
/// Turn a message into a JSON object to send it to the API
|
||||
String toJSON() =>
|
||||
jsonEncode({
|
||||
String toJSON() => jsonEncode({
|
||||
"id": id,
|
||||
"title": title,
|
||||
"data": data,
|
||||
});
|
||||
|
||||
bool get hasId => this.id != null && this.id.isNotEmpty;
|
||||
bool get hasId => this.id.isNotEmpty;
|
||||
}
|
||||
|
Reference in New Issue
Block a user