Skip to content

Commit dde59ac

Browse files
gnpriceGaurav-Kushwaha-1225
authored andcommitted
action_sheet [nfc]: Simplify conditions by reordering them
1 parent 4e25697 commit dde59ac

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/widgets/action_sheet.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ void showTopicActionSheet(BuildContext context, {
166166

167167
final visibilityOptions = <UserTopicVisibilityPolicy>[];
168168
final visibilityPolicy = store.topicVisibilityPolicy(channelId, topic);
169-
if (subscription != null && !subscription.isMuted) {
169+
if (subscription == null) {
170+
// Not subscribed to the channel; there is no user topic change to be made.
171+
} else if (!subscription.isMuted) {
170172
// Channel is subscribed and not muted.
171173
switch (visibilityPolicy) {
172174
case UserTopicVisibilityPolicy.muted:
@@ -190,7 +192,7 @@ void showTopicActionSheet(BuildContext context, {
190192
// our data structures.
191193
assert(false);
192194
}
193-
} else if (subscription != null && subscription.isMuted) {
195+
} else {
194196
// Channel is muted.
195197
if (supportsUnmutingTopics) {
196198
switch (visibilityPolicy) {
@@ -216,8 +218,6 @@ void showTopicActionSheet(BuildContext context, {
216218
assert(false);
217219
}
218220
}
219-
} else {
220-
// Not subscribed to the channel; there is no user topic change to be made.
221221
}
222222
optionButtons.addAll(visibilityOptions.map((to) {
223223
return UserTopicUpdateButton(

0 commit comments

Comments
 (0)