Skip to content

Commit 6070a7f

Browse files
gnpricePIG208
authored andcommitted
action_sheet [nfc]: Simplify conditions by reordering them
1 parent bf45f16 commit 6070a7f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/widgets/action_sheet.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ void showTopicActionSheet(BuildContext context, {
165165

166166
final visibilityOptions = <UserTopicVisibilityPolicy>[];
167167
final visibilityPolicy = store.topicVisibilityPolicy(channelId, topic);
168-
if (subscription != null && !subscription.isMuted) {
168+
if (subscription == null) {
169+
// Not subscribed to the channel; there is no user topic change to be made.
170+
} else if (!subscription.isMuted) {
169171
// Channel is subscribed and not muted.
170172
switch (visibilityPolicy) {
171173
case UserTopicVisibilityPolicy.muted:
@@ -189,7 +191,7 @@ void showTopicActionSheet(BuildContext context, {
189191
// our data structures.
190192
assert(false);
191193
}
192-
} else if (subscription != null && subscription.isMuted) {
194+
} else {
193195
// Channel is muted.
194196
if (supportsUnmutingTopics) {
195197
switch (visibilityPolicy) {
@@ -215,8 +217,6 @@ void showTopicActionSheet(BuildContext context, {
215217
assert(false);
216218
}
217219
}
218-
} else {
219-
// Not subscribed to the channel; there is no user topic change to be made.
220220
}
221221
optionButtons.addAll(visibilityOptions.map((to) {
222222
return UserTopicUpdateButton(

0 commit comments

Comments
 (0)