Skip to content

Commit 76091f6

Browse files
committed
Working on map view
1 parent 67c0b55 commit 76091f6

11 files changed

Lines changed: 2546 additions & 2228 deletions

File tree

Hack FSU.xcodeproj/project.pbxproj

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,12 @@
349349
TargetAttributes = {
350350
61551A6B1BD9C0C50091D44A = {
351351
CreatedOnToolsVersion = 7.0;
352-
DevelopmentTeam = KW8RLKUW3C;
352+
DevelopmentTeam = 79838R6XL2;
353353
LastSwiftMigration = 0810;
354+
ProvisioningStyle = Automatic;
354355
SystemCapabilities = {
355356
com.apple.Push = {
356-
enabled = 1;
357+
enabled = 0;
357358
};
358359
};
359360
};
@@ -648,12 +649,14 @@
648649
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
649650
CLANG_ENABLE_MODULES = YES;
650651
CODE_SIGN_IDENTITY = "iPhone Developer: Todd Joseph Littlejohn (4KYDF7BG9W)";
652+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
653+
DEVELOPMENT_TEAM = 79838R6XL2;
651654
INFOPLIST_FILE = "Hack FSU/Info.plist";
652655
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
653656
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
654-
PRODUCT_BUNDLE_IDENTIFIER = com.hackfsu.ios.hackfsu;
657+
PRODUCT_BUNDLE_IDENTIFIER = com.hackfsu.mobile.ios;
655658
PRODUCT_NAME = "$(TARGET_NAME)";
656-
PROVISIONING_PROFILE = "333e0c91-e45f-458e-a7ed-829f77fcf8dd";
659+
PROVISIONING_PROFILE = "";
657660
SWIFT_OBJC_BRIDGING_HEADER = "Hack FSU-Bridging-Header.h";
658661
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
659662
SWIFT_VERSION = 2.3;
@@ -669,13 +672,14 @@
669672
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
670673
CLANG_ENABLE_MODULES = YES;
671674
CODE_SIGN_IDENTITY = "iPhone Distribution: Todd Joseph Littlejohn (KW8RLKUW3C)";
672-
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Todd Joseph Littlejohn (KW8RLKUW3C)";
675+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
676+
DEVELOPMENT_TEAM = 79838R6XL2;
673677
INFOPLIST_FILE = "Hack FSU/Info.plist";
674678
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
675679
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
676-
PRODUCT_BUNDLE_IDENTIFIER = com.hackfsu.ios.hackfsu;
680+
PRODUCT_BUNDLE_IDENTIFIER = com.hackfsu.mobile.ios;
677681
PRODUCT_NAME = "$(TARGET_NAME)";
678-
PROVISIONING_PROFILE = "312d49a1-b34f-40b9-94f1-74249894be2d";
682+
PROVISIONING_PROFILE = "";
679683
SWIFT_OBJC_BRIDGING_HEADER = "Hack FSU-Bridging-Header.h";
680684
SWIFT_VERSION = 2.3;
681685
TARGETED_DEVICE_FAMILY = 1;
@@ -788,13 +792,14 @@
788792
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
789793
CLANG_ENABLE_MODULES = YES;
790794
CODE_SIGN_IDENTITY = "iPhone Distribution: Todd Joseph Littlejohn (KW8RLKUW3C)";
791-
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Todd Joseph Littlejohn (KW8RLKUW3C)";
795+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
796+
DEVELOPMENT_TEAM = 79838R6XL2;
792797
INFOPLIST_FILE = "Hack FSU/Info.plist";
793798
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
794799
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
795-
PRODUCT_BUNDLE_IDENTIFIER = com.hackfsu.ios.hackfsu;
800+
PRODUCT_BUNDLE_IDENTIFIER = com.hackfsu.mobile.ios;
796801
PRODUCT_NAME = "$(TARGET_NAME)";
797-
PROVISIONING_PROFILE = "312d49a1-b34f-40b9-94f1-74249894be2d";
802+
PROVISIONING_PROFILE = "";
798803
SWIFT_OBJC_BRIDGING_HEADER = "Hack FSU-Bridging-Header.h";
799804
SWIFT_VERSION = 2.3;
800805
TARGETED_DEVICE_FAMILY = 1;
Binary file not shown.

Hack FSU/AppDelegate.swift

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -27,58 +27,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2727
UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent
2828
UITabBar.appearance().tintColor = UIColor._hackRed()
2929

30-
// Register for Push Notitications
31-
if application.applicationState != UIApplicationState.Background {
32-
// Track an app open here if we launch with a push, unless
33-
// "content_available" was used to trigger a background push (introduced in iOS 7).
34-
// In that case, we skip tracking here to avoid double counting the app-open.
35-
36-
let preBackgroundPush = !application.respondsToSelector("backgroundRefreshStatus")
37-
let oldPushHandlerOnly = !self.respondsToSelector(#selector(UIApplicationDelegate.application(_:didReceiveRemoteNotification:fetchCompletionHandler:)))
38-
var pushPayload = false
39-
if let options = launchOptions {
40-
pushPayload = options[UIApplicationLaunchOptionsRemoteNotificationKey] != nil
41-
}
42-
if (preBackgroundPush || oldPushHandlerOnly || pushPayload) {
43-
PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)
44-
}
45-
}
46-
47-
if application.respondsToSelector(#selector(UIApplication.registerUserNotificationSettings(_:))) {
48-
49-
let settings = UIUserNotificationSettings(forTypes: [UIUserNotificationType.Alert, UIUserNotificationType.Sound, UIUserNotificationType.Badge], categories: nil)
50-
application.registerUserNotificationSettings(settings)
51-
application.registerForRemoteNotifications()
52-
} else {
53-
print("fuck")
54-
}
55-
56-
5730
return true
5831
}
59-
60-
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
61-
let installation = PFInstallation.currentInstallation()
62-
installation.setDeviceTokenFromData(deviceToken)
63-
installation.channels = ["updates"]
64-
installation.saveInBackground()
65-
}
66-
67-
func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
68-
if error.code == 3010 {
69-
print("Push notifications are not supported in the iOS Simulator.")
70-
} else {
71-
print("application:didFailToRegisterForRemoteNotificationsWithError: %@", error)
72-
}
73-
}
74-
75-
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
76-
PFPush.handlePush(userInfo)
77-
if application.applicationState == UIApplicationState.Inactive {
78-
PFAnalytics.trackAppOpenedWithRemoteNotificationPayload(userInfo)
79-
}
80-
}
81-
32+
8233
func applicationWillResignActive(application: UIApplication) {
8334
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
8435
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.

Hack FSU/HFFeedViewController.swift

Lines changed: 63 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,19 @@ class HFFeedViewController: UIViewController, UITableViewDelegate, UITableViewDa
2222
@IBOutlet weak var tableViewContainerView: UIView!
2323

2424
let apiURL = NSURL(string: "https://hackfsu.com/api/hackathon/get/updates")!
25+
let scheduleapiURL = NSURL(string: "https://hackfsu.com/api/hackathon/get/schedule_items")!
26+
2527
var titles = [String]()
2628
var contents = [String]()
29+
var updatesDates = [String]()
2730

28-
var refreshControl: UIRefreshControl!
31+
var scheduleNames = [String]()
2932

33+
var refreshControl: UIRefreshControl!
3034
var alamoCalled = false;
3135

36+
/**********************************************************************************/
37+
3238
// MARK: Class Variables
3339
var updateFeedArray:[HFUpdate] = [HFUpdate]()
3440
var twitterFeedArray:[HFScheduleItem] = [HFScheduleItem]()
@@ -42,6 +48,8 @@ class HFFeedViewController: UIViewController, UITableViewDelegate, UITableViewDa
4248
var dayOfWeekArray:[String] = [String]()
4349
// var feedSegmentControl:UISegmentedControl!
4450

51+
/**********************************************************************************/
52+
4553
override func viewDidLoad() {
4654
super.viewDidLoad()
4755
feedTableView.setContentOffset(CGPointZero, animated: false)
@@ -79,6 +87,10 @@ class HFFeedViewController: UIViewController, UITableViewDelegate, UITableViewDa
7987
feedTableView.addSubview(refreshControl)
8088

8189
callAlamo(apiURL)
90+
callAlamo(scheduleapiURL);
91+
92+
93+
8294

8395
}
8496

@@ -108,24 +120,43 @@ class HFFeedViewController: UIViewController, UITableViewDelegate, UITableViewDa
108120
Alamofire.request(.GET, url, encoding: .JSON).validate().responseJSON(completionHandler: {
109121

110122
response in
111-
self.parseResults(JSON(response.result.value!))
123+
self.parseResults(JSON(response.result.value!), url: url)
112124
self.alamoCalled = true
113125

114126
})
115127
}
116128

