Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

Commit

Permalink
Merge pull request #7 from nfls/1.2.6-christmas
Browse files Browse the repository at this point in the history
1.2.6 christmas
  • Loading branch information
hqy2000 authored Dec 30, 2017
2 parents a37887a + 578c2e6 commit 242e2f6
Show file tree
Hide file tree
Showing 33 changed files with 1,296 additions and 234 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Unity
Unity/
## Build generated
build/
DerivedData/
Expand Down
4 changes: 2 additions & 2 deletions ContentExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.2.6</string>
<string>1.2.7</string>
<key>CFBundleVersion</key>
<string>12</string>
<string>2</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
Expand Down
57 changes: 36 additions & 21 deletions General/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,32 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var time = Date().timeIntervalSince1970
var theme = ThemeManager()
var url:String? = nil

@objc var currentUnityController: UnityAppController?
var isUnityRunning = false
var application: UIApplication?
var enableAllOrientation = true

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
self.application = application
unity_init(CommandLine.argc, CommandLine.unsafeArgv)
currentUnityController = UnityAppController()
currentUnityController!.application(application, didFinishLaunchingWithOptions: launchOptions)
// first call to startUnity will do some init stuff, so just call it here and directly stop it again
startUnity()
stopUnity()

IQKeyboardManager.sharedManager().enable = true
NetworkActivityIndicatorManager.shared.isEnabled = true
NetworkActivityIndicatorManager.shared.completionDelay = 0.5
/*
UMAnalyticsConfig.sharedInstance().appKey = "59c733a1c895764c1100001c"
UMAnalyticsConfig.sharedInstance().channelId = "App Store"
MAnalyticsConfig.sharedInstance().channelId = "App Store"
MobClick.start(withConfigure: UMAnalyticsConfig.sharedInstance())
let version = Bundle.main.infoDictionary!["CFBundleShortVersionString"]
MobClick.setAppVersion(version as! String)
MobClick.setEncryptEnabled(true)
//MobClick.setLogEnabled(true)
MobClick.setLogEnabled(true)
*/
if let options = launchOptions{
dump(options[UIApplicationLaunchOptionsKey.remoteNotification])
}
Expand Down Expand Up @@ -93,24 +106,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
// let _ = ThemeManager.init()
let interval = Date().timeIntervalSince1970 - time
if(isLaunched){
if(!isOn && interval >= 60){
if let controller = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController() as? LaunchScreenViewController {
if let window = self.window, let rootViewController = window.rootViewController {
var currentController = rootViewController
while let presentedController = currentController.presentedViewController {
currentController = presentedController
}
if !((currentController as? UINavigationController)?.topViewController is QLPreviewController) {
currentController.present(controller, animated: true, completion: nil)
}
}
}
}
} else {
isLaunched = true
}
}


Expand Down Expand Up @@ -145,6 +140,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}
return true
}

func startUnity() {
if !isUnityRunning {
isUnityRunning = true
currentUnityController!.applicationDidBecomeActive(application!)
}
}

func stopUnity() {
if isUnityRunning {
currentUnityController!.applicationWillResignActive(application!)
isUnityRunning = false
}
}

func resetUnity() {
unity_init(CommandLine.argc, CommandLine.unsafeArgv)
currentUnityController = UnityAppController()
currentUnityController!.application(application!, didFinishLaunchingWithOptions: nil)
}
}


Expand Down
252 changes: 111 additions & 141 deletions General/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

