Unverified Commit fa006df2 authored by Zach Knox's avatar Zach Knox
Browse files

starting on notifications, among other things I forgot

parent 275c15da
......@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<string>${SHARED_VERSION_NUMBER}</string>
<key>CFBundleVersion</key>
<string>45</string>
<string>${SHARED_BUILD_NUMBER}</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
......
......@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<string>${SHARED_VERSION_NUMBER}</string>
<key>CFBundleVersion</key>
<string>45</string>
<string>${SHARED_BUILD_NUMBER}</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
......
......@@ -49,6 +49,7 @@ class IntentViewController: UIViewController, INUIHostedViewControlling {
let detailVC = storyboard.instantiateViewController(withIdentifier: "detailView") as! WOPFacilityDetailViewController
detailVC.facility = facility
//detailVC.preferredContentSize = CGSize(width: 300, height: 35)
attachChild(detailVC)
completion(true, parameters, self.desiredSize)
......@@ -72,6 +73,7 @@ class IntentViewController: UIViewController, INUIHostedViewControlling {
return self.extensionContext!.hostedViewMaximumAllowedSize
}
// Taken from Apple's SoupChef sample code
private func attachChild(_ viewController: UIViewController) {
addChild(viewController)
......
......@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<string>${SHARED_VERSION_NUMBER}</string>
<key>CFBundleVersion</key>
<string>45</string>
<string>${SHARED_BUILD_NUMBER}</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>
......
......@@ -75,6 +75,8 @@
928EC26421604DD800D8F9FE /* DownloadController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD3C97481DC18AB300A84434 /* DownloadController.swift */; };
928EC26521605CD700D8F9FE /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD763A791DE24EF100ADFD6B /* Model.swift */; };
928EC26721611E5900D8F9FE /* DatabaseController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 928EC26621611E5900D8F9FE /* DatabaseController.swift */; };
9296814D21CED36600FA2238 /* ViewInMapsActionActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9296814C21CED36600FA2238 /* ViewInMapsActionActivity.swift */; };
9296814E21CEDC3E00FA2238 /* ViewInMapsActionActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9296814C21CED36600FA2238 /* ViewInMapsActionActivity.swift */; };
92B2D2FF1FF8599500349E90 /* FilterSelectionTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92B2D2FE1FF8599500349E90 /* FilterSelectionTableViewController.swift */; };
92B89E2E20093E3600928284 /* AlertDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92B89E2D20093E3600928284 /* AlertDetailViewController.swift */; };
92B89E302009444E00928284 /* PullingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92B89E2F2009444E00928284 /* PullingViewController.swift */; };
......@@ -232,6 +234,7 @@
9281AD7B2002CF1700D09203 /* SetIconTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetIconTableViewController.swift; sourceTree = "<group>"; };
928EC2522160475900D8F9FE /* WhatsOpenKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WhatsOpenKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
928EC26621611E5900D8F9FE /* DatabaseController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseController.swift; sourceTree = "<group>"; };
9296814C21CED36600FA2238 /* ViewInMapsActionActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewInMapsActionActivity.swift; sourceTree = "<group>"; };
92B2D2FE1FF8599500349E90 /* FilterSelectionTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterSelectionTableViewController.swift; sourceTree = "<group>"; };
92B89E2D20093E3600928284 /* AlertDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertDetailViewController.swift; sourceTree = "<group>"; };
92B89E2F2009444E00928284 /* PullingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PullingViewController.swift; sourceTree = "<group>"; };
......@@ -383,6 +386,7 @@
9281AD7B2002CF1700D09203 /* SetIconTableViewController.swift */,
92A2757120C8992600E1A102 /* Primary Views */,
924E0E302085851400C1F2AF /* DetailViewButtonsViewController.swift */,
9296814C21CED36600FA2238 /* ViewInMapsActionActivity.swift */,
9265F3A21F2C0B1500A54A21 /* AboutScreenViewController.swift */,
927C80D91EB02566009079AD /* SettingsTableViewController.swift */,
9259134420784D66002E50B1 /* SelectOneDefaultTableViewController.swift */,
......@@ -996,7 +1000,7 @@
);
runOnlyForDeploymentPostprocessing = 1;
shellPath = /bin/sh;
shellScript = "#!/bin/bash\nbuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
shellScript = "#!/bin/bash\n#buildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\n#buildNumber=$(($buildNumber + 1))\n#/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
};
9203CBA82023D51A006ACC3B /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
......@@ -1051,7 +1055,7 @@
);
runOnlyForDeploymentPostprocessing = 1;
shellPath = /bin/sh;
shellScript = "#!/bin/bash\nbuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
shellScript = "#!/bin/bash\n#buildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\n#buildNumber=$(($buildNumber + 1))\n#/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
};
92CAA54E21665A0000CAF0D4 /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
......@@ -1065,7 +1069,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#!/bin/bash\nbuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
shellScript = "#!/bin/bash\n#buildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\n#buildNumber=$(($buildNumber + 1))\n#/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
};
92CAA54F21665A1300CAF0D4 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
......@@ -1078,7 +1082,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#!/bin/bash\nbuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
shellScript = "#!/bin/bash\n#buildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\n#buildNumber=$(($buildNumber + 1))\n#/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
};
92CAA55021665A1F00CAF0D4 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
......@@ -1091,7 +1095,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#!/bin/bash\nbuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
shellScript = "#!/bin/bash\n#buildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\n#buildNumber=$(($buildNumber + 1))\n#/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
};
92FF6C7820017E1C00D836AE /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
......@@ -1178,6 +1182,7 @@
files = (
9203CB862023D51A006ACC3B /* FilterSelectionTableViewController.swift in Sources */,
9203CB892023D51A006ACC3B /* AlertCollectionViewCell.swift in Sources */,
9296814E21CEDC3E00FA2238 /* ViewInMapsActionActivity.swift in Sources */,
9203CB8A2023D51A006ACC3B /* CheckingTableViewCell.swift in Sources */,
9203CB8B2023D51A006ACC3B /* FacilitiesListViewController.swift in Sources */,
9203CB8C2023D51A006ACC3B /* AlertDetailViewController.swift in Sources */,
......@@ -1245,6 +1250,7 @@
files = (
92B2D2FF1FF8599500349E90 /* FilterSelectionTableViewController.swift in Sources */,
92FF6C731FFEEEE900D836AE /* AlertCollectionViewCell.swift in Sources */,
9296814D21CED36600FA2238 /* ViewInMapsActionActivity.swift in Sources */,
92108A331ED755F100675E16 /* CheckingTableViewCell.swift in Sources */,
92182EC01E95BD2C00192ABA /* FacilitiesListViewController.swift in Sources */,
92B89E2E20093E3600928284 /* AlertDetailViewController.swift in Sources */,
......@@ -1762,6 +1768,8 @@
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SHARED_BUILD_NUMBER = 49;
SHARED_VERSION_NUMBER = 1.2;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
......@@ -1980,6 +1988,8 @@
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SHARED_BUILD_NUMBER = 49;
SHARED_VERSION_NUMBER = 1.2;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
......@@ -2030,6 +2040,8 @@
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SHARED_BUILD_NUMBER = 49;
SHARED_VERSION_NUMBER = 1.2;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
......
......@@ -7,6 +7,7 @@
//
import UIKit
import UserNotifications
import RealmSwift
import Fabric
......@@ -33,6 +34,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
initAlerts(defaults)
initAlertNotifications(defaults)
initCampuses(defaults)
if defaults.value(forKey: "mapsApp") == nil {
defaults.set("Apple Maps", forKey: "mapsApp")
......@@ -100,6 +102,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
defaults.set(setAlerts, forKey: "alerts")
}
}
func initAlertNotifications(_ defaults: UserDefaults) {
let notifications = defaults.dictionary(forKey: "notificationDefaults")
if notifications == nil {
var setAlerts = [String: Bool]()
setAlerts.updateValue(false, forKey: "informational")
setAlerts.updateValue(false, forKey: "minor alerts")
setAlerts.updateValue(false, forKey: "major alerts")
setAlerts.updateValue(false, forKey: "emergency")
defaults.set(setAlerts, forKey: "notificationDefaults")
}
}
func initCampuses(_ defaults: UserDefaults) {
let campuses = defaults.dictionary(forKey: "campuses")
......@@ -114,6 +129,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
WOPDownloadController.performAlertsDownload(completion: { alerts in
if alerts != nil {
DispatchQueue.main.async {
// Add to Realm
let date = Date()
let realm = try! Realm(configuration: WOPDatabaseController.getConfig())
let results = realm.objects(WOPFacilitiesModel.self)
......@@ -145,6 +161,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
fromRealm.lastUpdated = date
}
}
// Notification
completionHandler(UIBackgroundFetchResult.newData)
}
} else {
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "addshortcut.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "addshortcut@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "addshortcut@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "heart_empty.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "heart_empty@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "heart_empty@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "heart_filled.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "heart_filled@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "heart_filled@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "map@2x_2.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "map@2x-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "map@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
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