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

Feat/dark mode webview #274

Merged
merged 7 commits into from
Feb 12, 2024

Conversation

forgotvas
Copy link
Contributor

@forgotvas forgotvas commented Feb 5, 2024

@forgotvas forgotvas linked an issue Feb 5, 2024 that may be closed by this pull request
rnr
rnr previously approved these changes Feb 5, 2024
Copy link
Contributor

@volodymyr-chekyrta volodymyr-chekyrta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

@forgotvas forgotvas dismissed stale reviews from volodymyr-chekyrta and rnr via b4eee5a February 6, 2024 16:14
rnr
rnr previously approved these changes Feb 7, 2024
Comment on lines +64 to +66
public func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
webView.isHidden = true
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it important to hide the webview here? as hiding it here is required webview?isHidded = true at multiple places

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's important to hide webview on start loading, because inversion script will start to work only when page will be loaded and if not to hide it, then user will see light mode on start and then it will turn into dark mode. So idea is show only dark mode.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use isLoading property here, so the user will see loading while the inversion is happening?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, isLoading property doesn't hide webView it's shows ProgressView on parent view.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, that's what I'm trying to understand why it's needed, because if it's user-facing and there won't be any loading screen, and we also hide the webview, the view will not look good. If we se the isloading true, the user will see a loading screen and behind the scene the color inversion will happen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to clarify, do you want to set isHidden when we set isLoading? If so then it will work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without isHidden:

Simulator.Screen.Recording.-.iPhone.15.-.2024-02-12.at.13.57.16.mp4

with isHidden

Simulator.Screen.Recording.-.iPhone.15.-.2024-02-12.at.13.58.04.mp4

}

public func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
webView.isHidden = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to create a task for handling the review failure case. In which we might add a loading error with the reload button. Thoughts?

Copy link
Contributor Author

@forgotvas forgotvas Feb 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rnr ^^^, @saeedbashir maybe it should be part of #276 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it might be separate ticket

@@ -16,11 +16,12 @@ public enum LessonType: Equatable {
case discussion(String, String, String)

static func from(_ block: CourseBlock, streamingQuality: StreamingQuality) -> Self {
let mandatoryInjections: [WebviewInjection] = [.inversionCss, .ajaxCallback]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name is fine, but how about renaming it to webviewInjections thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure that it will be correct, idea is to name that variable to indicate that these are the necessary injections for all webviews.

@@ -47,6 +47,11 @@ public extension WebviewInjection {
.webviewInjection()
}

static var inversionCss: WebviewInjection {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@forgotvas Although the name is fine, but what do you think about renaming it to colorInversionCss, for more clear name as inversion can be of any type thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed

@forgotvas forgotvas dismissed stale reviews from volodymyr-chekyrta and rnr via 2a311a0 February 12, 2024 09:10
Copy link
Contributor

@saeedbashir saeedbashir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@volodymyr-chekyrta volodymyr-chekyrta merged commit c622576 into openedx:develop Feb 12, 2024
3 checks passed
@forgotvas forgotvas deleted the feat/dark-webview branch February 26, 2024 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iOS] Dark Mode Support for the webview
5 participants