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: Download sync profile #1023

Merged
merged 23 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2ca2ff1
feat: Basic sync profile navigation
PhilippeWeidmann Aug 8, 2023
c4a447d
feat: SyncProfileNavigationView entry point
PhilippeWeidmann Sep 28, 2023
971d765
feat: SyncDownloadProfileView + SyncWelcomeView
PhilippeWeidmann Sep 29, 2023
349ca9c
feat: SyncCopyPasswordView
PhilippeWeidmann Oct 2, 2023
709d018
feat: Sync UI improvements + Previews
PhilippeWeidmann Oct 2, 2023
8ee13a2
feat: TipView
PhilippeWeidmann Oct 2, 2023
3c38fda
feat: SyncInstallProfileTutorialView
PhilippeWeidmann Oct 2, 2023
ca12139
feat: Make ConfigWebServer more modular
PhilippeWeidmann Oct 2, 2023
aceeaa9
feat: Add tutorial images
PhilippeWeidmann Oct 5, 2023
eae052f
feat: Back button bottom of page
PhilippeWeidmann Oct 5, 2023
bc4d521
feat: Real call for application password
PhilippeWeidmann Oct 5, 2023
f8d0474
feat: Add ChipView to SyncWelcomeView
PhilippeWeidmann Oct 5, 2023
78ee771
chore: Make sonarcloud happy
PhilippeWeidmann Oct 5, 2023
99ce195
fix: Update sync-tutorial-1 step image
PhilippeWeidmann Oct 5, 2023
b576ced
feat(SyncProfile): I18n
PhilippeWeidmann Oct 5, 2023
880918f
fix(MailApiFetcherSyncProfile): Ensure unique name
PhilippeWeidmann Oct 5, 2023
0e4d3d9
fix(SyncProfile): UI improvements
PhilippeWeidmann Oct 5, 2023
6414280
feat(SyncProfile): Menu and Settings access points
PhilippeWeidmann Oct 5, 2023
9d55dc0
fix: Updated paddings/i18n/illustrations
PhilippeWeidmann Oct 6, 2023
e7ce934
fix(ChipView): Correct padding + TextStyle
PhilippeWeidmann Oct 6, 2023
bbfa254
fix: Add correct padding and spacing
PhilippeWeidmann Oct 6, 2023
4528d0a
refactor: PR feedback
PhilippeWeidmann Oct 6, 2023
c058a7c
refactor(SyncProfileNavigationView): Use CloseButton
PhilippeWeidmann Oct 6, 2023
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
9 changes: 9 additions & 0 deletions .package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,15 @@
"version" : "1.0.3"
}
},
{
"identity" : "swifter",
"kind" : "remoteSourceControl",
"location" : "https://github.com/httpswift/swifter",
"state" : {
"revision" : "9483a5d459b45c3ffd059f7b55f9638e268632fd",
"version" : "1.5.0"
}
},
{
"identity" : "swiftregex",
"kind" : "remoteSourceControl",
Expand Down
38 changes: 38 additions & 0 deletions Mail/Components/ChipView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
Infomaniak Mail - iOS App
Copyright (C) 2022 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 MailCore
import SwiftUI

struct ChipView: View {
@AppStorage(UserDefaults.shared.key(.accentColor)) private var accentColor = DefaultPreferences.accentColor

let text: String

var body: some View {
Text(text)
PhilippeWeidmann marked this conversation as resolved.
Show resolved Hide resolved
.textStyle(.labelMediumAccent)
.padding(.vertical, value: .small)
.padding(.horizontal, value: .intermediate)
.background(Capsule().fill(accentColor.secondary.swiftUIColor))
}
}

#Preview {
ChipView(text: "Test")
}
38 changes: 38 additions & 0 deletions Mail/Components/SyncStepToolbarItem.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
Infomaniak Mail - iOS App
Copyright (C) 2022 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 MailResources
import SwiftUI

struct SyncStepToolbarItem: View {
let step: Int
let totalSteps: Int
var body: some View {
VStack {
Text(MailResourcesStrings.Localizable.syncTutorialStepCount(step, totalSteps))
.textStyle(.bodyMedium)
.padding(value: .small)
.background(RoundedRectangle(cornerRadius: 8).fill(MailResourcesAsset.textFieldBorder.swiftUIColor))
}
.padding(value: .regular)
}
}

#Preview {
SyncStepToolbarItem(step: 1, totalSteps: 3)
}
43 changes: 43 additions & 0 deletions Mail/Components/TipView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
Infomaniak Mail - iOS App
Copyright (C) 2022 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 MailCore
import MailResources
import SwiftUI

struct TipView: View {
@AppStorage(UserDefaults.shared.key(.accentColor)) private var accentColor = DefaultPreferences.accentColor

let message: String
var body: some View {
HStack(alignment: .top) {
MailResourcesAsset.lightBulbShine.swiftUIImage
.foregroundColor(accentColor.primary)

Text(message)
.textStyle(.body)
}
.padding(value: .regular)
.background(MailResourcesAsset.textFieldColor.swiftUIColor)
.cornerRadius(8)
}
}

#Preview {
TipView(message: "Hello, World!")
}
3 changes: 3 additions & 0 deletions Mail/Helpers/AppAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ enum ApplicationAssembly {
},
Factory(type: LocalContactsHelpable.self) { _, _ in
LocalContactsHelper()
},
Factory(type: ConfigWebServer.self) { _, _ in
ConfigWebServer()
}
]

