-
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Features: - Group creation - Group management - Displaying qr-codes when generating invitations, thanks lissine - Added privacy setting to ignore incoming messages from unknown sources Fixes: - Improved background handling - Multiple iPad related fixes - Fixed backscrolling for selfchats (notes to self) - Fixed muc status code handling - Fixed dark mode for some alerts - Improved accessibility of several of our new UIs (thank you very much @ryanlintott) - Improve first login - Improve multi account devices - Fix crash on macOS 14.4 - Many crash & bug fixes
- Loading branch information
Showing
69 changed files
with
2,355 additions
and
1,312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// | ||
// ChannelMemberList.swift | ||
// Monal | ||
// | ||
// Created by Friedrich Altheide on 17.02.24. | ||
// Copyright © 2024 monal-im.org. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
import monalxmpp | ||
import OrderedCollections | ||
|
||
struct ChannelMemberList: View { | ||
@State private var channelMembers: OrderedDictionary<String, String> | ||
@StateObject var channel: ObservableKVOWrapper<MLContact> | ||
private let account: xmpp | ||
|
||
init(mucContact: ObservableKVOWrapper<MLContact>) { | ||
self.account = MLXMPPManager.sharedInstance().getConnectedAccount(forID: mucContact.accountId)! as xmpp | ||
_channel = StateObject(wrappedValue: mucContact) | ||
|
||
let jidList = Array(DataLayer.sharedInstance().getMembersAndParticipants(ofMuc: mucContact.contactJid, forAccountId: mucContact.accountId)) | ||
var nickSet : OrderedDictionary<String, String> = OrderedDictionary() | ||
for jidDict in jidList { | ||
if let nick = jidDict["room_nick"] as? String { | ||
nickSet.updateValue((jidDict["affiliation"] as? String) ?? "none", forKey:nick) | ||
} | ||
} | ||
_channelMembers = State(wrappedValue: nickSet) | ||
} | ||
|
||
var body: some View { | ||
List { | ||
Section(header: Text(self.channel.obj.contactDisplayName)) { | ||
ForEach(self.channelMembers.sorted(by: <), id: \.self.key) { | ||
member in | ||
ZStack(alignment: .topLeading) { | ||
HStack(alignment: .center) { | ||
Text(member.key) | ||
Spacer() | ||
if member.value == "owner" { | ||
Text(NSLocalizedString("Owner", comment: "")) | ||
} else if member.value == "admin" { | ||
Text(NSLocalizedString("Admin", comment: "")) | ||
} else { | ||
Text(NSLocalizedString("Member", comment: "")) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
.navigationBarTitle("Channel Members", displayMode: .inline) | ||
} | ||
} | ||
|
||
struct ChannelMemberList_Previews: PreviewProvider { | ||
static var previews: some View { | ||
ChannelMemberList(mucContact:ObservableKVOWrapper<MLContact>(MLContact.makeDummyContact(3))); | ||
} | ||
} |
Oops, something went wrong.