117-
func parseResults(theJSON : JSON) {
129+
func parseResults(theJSON : JSON, url: NSURL) {
130+
131+
if (url == apiURL) {
132+
118133
for result in theJSON["updates"].arrayValue {
119134
let title = result["title"].stringValue
120135
let content = result["content"].stringValue
136+
let dates = result["submit_time"].stringValue
137+
121138
self.contents.append(content)
122139
self.titles.append(title)
140+
self.updatesDates.append(dates)
141+
123142
}
124-
for i in self.titles {
125-
print(i)
143+
126144
}
145+
else if (url == scheduleapiURL) {
146+
for results in theJSON["schedule_items"].arrayValue {
147+
let name = results["name"].stringValue
148+
self.scheduleNames.append(name)
149+
}
150+
151+
}
152+
153+
// for i in self.scheduleNames {
154+
// print(i)
155+
// }
127156
self.feedTableView.reloadData()
128157
}
158+
159+
129160

130161

131162

@@ -176,10 +207,11 @@ class HFFeedViewController: UIViewController, UITableViewDelegate, UITableViewDa
176207
cell.title.text = titles[indexPath.section]
177208
//cell.subTitle.text = update.getContent()
178209
cell.subTitle.text = contents[indexPath.section]
179-
//print(update.getTimestamp())
180-
//cell.timestamp.text = update.getTimestamp()
181-
cell.timestamp.text = "temp"
182-
//print(update.getTimestamp())
210+
211+
let hi = updatesDates[indexPath.section]
212+
213+
cell.timestamp.text = theTIMEBIH(hi);
214+
183215
cell.configureFlatCellWithColor(tempCellColor, selectedColor: tempCellColor, roundingCorners: .AllCorners)
184216
cell.cornerRadius = 3.5
185217
cell.backgroundColor = UIColor.colorFromHex(0xEDECF3)
@@ -283,6 +315,20 @@ class HFFeedViewController: UIViewController, UITableViewDelegate, UITableViewDa
283315
}
284316
}
285317

