Unverified Commit 26317b78 authored by Zach Knox's avatar Zach Knox
Browse files

added API endpoint URL support and fixed a couple bugs

If the URL is not HTTPS, you'll need to set the Allow Arbitrary Loads item in Info.plist to YES. DO NOT SET IT TO YES WHEN SUBMITTING TO THE STORE
parent b0de008f
......@@ -846,7 +846,7 @@
};
CD81F5181DC0334600009FBD = {
CreatedOnToolsVersion = 8.0;
DevelopmentTeam = HQSN7HX89U;
DevelopmentTeam = N5GM564QWL;
LastSwiftMigration = 0910;
ProvisioningStyle = Automatic;
};
......@@ -1870,7 +1870,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SHARED_BUILD_NUMBER = 51;
SHARED_BUILD_NUMBER = 52;
SHARED_VERSION_NUMBER = 1.2;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
......@@ -1888,7 +1888,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = HQSN7HX89U;
DEVELOPMENT_TEAM = N5GM564QWL;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
......@@ -1898,7 +1898,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -D APPSTORE";
PRIMARYICON = appicon;
PRODUCT_BUNDLE_IDENTIFIER = io.srct.whatsopen;
PRODUCT_BUNDLE_IDENTIFIER = srct.whatsopen;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
......@@ -2172,7 +2172,7 @@
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SHARED_BUILD_NUMBER = 51;
SHARED_BUILD_NUMBER = 52;
SHARED_VERSION_NUMBER = 1.2;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
......@@ -2224,7 +2224,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SHARED_BUILD_NUMBER = 51;
SHARED_BUILD_NUMBER = 52;
SHARED_VERSION_NUMBER = 1.2;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
......@@ -2242,7 +2242,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = HQSN7HX89U;
DEVELOPMENT_TEAM = N5GM564QWL;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
......@@ -2251,7 +2251,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRIMARYICON = "appicon-dev";
PRODUCT_BUNDLE_IDENTIFIER = io.srct.whatsopen;
PRODUCT_BUNDLE_IDENTIFIER = srct.whatsopen;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
......@@ -2272,7 +2272,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = HQSN7HX89U;
DEVELOPMENT_TEAM = N5GM564QWL;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
......@@ -2281,7 +2281,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRIMARYICON = "appicon-dev";
PRODUCT_BUNDLE_IDENTIFIER = io.srct.whatsopen;
PRODUCT_BUNDLE_IDENTIFIER = srct.whatsopen;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
......
......@@ -42,6 +42,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
if defaults.value(forKey: "mapsApp") == nil {
defaults.set("Apple Maps", forKey: "mapsApp")
}
if defaults.value(forKey: "apiURL") == nil {
defaults.set("https://api.srct.gmu.edu/whatsopen/v2/", forKey: "apiURL")
}
application.setMinimumBackgroundFetchInterval(3600)
......
......@@ -501,6 +501,7 @@
</view>
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" prompted="NO"/>
<connections>
<outlet property="aboutLogo" destination="tzw-Ro-L8p" id="0FY-37-64r"/>
<outlet property="versionLabel" destination="WT6-Th-cbL" id="AAg-iN-BqQ"/>
</connections>
</viewController>
......
......@@ -58,6 +58,11 @@
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
</dict>
<key>NSUserActivityTypes</key>
<array>
<string>WOPViewFacilityIntent</string>
......
......@@ -8,15 +8,37 @@
import UIKit
import SafariServices
import WhatsOpenKit
class AboutScreenViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet var versionLabel: UILabel!
@IBOutlet var aboutLogo: UIImageView!
override var preferredStatusBarStyle: UIStatusBarStyle {
return .default
}
@objc func pickAPIURL(_ sender: Any?) {
let alert = UIAlertController(title: "Set API Endpoint URL?", message: "", preferredStyle: .alert)
alert.addTextField { textField in
textField.text = WOPDatabaseController.getDefaults().string(forKey: "apiURL") ?? ""
}
alert.addAction(UIAlertAction(title: "Reset", style: .destructive, handler: { (action) in
WOPDatabaseController.getDefaults().set("https://api.srct.gmu.edu/whatsopen/v2/", forKey: "apiURL")
alert.dismiss(animated: true, completion: nil)
}))
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { (action) in
alert.dismiss(animated: true, completion: nil)
}))
alert.addAction(UIAlertAction(title: "Set", style: .default, handler: { (action) in
WOPDatabaseController.getDefaults().set(alert.textFields![0].text, forKey: "apiURL")
}))
present(alert, animated: true, completion: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
......@@ -27,7 +49,9 @@ class AboutScreenViewController: UIViewController, UITableViewDelegate, UITableV
versionLabel.text = versionstring
let longPress = UILongPressGestureRecognizer(target: self, action: #selector(pickAPIURL(_:)))
aboutLogo.isUserInteractionEnabled = true
aboutLogo.addGestureRecognizer(longPress)
// Do any additional setup after loading the view.
}
......
......@@ -11,9 +11,11 @@ import MapKit
import WhatsOpenKit
import Intents
import IntentsUI
import DeckTransition
class DetailViewButtonsViewController: UIViewController, INUIAddVoiceShortcutViewControllerDelegate {
class DetailViewButtonsViewController: UIViewController, INUIAddVoiceShortcutViewControllerDelegate, DeckTransitionViewControllerProtocol {
var childViewControllerForDeck: UIViewController?
@IBOutlet var facilityDetailView: UIView!
var detailViewController: WOPFacilityDetailViewController?
......@@ -106,6 +108,7 @@ class DetailViewButtonsViewController: UIViewController, INUIAddVoiceShortcutVie
self.detailViewController!.view.translatesAutoresizingMaskIntoConstraints = false
self.addChild(self.detailViewController!)
self.addSubview(self.detailViewController!.view, toView: self.facilityDetailView)
childViewControllerForDeck = self.detailViewController
super.viewDidLoad()
setFavoriteButtonText()
......
......@@ -7,9 +7,12 @@
//
import UIKit
import DeckTransition
class PullingViewController: UIViewController {
class PullingViewController: UIViewController, DeckTransitionViewControllerProtocol {
var childViewControllerForDeck: UIViewController?
@IBOutlet var containerView: UIView!
weak var currentViewController: UIViewController?
......@@ -45,6 +48,7 @@ class PullingViewController: UIViewController {
self.accessibilityCustomActions = [
UIAccessibilityCustomAction(name: "Dismiss Detail View", target: self, selector: #selector(PullingViewController.willDismiss))
]
childViewControllerForDeck = self.currentViewController
super.viewDidLoad()
// Do any additional setup after loading the view.
......
......@@ -14,8 +14,9 @@ import ObjectMapper
public class WOPDownloadController: NSObject {
//https://api.srct.gmu.edu/whatsopen/v2/facilities/?format=json
public static func performDownload(completion: @escaping (_ result: List<WOPFacility>?) -> Void) {
let requestURL: NSURL = NSURL(string: "https://api.srct.gmu.edu/whatsopen/v2/facilities/?format=json")!
let apiURL = WOPDatabaseController.getDefaults().string(forKey: "apiURL") ?? "https://api.srct.gmu.edu/whatsopen/v2/"
let requestURL: NSURL = NSURL(string: "\(apiURL)facilities/?format=json")!
let urlRequest: NSMutableURLRequest = NSMutableURLRequest(url: requestURL as URL)
let session = URLSession.shared
......@@ -23,6 +24,7 @@ public class WOPDownloadController: NSObject {
(data, response, error) -> Void in
if(error != nil) {
dump(error)
completion(nil)
return
}
......@@ -56,8 +58,9 @@ public class WOPDownloadController: NSObject {
}
public static func performAlertsDownload(completion: @escaping (_ result: List<WOPAlert>?) -> Void) {
let apiURL = WOPDatabaseController.getDefaults().string(forKey: "apiURL") ?? "https://api.srct.gmu.edu/whatsopen/v2/"
let requestURL: NSURL = NSURL(string: "https://api.srct.gmu.edu/whatsopen/v2/alerts/?format=json")!
let requestURL: NSURL = NSURL(string: "\(apiURL)alerts/?format=json")!
let urlRequest: NSMutableURLRequest = NSMutableURLRequest(url: requestURL as URL)
let session = URLSession.shared
......
......@@ -71,7 +71,7 @@ public class WOPFacilityDetailViewController: UIViewController, UITableViewDeleg
OpenLabel.backgroundColor = UIColor(red:0.17, green:0.17, blue: 0.17, alpha: 1.0)
}
OpenTimesList.bounces = false
OpenTimesList.bounces = true
if #available(iOS 11.0, *) {
navigationItem.largeTitleDisplayMode = .never
......
......@@ -273,7 +273,7 @@ public class WOPAlert: Object, MapContext, Mappable {
urgency <- map["urgency_tag"]
subject <- map["subject"]
body <- map["body"]
message <- map["url"]
url <- map["url"]
message <- map["message"]
startDate <- map["start_datetime"]
endDate <- map["end_datetime"]
......
......@@ -137,7 +137,7 @@
<nil key="highlightedColor"/>
</label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" usesAttributedText="YES" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="RN8-f7-qjd">
<rect key="frame" x="16" y="94" width="343" height="553"/>
<rect key="frame" x="16" y="94" width="343" height="573"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<attributedString key="attributedText">
<fragment>
......@@ -161,7 +161,7 @@
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="KTh-gG-Ygq" firstAttribute="bottom" secondItem="RN8-f7-qjd" secondAttribute="bottom" constant="20" id="9Q1-0E-LoL"/>
<constraint firstItem="KTh-gG-Ygq" firstAttribute="bottom" secondItem="RN8-f7-qjd" secondAttribute="bottom" id="9Q1-0E-LoL"/>
<constraint firstItem="RN8-f7-qjd" firstAttribute="leading" secondItem="KTh-gG-Ygq" secondAttribute="leading" constant="16" id="BTq-qf-AKg"/>
<constraint firstItem="7p3-a2-wz4" firstAttribute="leading" secondItem="KTh-gG-Ygq" secondAttribute="leading" constant="16" id="BXV-c8-S4r"/>
<constraint firstItem="lSK-qc-Uis" firstAttribute="centerY" secondItem="7p3-a2-wz4" secondAttribute="centerY" id="Dyn-aP-deC"/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment