Skip to content

Commit

Permalink
feat: New Window button menu
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeWeidmann committed May 31, 2024
1 parent 23b9f8c commit 5ca49ad
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 0 deletions.
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(rootViewState: rootViewState)
}
.keyboardShortcut("n", modifiers: [.option, .command])
}

@MainActor func newWindow(rootViewState: RootViewState) {
matomo.track(eventWithCategory: .menuAction, name: "newWindow")
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

0 comments on commit 5ca49ad

Please sign in to comment.