-
Notifications
You must be signed in to change notification settings - Fork 19
refactor: Implement trailing content management for schedule options and bottom sheets #2990
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
Open
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c443306
refactor: Implement trailing content management for schedule options …
Elouan1411 19e9b6d
fix: Correct matomo
Elouan1411 895a49a
refactor: Remove unnecessary code
Elouan1411 c623b65
refactor: Clean code
Elouan1411 5a9fd02
refactor: Create extension for trailing content
Elouan1411 78269d4
fix: Prevent leak by using val for view
Elouan1411 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
43 changes: 43 additions & 0 deletions
43
app/src/main/java/com/infomaniak/mail/ui/main/thread/actions/KSuiteChipManager.kt
This file contains hidden or 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,43 @@ | ||
| /* | ||
| * Infomaniak Mail - Android | ||
| * Copyright (C) 2026 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/>. | ||
| */ | ||
| package com.infomaniak.mail.ui.main.thread.actions | ||
|
|
||
| import android.content.Context | ||
| import android.view.ViewGroup | ||
| import com.infomaniak.core.ksuite.ksuitepro.views.EvolveChipView | ||
| import com.infomaniak.core.ksuite.myksuite.ui.views.BaseMyKSuiteChipView | ||
| import com.infomaniak.core.ksuite.myksuite.ui.views.MyKSuitePlusChipView | ||
|
|
||
| class KSuiteChipManager(context: Context) { | ||
| private val kSuitePersoChipView: BaseMyKSuiteChipView = MyKSuitePlusChipView(context) | ||
| private val kSuiteProChipView: EvolveChipView = EvolveChipView(context) | ||
|
|
||
| fun displayChipFor(container: ViewGroup, trailingContent: TrailingContent): Boolean { | ||
| container.removeView(kSuitePersoChipView) | ||
| container.removeView(kSuiteProChipView) | ||
| val chipView = when (trailingContent) { | ||
| // ComposeView are not compatible with view without lifecycles (ex: PopupWindow in RecipientFieldView). | ||
| // This is causing a crash so to avoid that, we have to programmatically | ||
| // add the Compose view only where it's needed. | ||
| TrailingContent.KSuitePersoChip -> kSuitePersoChipView | ||
| TrailingContent.KSuiteProChip -> kSuiteProChipView | ||
| else -> null | ||
| } | ||
| return chipView?.also(container::addView) != null | ||
| } | ||
| } |
This file contains hidden or 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
27 changes: 27 additions & 0 deletions
27
app/src/main/java/com/infomaniak/mail/ui/main/thread/actions/TrailingContent.kt
This file contains hidden or 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,27 @@ | ||
| /* | ||
| * Infomaniak Mail - Android | ||
| * Copyright (C) 2026 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/>. | ||
| */ | ||
| package com.infomaniak.mail.ui.main.thread.actions | ||
|
|
||
| /** Keep the entries order, it's used by the attribute (or change also the attributes order in attrs.xml) */ | ||
| enum class TrailingContent { | ||
| None, | ||
| Chevron, | ||
| Description, | ||
| KSuitePersoChip, | ||
| KSuiteProChip, | ||
| } |
This file contains hidden or 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
38 changes: 38 additions & 0 deletions
38
app/src/main/java/com/infomaniak/mail/utils/extensions/TrailingContentExt.kt
This file contains hidden or 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,38 @@ | ||
| /* | ||
| * Infomaniak Mail - Android | ||
| * Copyright (C) 2026 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/>. | ||
| */ | ||
|
|
||
| package com.infomaniak.mail.utils.extensions | ||
|
|
||
| import com.infomaniak.core.ksuite.data.KSuite | ||
| import com.infomaniak.mail.ui.main.settings.ItemSettingView | ||
| import com.infomaniak.mail.ui.main.thread.actions.ActionItemView | ||
| import com.infomaniak.mail.ui.main.thread.actions.TrailingContent | ||
|
|
||
| fun KSuite?.toTrailingContent(default: TrailingContent = TrailingContent.Chevron): TrailingContent = when (this) { | ||
| KSuite.Perso.Free -> TrailingContent.KSuitePersoChip | ||
| KSuite.Pro.Free, KSuite.StarterPack -> TrailingContent.KSuiteProChip | ||
| else -> default | ||
| } | ||
|
|
||
| fun ActionItemView.setKSuiteTrailingContent(kSuite: KSuite?, default: TrailingContent = TrailingContent.Chevron) { | ||
| trailingContent = kSuite.toTrailingContent(default) | ||
| } | ||
|
|
||
| fun ItemSettingView.setKSuiteTrailingContent(kSuite: KSuite?, default: TrailingContent = TrailingContent.Chevron) { | ||
| trailingContent = kSuite.toTrailingContent(default) | ||
| } |
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.
Keep this