37 changes: 27 additions & 10 deletions General/GameCenterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class GameCenterViewController:UITableViewController{
var descriptions = [String]()
var urls = [String]()
var images = [String]()

var in_url:String? = nil


func loadFromLocal(){
Expand Down Expand Up @@ -49,16 +49,19 @@ class GameCenterViewController:UITableViewController{
Alamofire.request("https://api.nfls.io/game/list").responseJSON { response in
switch(response.result){
case .success(let json):

let info = ((json as! [String:AnyObject])["info"] as! [[String:Any]])
self.names.removeAll()
self.descriptions.removeAll()
self.urls.removeAll()
self.images.removeAll()
var index:Int? = nil
for detail in info {
self.names.append(detail["name"] as! String)
self.descriptions.append(detail["description"] as! String)
self.urls.append(detail["url"] as! String)
if self.urls.last == self.in_url {
index = self.names.count - 1
}
self.images.append(detail["icon"] as! String)
}
UserDefaults.standard.set(self.names, forKey: "game_names")
Expand All @@ -69,6 +72,13 @@ class GameCenterViewController:UITableViewController{
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0, execute: {
self.tableView.reloadData()
})
if let index = index {
if self.urls[index] == "unity" {
self.performSegue(withIdentifier: "showUnity", sender: index)
} else {
self.performSegue(withIdentifier: "showGame", sender: index)
}
}
break
default:
break
Expand Down Expand Up @@ -109,24 +119,31 @@ class GameCenterViewController:UITableViewController{
cell.detailTextLabel!.font = UIFont(name: "Helvetica", size: 14)
cell.imageView?.kf.setImage(with: URL(string: images[indexPath.row]), placeholder: nil, options: nil, progressBlock: nil, completionHandler: { (image, _, _, _) in
DispatchQueue.main.async {
cell.imageView?.image = image!.kf.resize(to: CGSize(width: 75, height: 75))
if let image = image {
cell.imageView?.image = image.kf.resize(to: CGSize(width: 75, height: 75))
}
}

})

return cell
}

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
self.performSegue(withIdentifier: "showGame", sender: indexPath.row)
if urls[indexPath.row] == "unity" {
self.performSegue(withIdentifier: "showUnity", sender: indexPath.row)
} else {
self.performSegue(withIdentifier: "showGame", sender: indexPath.row)
}
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let index = sender as! Int
let dest = segue.destination as! GameViewController
dest.location = urls[index]
dest.name = names[index]
dest.id = index + 1
if segue.destination is GameViewController {
let index = sender as! Int
let dest = segue.destination as! GameViewController
dest.location = urls[index]
dest.name = names[index]
dest.id = index + 1
}
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 75
Expand Down
4 changes: 2 additions & 2 deletions General/GameView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ class GameViewController:UIViewController,WKNavigationDelegate,WKUIDelegate,SKPr

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
MobClick.beginLogPageView("Gaming")
//MobClick.beginLogPageView("Gaming")
}

override func viewWillDisappear(_ animated: Bool) {
MobClick.endLogPageView("Gaming")
//MobClick.endLogPageView("Gaming")

super.viewWillDisappear(animated)
}
Expand Down
16 changes: 0 additions & 16 deletions General/InAppSettings.bundle/Authors.plist
Original file line number Diff line number Diff line change
Expand Up @@ -164,22 +164,6 @@
<key>Key</key>
<string></string>
</dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>Secret Zone</string>
<key>Key</key>
<string></string>
</dict>
<dict>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
<key>Title</key>
<string></string>
<key>Key</key>
<string>app.code</string>
</dict>
</array>
</dict>
</plist>
8 changes: 0 additions & 8 deletions General/InAppSettings.bundle/Root.plist
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,6 @@
<key>File</key>
<string>Authors</string>
</dict>
<dict>
<key>Type</key>
<string>PSChildPaneSpecifier</string>
<key>Title</key>
<string>管理</string>
<key>File</key>
<string>Management</string>
</dict>
</array>
</dict>
</plist>
8 changes: 4 additions & 4 deletions General/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.6</string>
<string>1.2.7</string>
<key>CFBundleVersion</key>
<string>12</string>
<string>2</string>
<key>CodeNameCN</key>
<string>ドライクリーク</string>
<string>決別</string>
<key>CodeNameEN</key>
<string>Arroyo</string>
<string>Farewell</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
Expand Down
1 change: 1 addition & 0 deletions General/NFLSers-iOS-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//

#import "UMMobClick/MobClick.h"
27 changes: 15 additions & 12 deletions General/NewsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class NewsViewController:UITableViewController,FrostedSidebarDelegate{
))

required init?(coder aDecoder: NSCoder) {
let images = ["resources","game","photo","alumni","ic","forum","wiki","media","weather"]
let images = ["resources","game"/*,"photo"*/,"alumni","ic","forum","wiki","media","weather"]
var barImages = [UIImage]()
for image in images{
barImages.append(UIImage(named: image+".png")!)
Expand All @@ -58,26 +58,24 @@ class NewsViewController:UITableViewController,FrostedSidebarDelegate{
self.performSegue(withIdentifier: "showGame", sender: self)
}
self.bar.actionForIndex[2] = {
self.performSegue(withIdentifier: "showPhoto", sender: self)
}
self.bar.actionForIndex[3] = {
self.performSegue(withIdentifier: "showAlumni", sender: self)
}
self.bar.actionForIndex[4] = {
self.bar.actionForIndex[3] = {
self.performSegue(withIdentifier: "showIC", sender: self)
}
self.bar.actionForIndex[5] = {
self.bar.actionForIndex[4] = {
self.performSegue(withIdentifier: "showForum", sender: self)
}
self.bar.actionForIndex[6] = {
self.bar.actionForIndex[5] = {
self.performSegue(withIdentifier: "showWiki", sender: self)
}
self.bar.actionForIndex[7] = {
self.bar.actionForIndex[6] = {
self.performSegue(withIdentifier: "showMedia", sender: self)
}
self.bar.actionForIndex[8] = {
self.bar.actionForIndex[7] = {
self.performSegue(withIdentifier: "showWeather", sender: self)
}
//self.bar.actionForIndex.removeValue(forKey: 2)

self.bar.delegate = self

Expand Down Expand Up @@ -122,7 +120,7 @@ class NewsViewController:UITableViewController,FrostedSidebarDelegate{
view.addGestureRecognizer(swipeBack)

}

@objc func refresh() {
loadNews()
debugPrint("refresh")
Expand Down Expand Up @@ -326,7 +324,7 @@ class NewsViewController:UITableViewController,FrostedSidebarDelegate{
}
self.showLogin()
} else {
MobClick.profileSignIn(withPUID: (String(describing: (json as! [String:Int])["id"]!)))
//MobClick.profileSignIn(withPUID: (String(describing: (json as! [String:Int])["id"]!)))
self.getAuthStatus()
self.getBadge()
self.requestMessage()
Expand Down Expand Up @@ -456,7 +454,7 @@ class NewsViewController:UITableViewController,FrostedSidebarDelegate{
self.performSegue(withIdentifier: "showWeather", sender: self)
break
case "game":
self.performSegue(withIdentifier: "showGame", sender: self)
self.performSegue(withIdentifier: "showGame", sender: in_url)
break
default:
if let url = realurl{
Expand Down Expand Up @@ -487,6 +485,11 @@ class NewsViewController:UITableViewController,FrostedSidebarDelegate{
if(sender as? String != nil){
dest.in_url = sender as! String
}
} else if (segue.identifier == "showGame") {
let dest = segue.destination as! GameCenterViewController
if(sender as? String != nil){
dest.in_url = sender as! String
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions General/ResourcesFiltringView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ class ResourcesFiltringViewController:UIViewController, UITableViewDataSource, U
listRequest()
}
override func viewWillAppear(_ animated: Bool) {
MobClick.beginLogPageView("Resources")
//MobClick.beginLogPageView("Resources")
UIApplication.shared.isIdleTimerDisabled = false
}
override func viewWillDisappear(_ animated: Bool) {
MobClick.endLogPageView("Resources")
//MobClick.endLogPageView("Resources")
}
@objc func setting() {
var mutipleSelectAction = UIAlertAction()
Expand Down Expand Up @@ -212,7 +212,7 @@ class ResourcesFiltringViewController:UIViewController, UITableViewDataSource, U
response in
switch response.result{
case .success(let json):

self.files.removeAll()
let data = (json as! [String:AnyObject])["items"]! as! NSArray
for file in data{
var name = (file as! [String:Any])["href"] as! String
Expand Down Expand Up @@ -279,7 +279,7 @@ class ResourcesFiltringViewController:UIViewController, UITableViewDataSource, U
}
}
func checkForYear(){
if(!UserDefaults.standard.bool(forKey: "ettings.resources.rank")){
if(!UserDefaults.standard.bool(forKey: "settings.resources.rank")){
for file in files{
if(file.filename.contains("2016")){
files.reverse()
Expand Down
Loading

0 comments on commit 242e2f6

Please sign in to comment.