Expand Down
16 changes: 16 additions & 0 deletions Mail/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@
<string>mailto</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>None</string>
<key>CFBundleURLName</key>
<string>com.infomaniak.mail.profile</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.infomaniak.mail.profile-callback</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array/>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
Expand Down
10 changes: 6 additions & 4 deletions Mail/Views/Menu Drawer/Items/MenuDrawerItemCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,21 @@ struct MenuDrawerItemCell: View {

Text(label)
.textStyle(.bodyMedium)
.multilineTextAlignment(.leading)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't .leading the default value?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe because we are inside a button label I had to specify it

}
.frame(maxWidth: .infinity, alignment: .leading)
.padding(UIPadding.menuDrawerCell)
}
}
}

struct ItemCellView_Previews: PreviewProvider {
static var previews: some View {
#Preview {
VStack {
MenuDrawerItemCell(icon: MailResourcesAsset.drawerDownload,
label: "Importer des mails",
matomoName: "") { print("Hello") }
.previewLayout(.sizeThatFits)
.previewDevice(PreviewDevice(stringLiteral: "iPhone 11 Pro"))
MenuDrawerItemCell(icon: MailResourcesAsset.drawerDownload,
label: MailResourcesStrings.Localizable.buttonSyncCalendarsAndContacts,
matomoName: "") { print("Hello") }
}
}
9 changes: 9 additions & 0 deletions Mail/Views/Menu Drawer/Items/MenuDrawerItemsListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,15 @@ struct MenuDrawerItemsHelpListView: View {

@State private var isShowingHelp = false
@State private var isShowingBugTracker = false
@State private var isShowingSyncProfile = false

var body: some View {
MenuDrawerItemsListView {
MenuDrawerItemCell(icon: MailResourcesAsset.doubleArrowsSynchronize,
label: MailResourcesStrings.Localizable.buttonSyncCalendarsAndContacts,
matomoName: "syncProfile") {
isShowingSyncProfile = true
}
MenuDrawerItemCell(icon: MailResourcesAsset.feedback,
label: MailResourcesStrings.Localizable.buttonFeedback,
matomoName: "feedback") {
Expand All @@ -82,6 +88,9 @@ struct MenuDrawerItemsHelpListView: View {
.sheet(isPresented: $isShowingBugTracker) {
BugTrackerView(isPresented: $isShowingBugTracker)
}
.sheet(isPresented: $isShowingSyncProfile) {
SyncProfileNavigationView()
}
}

private func sendFeedback() {
Expand Down
12 changes: 12 additions & 0 deletions Mail/Views/Settings/General/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ struct SettingsView: View {
@AppStorage(UserDefaults.shared.key(.externalContent)) private var externalContent = DefaultPreferences.externalContent
@AppStorage(UserDefaults.shared.key(.threadMode)) private var threadMode = DefaultPreferences.threadMode

@State private var isShowingSyncProfile = false

var body: some View {
ScrollView {
VStack(alignment: .leading, spacing: 0) {
Expand Down Expand Up @@ -69,6 +71,13 @@ struct SettingsView: View {
SettingsNotificationsView()
}

Button {
isShowingSyncProfile = true
} label: {
SettingsSubMenuLabel(title: MailResourcesStrings.Localizable.buttonSyncCalendarsAndContacts)
}
.buttonStyle(.plain)

IKDivider()
}

Expand Down Expand Up @@ -152,6 +161,9 @@ struct SettingsView: View {
.background(MailResourcesAsset.backgroundColor.swiftUIColor)
.navigationBarTitle(MailResourcesStrings.Localizable.settingsTitle, displayMode: .inline)
.backButtonDisplayMode(.minimal)
.sheet(isPresented: $isShowingSyncProfile) {
SyncProfileNavigationView()
}
.matomoView(view: [MatomoUtils.View.settingsView.displayName, "General"])
}
}
Expand Down
42 changes: 26 additions & 16 deletions Mail/Views/Settings/SettingsSubMenuCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,31 @@
import MailCore
import SwiftUI

struct SettingsSubMenuLabel: View {
let title: String
var subtitle: String?
var icon: Image?

var body: some View {
HStack(spacing: UIPadding.regular) {
icon

VStack(alignment: .leading) {
Text(title)
.textStyle(.body)
if let subtitle {
Text(subtitle)
.textStyle(.bodySmallTertiary)
}
}
.frame(maxWidth: .infinity, alignment: .leading)

ChevronIcon(style: .right)
}
.settingsItem()
}
}

struct SettingsSubMenuCell<Content: View>: View {
let title: String
var subtitle: String?
Expand All @@ -27,22 +52,7 @@ struct SettingsSubMenuCell<Content: View>: View {

var body: some View {
NavigationLink(destination: destination) {
HStack(spacing: UIPadding.regular) {
icon

VStack(alignment: .leading) {
Text(title)
.textStyle(.body)
if let subtitle {
Text(subtitle)
.textStyle(.bodySmallTertiary)
}
}
.frame(maxWidth: .infinity, alignment: .leading)

ChevronIcon(style: .right)
}
.settingsItem()
SettingsSubMenuLabel(title: title, subtitle: subtitle, icon: icon)
}
}
}
Expand Down
31 changes: 31 additions & 0 deletions Mail/Views/Sync Profile/DownloadConfigSafariView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Infomaniak Mail - iOS App
Copyright (C) 2022 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 SafariServices
import SwiftUI

struct DownloadConfigSafariView: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> SFSafariViewController {
let url = URL(string: "http://localhost:8080/index")!
return SFSafariViewController(url: url)
}

func updateUIViewController(_ uiViewController: SFSafariViewController, context: Context) {
// SFSafariViewController is never updated
}
}
Loading
Loading