Skip to content

Commit

Permalink
Merge pull request #73 from acsalu/save-history
Browse files Browse the repository at this point in the history
Fully connect to server.
  • Loading branch information
acsalu committed Dec 10, 2015
2 parents 204fb76 + d18fcd6 commit 65fe220
Show file tree
Hide file tree
Showing 62 changed files with 4,102 additions and 1,900 deletions.
25 changes: 25 additions & 0 deletions Emome.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
90330AA71C14A7BA00A23B28 /* EMOChooseSeggestionTypeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90330AA61C14A7BA00A23B28 /* EMOChooseSeggestionTypeViewController.swift */; };
90330AA91C14A7E600A23B28 /* EMOBaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90330AA81C14A7E600A23B28 /* EMOBaseViewController.swift */; };
903A2DE11C07B27C00C8964A /* EMOColorSplashViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 903A2DE01C07B27C00C8964A /* EMOColorSplashViewController.swift */; };
903BA55C1C18F5E3001BD564 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 903BA55B1C18F5E3001BD564 /* CoreData.framework */; };
906190B61BE6E4BC0061E103 /* EmoEmomeColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 906190B51BE6E4BC0061E103 /* EmoEmomeColors.swift */; };
907C0F431BDEA94C00C896D3 /* EMOScenarioSelectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 907C0F421BDEA94C00C896D3 /* EMOScenarioSelectionViewController.swift */; };
907C0F451BDEA9AC00C896D3 /* EMOSeggestionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 907C0F441BDEA9AC00C896D3 /* EMOSeggestionViewController.swift */; };
Expand All @@ -36,6 +37,8 @@
90C6FD481BB0B5CF009F9FB3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90C6FD471BB0B5CF009F9FB3 /* AppDelegate.swift */; };
90C6FD4F1BB0B5CF009F9FB3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 90C6FD4E1BB0B5CF009F9FB3 /* Assets.xcassets */; };
90C6FD521BB0B5CF009F9FB3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 90C6FD501BB0B5CF009F9FB3 /* LaunchScreen.storyboard */; };
90D46DC41C18FA820081BAB2 /* EmomeCoreData.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 90D46DC21C18FA820081BAB2 /* EmomeCoreData.xcdatamodeld */; };
90D46DC61C193DE10081BAB2 /* EMOUIViewUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90D46DC51C193DE10081BAB2 /* EMOUIViewUtils.swift */; };
90DF63801C14974C00AC74AC /* EMOColorSplashLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90DF637F1C14974C00AC74AC /* EMOColorSplashLayer.swift */; };
90EFFD851C0806BF005AD750 /* EMOHomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90EFFD841C0806BF005AD750 /* EMOHomeViewController.swift */; };
90EFFD871C08C9CB005AD750 /* EMOEmotionColorButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90EFFD861C08C9CA005AD750 /* EMOEmotionColorButton.swift */; };
Expand Down Expand Up @@ -79,6 +82,7 @@
90330AA61C14A7BA00A23B28 /* EMOChooseSeggestionTypeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EMOChooseSeggestionTypeViewController.swift; sourceTree = "<group>"; };
90330AA81C14A7E600A23B28 /* EMOBaseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EMOBaseViewController.swift; sourceTree = "<group>"; };
903A2DE01C07B27C00C8964A /* EMOColorSplashViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EMOColorSplashViewController.swift; sourceTree = "<group>"; };
903BA55B1C18F5E3001BD564 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
906190B51BE6E4BC0061E103 /* EmoEmomeColors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EmoEmomeColors.swift; sourceTree = "<group>"; };
907C0F421BDEA94C00C896D3 /* EMOScenarioSelectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EMOScenarioSelectionViewController.swift; sourceTree = "<group>"; };
907C0F441BDEA9AC00C896D3 /* EMOSeggestionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EMOSeggestionViewController.swift; sourceTree = "<group>"; };
Expand All @@ -100,6 +104,8 @@
90C6FD4E1BB0B5CF009F9FB3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
90C6FD511BB0B5CF009F9FB3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
90C6FD531BB0B5CF009F9FB3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
90D46DC31C18FA820081BAB2 /* EmomeCoreData.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = EmomeCoreData.xcdatamodel; sourceTree = "<group>"; };
90D46DC51C193DE10081BAB2 /* EMOUIViewUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EMOUIViewUtils.swift; sourceTree = "<group>"; };
90DF637F1C14974C00AC74AC /* EMOColorSplashLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EMOColorSplashLayer.swift; sourceTree = "<group>"; };
90EFFD841C0806BF005AD750 /* EMOHomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EMOHomeViewController.swift; sourceTree = "<group>"; };
90EFFD861C08C9CA005AD750 /* EMOEmotionColorButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EMOEmotionColorButton.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -128,6 +134,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
903BA55C1C18F5E3001BD564 /* CoreData.framework in Frameworks */,
85902B3DCE963DC4D680B59D /* Pods_Emome.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -166,6 +173,7 @@
90EFFD8A1C090258005AD750 /* EMOHomeActionButton.swift */,
90DF637F1C14974C00AC74AC /* EMOColorSplashLayer.swift */,
90B58C211C17E3170050730F /* EMOEmotionSlider.swift */,
90D46DC51C193DE10081BAB2 /* EMOUIViewUtils.swift */,
);
name = UI;
sourceTree = "<group>";
Expand All @@ -178,6 +186,7 @@
90F758611C168AB9003F9C69 /* EMOScenario.swift */,
9030FF501BFAC92300948793 /* EMOEnums.swift */,
90F758651C175615003F9C69 /* EMORequestParser.swift */,
90D46DC21C18FA820081BAB2 /* EmomeCoreData.xcdatamodeld */,
);
name = Data;
sourceTree = "<group>";
Expand Down Expand Up @@ -284,6 +293,7 @@
A1E2B34085E0F8003C70AC32 /* Frameworks */ = {
isa = PBXGroup;
children = (
903BA55B1C18F5E3001BD564 /* CoreData.framework */,
85FF42BE84B4AE0D14439A0B /* Pods_Emome.framework */,
);
name = Frameworks;
Expand Down Expand Up @@ -526,12 +536,14 @@
906190B61BE6E4BC0061E103 /* EmoEmomeColors.swift in Sources */,
908C890D1BE06C1100190BB5 /* EMODataManager.swift in Sources */,
90B9A8161C016A510008DAF4 /* GCDUtils.swift in Sources */,
90D46DC41C18FA820081BAB2 /* EmomeCoreData.xcdatamodeld in Sources */,
9030FF511BFAC92300948793 /* EMOEnums.swift in Sources */,
90B58C181C175FDD0050730F /* EMOConsts.swift in Sources */,
9030FF4E1BFA419100948793 /* EMOSuggestion.swift in Sources */,
90B58C241C17EE450050730F /* EMOSuggestionExtraMessageViewController.swift in Sources */,
90B58C201C17DAE40050730F /* EMOSpecifyEmotionViewController.swift in Sources */,
90B58C261C17F7570050730F /* EMOPostingSuggestionViewController.swift in Sources */,
90D46DC61C193DE10081BAB2 /* EMOUIViewUtils.swift in Sources */,
90330AA91C14A7E600A23B28 /* EMOBaseViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -768,6 +780,19 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCVersionGroup section */
90D46DC21C18FA820081BAB2 /* EmomeCoreData.xcdatamodeld */ = {
isa = XCVersionGroup;
children = (
90D46DC31C18FA820081BAB2 /* EmomeCoreData.xcdatamodel */,
);
currentVersion = 90D46DC31C18FA820081BAB2 /* EmomeCoreData.xcdatamodel */;
path = EmomeCoreData.xcdatamodeld;
sourceTree = "<group>";
versionGroupType = wrapper.xcdatamodel;
};
/* End XCVersionGroup section */
};
rootObject = 90C6FD3C1BB0B5CE009F9FB3 /* Project object */;
}
Binary file modified Emome/.DS_Store
Binary file not shown.
67 changes: 65 additions & 2 deletions Emome/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Fabric
import Crashlytics
import XCGLogger
import FBSDKCoreKit
import CoreData

