Skip to content

Moved from UIWebView to WKWebView #23

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions Conekta/Conekta.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
#import <Foundation/Foundation.h>
#import "Token.h"
#import "Card.h"
#import <WebKit/WebKit.h>

@interface Conekta : NSObject

@property (nonatomic, retain) NSString *baseURI;
@property (nonatomic, retain) NSString *publicKey;
@property (nonatomic, retain) UIViewController *delegate;
@property (strong, nonatomic) WKWebView *webView;

- (NSString *) deviceFingerprint;
- (void) collectDevice;
Expand Down
10 changes: 6 additions & 4 deletions Conekta/Conekta.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ - (NSString *) deviceFingerprint

- (void) collectDevice {
NSString *html = [NSString stringWithFormat:@"<html style=\"background: blue;\"><head></head><body><script type=\"text/javascript\" src=\"https://conektaapi.s3.amazonaws.com/v0.5.0/js/conekta.js\" data-conekta-public-key=\"%@\" data-conekta-session-id=\"%@\"></script></body></html>", [self publicKey], [self deviceFingerprint]];
UIWebView *web = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
[web loadHTMLString:html baseURL:nil];
[web setScalesPageToFit:YES];
[self.delegate.view addSubview:web];
WKWebViewConfiguration *theConfiguration = [[WKWebViewConfiguration alloc] init];
WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 0, 0) configuration:theConfiguration];
NSURL *nsurl=[NSURL URLWithString:html];
NSURLRequest *nsrequest=[NSURLRequest requestWithURL:nsurl];
[webView loadRequest:nsrequest];
[self.delegate.view addSubview:webView];
}

- (id) populate: (id) class
Expand Down