Last active
October 21, 2022 21:33
-
-
Save ohryan/6f84aadf1966f18936a3 to your computer and use it in GitHub Desktop.
TVML TvOS AppDelegate for use with TeeVee for WP, WordPress plugin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import TVMLKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate, TVApplicationControllerDelegate { | |
var window: UIWindow? | |
var appController: TVApplicationController? | |
static let TVDomain = "http://teevee.dev/" | |
static let TVPluginURL = "\(AppDelegate.TVDomain)wp-content/plugins/teevee/" | |
static let TVBaseURL = "\(AppDelegate.TVDomain)teeveeclient/" | |
static let TVBootURL = "\(AppDelegate.TVBaseURL)js/application.js?" | |
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
window = UIWindow(frame: UIScreen.mainScreen().bounds) | |
let appControllerContext = TVApplicationControllerContext() | |
guard let javaScriptURL = NSURL(string: AppDelegate.TVBootURL) else { | |
fatalError("unable to create NSURL") | |
} | |
appControllerContext.javaScriptApplicationURL = javaScriptURL | |
appControllerContext.launchOptions["BASEURL"] = AppDelegate.TVBaseURL | |
appControllerContext.launchOptions["PLUGINURL"] = AppDelegate.TVPluginURL | |
appController = TVApplicationController(context: appControllerContext, window: window, delegate: self) | |
return true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I should probably remove this gist. I don't even know if this code works. I pulled the plugin because I didn't have time to keep it up to date.