-
Notifications
You must be signed in to change notification settings - Fork 444
Ref #3939: Add support to Apple Screen Time Limits #7639
Conversation
Code looks legit, thanks @domcorvasce. |
30b9e10
to
b1ace8b
Compare
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.
There's one change required.
Currently this implementation screen limit covers entire screen because it's added to the BrowserViewController.
We have to add it somewhere at the webview constraints level so the user can change to another tab.
It would also have to be one STWebpageController
per tab.
I will try to update this code, find a good place for it
I was going for Safari behaviour but I double-checked and Safari attaches the controller to the specific tab.
Yet we only actively track the active tabs. |
4891a95
to
ff9059c
Compare
@iccub I moved the logic into One quick note about Tab.swift:180: even though we suppress usage recording, assuming the user already maxed out the available time we need to set the active URL to PS: Yes, I double-checked that inactive tabs don't count towards ST. |
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.
The placement is good now, I am able to switch tabs.
I noticed one bug that bypasses the screen limit though.
STR:
- Open new tab
- Enter url of the website you passed the limit on
- It will show screen limit screen correctly
- Now press back arrow to take you to NTP, then forward back to the website
Result is the website does not show the limit screen anymore, you can refresh and navigate within that tab without any limits
Don't feel pressured to fix that if you don't want to, we can try to find the cause of the problem too
I also noticed the screen limit is ignored in private mode. Safari does not do that. It is a product decision however, we have to decide on that behavior. |
Good catch. Now I’m eager to learn why it’s happening 😅
I see. They’re attaching the ST controller to block websites that hit the usage limit in non private tabs but they don’t actively track page usage in private tabs (try browsing a website in private mode and it won’t show up in your Screen Time breakdown) |
This commit only allows us to show the ST block in private tabs. Page usage is still not tracked while browsing privately (see `Tab.swift:312`).
Question -- would this update also replicate Safari's behavior of syncing time spent on individual websites with ScreenTime, as opposed to aggregating and simply showing cumulative time spent on "Brave Browser"? Thanks for building this! Have been waiting for this feature for a loooooong time! You all rock! |
Yep |
Grazie mille! |
small update on this one. i ran this branch for a while and i've been getting multiple random crash related to screen time. we are investigating the probme |
I have Brave browser freshly downloaded for iOS. Screentime /time limit websites is not working. Is there a solution on this page, can someone explain further? Do I need to just download something from here to add to that browser? |
Can this support extent to private browsing mode? |
@bgala the time limits I hope yes. We will try to match what Safari does |
There's been couple bigger problems and I made a new one here #7983 |
Summary of Changes
This pull request fixes #3939. It adds support for:
tracking time spent on individual websites (unless you're in incognito mode)
enforcing usage limits per single web page
The Screen Time API is not well documented. I benefitted from reading mozilla-mobile/firefox-ios#15111.
There is no way to test this feature using the Simulator—I've tried but Screen Time does not work. You need a real device.
Submitter Checklist:
NSLocalizableString()
Test Plan:
Background
Test 1
Test 2
Test 3
Test 4
Test 5
Screenshots:
Reviewer Checklist:
QA/(Yes|No)
bug
/enhancement