Skip to content

Commit acd1e34

Browse files
jogendramariobehling
authored andcommitted
fix data loading and UITests, update event model and cocoapods (#55)
updated project settings Moved all files constants to Constants file removed outdated UITests Linting fix url endpoint update tracks in event model use `self` to refer to class name as string use DispatchQueue over OperationQueue Fix data loading, update event model with new track ids, and storyboard loading identifiers updated cocoapods to latest 1.5.0
1 parent fe9860f commit acd1e34

Some content is hidden

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

43 files changed

+424
-395
lines changed

FOSSAsia.xcodeproj/project.pbxproj

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -335,18 +335,15 @@
335335
children = (
336336
30F0AFB41C81B9B000CE5D18 /* Provider */,
337337
30321F5B1C81759F008E5258 /* Api */,
338-
285F1B641C5AF7B100A7E0DD /* AppDelegate.swift */,
339-
28091E901C64B0B900E789CD /* Constants.swift */,
340338
2818A9381C62301A00ECB57F /* Models */,
341339
2818A9391C62305100ECB57F /* ViewModels */,
342340
285F1B901C5B06A600A7E0DD /* Helpers */,
343341
2859B1031C5E2F0A009656FC /* Views */,
344342
2818A9311C62300300ECB57F /* View Controllers */,
345343
2818A93B1C62347A00ECB57F /* Protocols */,
346344
2818A93C1C62348300ECB57F /* Storyboards */,
347-
285F1B6D1C5AF7B100A7E0DD /* Assets.xcassets */,
348-
285F1B721C5AF7B100A7E0DD /* Info.plist */,
349-
285F1B801C5AFE3200A7E0DD /* Fossasia-Bridging-Header.h */,
345+
4039027B208766CC00FF8F22 /* Assets */,
346+
4039027C2087673900FF8F22 /* Supporting Files */,
350347
);
351348
path = FOSSAsia;
352349
sourceTree = "<group>";
@@ -358,6 +355,7 @@
358355
285F1B961C5B08FC00A7E0DD /* DateTools */,
359356
2859B0FF1C5DFD09009656FC /* Colors.swift */,
360357
28A0BC6E1C5F42D6001625FB /* Error.swift */,
358+
28091E901C64B0B900E789CD /* Constants.swift */,
361359
285F1B8E1C5B069D00A7E0DD /* Observable.swift */,
362360
285F1B781C5AFBBB00A7E0DD /* SwiftHEXColors.swift */,
363361
);
@@ -417,6 +415,24 @@
417415
name = Provider;
418416
sourceTree = "<group>";
419417
};
418+
4039027B208766CC00FF8F22 /* Assets */ = {
419+
isa = PBXGroup;
420+
children = (
421+
285F1B6D1C5AF7B100A7E0DD /* Assets.xcassets */,
422+
);
423+
name = Assets;
424+
sourceTree = "<group>";
425+
};
426+
4039027C2087673900FF8F22 /* Supporting Files */ = {
427+
isa = PBXGroup;
428+
children = (
429+
285F1B641C5AF7B100A7E0DD /* AppDelegate.swift */,
430+
285F1B721C5AF7B100A7E0DD /* Info.plist */,
431+
285F1B801C5AFE3200A7E0DD /* Fossasia-Bridging-Header.h */,
432+
);
433+
name = "Supporting Files";
434+
sourceTree = "<group>";
435+
};
420436
8C4556AD4F10E8C1FF0495B8 /* Pods */ = {
421437
isa = PBXGroup;
422438
children = (
@@ -460,7 +476,6 @@
460476
285F1B5F1C5AF7B100A7E0DD /* Resources */,
461477
285F1B861C5B014600A7E0DD /* Embed Frameworks */,
462478
4AB91F7697E9AB18AC6A625D /* [CP] Embed Pods Frameworks */,
463-
3CB547C3F88DBF70424920E4 /* [CP] Copy Pods Resources */,
464479
);
465480
buildRules = (
466481
);
@@ -496,7 +511,7 @@
496511
isa = PBXProject;
497512
attributes = {
498513
LastSwiftUpdateCheck = 0720;
499-
LastUpgradeCheck = 0910;
514+
LastUpgradeCheck = 0930;
500515
ORGANIZATIONNAME = FossAsia;
501516
TargetAttributes = {
502517
285F1B601C5AF7B100A7E0DD = {
@@ -557,21 +572,6 @@
557572
/* End PBXResourcesBuildPhase section */
558573

559574
/* Begin PBXShellScriptBuildPhase section */
560-
3CB547C3F88DBF70424920E4 /* [CP] Copy Pods Resources */ = {
561-
isa = PBXShellScriptBuildPhase;
562-
buildActionMask = 2147483647;
563-
files = (
564-
);
565-
inputPaths = (
566-
);
567-
name = "[CP] Copy Pods Resources";
568-
outputPaths = (
569-
);
570-
runOnlyForDeploymentPostprocessing = 0;
571-
shellPath = /bin/sh;
572-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FOSSAsia/Pods-FOSSAsia-resources.sh\"\n";
573-
showEnvVarsInLog = 0;
574-
};
575575
4AB91F7697E9AB18AC6A625D /* [CP] Embed Pods Frameworks */ = {
576576
isa = PBXShellScriptBuildPhase;
577577
buildActionMask = 2147483647;
@@ -725,12 +725,14 @@
725725
CLANG_WARN_BOOL_CONVERSION = YES;
726726
CLANG_WARN_COMMA = YES;
727727
CLANG_WARN_CONSTANT_CONVERSION = YES;
728+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
728729
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
729730
CLANG_WARN_EMPTY_BODY = YES;
730731
CLANG_WARN_ENUM_CONVERSION = YES;
731732
CLANG_WARN_INFINITE_RECURSION = YES;
732733
CLANG_WARN_INT_CONVERSION = YES;
733734
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
735+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
734736
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
735737
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
736738
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -779,12 +781,14 @@
779781
CLANG_WARN_BOOL_CONVERSION = YES;
780782
CLANG_WARN_COMMA = YES;
781783
CLANG_WARN_CONSTANT_CONVERSION = YES;
784+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
782785
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
783786
CLANG_WARN_EMPTY_BODY = YES;
784787
CLANG_WARN_ENUM_CONVERSION = YES;
785788
CLANG_WARN_INFINITE_RECURSION = YES;
786789
CLANG_WARN_INT_CONVERSION = YES;
787790
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
791+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
788792
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
789793
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
790794
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;

FOSSAsia.xcodeproj/xcshareddata/xcschemes/FOSSAsia.xcscheme

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0910"
3+
LastUpgradeVersion = "0930"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,7 +26,6 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
language = ""
3029
shouldUseLaunchSchemeArgsEnv = "YES">
3130
<Testables>
3231
<TestableReference
@@ -56,7 +55,6 @@
5655
buildConfiguration = "Debug"
5756
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5857
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
59-
language = ""
6058
launchStyle = "0"
6159
useCustomWorkingDirectory = "NO"
6260
ignoresPersistentStateOnLaunch = "NO"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

FOSSAsia/ApiClient.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import Foundation
1111
typealias ApiRequestCompletionHandler = (Data?, Error?) -> Void
1212

1313
struct ApiClient {
14-
// static let url = "https://raw.githubusercontent.com/fossasia/open-event/master/testapi/event/1/"
15-
static let url = "https://raw.githubusercontent.com/fossasia/2016.fossasia.org/gh-pages/schedule/"
16-
14+
15+
static let url = "https://raw.githubusercontent.com/fossasia/open-event-scraper/master/out/"
16+
1717
let eventInfo: EventInfo
1818

1919
func sendGetRequest(_ completionHandler: @escaping ApiRequestCompletionHandler) {
@@ -32,26 +32,26 @@ struct ApiClient {
3232
completionHandler(nil, error)
3333
return
3434
}
35-
35+
3636
self.processResponse(unwrappedData, completionHandler: { (error) -> Void in
3737
guard error == nil else {
3838
completionHandler(nil, error)
3939
return
4040
}
4141
completionHandler(unwrappedData, nil)
4242
})
43-
44-
})
43+
44+
})
4545
task.resume()
4646
}
4747

4848
fileprivate func getUrl(_ eventInfo: EventInfo) -> String {
49-
return ApiClient.url + eventInfo.rawValue + ".json"
49+
return ApiClient.url + eventInfo.rawValue + Constants.jsonFileExtension
5050
}
51-
51+
5252
fileprivate func processResponse(_ data: Data, completionHandler: CommitmentCompletionHandler) {
53-
if let dir : NSString = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.allDomainsMask, true).first as NSString? {
54-
let path = dir.appendingPathComponent(SettingsManager.getLocalFileName(eventInfo));
53+
if let dir: NSString = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.allDomainsMask, true).first as NSString? {
54+
let path = dir.appendingPathComponent(SettingsManager.getLocalFileName(eventInfo))
5555
try? data.write(to: URL(fileURLWithPath: path), options: [])
5656
completionHandler(nil)
5757
}

FOSSAsia/AppDelegate.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import UserNotifications
1313
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
1414

1515
var window: UIWindow?
16-
16+
1717
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
1818
// Override point for customization after application launch.
1919
UITabBar.appearance().tintColor = Colors.mainRedColor
2020
UINavigationBar.appearance().tintColor = Colors.creamTintColor
21-
21+
2222
UserDefaults.standard.register(defaults: [Constants.UserDefaultsKey.FilteredTrackIds: (1...Constants.numberOfTracks).toArray()])
2323
// Set the Local Notification Delegate
2424
let center = UNUserNotificationCenter.current()
@@ -49,4 +49,3 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
4949
}
5050

5151
}
52-

FOSSAsia/Colors.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
// Copyright © 2016 FossAsia. All rights reserved.
77
//
88

9-
import Foundation
9+
import UIKit
1010

1111
struct Colors {
1212
static let mainRedColor = UIColor(hexString: "D90300")
1313
static let creamTintColor = UIColor(hexString: "FEFAD5")
1414
static let favoriteOrangeColor = UIColor(hexString: "F5A623")
15-
}
15+
static let highlightedBackgroundColor = UIColor(hexString: "FFF5F5")
16+
}

FOSSAsia/Constants.swift

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,43 @@
99
import Foundation
1010

1111
struct Constants {
12+
1213
static let numberOfTracks = 15
13-
14+
static let jsonFileExtension = ".json"
15+
static let localNotificationIdentifier = "LocalNotification"
16+
static let sessionsStoryboardName = "Sessions"
17+
static let individualEventStoryboard = "IndividualEvent"
18+
static let eventViewControllerID = "EventViewController"
19+
static let okTitle = "OK"
20+
static let cancelTitle = "Cancel"
21+
static let appStoreAlertTitle = "Open App Store?"
22+
static let appStoreAlertMessage = "Tapping OK will temporarily exit this application and open the app's page on the App Store"
23+
1424
struct UserDefaultsKey {
1525
static let FilteredTrackIds = "FilteredTrackIds"
1626
}
17-
}
1827