318+
func theTIMEBIH(date: String) -> String {
319+
320+
let dateFormatterGet = NSDateFormatter()
321+
dateFormatterGet.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"
322+
323+
let dateFormatterPrint = NSDateFormatter()
324+
dateFormatterPrint.dateFormat = "E h:mm a"
325+
326+
let date: NSDate? = dateFormatterGet.dateFromString(date)
327+
328+
329+
return dateFormatterPrint.stringFromDate(date!)
330+
}
331+
286332

287333

288334

@@ -295,6 +341,7 @@ class HFFeedViewController: UIViewController, UITableViewDelegate, UITableViewDa
295341
// getScheduleItemsFromParse()
296342
}
297343

344+
298345
/* checkForContent will check if there is data to be displayed in the view. If not, it will set the correct Glyptodon view. */
299346
/*
300347
func checkForContent() {
@@ -406,7 +453,7 @@ class HFFeedViewController: UIViewController, UITableViewDelegate, UITableViewDa
406453
}
407454
}
408455
}
409-
*/
456+
410457

411458
func dateToString(date: NSDate) -> String {
412459
//format date
@@ -455,14 +502,17 @@ class HFFeedViewController: UIViewController, UITableViewDelegate, UITableViewDa
455502
//format date
456503

457504
let dateFormatter = NSDateFormatter()
458-
dateFormatter.dateFormat = "hh:mm a"
505+
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ"
459506
// let dateString = dateFormatter.stringFromDate(date.dateByAddingTimeInterval(18000))
460507
let dateString = dateFormatter.stringFromDate(date)
508+
461509
let timeComponents = dateString.componentsSeparatedByString(":")
462510
let hour = Int(timeComponents[0])
463511

512+
print("\(hour!):\(timeComponents[1])")
513+
464514
return "\(hour!):\(timeComponents[1])"
465515

466516
}
467-
468-
}// End of View Controller Class
517+
*/
518+
}

