mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-16 06:28:27 +02:00
MESSENGER-3152 unignore alert
This commit is contained in:
@@ -277,6 +277,7 @@
|
||||
"settings_night_mode" = "Nachtmodus";
|
||||
"settings_enable_push_notif" = "Benachrichtigungen auf diesem Gerät";
|
||||
"settings_unignore_user" = "Alle Nachrichten von %@ anzeigen?";
|
||||
"settings_unignore_user_message" = "Diese Aktion kann eine Weile dauern.";
|
||||
"settings_contacts_phonebook_country" = "Land des Telefonbuches";
|
||||
"settings_labs_e2e_encryption" = "Ende-zu-Ende-Verschlüsselung";
|
||||
"settings_version" = "Version %@";
|
||||
|
||||
@@ -665,6 +665,7 @@ Tap the + to start adding people.";
|
||||
"settings_show_url_previews_description" = "Previews will only be shown in unencrypted rooms.";
|
||||
|
||||
"settings_unignore_user" = "Show all messages from %@?";
|
||||
"settings_unignore_user_message" = "This action may take a while.";
|
||||
|
||||
"settings_contacts_enable_sync" = "Find your contacts";
|
||||
"settings_contacts_phonebook_country" = "Phonebook country";
|
||||
|
||||
@@ -7515,6 +7515,10 @@ public class VectorL10n: NSObject {
|
||||
public static func settingsUnignoreUser(_ p1: String) -> String {
|
||||
return VectorL10n.tr("Vector", "settings_unignore_user", p1)
|
||||
}
|
||||
/// This action may take a while.
|
||||
public static var settingsUnignoreUserMessage: String {
|
||||
return VectorL10n.tr("Vector", "settings_unignore_user_message")
|
||||
}
|
||||
/// USER INTERFACE
|
||||
public static var settingsUserInterface: String {
|
||||
return VectorL10n.tr("Vector", "settings_user_interface")
|
||||
|
||||
@@ -28,12 +28,9 @@ class IgnoredUser: ObservableObject, Identifiable {
|
||||
self.displayName = displayName
|
||||
self.matrixId = matrixId
|
||||
self.avatar = avatar
|
||||
|
||||
print("FROT: init \(self.displayName) \(self.matrixId) \(self.avatar)")
|
||||
}
|
||||
|
||||
func avatarImage() -> UIImage {
|
||||
print("FROT: \(self.avatar)")
|
||||
if let cachePath = MXMediaManager.thumbnailCachePath(forMatrixContentURI: self.avatar, andType: "image/jpeg", inFolder: nil, toFitViewSize: CGSize(width: 12, height: 12), with: MXThumbnailingMethodCrop) {
|
||||
if let image = MXMediaManager.loadThroughCache(withFilePath: cachePath) {
|
||||
return image
|
||||
|
||||
@@ -50,7 +50,7 @@ struct IgnoredUsersView: View {
|
||||
|
||||
var body: some View {
|
||||
List(ignoredUsers) { user in
|
||||
IgnoredUserView(user: user)
|
||||
IgnoredUserView(session:session, user: user)
|
||||
}
|
||||
.navigationTitle(NSLocalizedString("bwi_notification_times", tableName: "Bwi", comment: ""))
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
@@ -60,7 +60,8 @@ struct IgnoredUsersView: View {
|
||||
fileprivate struct IgnoredUserView: View {
|
||||
@State private var showingAlert = false
|
||||
|
||||
var user: IgnoredUser
|
||||
let session: MXSession?
|
||||
let user: IgnoredUser
|
||||
|
||||
var body: some View {
|
||||
Button (action: {
|
||||
@@ -79,10 +80,10 @@ fileprivate struct IgnoredUserView: View {
|
||||
}
|
||||
.alert(isPresented:$showingAlert) {
|
||||
Alert(
|
||||
title: Text("Are you sure you want to delete this?"),
|
||||
message: Text("\(self.user.displayName)"),
|
||||
primaryButton: .destructive(Text("Delete")) {
|
||||
print("Deleting...")
|
||||
title: Text(VectorL10n.settingsUnignoreUser(self.user.displayName)),
|
||||
message: Text(VectorL10n.settingsUnignoreUserMessage),
|
||||
primaryButton: .default(Text(VectorL10n.yes)) {
|
||||
unignoreUser(self.session, self.user)
|
||||
},
|
||||
secondaryButton: .cancel()
|
||||
)
|
||||
@@ -96,3 +97,74 @@ struct IgnoredUsersView_Previews: PreviewProvider {
|
||||
IgnoredUsersView(session: nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fileprivate func unignoreUser(_ session:MXSession?,_ user:IgnoredUser) {
|
||||
if let session = session {
|
||||
session.unIgnore(users: [user.matrixId], completion: { response in
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
MXSession* session = self.mainSession;
|
||||
|
||||
NSString *ignoredUserId = session.ignoredUsers[row];
|
||||
|
||||
if (ignoredUserId)
|
||||
{
|
||||
[currentAlert dismissViewControllerAnimated:NO completion:nil];
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
|
||||
UIAlertController *unignorePrompt = [UIAlertController alertControllerWithTitle:[VectorL10n settingsUnignoreUser:ignoredUserId] message:nil preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
[unignorePrompt addAction:[UIAlertAction actionWithTitle:[VectorL10n yes]
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
|
||||
if (weakSelf)
|
||||
{
|
||||
typeof(self) self = weakSelf;
|
||||
self->currentAlert = nil;
|
||||
|
||||
MXSession* session = self.mainSession;
|
||||
|
||||
// Remove the member from the ignored user list
|
||||
[self startActivityIndicator];
|
||||
[session unIgnoreUsers:@[ignoredUserId] success:^{
|
||||
|
||||
[self stopActivityIndicator];
|
||||
|
||||
} failure:^(NSError *error) {
|
||||
|
||||
[self stopActivityIndicator];
|
||||
|
||||
MXLogDebug(@"[SettingsViewController] Unignore %@ failed", ignoredUserId);
|
||||
|
||||
NSString *myUserId = session.myUser.userId;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kMXKErrorNotification object:error userInfo:myUserId ? @{kMXKErrorUserIdKey: myUserId} : nil];
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
}]];
|
||||
|
||||
[unignorePrompt addAction:[UIAlertAction actionWithTitle:[VectorL10n no]
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
|
||||
if (weakSelf)
|
||||
{
|
||||
typeof(self) self = weakSelf;
|
||||
self->currentAlert = nil;
|
||||
}
|
||||
|
||||
}]];
|
||||
|
||||
[unignorePrompt mxk_setAccessibilityIdentifier: @"SettingsVCUnignoreAlert"];
|
||||
[self presentViewController:unignorePrompt animated:YES completion:nil];
|
||||
currentAlert = unignorePrompt;
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user