@@ -17,6 +17,8 @@ import mozilla.components.support.base.log.logger.Logger
1717import org .mozilla .vrbrowser .VRBrowserApplication
1818import org .mozilla .vrbrowser .utils .SystemUtils
1919import java .util .concurrent .CompletableFuture
20+ import java .util .stream .Collectors
21+ import java .util .stream .Stream
2022
2123class HistoryStore constructor (val context : Context ) {
2224
@@ -25,6 +27,14 @@ class HistoryStore constructor(val context: Context) {
2527 private var listeners = ArrayList <HistoryListener >()
2628 private var storage = (context .applicationContext as VRBrowserApplication ).places .history
2729
30+ companion object {
31+ @ JvmStatic
32+ val BLOCK_LIST : MutableList <String > = Stream .of (
33+ "https://accounts.firefox.com/authorization" ,
34+ "https://accounts.firefox.com/oauth"
35+ ).collect (Collectors .toList ())
36+ }
37+
2838 // Bookmarks might have changed during sync, so notify our listeners.
2939 private val syncStatusObserver = object : SyncStatusObserver {
3040 override fun onStarted () {}
@@ -93,13 +103,21 @@ class HistoryStore constructor(val context: Context) {
93103 }
94104
95105 fun recordVisit (aURL : String , pageVisit : PageVisit ) = GlobalScope .future {
96- storage .recordVisit (aURL , pageVisit )
97- notifyListeners ()
106+ if (BLOCK_LIST .stream ().noneMatch {
107+ aURL .startsWith (it )
108+ }) {
109+ storage .recordVisit (aURL , pageVisit )
110+ notifyListeners ()
111+ }
98112 }
99113
100114 fun recordObservation (aURL : String , observation : PageObservation ) = GlobalScope .future {
101- storage .recordObservation (aURL , observation )
102- notifyListeners ()
115+ if (BLOCK_LIST .stream ().noneMatch {
116+ aURL .startsWith (it )
117+ }) {
118+ storage .recordObservation (aURL , observation )
119+ notifyListeners ()
120+ }
103121 }
104122
105123 fun deleteHistory (aUrl : String , timestamp : Long ) = GlobalScope .future {
0 commit comments