Skip to content

Commit

Permalink
6.0.2rc1 (#979)
Browse files Browse the repository at this point in the history
Minor improvements
  • Loading branch information
tmolitor-stud-tu authored Nov 26, 2023
2 parents 3d96b41 + 93383f1 commit 7cec7a6
Show file tree
Hide file tree
Showing 29 changed files with 436 additions and 164 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/beta.build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
EXPORT_OPTIONS_IOS: "../scripts/exportOptions/Beta_iOS_ExportOptions.plist"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
clean: true
submodules: true
Expand Down Expand Up @@ -75,22 +75,22 @@ jobs:
run: ./scripts/uploadNonAlpha.sh beta
- name: Publish catalyst to appstore connect
run: xcrun altool --upload-app --file ./Monal/build/app/Monal.pkg --type macos --asc-provider S8D843U34Y -u "$(cat /Users/ci/apple_connect_upload_mail.txt)" -p "$(cat /Users/ci/apple_connect_upload_secret.txt)" --primary-bundle-id org.monal-im.prod.catalyst.monal
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: monal-catalyst
path: Monal/build/app/Monal.zip
if-no-files-found: error
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: monal-ios
path: Monal/build/ipa/Monal.ipa
if-no-files-found: error
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: monal-catalyst-dsym
path: Monal/build/macos_Monal.xcarchive/dSYMs
if-no-files-found: error
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: monal-ios-dsym
path: Monal/build/ios_Monal.xcarchive/dSYMs
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/develop-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
EXPORT_OPTIONS_IOS: "../scripts/exportOptions/Alpha_iOS_ExportOptions.plist"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
clean: true
submodules: true
Expand Down Expand Up @@ -60,22 +60,22 @@ jobs:
run: xcrun notarytool submit ./Monal/build/app/Monal.zip --wait --team-id S8D843U34Y --key "/Users/ci/appstoreconnect/apiKey.p8" --key-id "$(cat /Users/ci/appstoreconnect/apiKeyId.txt)" --issuer "$(cat /Users/ci/appstoreconnect/apiIssuerId.txt)"
- name: Update monal homebrew alpha repo
run: scripts/updateAlphaHomebrew.sh
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: monal-catalyst
path: Monal/build/app/Monal.tar
if-no-files-found: error
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: monal-ios
path: Monal/build/ipa/Monal.ipa
if-no-files-found: error
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: monal-catalyst-dsym
path: Monal/build/macos_Monal.xcarchive/dSYMs
if-no-files-found: error
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: monal-ios-dsym
path: Monal/build/ios_Monal.xcarchive/dSYMs
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/stable.build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
EXPORT_OPTIONS_IOS: "../scripts/exportOptions/Stable_iOS_ExportOptions.plist"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
clean: true
submodules: true
Expand Down Expand Up @@ -73,22 +73,22 @@ jobs:
run: xcrun altool --upload-app --file ./Monal/build/app/Monal.pkg --type macos --asc-provider S8D843U34Y -u "$(cat /Users/ci/apple_connect_upload_mail.txt)" -p "$(cat /Users/ci/apple_connect_upload_secret.txt)" --primary-bundle-id maccatalyst.G7YU7X7KRJ.SworIM
# - name: Update xmpp.org client list with new timestamp
# run: ./scripts/push_xmpp.org.sh
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: monal-catalyst-pkg
path: Monal/build/app/Monal.pkg
if-no-files-found: error
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: monal-ios
path: Monal/build/ipa/Monal.ipa
if-no-files-found: error
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: monal-catalyst-dsym
path: Monal/build/macos_Monal.xcarchive/dSYMs
if-no-files-found: error
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: monal-ios-dsym
path: Monal/build/ios_Monal.xcarchive/dSYMs
Expand Down
83 changes: 83 additions & 0 deletions Monal/Classes/ContactList.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//
// ContactList.swift
// Monal
//
// Created by Jan on 15.12.22.
// Copyright © 2022 monal-im.org. All rights reserved.
//

import SwiftUI
import monalxmpp

struct ContactEntry: View {
let contact : MLContact

var body:some View {
ZStack(alignment: .topLeading) {
HStack(alignment: .center) {
Image(uiImage: contact.avatar)
.resizable()
.frame(width: 40, height: 40, alignment: .center)
VStack(alignment: .leading) {
Text(contact.contactDisplayName as String)
Text(contact.contactJid as String).font(.footnote).opacity(0.6)
}
}
}
}
}

struct ContactList: View {
@State var contacts : [MLContact]
@State var selectedContact : MLContact?
@State var searchFieldInput = ""

func matchesSearch(contact : MLContact) -> Bool {
// TODO better lookup
if searchFieldInput.isEmpty == true {
return true
} else {
return contact.contactDisplayName.lowercased().contains(searchFieldInput.lowercased()) ||
contact.contactJid.contains(searchFieldInput.lowercased())
}
}

var body: some View {
if(contacts.isEmpty) {
Text("No contacts to show :(")
.navigationTitle("Contact Lists")
} else {
List {
Section {
TextField("Search contacts", text: $searchFieldInput)
}
ForEach(contacts, id: \.self) { contact in
if matchesSearch(contact: contact) {
ContactEntry(contact: contact)
}
}
.onDelete {
print(contacts.remove(atOffsets: $0))
}
.onInsert(of: [""], perform: { _,_ in
})
}
.listStyle(.inset)
.navigationBarTitle("Contact List", displayMode: .inline)
.toolbar {
EditButton()
}
}
}
}

struct ContactList_Previews: PreviewProvider {
static var previews: some View {
ContactList(contacts: [
MLContact.makeDummyContact(0),
MLContact.makeDummyContact(1),
MLContact.makeDummyContact(2),
MLContact.makeDummyContact(3)]
)
}
}
16 changes: 15 additions & 1 deletion Monal/Classes/ContactsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ -(void) openAddContacts:(id)sender
[self presentViewController:addContactMenuView animated:YES completion:^{}];
}

