Skip to content
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

Add FXIOS-6706 [v116] Screen Time implementation #15111

Merged
merged 2 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions Client/Frontend/Browser/WebView/WebviewViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import Foundation
import Shared
import WebKit
import ScreenTime

class WebviewViewController: UIViewController, ContentContainable, ScreenshotableView {
private var webView: WKWebView
private let screenTimeController = STWebpageController()
var contentType: ContentType = .webview

init(webView: WKWebView) {
Expand All @@ -21,10 +23,11 @@ class WebviewViewController: UIViewController, ContentContainable, Screenshotabl

override func viewDidLoad() {
super.viewDidLoad()
setupLayout()
setupWebView()
setupScreenTimeController()
}

private func setupLayout() {
private func setupWebView() {
view.addSubview(webView)
webView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
Expand All @@ -35,9 +38,24 @@ class WebviewViewController: UIViewController, ContentContainable, Screenshotabl
])
}

private func setupScreenTimeController() {
addChild(screenTimeController)
view.addSubview(screenTimeController.view)
screenTimeController.view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
screenTimeController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
screenTimeController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
screenTimeController.view.topAnchor.constraint(equalTo: view.topAnchor),
screenTimeController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
screenTimeController.didMove(toParent: self)
screenTimeController.url = webView.url
}

func update(webView: WKWebView) {
self.webView = webView
setupLayout()
setupWebView()
setupScreenTimeController()
}

// MARK: - ScreenshotableView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ class AppSettingsTableViewController: SettingsTableViewController, AppSettingsSc
ThemeSetting(settings: self),
SiriPageSetting(settings: self),
blockpopUpSetting,
NoImageModeSetting(settings: self)
NoImageModeSetting(settings: self),
]

if isSearchBarLocationFeatureEnabled {
Expand Down