-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathBLCheckoutViewController.m
61 lines (45 loc) · 1.53 KB
/
BLCheckoutViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// BLCheckoutViewController.m
// ShoppingCart
//
// Created by Bennett Lee on 7/14/14.
// Copyright (c) 2014 Bennett Lee. All rights reserved.
//
#import "BLCheckoutViewController.h"
#import "BLCart.h"
@interface BLCheckoutViewController () <UIWebViewDelegate>
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *spinner;
@property (weak, nonatomic) IBOutlet UIWebView *webView;
@end
@implementation BLCheckoutViewController
#pragma mark Initialization
- (id)initWithCoder:(NSCoder *)aDecoder{
self = [super initWithCoder: aDecoder];
if (self) {
}
return self;
}
- (void)viewDidLoad{
[super viewDidLoad];
self.webView.delegate = self;
[self.spinner startAnimating];
// Load webview
NSURLRequest *request = [NSURLRequest requestWithURL:self.url];
[self.webView loadRequest:request];
// Do any additional setup after loading the view.
}
#pragma mark - UIWebViewDelegate
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{
// NSLog(@"error %@", error);
}
// Stop animation after web view loaded
- (void)webViewDidFinishLoad:(UIWebView *)webView{
// // Make sure the final destination is checkoutURL (first destination will be Shopify's multipass login)
// if (![self.url isEqual:[[BLCart sharedCart] checkoutURL]]){
// self.url = [[BLCart sharedCart] checkoutURL];
// NSURLRequest *request = [NSURLRequest requestWithURL:self.url];
// [self.webView loadRequest:request];
[self.spinner stopAnimating];
// }
}
@end