//
//  OptOutVC.swift
//  SimpleKidsSDKPods
//
//  Created by Abdul Rafay Mohd on 21/04/21.
//

import Foundation
import WebKit
import NielsenAppApi

class OptOutVC: UIViewController, NielsenAppApiDelegate, WKNavigationDelegate {
    
    var webView: WKWebView!
    var nielsenApi: NielsenAppApi!
    var optOutURL: String!
    
    override func loadView() {
        webView = WKWebView()
        webView.navigationDelegate = self
        view = webView
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
  //      self.view.backgroundColor = UIColor(patternImage: UIImage(named: "new_ios_bg.png")!)
        
        if let url = URL(string: optOutURL) {
            webView.load(URLRequest(url: url))
            webView.allowsBackForwardNavigationGestures = true
        }
        
//        self.nielsenApi = NielsenInit.createNielsenApi(delegate: self)
//
//        if let appApi = self.nielsenApi {
//            //Getting the optPut URL from SDK
//            if let url = URL(string: appApi.optOutURL) {
//                webView.load(URLRequest(url: url))
//                webView.allowsBackForwardNavigationGestures = true
//            }
//        }
    }
    
}