let log = XCGLogger.defaultInstance()

Expand All @@ -29,7 +30,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

// Set up logger
log.setup(.Verbose, showThreadName: true, showLogLevel: true, showFileNames: true, showLineNumbers: true, writeToFile: nil, fileLogLevel: .Debug)

return true
}

Expand Down Expand Up @@ -59,7 +60,69 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}


// MARK: - Core Data stack

lazy var applicationDocumentsDirectory: NSURL = {
// The directory the application uses to store the Core Data store file. This code uses a directory named "com.acsalu.TestCoreData" in the application's documents Application Support directory.
let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
return urls[urls.count-1]
}()

lazy var managedObjectModel: NSManagedObjectModel = {
// The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model.
let modelURL = NSBundle.mainBundle().URLForResource("EmomeCoreData", withExtension: "momd")!
return NSManagedObjectModel(contentsOfURL: modelURL)!
}()

lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator = {
// The persistent store coordinator for the application. This implementation creates and returns a coordinator, having added the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail.
// Create the coordinator and store
let coordinator = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel)
let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("SingleViewCoreData.sqlite")
var failureReason = "There was an error creating or loading the application's saved data."
do {
try coordinator.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: nil)
} catch {
// Report any error we got.
var dict = [String: AnyObject]()
dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data"
dict[NSLocalizedFailureReasonErrorKey] = failureReason

dict[NSUnderlyingErrorKey] = error as NSError
let wrappedError = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict)
// Replace this with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog("Unresolved error \(wrappedError), \(wrappedError.userInfo)")
abort()
}

return coordinator
}()

lazy var managedObjectContext: NSManagedObjectContext = {
// Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) This property is optional since there are legitimate error conditions that could cause the creation of the context to fail.
let coordinator = self.persistentStoreCoordinator
var managedObjectContext = NSManagedObjectContext(concurrencyType: .MainQueueConcurrencyType)
managedObjectContext.persistentStoreCoordinator = coordinator
return managedObjectContext
}()

// MARK: - Core Data Saving support

func saveContext () {
if managedObjectContext.hasChanges {
do {
try managedObjectContext.save()
} catch {
// Replace this implementation with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
NSLog("Unresolved error \(nserror), \(nserror.userInfo)")
abort()
}
}
}

}

30 changes: 26 additions & 4 deletions Emome/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,48 @@
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "app-icon-spotlight@2x.png",
"filename" : "app-icon@2x-1.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "app-icon-spotlight@3x.png",
"filename" : "app-icon@3x-1.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "[email protected]",
"filename" : "app-icon-spotlight@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "[email protected]",
"filename" : "app-icon-spotlight@3x.png",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "1x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "[email protected]",
"scale" : "2x"
}
],
"info" : {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Emome/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Emome/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
22 changes: 22 additions & 0 deletions Emome/Assets.xcassets/btn-rating-bad.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions Emome/Assets.xcassets/btn-rating-good.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions Emome/Assets.xcassets/img-smile-face.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 65fe220

Please sign in to comment.