-
Notifications
You must be signed in to change notification settings - Fork 4
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: Scheduled sending #1619
Open
lebojo
wants to merge
83
commits into
master
Choose a base branch
from
feat-Scheduled-sending
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: Scheduled sending #1619
Changes from all commits
Commits
Show all changes
83 commits
Select commit
Hold shift + click to select a range
df1ffc8
style: Init floating panel list and enum
lebojo 3edb40f
style: All views done
lebojo 0c08a97
fix: Testing integration with preprod
lebojo 10762c7
feat: Can now schedule message
lebojo 67203c1
fix: Enum date
lebojo 6b13fd2
fix: Can recieve scheduled messages
lebojo 9acdea4
feat: Show scheduled thread count
lebojo 1415c7f
refactor: Add custom schedule to enum
lebojo 38b4b89
refactor: Same date view for thread + feat: Icon for scheduled messages
lebojo 1cd38c6
fix: Can delete scheduled draft
lebojo a00c08f
feat: Change draft schedule from message View
lebojo e19443f
feat: Delete schedule
lebojo 3a6be0e
fix: Better use for calendar
lebojo c8dc893
feat: Collapse double func
lebojo f28f68a
fix: Remove preprod
lebojo 70708d7
refactor: Send or schedule
lebojo efafd0b
refactor: Delete doublons
lebojo fe5571a
feat: Custom schedule
lebojo 2686958
fix: Edit draft
lebojo 88a9bd7
fix: See scheduled draft folder
lebojo 67c2bb8
refactor: Delete multiple draft
lebojo b8703cb
fix: Localized strings
lebojo 1a6181b
fix: Format
lebojo eaaa208
refactor: Working system for new schedule
lebojo b04a33d
fix: Localizable for snackbar info
lebojo 7ace1c9
feat: Reload schedule folder
lebojo 50836f5
fix: Scheduled folder is showing only when needed
lebojo 2098bda
feat: Added option for modal dismiss optional
lebojo 45368a5
feat: Edit draft from draft
lebojo 8668e63
feat: Snakbar to cancel schedule
lebojo 3b3ac29
feat: Verify is schedule is possible
lebojo 9f13792
style: Localized string for cancelled schedule
lebojo 5f0d898
style: Refactor to match Figma's style
lebojo 9a37475
style: Match color of figma
lebojo a89005e
fix: Replace date iso8601 String to Date object
lebojo 529f54d
style: Match the figma's clock for HeaderDateView
lebojo 943b8d9
feat: Schedule header match color of label
lebojo a23a5f1
fix: Modifying schedule date
lebojo 75be70f
fix: Color for schedule date matching figma's
lebojo dd97555
fix: Remove useless date
lebojo a962974
style: Remove debug things
lebojo 66fcaae
feat: Add feature flag support for custom schedule
lebojo ffec3a4
feat: Add schedule discoveryView and set optional later button
lebojo a34cc99
fix: Floating panel can't be hidden
lebojo e290d6a
fix: Check if conversion worked
lebojo 4f69d20
fix: Transition between panel and modal
lebojo 0ddad01
style: Extract custom Schedule button into his own file
lebojo 55d0f2e
refactor: Clarify CustomScheduleModalView
lebojo f546d12
fix: Norm code
lebojo 3e0a18d
style: Change color of schedule header to match figma
lebojo 129d75e
fix: Correct feature flag check
lebojo ef9700b
refactor: New icons and icon names.
lebojo 6e89601
fix: Update old tests
lebojo edf67e6
fix: Floating panel showing für reschedule too
lebojo 11f9b30
feat: Floating panel self dismiss
lebojo 2643c1f
feat: Inverse threads list order in scheduled draft folder
lebojo 77a4831
fix: Remove useless ternary
lebojo 10bfa5d
feat: Snackbar take boolean to display
lebojo 77d4a60
feat: New icons and localized strings
lebojo de176ad
fix: Remove unused
lebojo 150e90d
fix: Wrong statement
lebojo 779eb33
fix: Added snooze folder for match API
lebojo 78f95d7
style: Added iconsize
lebojo 8eb4074
refactor: Simplified showed scheduled option logic
lebojo 28b852f
fix: Wording
lebojo 183c409
refactor: Rethrows schedules action
lebojo 89ff993
fix: Format
lebojo 2d8c8c7
fix: Wording
lebojo f6ae3ca
refactor: Wording and uses of ikLabel
lebojo 45eaf9b
fix: Used already own discovery picture
lebojo 5a9c197
fix: Remove swipe action from scheduled messages/thread
lebojo 3d54606
refactor: Correct Draft Action to schedule action
lebojo 3dbefe4
refactor: Simplified schedule date checker
lebojo c0e6701
chore: Updated strings
lebojo eb85bda
refactor: Wording scheduleAction draftAction
lebojo a69caca
feat: Change quick actions for scheduled
lebojo 3de6c13
fix: No more thread in scheduled folder
lebojo b497bd6
fix: Bottombar for Scheduled
lebojo 275f60a
refactor: New strategy for Later button (DiscoveryView)
lebojo 4c08fd4
refactor: Remove "row" from name
lebojo 81070cc
fix: Remove comments
lebojo a60928e
feat: Matomo
lebojo f0396c7
fix: Update locco
lebojo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,86 @@ | ||
/* | ||
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 InfomaniakCoreCommonUI | ||
import InfomaniakCoreSwiftUI | ||
import InfomaniakDI | ||
import MailCore | ||
import MailCoreUI | ||
import MailResources | ||
import SwiftUI | ||
|
||
struct CustomScheduleAlertView: View { | ||
@LazyInjectService private var matomo: MatomoUtils | ||
|
||
@State private var isShowingError = false | ||
@State private var selectedDate: Date | ||
|
||
let startingDate: Date | ||
let confirmAction: (Date) -> Void | ||
let cancelAction: (() -> Void)? | ||
|
||
private var isDelayTooShort: Bool { | ||
selectedDate < Date.minimumScheduleDelay | ||
} | ||
|
||
init(startingDate: Date, confirmAction: @escaping (Date) -> Void, cancelAction: (() -> Void)? = nil) { | ||
_selectedDate = .init(initialValue: startingDate) | ||
self.startingDate = startingDate | ||
self.confirmAction = confirmAction | ||
self.cancelAction = cancelAction | ||
} | ||
|
||
var body: some View { | ||
VStack(alignment: .leading, spacing: 0) { | ||
Text(MailResourcesStrings.Localizable.datePickerTitle) | ||
.textStyle(.bodyMedium) | ||
.padding(.bottom, IKPadding.alertTitleBottom) | ||
DatePicker( | ||
MailResourcesStrings.Localizable.datePickerTitle, | ||
selection: $selectedDate, | ||
in: Date.minimumScheduleDelay... | ||
) | ||
.labelsHidden() | ||
.onChange(of: selectedDate) { newDate in | ||
isShowingError = newDate < Date.minimumScheduleDelay | ||
} | ||
|
||
Text(MailResourcesStrings.Localizable.errorScheduleDelayTooShort) | ||
.textStyle(.labelError) | ||
.padding(.top, value: .extraSmall) | ||
.opacity(isShowingError ? 1 : 0) | ||
.padding(.bottom, IKPadding.alertDescriptionBottom) | ||
|
||
ModalButtonsView(primaryButtonTitle: MailResourcesStrings.Localizable.buttonScheduleTitle, | ||
secondaryButtonTitle: MailResourcesStrings.Localizable.buttonCancel, | ||
primaryButtonEnabled: !isShowingError, | ||
primaryButtonDismiss: !isDelayTooShort, | ||
primaryButtonAction: executeActionIfPossible, | ||
secondaryButtonAction: cancelAction) | ||
} | ||
} | ||
|
||
private func executeActionIfPossible() { | ||
guard !isDelayTooShort else { | ||
isShowingError = true | ||
return | ||
} | ||
confirmAction(selectedDate) | ||
matomo.track(eventWithCategory: .scheduleSend, name: "customSchedule") | ||
} | ||
} |
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,60 @@ | ||
/* | ||
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 InfomaniakCoreSwiftUI | ||
import MailCore | ||
import MailResources | ||
import SwiftUI | ||
|
||
struct ModifyMessageScheduleAlertView: View { | ||
@EnvironmentObject private var mainViewState: MainViewState | ||
@EnvironmentObject private var mailboxManager: MailboxManager | ||
|
||
let draftResource: String | ||
|
||
var body: some View { | ||
VStack(alignment: .leading, spacing: IKPadding.medium) { | ||
Text(MailResourcesStrings.Localizable.editSendTitle) | ||
.textStyle(.bodyMedium) | ||
Text(MailResourcesStrings.Localizable.editSendDescription) | ||
.textStyle(.body) | ||
ModalButtonsView(primaryButtonTitle: MailResourcesStrings.Localizable.buttonModify, | ||
secondaryButtonTitle: MailResourcesStrings.Localizable.buttonCancel, | ||
primaryButtonAction: modifySchedule) | ||
} | ||
} | ||
|
||
private func modifySchedule() { | ||
Task { | ||
await tryOrDisplayError { | ||
try await mailboxManager.moveScheduleToDraft(draftResource: draftResource) | ||
guard let draft = try await mailboxManager.loadRemotely(from: draftResource) else { return } | ||
|
||
DraftUtils.editDraft( | ||
from: draft, | ||
mailboxManager: mailboxManager, | ||
composeMessageIntent: $mainViewState.composeMessageIntent | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
||
#Preview { | ||
ModifyMessageScheduleAlertView(draftResource: "") | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context: We had seen together (IRL) that there was a bug: When we modify a draft, it appeared twice (the modified version and the old one) (duplicate bug)
And when we reverted that part of the code it seemed to work again.
Update: I tried to reproduce the bug but I can't do it, it would be necessary to investigate a little more