Skip to content

Commit

Permalink
Added domain based nsfw blocking on Quetta Browser
Browse files Browse the repository at this point in the history
  • Loading branch information
akaMrNagar committed Jan 3, 2025
1 parent 3ebcbd0 commit 9c5cee9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,15 @@ public class MindfulAccessibilityService extends AccessibilityService implements
* These are used to retrieve/extract url from the browsers.
*/
private final HashSet<String> mUrlBarNodeIds = new HashSet<>(Set.of(
":id/url_bar",
":id/mozac_browser_toolbar_url_view",
":id/url_bar", // Chrome
":id/mozac_browser_toolbar_url_view", // Firefox
":id/url",
":id/search",
":id/url_field",
":id/location_bar_edit_text",
":id/addressbarEdit",
":id/bro_omnibar_address_title_text"
":id/bro_omnibar_address_title_text",
":id/cbn_tv_title" // Quetta Browser
));

// Fixed thread pool for parallel event processing
Expand Down
17 changes: 9 additions & 8 deletions lib/ui/splash_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ class _SplashScreenState extends ConsumerState<SplashScreen> {
initializeNecessaryProviders(ref);
}

_isAccessProtected
? _authenticate()
: Future.delayed(
_haveAllEssentialPermissions && _isOnboardingDone ? 750.ms : 0.ms,
_pushNextScreen,
);
_isAccessProtected ? _authenticate() : _pushNextScreen(true);
}

void _pushNextScreen() {
void _pushNextScreen(bool shouldDelay) async {
await Future.delayed(
shouldDelay && _haveAllEssentialPermissions && _isOnboardingDone
? 1250.ms
: 0.ms,
);

if (!mounted) return;

if (_haveAllEssentialPermissions && _isOnboardingDone) {
Expand All @@ -90,7 +91,7 @@ class _SplashScreenState extends ConsumerState<SplashScreen> {

void _authenticate() async {
final isSuccess = await AuthService.instance.authenticate();
if (isSuccess) _pushNextScreen();
if (isSuccess) _pushNextScreen(false);
}

@override
Expand Down

0 comments on commit 9c5cee9

Please sign in to comment.