Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: New Window button menu #1442

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Mail/Commands/CustomCommands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ struct CustomCommands: Commands {
CommandGroup(replacing: .newItem) {
if #available(iOS 16.0, *) {
NewMessageCommand(mailboxManager: mainViewState?.mailboxManager)

NewWindowCommand(rootViewState: rootViewState)
}
}

Expand Down
45 changes: 45 additions & 0 deletions Mail/Commands/NewWindowCommand.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
Infomaniak Mail - iOS App
Copyright (C) 2024 Infomaniak Network SA

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import InfomaniakCore
import InfomaniakCoreUI
import InfomaniakDI
import MailCore
import MailResources
import SwiftUI

@available(iOS 16.0, *)
struct NewWindowCommand: View {
@LazyInjectService private var matomo: MatomoUtils

@Environment(\.openWindow) private var openWindow

let rootViewState: RootViewState

var body: some View {
Button(MailResourcesStrings.Localizable.buttonNewWindow) {
newWindow()
}
.keyboardShortcut("n", modifiers: [.option, .command])
}

@MainActor func newWindow() {
matomo.track(eventWithCategory: .menuAction, name: "newWindow")
PhilippeWeidmann marked this conversation as resolved.
Show resolved Hide resolved
openWindow(id: DesktopWindowIdentifier.mainWindowIdentifier(currentViewState: rootViewState))
}
}
3 changes: 3 additions & 0 deletions MailResources/Localizable/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@
/* loco:6267bafe7edebd666d7d6923 */
"buttonNewMessage" = "Neue Nachricht";

/* loco:66596b6a5fa78a61780e4315 */
"buttonNewWindow" = "Neues Fenster";

/* loco:6527b7d4882400da7d04ffd2 */
"buttonNo" = "Nein";

Expand Down
3 changes: 3 additions & 0 deletions MailResources/Localizable/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@
/* loco:6267bafe7edebd666d7d6923 */
"buttonNewMessage" = "New message";

/* loco:66596b6a5fa78a61780e4315 */
"buttonNewWindow" = "New Window";

/* loco:6527b7d4882400da7d04ffd2 */
"buttonNo" = "No";

Expand Down
3 changes: 3 additions & 0 deletions MailResources/Localizable/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@
/* loco:6267bafe7edebd666d7d6923 */
"buttonNewMessage" = "Nuevo mensaje";

/* loco:66596b6a5fa78a61780e4315 */
"buttonNewWindow" = "Nueva ventana";

/* loco:6527b7d4882400da7d04ffd2 */
"buttonNo" = "No";

Expand Down
3 changes: 3 additions & 0 deletions MailResources/Localizable/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@
/* loco:6267bafe7edebd666d7d6923 */
"buttonNewMessage" = "Nouveau message";

/* loco:66596b6a5fa78a61780e4315 */
"buttonNewWindow" = "Nouvelle fenêtre";

/* loco:6527b7d4882400da7d04ffd2 */
"buttonNo" = "Non";

Expand Down
3 changes: 3 additions & 0 deletions MailResources/Localizable/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@
/* loco:6267bafe7edebd666d7d6923 */
"buttonNewMessage" = "Nuovo messaggio";

/* loco:66596b6a5fa78a61780e4315 */
"buttonNewWindow" = "Nuova finestra";

/* loco:6527b7d4882400da7d04ffd2 */
"buttonNo" = "No";

Expand Down
Loading