Skip to content

Commit b3e4c7f

Browse files
ColhodmColhodm
authored andcommitted
Did more back end integration
1 parent eb37a55 commit b3e4c7f

4 files changed

Lines changed: 64 additions & 31 deletions

File tree

Cal-Hacks-TBD/Cal-Hacks-TBD/Base.lproj/Main.storyboard

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,6 @@
3232
<fontDescription key="fontDescription" type="system" pointSize="14"/>
3333
<textInputTraits key="textInputTraits"/>
3434
</textField>
35-
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="i1K-gj-o2c">
36-
<rect key="frame" x="68" y="539" width="210" height="30"/>
37-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
38-
<state key="normal" title="Continue to Map Page for Now"/>
39-
<connections>
40-
<segue destination="3h1-n7-Cyk" kind="show" identifier="mapscreensegue" id="Z69-EN-MgI"/>
41-
</connections>
42-
</button>
4335
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h8e-9u-8wV">
4436
<rect key="frame" x="139" y="127" width="79" height="21"/>
4537
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
@@ -93,14 +85,16 @@
9385
<connections>
9486
<outlet property="firstBox" destination="PEP-wQ-Vvf" id="CCW-wf-DbH"/>
9587
<outlet property="secondBox" destination="ZYQ-cX-gJg" id="5CF-b9-Nhd"/>
88+
<outlet property="signUpBox" destination="EGX-U1-Sqy" id="24n-yT-NBH"/>
9689
<segue destination="diG-zi-HYZ" kind="show" identifier="createContract" id="LAL-j6-ozX"/>
90+
<segue destination="3h1-n7-Cyk" kind="show" identifier="mapscreensegue" id="1iT-G4-co4"/>
9791
</connections>
9892
</viewController>
9993
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
10094
</objects>
10195
<point key="canvasLocation" x="1948" y="55.322338830584712"/>
10296
</scene>
103-
<!--Map View Controller-->
97+
<!--Item-->
10498
<scene sceneID="PeV-wZ-jsx">
10599
<objects>
106100
<viewController id="3h1-n7-Cyk" customClass="MapViewController" customModule="Cal_Hacks_TBD" customModuleProvider="target" sceneMemberID="viewController">
@@ -110,6 +104,7 @@
110104
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
111105
<viewLayoutGuide key="safeArea" id="Nlh-Be-eMw"/>
112106
</view>
107+
<tabBarItem key="tabBarItem" title="Item" id="usF-FS-aLj"/>
113108
<connections>
114109
<outlet property="mapView" destination="QIN-1X-Vmf" id="eB4-3t-JLW"/>
115110
</connections>
@@ -118,6 +113,24 @@
118113
</objects>
119114
<point key="canvasLocation" x="2706.4000000000001" y="54.422788605697157"/>
120115
</scene>
116+
<!--Tab Bar Controller-->
117+
<scene sceneID="H01-QJ-eJt">
118+
<objects>
119+
<tabBarController id="B25-uf-jTB" sceneMemberID="viewController">
120+
<tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="fBz-iV-tqV">
121+
<rect key="frame" x="0.0" y="0.0" width="375" height="49"/>
122+
<autoresizingMask key="autoresizingMask"/>
123+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
124+
</tabBar>
125+
<connections>
126+
<segue destination="3h1-n7-Cyk" kind="relationship" relationship="viewControllers" id="z37-xQ-3lb"/>
127+
<segue destination="diG-zi-HYZ" kind="relationship" relationship="viewControllers" id="rs5-1T-6wM"/>
128+
</connections>
129+
</tabBarController>
130+
<placeholder placeholderIdentifier="IBFirstResponder" id="R4T-Up-AzF" userLabel="First Responder" sceneMemberID="firstResponder"/>
131+
</objects>
132+
<point key="canvasLocation" x="167" y="968"/>
133+
</scene>
121134
<!--Sign Up-->
122135
<scene sceneID="hVF-Hd-k6n">
123136
<objects>
@@ -197,7 +210,7 @@
197210
</objects>
198211
<point key="canvasLocation" x="2453.5999999999999" y="775.86206896551732"/>
199212
</scene>
200-
<!--Login Controller-->
213+
<!--Item-->
201214
<scene sceneID="T8f-Hd-9yJ">
202215
<objects>
203216
<viewController id="diG-zi-HYZ" customClass="LoginController" customModule="Cal_Hacks_TBD" customModuleProvider="target" sceneMemberID="viewController">
@@ -264,6 +277,7 @@
264277
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
265278
<viewLayoutGuide key="safeArea" id="cIt-8d-BGC"/>
266279
</view>
280+
<tabBarItem key="tabBarItem" title="Item" id="Kpc-3s-h9T"/>
267281
<connections>
268282
<outlet property="descriptionOfQuery" destination="Cu4-Xg-vQh" id="MoR-Dj-kd9"/>
269283
<outlet property="destination" destination="G0j-yG-XO8" id="6cJ-OH-xaf"/>
@@ -318,4 +332,8 @@
318332
<point key="canvasLocation" x="1008.8" y="55.322338830584712"/>
319333
</scene>
320334
</scenes>
335+
<inferredMetricsTieBreakers>
336+
<segue reference="LAL-j6-ozX"/>
337+
<segue reference="1iT-G4-co4"/>
338+
</inferredMetricsTieBreakers>
321339
</document>

