Skip to content

Instantly share code, notes, and snippets.

@ohryan
Last active October 21, 2022 21:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ohryan/6f84aadf1966f18936a3 to your computer and use it in GitHub Desktop.
Save ohryan/6f84aadf1966f18936a3 to your computer and use it in GitHub Desktop.
TVML TvOS AppDelegate for use with TeeVee for WP, WordPress plugin.
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
}
}
@VariantT505
Copy link

And where is the TeeVee for WP plugin?

@ohryan
Copy link
Author

ohryan commented Oct 21, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment