Skip to content

Commit c26869a

Browse files
Merge pull request #190 from cuappdev/matt/analytic-fix
Analytic Fix
2 parents 9836739 + e9ba510 commit c26869a

10 files changed

Lines changed: 498 additions & 31 deletions

File tree

Siri/Base.lproj/Intents.intentdefinition

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>INIntentDefinitionModelVersion</key>
88
<string>1.0</string>
99
<key>INIntentDefinitionSystemVersion</key>
10-
<string>17G65</string>
10+
<string>18B75</string>
1111
<key>INIntentDefinitionToolsBuildVersion</key>
1212
<string>10B61</string>
1313
<key>INIntentDefinitionToolsVersion</key>
@@ -113,7 +113,7 @@
113113
<key>INIntentRestrictions</key>
114114
<integer>0</integer>
115115
<key>INIntentTitle</key>
116-
<string>Get Routes </string>
116+
<string>Get Routes</string>
117117
<key>INIntentTitleID</key>
118118
<string>6mhV59</string>
119119
<key>INIntentType</key>
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>INEnums</key>
6+
<array/>
7+
<key>INIntentDefinitionModelVersion</key>
8+
<string>1.0</string>
9+
<key>INIntentDefinitionSystemVersion</key>
10+
<string>17G65</string>
11+
<key>INIntentDefinitionToolsBuildVersion</key>
12+
<string>10B61</string>
13+
<key>INIntentDefinitionToolsVersion</key>
14+
<string>10.1</string>
15+
<key>INIntents</key>
16+
<array>
17+
<dict>
18+
<key>INIntentCategory</key>
19+
<string>request</string>
20+
<key>INIntentDescriptionID</key>
21+
<string>wweA1z</string>
22+
<key>INIntentLastParameterTag</key>
23+
<integer>9</integer>
24+
<key>INIntentName</key>
25+
<string>GetRoutes</string>
26+
<key>INIntentParameterCombinations</key>
27+
<dict>
28+
<key>searchTo,latitude,longitude</key>
29+
<dict>
30+
<key>INIntentParameterCombinationIsPrimary</key>
31+
<false/>
32+
<key>INIntentParameterCombinationSubtitle</key>
33+
<string></string>
34+
<key>INIntentParameterCombinationSubtitleID</key>
35+
<string>KKOS3V</string>
36+
<key>INIntentParameterCombinationSupportsBackgroundExecution</key>
37+
<false/>
38+
<key>INIntentParameterCombinationTitle</key>
39+
<string>Find bus to ${searchTo}</string>
40+
<key>INIntentParameterCombinationTitleID</key>
41+
<string>DexuVZ</string>
42+
</dict>
43+
</dict>
44+
<key>INIntentParameters</key>
45+
<array>
46+
<dict>
47+
<key>INIntentParameterDisplayPriority</key>
48+
<integer>1</integer>
49+
<key>INIntentParameterName</key>
50+
<string>searchTo</string>
51+
<key>INIntentParameterSupportsMultipleValues</key>
52+
<false/>
53+
<key>INIntentParameterTag</key>
54+
<integer>2</integer>
55+
<key>INIntentParameterType</key>
56+
<string>String</string>
57+
</dict>
58+
<dict>
59+
<key>INIntentParameterDisplayPriority</key>
60+
<integer>2</integer>
61+
<key>INIntentParameterName</key>
62+
<string>latitude</string>
63+
<key>INIntentParameterSupportsMultipleValues</key>
64+
<false/>
65+
<key>INIntentParameterTag</key>
66+
<integer>7</integer>
67+
<key>INIntentParameterType</key>
68+
<string>String</string>
69+
</dict>
70+
<dict>
71+
<key>INIntentParameterDisplayPriority</key>
72+
<integer>3</integer>
73+
<key>INIntentParameterName</key>
74+
<string>longitude</string>
75+
<key>INIntentParameterSupportsMultipleValues</key>
76+
<false/>
77+
<key>INIntentParameterTag</key>
78+
<integer>8</integer>
79+
<key>INIntentParameterType</key>
80+
<string>String</string>
81+
</dict>
82+
</array>
83+
<key>INIntentResponse</key>
84+
<dict>
85+
<key>INIntentResponseCodes</key>
86+
<array>
87+
<dict>
88+
<key>INIntentResponseCodeFormatString</key>
89+
<string>Failed to find routes</string>
90+
<key>INIntentResponseCodeFormatStringID</key>
91+
<string>JvOfFg</string>
92+
<key>INIntentResponseCodeName</key>
93+
<string>failure</string>
94+
<key>INIntentResponseCodeSuccess</key>
95+
<false/>
96+
</dict>
97+
<dict>
98+
<key>INIntentResponseCodeFormatString</key>
99+
<string></string>
100+
<key>INIntentResponseCodeFormatStringID</key>
101+
<string>yRbqhi</string>
102+
<key>INIntentResponseCodeName</key>
103+
<string>success</string>
104+
<key>INIntentResponseCodeSuccess</key>
105+
<true/>
106+
</dict>
107+
</array>
108+
<key>INIntentResponseLastParameterTag</key>
109+
<integer>7</integer>
110+
<key>INIntentResponseParameters</key>
111+
<array/>
112+
</dict>
113+
<key>INIntentRestrictions</key>
114+
<integer>0</integer>
115+
<key>INIntentTitle</key>
116+
<string>Get Routes </string>
117+
<key>INIntentTitleID</key>
118+
<string>6mhV59</string>
119+
<key>INIntentType</key>
120+
<string>Custom</string>
121+
<key>INIntentUserConfirmationRequired</key>
122+
<false/>
123+
<key>INIntentVerb</key>
124+
<string>Request</string>
125+
</dict>
126+
</array>
127+
</dict>
128+
</plist>

Siri/en.lproj/Intents.strings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"6mhV59" = "Get Routes ";
1+
"6mhV59" = "Get Routes";
22

33
"DexuVZ" = "Find bus to ${searchTo}";
44

TCAT.xcodeproj/project.pbxproj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
222BDE16215C1CEE0040DD93 /* WhatsNewHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 222BDE15215C1CEE0040DD93 /* WhatsNewHeaderView.swift */; };
1212
224EB5A5214F2F01008232C2 /* AppShortcuts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 224EB5A4214F2F01008232C2 /* AppShortcuts.swift */; };
1313
226C8D762173AF69009985E3 /* VersionStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 226C8D752173AF69009985E3 /* VersionStore.swift */; };
14-
2292486921B891A30004279C /* Network+Endpoints.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2292486721B891A30004279C /* Network+Endpoints.swift */; };
15-
2292486A21B891A30004279C /* Network+Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2292486821B891A30004279C /* Network+Models.swift */; };
14+
2292486921B891A30004279C /* Endpoints.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2292486721B891A30004279C /* Endpoints.swift */; };
15+
2292486A21B891A30004279C /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2292486821B891A30004279C /* Models.swift */; };
1616
2292486C21B8ECB90004279C /* ServiceAlertsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2292486B21B8ECB90004279C /* ServiceAlertsViewController.swift */; };
1717
4036E23543D87A22BF6B0023 /* Pods_TCATUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E08977D7DB800C37CAF625E1 /* Pods_TCATUITests.framework */; };
1818
449A7C791D80D0E80019300C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 449A7C781D80D0E80019300C /* AppDelegate.swift */; };
@@ -145,8 +145,8 @@
145145
222BDE15215C1CEE0040DD93 /* WhatsNewHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = WhatsNewHeaderView.swift; path = Views/WhatsNewHeaderView.swift; sourceTree = "<group>"; };
146146
224EB5A4214F2F01008232C2 /* AppShortcuts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppShortcuts.swift; path = Utilities/AppShortcuts.swift; sourceTree = "<group>"; };
147147
226C8D752173AF69009985E3 /* VersionStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = VersionStore.swift; path = Utilities/VersionStore.swift; sourceTree = "<group>"; };
148-
2292486721B891A30004279C /* Network+Endpoints.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Network+Endpoints.swift"; path = "Utilities/Network+Endpoints.swift"; sourceTree = "<group>"; };
149-
2292486821B891A30004279C /* Network+Models.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Network+Models.swift"; path = "Utilities/Network+Models.swift"; sourceTree = "<group>"; };
148+
2292486721B891A30004279C /* Endpoints.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Endpoints.swift; path = Utilities/Endpoints.swift; sourceTree = "<group>"; };
149+
2292486821B891A30004279C /* Models.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Models.swift; path = Utilities/Models.swift; sourceTree = "<group>"; };
150150
2292486B21B8ECB90004279C /* ServiceAlertsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServiceAlertsViewController.swift; sourceTree = "<group>"; };
151151
449A7C751D80D0E80019300C /* TCAT.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TCAT.app; sourceTree = BUILT_PRODUCTS_DIR; };
152152
449A7C781D80D0E80019300C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@@ -184,6 +184,7 @@
184184
BF5C52A3207B96F0003C93B9 /* LiveIndicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LiveIndicator.swift; path = Views/LiveIndicator.swift; sourceTree = "<group>"; };
185185
BF5CBAD01FCE6CCE00478C6F /* RouteDetail+DrawerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "RouteDetail+DrawerViewController.swift"; path = "Controllers/RouteDetail+DrawerViewController.swift"; sourceTree = "<group>"; };
186186
BF6095261FD7091B0013E538 /* CustomNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CustomNavigationController.swift; path = Controllers/CustomNavigationController.swift; sourceTree = "<group>"; };
187+
BF73322021B67D7100F26620 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Intents.strings; sourceTree = "<group>"; };
187188
BF73F0F21F60B0BD003B479D /* LocationObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LocationObject.swift; path = Model/LocationObject.swift; sourceTree = "<group>"; };
188189
BF74AC191F945D7D00AFD4E4 /* GoogleMapsBase.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GoogleMapsBase.framework; path = Pods/GoogleMaps/Base/Frameworks/GoogleMapsBase.framework; sourceTree = "<group>"; };
189190
BF74AC1B1F945D8E00AFD4E4 /* GoogleMapsCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GoogleMapsCore.framework; path = Pods/GoogleMaps/Maps/Frameworks/GoogleMapsCore.framework; sourceTree = "<group>"; };
@@ -200,7 +201,6 @@
200201
BFA53FED1FD45D7000E770DF /* RouteDetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RouteDetailViewController.swift; path = Controllers/RouteDetailViewController.swift; sourceTree = "<group>"; };
201202
BFB86A06205C614C000794B2 /* OnboardingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OnboardingViewController.swift; path = Controllers/OnboardingViewController.swift; sourceTree = "<group>"; };
202203
BFC367F521B66E9A00ABD9AC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; name = Base; path = Base.lproj/Intents.intentdefinition; sourceTree = "<group>"; };
203-
BFC367F821B66EA700ABD9AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Intents.strings; sourceTree = "<group>"; };
204204
BFCA712C206AC69000E4CCE5 /* Keys.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Keys.swift; path = "Supporting Files/Keys.swift"; sourceTree = "<group>"; };
205205
BFD5B4E31FAADFAE00955C37 /* WalkPath.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WalkPath.swift; path = Model/WalkPath.swift; sourceTree = "<group>"; };
206206
BFF41EB1204365E800E0696B /* SummaryView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SummaryView.swift; path = Views/SummaryView.swift; sourceTree = "<group>"; };
@@ -314,8 +314,9 @@
314314
2292486621B891790004279C /* Network */ = {
315315
isa = PBXGroup;
316316
children = (
317-
2292486721B891A30004279C /* Network+Endpoints.swift */,
318-
2292486821B891A30004279C /* Network+Models.swift */,
317+
2292486721B891A30004279C /* Endpoints.swift */,
318+
2292486821B891A30004279C /* Models.swift */,
319+
DD3D9C201F94297100B164D4 /* Reachability.swift */,
319320
);
320321
name = Network;
321322
sourceTree = "<group>";
@@ -354,6 +355,7 @@
354355
DD2F988F1E50D89C0005F6BC /* Cells */,
355356
DD47EA501E50D77D009C68EB /* Controllers */,
356357
DD2F98911E50D8C90005F6BC /* Model */,
358+
2292486621B891790004279C /* Network */,
357359
50A19BA81E4BC5BC00AD6768 /* Supporting Files */,
358360
DD2F98941E50D8DC0005F6BC /* Utilities */,
359361
DD2F98951E50D8E60005F6BC /* Views */,
@@ -467,9 +469,7 @@
467469
D183AA011E6CB092006A9A15 /* Extensions.swift */,
468470
DD04B1AC208CC5E4006C1C23 /* JSONFileManager.swift */,
469471
DD87F2091E878CB5000C244B /* Loader.swift */,
470-
2292486621B891790004279C /* Network */,
471472
BF18AE112083B9B8000C3D82 /* Phrases.swift */,
472-
DD3D9C201F94297100B164D4 /* Reachability.swift */,
473473
5006F7B91EC0F59A005ACAF2 /* SearchTableViewHelpers.swift */,
474474
BF18AE0F2083B7F6000C3D82 /* StoreReviewHelper.swift */,
475475
BF84609D217139A30027FB62 /* Styles.swift */,
@@ -873,7 +873,7 @@
873873
5006F7BA1EC0F59A005ACAF2 /* SearchTableViewHelpers.swift in Sources */,
874874
BFCA712D206AC69000E4CCE5 /* Keys.swift in Sources */,
875875
5006F7B81EBFC7DE005ACAF2 /* CornellDestinationCell.swift in Sources */,
876-
2292486921B891A30004279C /* Network+Endpoints.swift in Sources */,
876+
2292486921B891A30004279C /* Endpoints.swift in Sources */,
877877
DDB49C9D1E8857FC00A99C35 /* BusPath.swift in Sources */,
878878
DD659C8A20508E1B00506BAC /* WalkWithDistanceIcon.swift in Sources */,
879879
DD36A7001F66378C00E4789E /* PlaceResult.swift in Sources */,
@@ -893,7 +893,7 @@
893893
DD2F989B1E50F99A0005F6BC /* Route.swift in Sources */,
894894
DD87F20A1E878CB5000C244B /* Loader.swift in Sources */,
895895
DD3D9C341F942CF000B164D4 /* CoordinateVisitor.swift in Sources */,
896-
2292486A21B891A30004279C /* Network+Models.swift in Sources */,
896+
2292486A21B891A30004279C /* Models.swift in Sources */,
897897
DD3D9C211F94297100B164D4 /* Reachability.swift in Sources */,
898898
DDBFEAA11E787008002BBD96 /* RouteSelectionView.swift in Sources */,
899899
222BDE16215C1CEE0040DD93 /* WhatsNewHeaderView.swift in Sources */,
@@ -1003,7 +1003,7 @@
10031003
isa = PBXVariantGroup;
10041004
children = (
10051005
BFC367F521B66E9A00ABD9AC /* Base */,
1006-
BFC367F821B66EA700ABD9AC /* en */,
1006+
BF73322021B67D7100F26620 /* en */,
10071007
);
10081008
name = Intents.intentdefinition;
10091009
sourceTree = "<group>";

TCAT/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
4646
// Log basic information
4747
let payload = AppLaunchedPayload()
4848
Analytics.shared.log(payload)
49-
49+
setupUniqueIdentifier()
5050
JSONFileManager.shared.deleteAllJSONs()
5151

5252
for (key, defaultValue) in userDataInits {

TCAT/Controllers/RouteOptionsViewController.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,9 @@ class RouteOptionsViewController: UIViewController, DestinationDelegate, SearchB
369369
return
370370
}
371371

372-
Network.getRoutes(startCoord: startCoord, endCoord: endCoord, endPlaceName: searchFrom.name, time: time, type: self.searchTimeType) { request in
373-
let requestUrl = Network.getRequestUrl(startCoord: startCoord, endCoord: endCoord, destinationName: searchTo.name, time: time, type: self.searchTimeType)
372+
Network.getRoutes(startCoord: startCoord, endCoord: endCoord, startPlaceName: searchFrom.name, endPlaceName: searchTo.name,
373+
time: time, type: self.searchTimeType) { request in
374+
let requestUrl = Network.getRequestUrl(startCoord: startCoord, endCoord: endCoord, originName: searchFrom.name, destinationName: searchTo.name, time: time, type: self.searchTimeType)
374375
self.processRequest(request: request, requestUrl: requestUrl, endPlace: searchTo)
375376
}
376377

TCAT/Model/Direction.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ class Direction: NSObject, NSCopying, Codable {
105105
do { routeNumber = try container.decode(Int.self, forKey: .routeNumber) } catch { routeNumber = -1 }
106106
stops = try! container.decode([LocationObject].self, forKey: .stops)
107107
do { stayOnBusForTransfer = try container.decode(Bool.self, forKey: .stayOnBusForTransfer) } catch { stayOnBusForTransfer = false }
108-
tripIdentifiers = try! container.decode([String]?.self, forKey: .tripIdentifiers)
109-
delay = try! container.decode(Int?.self, forKey: .delay)
108+
tripIdentifiers = try? container.decode([String].self, forKey: .tripIdentifiers)
109+
delay = try? container.decode(Int.self, forKey: .delay)
110110
travelDistance = try! container.decode(Double.self, forKey: .travelDistance)
111111
super.init()
112112
}
Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,29 +99,38 @@ class Network {
9999

100100
}
101101

102-
class func getRoutes(startCoord: CLLocationCoordinate2D, endCoord: CLLocationCoordinate2D, endPlaceName: String, time: Date, type: SearchType,
102+
class func getRoutes(startCoord: CLLocationCoordinate2D, endCoord: CLLocationCoordinate2D,
103+
startPlaceName: String, endPlaceName: String, time: Date, type: SearchType,
103104
callback: @escaping (_ request: APIRequest<RoutesRequest, Error>) -> Void) {
105+
104106
let request: APIRequest<RoutesRequest, Error> = tron.codable.request("route")
105107
request.method = .get
106108
request.parameters = [
107-
"arriveBy": type == .arriveBy,
108-
"end": "\(endCoord.latitude),\(endCoord.longitude)",
109-
"start": "\(startCoord.latitude),\(startCoord.longitude)",
110-
"time": time.timeIntervalSince1970,
111-
"destinationName": endPlaceName
109+
"arriveBy" : type == .arriveBy,
110+
"end" : "\(endCoord.latitude),\(endCoord.longitude)",
111+
"start" : "\(startCoord.latitude),\(startCoord.longitude)",
112+
"time" : time.timeIntervalSince1970,
113+
"destinationName" : endPlaceName,
114+
"originName" : startPlaceName
112115
]
113-
116+
117+
// Add unique identifier to request
118+
if let uid = userDefaults.string(forKey: Constants.UserDefaults.uid) {
119+
request.parameters["uid"] = uid
120+
}
121+
114122
callback(request)
115123
}
116-
117-
class func getRequestUrl(startCoord: CLLocationCoordinate2D, endCoord: CLLocationCoordinate2D, destinationName: String, time: Date, type: SearchType) -> String {
124+
125+
class func getRequestUrl(startCoord: CLLocationCoordinate2D, endCoord: CLLocationCoordinate2D,
126+
originName: String, destinationName: String, time: Date, type: SearchType) -> String {
118127
let path = "route"
119128
let arriveBy = (type == .arriveBy)
120129
let end = "\(endCoord.latitude),\(endCoord.longitude)"
121130
let start = "\(startCoord.latitude),\(startCoord.longitude)"
122131
let time = time.timeIntervalSince1970
123-
124-
return "\(address)\(path)?arriveBy=\(arriveBy)&end=\(end)&start=\(start)&time=\(time)&destinationName=\(destinationName)"
132+
133+
return "\(address)\(path)?arriveBy=\(arriveBy)&end=\(end)&start=\(start)&time=\(time)&destinationName=\(destinationName)&originName=\(originName)"
125134
}
126135

127136
/// TO BE CHANGED

0 commit comments

Comments
 (0)