Cal-Hacks-TBD/Cal-Hacks-TBD/LoginController.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,24 @@ class LoginController: UIViewController, UITextFieldDelegate {
4242
request.httpMethod = HTTPMethod.post.rawValue
4343
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
4444
print("HERE")
45-
//if !destination.endEditing(false){
46-
// print("EXITING HERE")
47-
// return
48-
// }
49-
//let quick = "(" + (placeNames[finalDest]?.coordinate.latitude.description)!
50-
// let temp = quick
51-
// + "," + (placeNames[finalDest]?.coordinate.longitude.description)!
52-
//let final = temp + ")"
45+
if !destination.endEditing(false){
46+
print("EXITING HERE")
47+
return
48+
}
49+
let quick = "(" + (placeNames[finalDest]?.coordinate.latitude.description)!
50+
let temp = quick
51+
+ "," + (placeNames[finalDest]?.coordinate.longitude.description)!
52+
let final = temp + ")"
5353

5454
let myCoords = (locationManager.location?.coordinate)!
5555
let quickone = "(" + myCoords.latitude.description
5656
let tempone = quickone
57-
+ "," + myCoords.latitude.description
57+
+ "," + myCoords.longitude.description
5858
let sourcefinal = tempone + ")"
5959
print("XXXXXX")
6060
print(sourcefinal)
6161
print("XXXXXX")
62-
let parameters = ["destination":"(20,10)", "price": price.text,"userid":userid,"source":sourcefinal,"description":descriptionOfQuery.text!] as! Dictionary<String, Any>
62+
let parameters = ["destination":final, "price": price.text!,"userid":"random","source":sourcefinal,"description":descriptionOfQuery.text!] as! Dictionary<String, String>
6363

6464

6565
do {

Cal-Hacks-TBD/Cal-Hacks-TBD/MapViewController.swift

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ class MapViewController: UIViewController {
7272
let cameraUpdate = GMSCameraUpdate.fit(mapBounds)
7373
print(cameraUpdate)
7474
mapView.moveCamera(cameraUpdate)
75-
locationManager.startUpdatingLocation()
75+
locationManager.startUpdatingLocation()
76+
makeGetRequest()
7677
}
7778
func scheduledTimerWithTimeInterval(){
7879
// Scheduling timer to Call the function "updateCounting" with the interval of 1 seconds
@@ -135,10 +136,9 @@ class MapViewController: UIViewController {
135136
let myCoords = (locationManager.location?.coordinate)!
136137
let quickone = "(" + myCoords.latitude.description
137138
let tempone = quickone
138-
+ "," + myCoords.latitude.description
139+
+ "," + myCoords.longitude.description
139140
let sourcefinal = tempone + ")"
140-
print(sourcefinal)
141-
let parameters = ["location":"temp", "radius": "5"] as Dictionary<String, String>
141+
let parameters = ["location":sourcefinal, "radius": "5"] as Dictionary<String, String>
142142

143143

144144
do {
@@ -149,28 +149,38 @@ class MapViewController: UIViewController {
149149
}
150150
print("EVEN GETTING HERE")
151151
Alamofire.request(request).responseJSON { (response) in
152-
var temp = response.value!
153-
print(temp)
154-
self.renderData(responseData: response.description)
152+
let temp = response.value! as? [Any]
153+
print("SHE WORKING ME")
154+
self.renderData(responseData: temp!)
155155

156156
}
157157
}
158158

159-
func renderData(responseData: String){
159+
func renderData(responseData: [Any]){
160160
// do some parsing to get the individual coordinates
161161
// assuming we create some list:
162162
// we're basically going to iterate through list and add them all to a path
163163
let path = GMSMutablePath()
164164
// latitude: 37.8716,longitude: -122.2727
165-
let names = [(37.9716,-122.2727), (37.6716,-122.2727), (37.7716,-122.2727)]
166-
for name in names {
167-
path.add(CLLocationCoordinate2D(latitude: CLLocationDegrees(name.0), longitude: CLLocationDegrees(name.1)))
165+
for name in responseData {
166+
let myCurrent = name as? Dictionary<String,Any>
167+
let start_location = myCurrent!["startLocation"] as? [Double]
168+
let end_location = myCurrent!["endlocation"] as? [Double]
169+
let contract_id = myCurrent!["_id"]
170+
let validity = myCurrent!["valid"]
171+
let price = myCurrent!["price"]
172+
let position = CLLocationCoordinate2D(latitude: CLLocationDegrees(start_location![0]), longitude: CLLocationDegrees(start_location![1]))
173+
let marker = GMSMarker(position: position)
174+
marker.title = "Random"
175+
marker.map = mapView
176+
path.add(CLLocationCoordinate2D(latitude: CLLocationDegrees(start_location![0]), longitude: CLLocationDegrees(start_location![1])))
168177
}
169178
if locationManager.location != nil{
170179
path.add((locationManager.location?.coordinate)!)
171180
mapView?.isMyLocationEnabled = true
172181
}
173182
//Update your mapView with path
183+
print("HERE")
174184
let mapBounds = GMSCoordinateBounds(path: path)
175185
let cameraUpdate = GMSCameraUpdate.fit(mapBounds)
176186
mapView.moveCamera(cameraUpdate)

Cal-Hacks-TBD/Cal-Hacks-TBD/ViewController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Alamofire
1111
import GooglePlaces
1212
class ViewController: UIViewController, UITextFieldDelegate {
1313

14+
@IBOutlet weak var signUpBox: UIButton!
1415
@IBOutlet weak var firstBox: UITextField!
1516
var locationManager = CLLocationManager()
1617
var userid = ""
@@ -79,6 +80,10 @@ class ViewController: UIViewController, UITextFieldDelegate {
7980
vc.userid = userid
8081
vc.logIn = logIn
8182
}
83+
if let vc = segue.destination as? SignUp
84+
{
85+
signUpBox.isHidden = true
86+
}
8287
}
8388

8489
override func didReceiveMemoryWarning() {

0 commit comments

Comments
 (0)