-(void) openContactRequests:(id)sender
-(void) openCreateGroup:(id) sender
{
UIViewController* createGroupView = [[SwiftuiInterface new] makeViewWithName:@"CreateGroup"];
[self presentViewController:createGroupView animated:YES completion:^{}];
}

-(void) openContactRequests:(id) sender
{
UIViewController* contactRequestsView = [[SwiftuiInterface new] makeViewWithName:@"ContactRequests"];
[self presentViewController:contactRequestsView animated:YES completion:^{}];
Expand Down Expand Up @@ -99,7 +105,15 @@ -(void) viewDidLoad
addContact.image = [UIImage systemImageNamed:@"person.fill.badge.plus"];
[addContact setAction:@selector(openAddContacts:)];

#ifdef IS_ALPHA
UIBarButtonItem* createGroup = [[UIBarButtonItem alloc] init];
createGroup.image = [UIImage systemImageNamed:@"person.3.fill"];
[createGroup setAction:@selector(openCreateGroup:)];
self.navigationItem.rightBarButtonItems = [[NSArray alloc] initWithObjects:addContact, [[UIBarButtonItem alloc] init], createGroup, nil];
#else
self.navigationItem.rightBarButtonItems = [[NSArray alloc] initWithObjects:addContact, [UIBarButtonItem new], nil];
#endif

[self configureContactRequestsImage];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleContactUpdate) name:kMonalContactRemoved object:nil];
Expand Down
116 changes: 116 additions & 0 deletions Monal/Classes/CreateGroupMenu.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
//
// AddContactMenu.swift
// Monal
//
// Created by Jan on 27.10.22.
// Copyright © 2022 monal-im.org. All rights reserved.
//

import MobileCoreServices
import UniformTypeIdentifiers
import SwiftUI
import monalxmpp

struct CreateGroupMenu: View {
var delegate: SheetDismisserProtocol

@State private var connectedAccounts: [xmpp]
@State private var selectedAccount: Int
@State private var groupName: String = ""

@State private var showAlert = false
// note: dismissLabel is not accessed but defined at the .alert() section
@State private var alertPrompt = AlertPrompt(dismissLabel: Text("Close"))

@ObservedObject private var overlay = LoadingOverlayState()

@State private var showQRCodeScanner = false
@State private var success = false

private let dismissWithNewGroup: (MLContact) -> ()

init(delegate: SheetDismisserProtocol, dismissWithNewGroup: @escaping (MLContact) -> (), prefillJid: String = "", preauthToken:String? = nil) {
// FIXME
self.delegate = delegate
self.dismissWithNewGroup = dismissWithNewGroup
self.groupName = prefillJid
// self.preauthToken = preauthToken

let connectedAccounts = MLXMPPManager.sharedInstance().connectedXMPP as! [xmpp]
self.connectedAccounts = connectedAccounts
self.selectedAccount = connectedAccounts.first != nil ? 0 : -1;
}

// FIXME duplicate code from WelcomeLogIn.swift, maybe move to SwiftuiHelpers

private func errorAlert(title: Text, message: Text = Text("")) {
alertPrompt.title = title
alertPrompt.message = message
showAlert = true
}

private func successAlert(title: Text, message: Text) {
alertPrompt.title = title
alertPrompt.message = message
self.success = true // < dismiss entire view on close
showAlert = true
}

private var buttonColor: Color {
return Color(UIColor.systemBlue)
}

var body: some View {
Form {
if(connectedAccounts.isEmpty) {
Text("Please make sure at least one account has connected before trying to create new group.")
.foregroundColor(.secondary)
}
else
{
Section() {
if(connectedAccounts.count > 1) {
Picker("Use account", selection: $selectedAccount) {
ForEach(Array(self.connectedAccounts.enumerated()), id: \.element) { idx, account in
Text(account.connectionProperties.identity.jid).tag(idx)
}
}
.pickerStyle(.menu)
}
TextField("Group Name (optional)", text: $groupName)
.autocorrectionDisabled()
.autocapitalization(.none)
.addClearButton(text:$groupName)

NavigationLink(destination: LazyClosureView(ContactList(contacts: DataLayer.sharedInstance().contactList() as! [MLContact])), label: {
Text("Group Members")
})
}
Section {
Button(action: {}, label: {
Text("Create new group")
})
}
}
}
.alert(isPresented: $showAlert) {
Alert(title: alertPrompt.title, message: alertPrompt.message, dismissButton:.default(Text("Close"), action: {
showAlert = false
if self.success == true {
// TODO dismissWithNewGroup
}
}))
}
.addLoadingOverlay(overlay)
.navigationBarTitle("Create new group", displayMode: .inline)
.navigationViewStyle(.stack)
}
}

struct CreateGroupMenu_Previews: PreviewProvider {
static var delegate = SheetDismisserProtocol()
static var previews: some View {
CreateGroupMenu(delegate: delegate, dismissWithNewGroup: { c in
})
}
}
Loading

0 comments on commit 7cec7a6

Please sign in to comment.