Skip to content

Commit

Permalink
action_sheet: Support muting/unmuting/following topics
Browse files Browse the repository at this point in the history
Currently, we don't have buttons, like "resolve topic", other than the
ones added here.

The switch statements follow the layout of the legacy app
implementation.

See also:
  https://github.com/zulip/zulip-mobile/blob/715d60a5e87fe37032bce58bd72edb99208e15be/src/action-sheets/index.js#L656-L753

Fixes: zulip#348

Signed-off-by: Zixuan James Li <[email protected]>
  • Loading branch information
PIG208 authored and shivanshsharma13 committed Dec 13, 2024
1 parent 896547d commit 11e7b1a
Show file tree
Hide file tree
Showing 13 changed files with 748 additions and 8 deletions.
32 changes: 32 additions & 0 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,22 @@
"@permissionsDeniedReadExternalStorage": {
"description": "Message for dialog asking the user to grant permissions for external storage read access."
},
"actionSheetOptionMuteTopic": "Mute topic",
"@actionSheetOptionMuteTopic": {
"description": "Label for muting a topic on action sheet."
},
"actionSheetOptionUnmuteTopic": "Unmute topic",
"@actionSheetOptionUnmuteTopic": {
"description": "Label for unmuting a topic on action sheet."
},
"actionSheetOptionFollowTopic": "Follow topic",
"@actionSheetOptionFollowTopic": {
"description": "Label for following a topic on action sheet."
},
"actionSheetOptionUnfollowTopic": "Unfollow topic",
"@actionSheetOptionUnfollowTopic": {
"description": "Label for unfollowing a topic on action sheet."
},
"actionSheetOptionCopyMessageText": "Copy message text",
"@actionSheetOptionCopyMessageText": {
"description": "Label for copy message text button on action sheet."
Expand Down Expand Up @@ -201,6 +217,22 @@
"event": {"type": "String", "example": "UpdateMessageEvent(id: 123, messageIds: [2345, 3456], newTopic: 'dinner')"}
}
},
"errorMuteTopicFailed": "Failed to mute topic",
"@errorMuteTopicFailed": {
"description": "Error message when muting a topic failed."
},
"errorUnmuteTopicFailed": "Failed to unmute topic",
"@errorUnmuteTopicFailed": {
"description": "Error message when unmuting a topic failed."
},
"errorFollowTopicFailed": "Failed to follow topic",
"@errorFollowTopicFailed": {
"description": "Error message when following a topic failed."
},
"errorUnfollowTopicFailed": "Failed to unfollow topic",
"@errorUnfollowTopicFailed": {
"description": "Error message when unfollowing a topic failed."
},
"errorSharingFailed": "Sharing failed",
"@errorSharingFailed": {
"description": "Error message when sharing a message failed."
Expand Down
2 changes: 1 addition & 1 deletion lib/api/model/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ enum UserTopicVisibilityPolicy {
muted(apiValue: 1),
unmuted(apiValue: 2), // TODO(server-7) newly added
followed(apiValue: 3), // TODO(server-8) newly added
unknown(apiValue: null);
unknown(apiValue: null); // TODO(#1074) remove this

const UserTopicVisibilityPolicy({required this.apiValue});

Expand Down
48 changes: 48 additions & 0 deletions lib/generated/l10n/zulip_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,30 @@ abstract class ZulipLocalizations {
/// **'To upload files, please grant Zulip additional permissions in Settings.'**
String get permissionsDeniedReadExternalStorage;

/// Label for muting a topic on action sheet.
///
/// In en, this message translates to:
/// **'Mute topic'**
String get actionSheetOptionMuteTopic;

/// Label for unmuting a topic on action sheet.
///
/// In en, this message translates to:
/// **'Unmute topic'**
String get actionSheetOptionUnmuteTopic;

/// Label for following a topic on action sheet.
///
/// In en, this message translates to:
/// **'Follow topic'**
String get actionSheetOptionFollowTopic;

/// Label for unfollowing a topic on action sheet.
///
/// In en, this message translates to:
/// **'Unfollow topic'**
String get actionSheetOptionUnfollowTopic;

/// Label for copy message text button on action sheet.
///
/// In en, this message translates to:
Expand Down Expand Up @@ -361,6 +385,30 @@ abstract class ZulipLocalizations {
/// **'Error handling a Zulip event from {serverUrl}; will retry.\n\nError: {error}\n\nEvent: {event}'**
String errorHandlingEventDetails(String serverUrl, String error, String event);

/// Error message when muting a topic failed.
///
/// In en, this message translates to:
/// **'Failed to mute topic'**
String get errorMuteTopicFailed;

/// Error message when unmuting a topic failed.
///
/// In en, this message translates to:
/// **'Failed to unmute topic'**
String get errorUnmuteTopicFailed;

/// Error message when following a topic failed.
///
/// In en, this message translates to:
/// **'Failed to follow topic'**
String get errorFollowTopicFailed;

/// Error message when unfollowing a topic failed.
///
/// In en, this message translates to:
/// **'Failed to unfollow topic'**
String get errorUnfollowTopicFailed;

/// Error message when sharing a message failed.
///
/// In en, this message translates to:
Expand Down
24 changes: 24 additions & 0 deletions lib/generated/l10n/zulip_localizations_ar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
@override
String get permissionsDeniedReadExternalStorage => 'To upload files, please grant Zulip additional permissions in Settings.';

@override
String get actionSheetOptionMuteTopic => 'Mute topic';

@override
String get actionSheetOptionUnmuteTopic => 'Unmute topic';

@override
String get actionSheetOptionFollowTopic => 'Follow topic';

@override
String get actionSheetOptionUnfollowTopic => 'Unfollow topic';

@override
String get actionSheetOptionCopyMessageText => 'Copy message text';

Expand Down Expand Up @@ -165,6 +177,18 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
return 'Error handling a Zulip event from $serverUrl; will retry.\n\nError: $error\n\nEvent: $event';
}

@override
String get errorMuteTopicFailed => 'Failed to mute topic';

@override
String get errorUnmuteTopicFailed => 'Failed to unmute topic';

@override
String get errorFollowTopicFailed => 'Failed to follow topic';

@override
String get errorUnfollowTopicFailed => 'Failed to unfollow topic';

@override
String get errorSharingFailed => 'Sharing failed';

Expand Down
24 changes: 24 additions & 0 deletions lib/generated/l10n/zulip_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
@override
String get permissionsDeniedReadExternalStorage => 'To upload files, please grant Zulip additional permissions in Settings.';

@override
String get actionSheetOptionMuteTopic => 'Mute topic';

@override
String get actionSheetOptionUnmuteTopic => 'Unmute topic';

@override
String get actionSheetOptionFollowTopic => 'Follow topic';

@override
String get actionSheetOptionUnfollowTopic => 'Unfollow topic';

@override
String get actionSheetOptionCopyMessageText => 'Copy message text';

Expand Down Expand Up @@ -165,6 +177,18 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
return 'Error handling a Zulip event from $serverUrl; will retry.\n\nError: $error\n\nEvent: $event';
}

@override
String get errorMuteTopicFailed => 'Failed to mute topic';

@override
String get errorUnmuteTopicFailed => 'Failed to unmute topic';

@override
String get errorFollowTopicFailed => 'Failed to follow topic';

@override
String get errorUnfollowTopicFailed => 'Failed to unfollow topic';

@override
String get errorSharingFailed => 'Sharing failed';

Expand Down
24 changes: 24 additions & 0 deletions lib/generated/l10n/zulip_localizations_fr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ class ZulipLocalizationsFr extends ZulipLocalizations {
@override
String get permissionsDeniedReadExternalStorage => 'To upload files, please grant Zulip additional permissions in Settings.';

@override
String get actionSheetOptionMuteTopic => 'Mute topic';

@override
String get actionSheetOptionUnmuteTopic => 'Unmute topic';

@override
String get actionSheetOptionFollowTopic => 'Follow topic';

@override
String get actionSheetOptionUnfollowTopic => 'Unfollow topic';

@override
String get actionSheetOptionCopyMessageText => 'Copy message text';

Expand Down Expand Up @@ -165,6 +177,18 @@ class ZulipLocalizationsFr extends ZulipLocalizations {
return 'Error handling a Zulip event from $serverUrl; will retry.\n\nError: $error\n\nEvent: $event';
}

@override
String get errorMuteTopicFailed => 'Failed to mute topic';

@override
String get errorUnmuteTopicFailed => 'Failed to unmute topic';

@override
String get errorFollowTopicFailed => 'Failed to follow topic';

@override
String get errorUnfollowTopicFailed => 'Failed to unfollow topic';

@override
String get errorSharingFailed => 'Sharing failed';

Expand Down
24 changes: 24 additions & 0 deletions lib/generated/l10n/zulip_localizations_ja.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
@override
String get permissionsDeniedReadExternalStorage => 'To upload files, please grant Zulip additional permissions in Settings.';

@override
String get actionSheetOptionMuteTopic => 'Mute topic';

@override
String get actionSheetOptionUnmuteTopic => 'Unmute topic';

@override
String get actionSheetOptionFollowTopic => 'Follow topic';

@override
String get actionSheetOptionUnfollowTopic => 'Unfollow topic';

@override
String get actionSheetOptionCopyMessageText => 'Copy message text';

Expand Down Expand Up @@ -165,6 +177,18 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
return 'Error handling a Zulip event from $serverUrl; will retry.\n\nError: $error\n\nEvent: $event';
}

@override
String get errorMuteTopicFailed => 'Failed to mute topic';

@override
String get errorUnmuteTopicFailed => 'Failed to unmute topic';

@override
String get errorFollowTopicFailed => 'Failed to follow topic';

@override
String get errorUnfollowTopicFailed => 'Failed to unfollow topic';

@override
String get errorSharingFailed => 'Sharing failed';

Expand Down
24 changes: 24 additions & 0 deletions lib/generated/l10n/zulip_localizations_pl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
@override
String get permissionsDeniedReadExternalStorage => 'Aby odebrać pliki Zulip musi uzyskać dodatkowe uprawnienia w Ustawieniach.';

@override
String get actionSheetOptionMuteTopic => 'Mute topic';

@override
String get actionSheetOptionUnmuteTopic => 'Unmute topic';

@override
String get actionSheetOptionFollowTopic => 'Follow topic';

@override
String get actionSheetOptionUnfollowTopic => 'Unfollow topic';

@override
String get actionSheetOptionCopyMessageText => 'Skopiuj tekst wiadomości';

Expand Down Expand Up @@ -165,6 +177,18 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
return 'Błąd zdarzenia Zulip z $serverUrl; ponawiam.\n\nBłąd: $error\n\nZdarzenie: $event';
}

@override
String get errorMuteTopicFailed => 'Failed to mute topic';

@override
String get errorUnmuteTopicFailed => 'Failed to unmute topic';

@override
String get errorFollowTopicFailed => 'Failed to follow topic';

@override
String get errorUnfollowTopicFailed => 'Failed to unfollow topic';

@override
String get errorSharingFailed => 'Udostępnianie bez powodzenia';

Expand Down
24 changes: 24 additions & 0 deletions lib/generated/l10n/zulip_localizations_ru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
@override
String get permissionsDeniedReadExternalStorage => 'Для загрузки файлов, пожалуйста, предоставьте Zulip дополнительные разрешения в настройках.';

@override
String get actionSheetOptionMuteTopic => 'Mute topic';

@override
String get actionSheetOptionUnmuteTopic => 'Unmute topic';

@override
String get actionSheetOptionFollowTopic => 'Follow topic';

@override
String get actionSheetOptionUnfollowTopic => 'Unfollow topic';

@override
String get actionSheetOptionCopyMessageText => 'Скопировать текст сообщения';

Expand Down Expand Up @@ -165,6 +177,18 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
return 'Error handling a Zulip event from $serverUrl; will retry.\n\nError: $error\n\nEvent: $event';
}

@override
String get errorMuteTopicFailed => 'Failed to mute topic';

@override
String get errorUnmuteTopicFailed => 'Failed to unmute topic';

@override
String get errorFollowTopicFailed => 'Failed to follow topic';

@override
String get errorUnfollowTopicFailed => 'Failed to unfollow topic';

@override
String get errorSharingFailed => 'Sharing failed';

Expand Down
Loading

0 comments on commit 11e7b1a

Please sign in to comment.