Skip to content

Commit 217374d

Browse files
committed
Merge branch 'master' of https://github.com/cuappdev/tcat-ios
2 parents 85ac02f + 857cf6e commit 217374d

File tree

77 files changed

+410
-539
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+410
-539
lines changed

TCAT/AppDelegate.swift

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2929
]
3030

3131
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
32+
3233
// Update shortcut items
3334
AppShortcuts.shared.updateShortcutItems()
3435

@@ -101,7 +102,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
101102
func applicationWillTerminate(_ application: UIApplication) {
102103
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
103104
}
104-
105+
106+
// MARK: Helper Functions
107+
108+
/// Creates and sets a unique identifier. If the device identifier changes, updates it.
109+
func setupUniqueIdentifier() {
110+
if
111+
let uid = UIDevice.current.identifierForVendor?.uuidString,
112+
uid != userDefaults.string(forKey: Constants.UserDefaults.uid)
113+
{
114+
userDefaults.set(uid, forKey: Constants.UserDefaults.uid)
115+
}
116+
}
117+
105118
func handleShortcut(item: UIApplicationShortcutItem) {
106119
let optionsVC = RouteOptionsViewController()
107120
if let shortcutData = item.userInfo as? [String: Data] {
@@ -182,9 +195,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
182195
let optionsVC = RouteOptionsViewController()
183196

184197
if
185-
let lat = items?.filter({$0.name == "lat"}).first?.value,
186-
let long = items?.filter({$0.name == "long"}).first?.value,
187-
let stop = items?.filter({$0.name == "stopName"}).first?.value {
198+
let lat = items?.filter({ $0.name == "lat" }).first?.value,
199+
let long = items?.filter({ $0.name == "long" }).first?.value,
200+
let stop = items?.filter({ $0.name == "stopName" }).first?.value {
188201
latitude = Double(lat)
189202
longitude = Double(long)
190203
stopName = stop
@@ -210,13 +223,21 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
210223
let longitude = intent.longitude,
211224
let searchTo = intent.searchTo,
212225
let stopName = searchTo.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed),
213-
let url = URL(string: "ithaca-transit://getRoutes?lat=\(latitude)&long=\(longitude)&stopName=\(stopName)") {
214-
UIApplication.shared.open(url, options: [:], completionHandler: nil)
215-
return true
226+
let url = URL(string: "ithaca-transit://getRoutes?lat=\(latitude)&long=\(longitude)&stopName=\(stopName)")
227+
{
228+
UIApplication.shared.open(url, options: [:]) { (didComplete) in
229+
let intentDescription = userActivity.interaction?.intent.intentDescription ?? "No Intent Description"
230+
let payload = SiriShortcutUsedPayload(didComplete: didComplete,
231+
intentDescription: intentDescription,
232+
locationName: stopName)
233+
Analytics.shared.log(payload)
216234
}
235+
return true
236+
}
217237
}
218238
return false
219239
}
240+
220241
}
221242

222243
extension UIWindow {

TCAT/Assets.xcassets/AppIcon-Old.appiconset/Contents.json

Lines changed: 0 additions & 158 deletions
This file was deleted.
-1.11 KB
Binary file not shown.
-1.82 KB
Binary file not shown.
-2.47 KB
Binary file not shown.
-1.4 KB
Binary file not shown.
-2.38 KB
Binary file not shown.
-3.41 KB
Binary file not shown.
-1.82 KB
Binary file not shown.
-3.17 KB
Binary file not shown.

0 commit comments

Comments
 (0)