Comments (10)
It looks like any solution might be too hackish, but ++ for a fix for this.
Using a WKWebView is definitely not a proper alternative to SFSafariViewController.
from chameleon.
There might be a way to theme it. I'll have a look next week or we'll need to think of a way to add exceptions (if there isn't one already) to solve this issue an #72 also.
from chameleon.
This is definitely "fixable". There may be a way to exclude it from being themed, but it wouldn't be ideal. Instead, we should find a way to theme it as a regular view controller would be themed, with a few modifications so it doesn't look bad. @bre7 Let me look into this while I also look into #72.
from chameleon.
Not sure if possible for the time being: http://stackoverflow.com/questions/33246813/how-to-change-the-background-color-of-a-sfsafariviewcontroller
from chameleon.
So, probably it would be nice to not apply any styles to SFSafariViewController at all :)
from chameleon.
Yeah. Exceptions can't be added I think. @ViccAlexander kinda hacky but the only possible solution I thought would be to swizzle SFVC viewDidLoad and set the components' style back to default.
from chameleon.
I looked into this and as @bre7 pointed out, there really isn't much that can be done until Apple fixes this themselves. Apple does however mention that if you'd like to customize the web content and controller, you're better off using WKWebView
instead.
From Apple Docs:
Use the
SFSafariViewController
class if your app lets users view websites from anywhere on the Internet. Use theWKWebView
class if your app customizes, interacts with, or controls the display of web content.
@bre7 Swizzling could work, but I don't think it's absolutely necessary when other options exist (WKWebView
). Hopefully in the next iOS release, we can get this fixed. If you'd like to give it a shot, feel free to do so though, and if it works, you can reopen this issue back up. 👍
from chameleon.
Actually, you are missing something really important.
The goal of SFSafariViewController is to show external links without leaving the current application. This controller runs in a separated thread and uses all the Safari-managed credentials. For instance if you have logged at Facebook in the Safari App, when you open a FB link using SFSafariViewController from your application, instead is showing a FB-login screen, you'll see immediately the content since the SafariController uses the Safari App FB credentials.
It's true we can use UIWebView or WKWebView to show external links, but it makes the developer to create a ViewController, embed the WebView and handle the callbacks. Also the Safari-managed credentials are not available.
In addition, from iOS 9 Apple introduced App Transport Security which tries to enforce high quality security by blocking insecure connections.
That means any outgoing connections from an app, using NSURLConnection, NSURLSession or WebViews, have to meet the ATS requirements or they are going to be blocked. Since the feature we are trying to implement is an viewer for external links, we cannot control the security features of other servers. That means we'll need to create a wildcard exception for ATS making the app vulnerable to attacks. Probably Apple introduced the SFSafariViewController considering that issue.
While you can push an update on the issue, found an ugly workaround for the styling issue by setting the Chameleon Theme to Safari colors and then immediately putting the app theme back:
[Chameleon setGlobalThemeUsingPrimaryColor:[UIColor whiteColor] withContentStyle:(UIContentStyle)UIContentStyleContrast];
SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:[NSURL URLWithString:url]];
[self.navigationController presentViewController:safari animated:YES completion:NULL];
[Chameleon setGlobalThemeUsingPrimaryColor:[UIColor mainColor] withContentStyle:(UIContentStyle)UIContentStyleContrast]
from chameleon.
Hello,
This also affect video player controls (triggered from youtube iframe in WKWebView in my case, but I think it will do the same for any other player that show up).
from chameleon.
This is the code I got to work perfectly with SFSafariViewController
however I can't seem to get the buttons to be the right bluish color but it works.
Chameleon.setGlobalThemeUsingPrimaryColor(nil, withSecondaryColor: nil, andContentStyle: UIContentStyle.dark)
from chameleon.
Related Issues (20)
- Tableview scrolling is clunky when I am applying the gradient colors to the views in my tableview cell.
- Navigation Bar Hairline won't hide with a searchController in Navigation Bar
- CIEDE2000 algorithm incorrect HOT 2
- Semantic Issue - Enumeration value 'kGCColorSpaceModelXYZ' not handled in switch : UIColor+ Chameleon.m
- NSInvalidArgumentException HOT 4
- Editor placeholder in source file HOT 4
- No support for latest version of swift. HOT 6
- No gradient with tableView editActionsForRowAt
- hidesNavigationBarHairline does not work on iPhone x/xr/xs/max
- Swift 5 supporting folk? HOT 8
- Getting Complementary colors (Analogous etc.) don't return the proper colors. HOT 1
- Function produces expected type 'UIColor'; did you mean to call it with '()'? HOT 13
- Xcode 11.1 issue HOT 10
- [Question] - Color Depth / Pixel Depth
- Am getting an error while using update carthage command
- Library not loaded
- Enumeration value 'kCGColorSpaceModelXYZ' not handled in switch
- Gradient starts giving rare hex values
- Building not working on Xcode 12
- Build fails with message "Function produces expected type 'UIColor()'; did you mean to call it with '()'?" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chameleon.