From 578c2e66e151dd1381ff4f7eada5089207f773b7 Mon Sep 17 00:00:00 2001 From: mmlmml1 Date: Sat, 30 Dec 2017 10:36:27 +0800 Subject: [PATCH] 1.2.7 Release --- ContentExtension/Info.plist | 4 +- General/AppDelegate.swift | 25 +++------- General/Base.lproj/Main.storyboard | 53 +--------------------- General/GameCenterView.swift | 37 +++++++++++---- General/InAppSettings.bundle/Authors.plist | 16 ------- General/InAppSettings.bundle/Root.plist | 8 ---- General/Info.plist | 8 ++-- General/NewsView.swift | 29 ++++++------ General/ResourcesFiltringView.swift | 4 +- General/UnityView.swift | 53 ++++++++++++++++++---- General/WeatherView.swift | 4 +- NFLSers-iOS.xcodeproj/project.pbxproj | 26 ++++++++--- pushNotification/Info.plist | 4 +- 13 files changed, 127 insertions(+), 144 deletions(-) diff --git a/ContentExtension/Info.plist b/ContentExtension/Info.plist index 95ccb76..2e2b277 100644 --- a/ContentExtension/Info.plist +++ b/ContentExtension/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 1.2.6 + 1.2.7 CFBundleVersion - 12 + 2 NSExtension NSExtensionAttributes diff --git a/General/AppDelegate.swift b/General/AppDelegate.swift index cbb125f..0af3f4e 100755 --- a/General/AppDelegate.swift +++ b/General/AppDelegate.swift @@ -28,6 +28,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { @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 @@ -105,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 - } } @@ -171,6 +154,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate { isUnityRunning = false } } + + func resetUnity() { + unity_init(CommandLine.argc, CommandLine.unsafeArgv) + currentUnityController = UnityAppController() + currentUnityController!.application(application!, didFinishLaunchingWithOptions: nil) + } } diff --git a/General/Base.lproj/Main.storyboard b/General/Base.lproj/Main.storyboard index b1c504a..5a23637 100755 --- a/General/Base.lproj/Main.storyboard +++ b/General/Base.lproj/Main.storyboard @@ -606,24 +606,6 @@ Cache - - - - - - - - - - - - - - - - - - @@ -665,6 +647,7 @@ Cache + @@ -962,7 +945,7 @@ Cache - + @@ -1123,7 +1106,6 @@ Cache - @@ -1301,37 +1283,6 @@ Cache - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/General/GameCenterView.swift b/General/GameCenterView.swift index b4b6d71..120a33a 100644 --- a/General/GameCenterView.swift +++ b/General/GameCenterView.swift @@ -18,7 +18,7 @@ class GameCenterViewController:UITableViewController{ var descriptions = [String]() var urls = [String]() var images = [String]() - + var in_url:String? = nil func loadFromLocal(){ @@ -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") @@ -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 @@ -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 diff --git a/General/InAppSettings.bundle/Authors.plist b/General/InAppSettings.bundle/Authors.plist index 4095f97..9e9bbee 100644 --- a/General/InAppSettings.bundle/Authors.plist +++ b/General/InAppSettings.bundle/Authors.plist @@ -164,22 +164,6 @@ Key - - Type - PSGroupSpecifier - Title - Secret Zone - Key - - - - Type - PSTextFieldSpecifier - Title - - Key - app.code - diff --git a/General/InAppSettings.bundle/Root.plist b/General/InAppSettings.bundle/Root.plist index 65e7fb3..e566577 100644 --- a/General/InAppSettings.bundle/Root.plist +++ b/General/InAppSettings.bundle/Root.plist @@ -160,14 +160,6 @@ File Authors - - Type - PSChildPaneSpecifier - Title - 管理 - File - Management - diff --git a/General/Info.plist b/General/Info.plist index 0e6ed88..29b698d 100755 --- a/General/Info.plist +++ b/General/Info.plist @@ -17,13 +17,13 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.2.6 + 1.2.7 CFBundleVersion - 12 + 2 CodeNameCN - ドライクリーク + 決別 CodeNameEN - Arroyo + Farewell ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/General/NewsView.swift b/General/NewsView.swift index a64ecc9..da6c57a 100644 --- a/General/NewsView.swift +++ b/General/NewsView.swift @@ -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")!) @@ -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 @@ -106,7 +104,7 @@ class NewsViewController:UITableViewController,FrostedSidebarDelegate{ Alamofire.request("https://api.nfls.io/weather/ping") checkStatus() self.removeFile(filename: "", path: "temp") - let rightButton = UIBarButtonItem(title: nil, style: .plain, target: self, action: #selector(self.showUnity)) + let rightButton = UIBarButtonItem(title: nil, style: .plain, target: self, action: #selector(self.settings)) rightButton.icon(from: .FontAwesome, code: "cog", ofSize: 20) self.navigationItem.rightBarButtonItem = rightButton let leftButton = UIBarButtonItem(title: nil, style: .plain, target: self, action: #selector(self.menu)) @@ -122,9 +120,7 @@ class NewsViewController:UITableViewController,FrostedSidebarDelegate{ view.addGestureRecognizer(swipeBack) } - @objc func showUnity() { - self.performSegue(withIdentifier: "showUnity", sender: self) - } + @objc func refresh() { loadNews() debugPrint("refresh") @@ -458,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{ @@ -489,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 + } } } diff --git a/General/ResourcesFiltringView.swift b/General/ResourcesFiltringView.swift index c0c1c1d..bbf5a0c 100644 --- a/General/ResourcesFiltringView.swift +++ b/General/ResourcesFiltringView.swift @@ -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 @@ -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() diff --git a/General/UnityView.swift b/General/UnityView.swift index 6c4f4fb..4d05901 100644 --- a/General/UnityView.swift +++ b/General/UnityView.swift @@ -11,19 +11,54 @@ import UIKit class UnityViewController:UIViewController { var unityView: UIView? + var isRunning = false override func viewDidLoad() { - let appDelegate = UIApplication.shared.delegate as! AppDelegate - appDelegate.startUnity() - + self.title = "Christmas Carol" unityView = UnityGetGLView()! - - self.view!.addSubview(unityView!) + self.view.addSubview(unityView!) unityView!.translatesAutoresizingMaskIntoConstraints = false - + self.view!.backgroundColor = UIColor.black // look, non-full screen unity content! - let views = ["view": unityView] - let w = NSLayoutConstraint.constraints(withVisualFormat: "|-20-[view]-20-|", options: [], metrics: nil, views: views) - let h = NSLayoutConstraint.constraints(withVisualFormat: "V:|-75-[view]-50-|", options: [], metrics: nil, views: views) + let views = ["view": unityView!] + let w = NSLayoutConstraint.constraints(withVisualFormat: "|-[view]-|", options: [], metrics: nil, views: views) + let h = NSLayoutConstraint.constraints(withVisualFormat: "V:|-[view]-|", options: [], metrics: nil, views: views) view.addConstraints(w + h) + //let res = UIBarButtonItem(barButtonSystemItem: .refresh, target: self, action: #selector(reset)) + //self.navigationItem.rightBarButtonItem = res + } + @objc func reset() { + let appDelegate = UIApplication.shared.delegate as! AppDelegate + + appDelegate.stopUnity() + appDelegate.resetUnity() + appDelegate.startUnity() + } + override func viewDidAppear(_ animated: Bool) { + if isRunning { + let appDelegate = UIApplication.shared.delegate as! AppDelegate + + appDelegate.startUnity() + } else { + isRunning = true + let alert = UIAlertController(title: "温馨提醒", message: "此消息将在3秒后自动消失\n1.佩戴耳机获得更佳食用效果\n2.建议在竖屏模式下食用\n3.重置游戏需要后台完全关闭App\n4.如果有任何BUG,请联系游戏开发者谢祖地\nBy:胡清阳", preferredStyle: .alert) + (alert.view.subviews[0].subviews[0].subviews[0].subviews[0].subviews[0].subviews[1] as! UILabel).textAlignment = .left + self.present(alert, animated: true) { + DispatchQueue.main.asyncAfter(deadline: .now() + 3.0, execute: { + alert.dismiss(animated: true, completion: { + let appDelegate = UIApplication.shared.delegate as! AppDelegate + appDelegate.startUnity() + }) + }) + } + } + } + + override func viewDidDisappear(_ animated: Bool) { + let appDelegate = UIApplication.shared.delegate as! AppDelegate + appDelegate.stopUnity() + unityView!.removeFromSuperview() + } + + } diff --git a/General/WeatherView.swift b/General/WeatherView.swift index d1f78cc..b45d68e 100644 --- a/General/WeatherView.swift +++ b/General/WeatherView.swift @@ -133,7 +133,7 @@ class WeatherViewController:UIViewController,UITableViewDataSource,UITableViewDe default: key = stations[indexPath.section].data[indexPath.row - 4]["name"] value = stations[indexPath.section].data[indexPath.row - 4]["value"] - cell.accessoryType = .disclosureIndicator + cell.accessoryType = .none } cell.textLabel!.text = key @@ -161,7 +161,7 @@ class WeatherViewController:UIViewController,UITableViewDataSource,UITableViewDe let latitude = stations[indexPath.section].latitude self.performSegue(withIdentifier: "showMap", sender: [longitude,latitude]) default: - self.showHistoryData(indexPath: indexPath) + //self.showHistoryData(indexPath: indexPath) break } return diff --git a/NFLSers-iOS.xcodeproj/project.pbxproj b/NFLSers-iOS.xcodeproj/project.pbxproj index f770eb0..a9ff909 100644 --- a/NFLSers-iOS.xcodeproj/project.pbxproj +++ b/NFLSers-iOS.xcodeproj/project.pbxproj @@ -1208,6 +1208,7 @@ E5BC3AD96A01BCEAF78DDDCA /* [CP] Check Pods Manifest.lock */, D6AE173A1E44D51600E66B4B /* Sources */, D6AE173B1E44D51600E66B4B /* Frameworks */, + 65BFCD831FE825D100821ABD /* ShellScript */, D6AE173C1E44D51600E66B4B /* Resources */, 22E64A7FDA9057C2741B7323 /* [CP] Embed Pods Frameworks */, 6B93F9D0123AA7825650D41B /* [CP] Copy Pods Resources */, @@ -1430,6 +1431,19 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-NFLSers-iOS/Pods-NFLSers-iOS-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; + 65BFCD831FE825D100821ABD /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "rm -rf \"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Data\";\ncp -Rf \"$UNITY_IOS_EXPORT_PATH/Data\" \"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Data\";"; + }; 6B93F9D0123AA7825650D41B /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -1685,7 +1699,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = K2P3533G4D; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = ContentExtension/Info.plist; @@ -1709,7 +1723,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = K2P3533G4D; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = ContentExtension/Info.plist; @@ -1733,7 +1747,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = K2P3533G4D; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = pushNotification/Info.plist; @@ -1757,7 +1771,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = K2P3533G4D; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = pushNotification/Info.plist; @@ -1888,7 +1902,7 @@ CODE_SIGN_ENTITLEMENTS = "NFLSers-iOS.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = K2P3533G4D; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1937,7 +1951,7 @@ CODE_SIGN_ENTITLEMENTS = "NFLSers-iOS.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = K2P3533G4D; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", diff --git a/pushNotification/Info.plist b/pushNotification/Info.plist index 628e324..a52e96f 100644 --- a/pushNotification/Info.plist +++ b/pushNotification/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 1.2.6 + 1.2.7 CFBundleVersion - 12 + 2 NSExtension NSExtensionPointIdentifier