28+
struct Sessions {
29+
static let track = "track"
30+
static let id = "id"
31+
static let sessionId = "session_id"
32+
static let title = "title"
33+
static let description = "description"
34+
static let location = "location"
35+
static let speakers = "speakers"
36+
static let startTime = "start_time"
37+
static let endTime = "end_time"
38+
static let speakerName = "name"
39+
}
40+
41+
struct SettingsManager {
42+
static let keyForEvent = "HasEvents"
43+
static let keyForMicrolocations = "HasMicrolocations"
44+
static let favesJSON = "faves.json"
45+
}
46+
47+
struct Images {
48+
static let navbarFaveHighlighted = "navbar_fave_highlighted"
49+
static let navbarFave = "navbar_fave"
50+
}
51+
}

FOSSAsia/Error.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ struct Error {
1717
case jsonSystemReadingFailed = -6004
1818
case writingOnDiskFailed = -6005
1919
}
20-
20+
2121
let errorCode: Code
2222
}

FOSSAsia/Event.swift

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,42 @@ import Foundation
1010

1111
struct Event {
1212
enum Track: Int, CustomStringConvertible {
13-
case techKids1 = 1
14-
case techKids2, openTechIOT, openTech, webTech, exhibition, hardwareIOT, python, databases, bigOpenData, devOps, privSec, isc, scienceHackDay, linux, design
13+
case openTechIOT = 1
14+
case openTech, techKids1, techKids2, techKids3, hardwareIOT, devOps, webTech, python, bigOpenData, databases, isc, privSec, scienceHackDay, linux, design, exhibition, social
1515
var description: String {
1616
switch self {
17-
case .techKids1: return "Tech Kids I";
18-
case .techKids2: return "Tech Kids II";
19-
case .openTechIOT: return "OpenTech and IOT";
20-
case .openTech: return "OpenTech Workshops";
21-
case .webTech: return "WebTech";
22-
case .exhibition: return "Exhibition";
23-
case .hardwareIOT: return "Hardware and IOT";
24-
case .python: return "Python";
25-
case .databases: return "Databases";
26-
case .bigOpenData: return "Big Data/Open Data";
27-
case .devOps: return "DevOps";
28-
case .privSec: return "Privacy and Security";
29-
case .isc: return "Internet, Society, Community";
30-
case .scienceHackDay: return "Science Hack Day";
31-
case .linux: return "Linux and MiniDebConf";
17+
case .techKids1: return "Tech Kids I"
18+
case .techKids2: return "Tech Kids II"
19+
case .techKids3: return "Tech Kids III"
20+
case .openTechIOT: return "OpenTech and IOT"
21+
case .openTech: return "OpenTech Workshops"
22+
case .webTech: return "WebTech"
23+
case .exhibition: return "Exhibition"
24+
case .hardwareIOT: return "Hardware and IOT"
25+
case .python: return "Python"
26+
case .databases: return "Databases"
27+
case .bigOpenData: return "Big Data/Open Data"
28+
case .devOps: return "DevOps"
29+
case .privSec: return "Privacy and Security"
30+
case .isc: return "Internet, Society, Community"
31+
case .scienceHackDay: return "Science Hack Day"
32+
case .linux: return "Linux and MiniDebConf"
3233
case .design: return "Design, VR, 3D"
34+
case .social: return "Social Event"
3335
}
3436
}
35-
37+
3638
func getTrackColor() -> UIColor {
3739
switch self {
38-
case .techKids1, .techKids2:
40+
case .techKids1, .techKids2, .techKids3:
3941
return UIColor(hexString: "8E8E93")!
4042
case .openTechIOT:
4143
return UIColor(hexString: "FF4D4D")!
4244
case .openTech:
4345
return UIColor(hexString: "FF8E4C")!
4446
case .webTech:
4547
return UIColor(hexString: "FFCF4C")!
46-
case .exhibition:
48+
case .exhibition, .social:
4749
return UIColor(hexString: "EAFF4C")!
4850
case .hardwareIOT:
4951
return UIColor(hexString: "B8FF4C")!

0 commit comments

Comments
 (0)