You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iceraven-browser/app/src/main/java/org/mozilla/fenix/home/recentvisits/interactor/RecentVisitsInteractor.kt

48 lines
1.7 KiB
Kotlin

For #22534 - Show history highlights and groups in "Recently visited" (#22535) * For #22534 - Update homescreen section name to "Recently visited" * For #22534 - Show both history highlights and groups in Recently visited For now the metadata groups don't support scoring so as an interim solution we will show up to 9 items, evenly distributes, first favoring groups sorted by date then history highlights pre-sorted by default. Tapping a history highlight will switch to it's already open tab if available or create a new one in which to load it if needed. A "Remove" option will also be available for history highlights to remove it from the screen and also from history. Currently removing a group / highlight will not query new ones to again show up to 9 items, this will be implemented separately. * For #22534 - Rename and refactor historymetadata to recentvisits The updated feature supports more than history metadata so updating the overall naming scheme seems needed. To signal that this is a homescreen feature the entire package is moved to home * For #22534 - Update UI tests to account for the new items space on the screen Saw failures about not finding the collection section on screen. This is probably happening because w are now adding the recent visits to homescreen above the collections section pushing it off screen. Since the collections might be obstructed by the toolbar shown on top as a quick solution we'll scroll to the next homescreen section so that the collections will be shown above in their entirety. * Update app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com> * Update app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com> Co-authored-by: Gabriel Luong <gabriel.luong@gmail.com> Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
3 years ago
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.fenix.home.recentvisits.interactor
import org.mozilla.fenix.home.recentvisits.RecentlyVisitedItem.RecentHistoryGroup
For #22534 - Show history highlights and groups in "Recently visited" (#22535) * For #22534 - Update homescreen section name to "Recently visited" * For #22534 - Show both history highlights and groups in Recently visited For now the metadata groups don't support scoring so as an interim solution we will show up to 9 items, evenly distributes, first favoring groups sorted by date then history highlights pre-sorted by default. Tapping a history highlight will switch to it's already open tab if available or create a new one in which to load it if needed. A "Remove" option will also be available for history highlights to remove it from the screen and also from history. Currently removing a group / highlight will not query new ones to again show up to 9 items, this will be implemented separately. * For #22534 - Rename and refactor historymetadata to recentvisits The updated feature supports more than history metadata so updating the overall naming scheme seems needed. To signal that this is a homescreen feature the entire package is moved to home * For #22534 - Update UI tests to account for the new items space on the screen Saw failures about not finding the collection section on screen. This is probably happening because w are now adding the recent visits to homescreen above the collections section pushing it off screen. Since the collections might be obstructed by the toolbar shown on top as a quick solution we'll scroll to the next homescreen section so that the collections will be shown above in their entirety. * Update app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com> * Update app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com> Co-authored-by: Gabriel Luong <gabriel.luong@gmail.com> Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
3 years ago
import org.mozilla.fenix.home.recentvisits.RecentlyVisitedItem.RecentHistoryHighlight
/**
* All possible user interactions with the "Recent visits" section.
*/
interface RecentVisitsInteractor {
/**
* Callback for when the user clicks on the "Show all" button besides the recent visits header.
*/
fun onHistoryShowAllClicked()
/**
* Callbacks for when the user clicks on a [RecentHistoryGroup].
*
* @param recentHistoryGroup The just clicked [RecentHistoryGroup].
*/
fun onRecentHistoryGroupClicked(recentHistoryGroup: RecentHistoryGroup)
/**
* Callback for when the user selected an option to remove a [RecentHistoryGroup].
*
* @param groupTitle [RecentHistoryGroup.title] of the item to remove.
*/
fun onRemoveRecentHistoryGroup(groupTitle: String)
For #22534 - Show history highlights and groups in "Recently visited" (#22535) * For #22534 - Update homescreen section name to "Recently visited" * For #22534 - Show both history highlights and groups in Recently visited For now the metadata groups don't support scoring so as an interim solution we will show up to 9 items, evenly distributes, first favoring groups sorted by date then history highlights pre-sorted by default. Tapping a history highlight will switch to it's already open tab if available or create a new one in which to load it if needed. A "Remove" option will also be available for history highlights to remove it from the screen and also from history. Currently removing a group / highlight will not query new ones to again show up to 9 items, this will be implemented separately. * For #22534 - Rename and refactor historymetadata to recentvisits The updated feature supports more than history metadata so updating the overall naming scheme seems needed. To signal that this is a homescreen feature the entire package is moved to home * For #22534 - Update UI tests to account for the new items space on the screen Saw failures about not finding the collection section on screen. This is probably happening because w are now adding the recent visits to homescreen above the collections section pushing it off screen. Since the collections might be obstructed by the toolbar shown on top as a quick solution we'll scroll to the next homescreen section so that the collections will be shown above in their entirety. * Update app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com> * Update app/src/main/java/org/mozilla/fenix/home/recentvisits/RecentVisitsFeature.kt Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com> Co-authored-by: Gabriel Luong <gabriel.luong@gmail.com> Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
3 years ago
/**
* Callback for when the user clicks on a [RecentHistoryHighlight].
*
* @param recentHistoryHighlight The just clicked [RecentHistoryHighlight].
*/
fun onRecentHistoryHighlightClicked(recentHistoryHighlight: RecentHistoryHighlight)
/**
* Callback for when the user selected an option to remove a [RecentHistoryHighlight].
*
* @param highlightUrl [RecentHistoryHighlight.url] of the item to remove.
*/
fun onRemoveRecentHistoryHighlight(highlightUrl: String)
}