Hack FSU/HFMapViewController.swift

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ import FlatUIKit
1111
import Parse
1212
import Agrume
1313
import ParseUI
14+
import Alamofire
15+
import AlamofireImage
16+
import SwiftyJSON
1417

1518
class HFMapViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
1619

1720

1821
@IBOutlet weak var floorTableView: UITableView!
1922
@IBOutlet var mapTableViewContainerView: UIView!
2023

21-
22-
23-
24+
let apiURL = NSURL(string: "https://hackfsu.com/api/hackathon/get/maps")!
2425

2526
// MARK: Class Variables
2627

@@ -46,8 +47,47 @@ class HFMapViewController: UIViewController, UITableViewDelegate, UITableViewDat
4647
self.navigationItem.title = "VENUE MAP"
4748
let attributesDictionary = [NSFontAttributeName: UIFont(name: "UniSansHeavyCAPS", size: 25)!, NSForegroundColorAttributeName: UIColor.whiteColor()]
4849
self.navigationController!.navigationBar.titleTextAttributes = attributesDictionary
50+
callAlamo(apiURL)
51+
}
52+
53+
func callAlamo(url : NSURL) {
54+
Alamofire.request(.GET, url, encoding: .JSON).validate().responseJSON(completionHandler: {
55+
56+
response in
57+
self.parseResults(JSON(response.result.value!), url: url)
58+
59+
60+
})
4961
}
5062

63+
func parseResults(theJSON : JSON, url: NSURL) {
64+
65+
for result in theJSON["maps"].arrayValue {
66+
let title = result["link"].stringValue
67+
let urlOfImages = NSURL(string: title)!
68+
print(title)
69+
getImagesAlamo(urlOfImages)
70+
71+
}
72+
}
73+
74+
func getImagesAlamo(url : NSURL) {
75+
Alamofire.request(.GET, url).responseImage {
76+
response in
77+
debugPrint(response)
78+
79+
print(response.request)
80+
print(response.response)
81+
debugPrint(response.result)
82+
83+
if let image = response.result.value {
84+
print("image downloaded: \(image)")
85+
}
86+
}
87+
}
88+
89+
90+
5191
override func viewDidAppear(animated: Bool) {
5292
checkForContent()
5393
getSponsorsFromParse()
@@ -70,6 +110,7 @@ class HFMapViewController: UIViewController, UITableViewDelegate, UITableViewDat
70110
let cell:HFMapTableViewCell = tableView.dequeueReusableCellWithIdentifier("map") as! HFMapTableViewCell
71111
let map = mapArray[indexPath.section]
72112
cell.mapImage.file = map.getMapImage()
113+
73114
cell.mapImage.loadInBackground()
74115
cell.mapImage.contentMode = .ScaleAspectFit
75116
cell.selectionStyle = .None
@@ -106,6 +147,9 @@ class HFMapViewController: UIViewController, UITableViewDelegate, UITableViewDat
106147
let agrume = Agrume(image: newMap!)
107148
agrume.showFrom(self)
108149
}
150+
for element in mapArray {
151+
print(element)
152+
}
109153

110154
}
111155

@@ -132,6 +176,7 @@ class HFMapViewController: UIViewController, UITableViewDelegate, UITableViewDat
132176
self.floorTableView.reloadData()
133177
self.checkForContent()
134178
} else {
179+
print("aw");
135180
print(error)
136181
}
137182
}

Podfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ target 'Hack FSU' do
1212
pod 'Agrume', :git => 'https://github.com/JanGorman/Agrume.git'
1313
pod 'Alamofire', '~> 3.5.0'
1414
pod 'SwiftyJSON', '~> 2.4.0'
15+
pod 'AlamofireImage', '~> 2.5.0'
1516
end

0 commit comments

Comments
 (0)