From d9640af33bd46bc89b3727f87bfd2623fe8db4b3 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Mon, 3 Aug 2015 18:04:16 +0800 Subject: [PATCH] add UserDoNotDisturb to User --- Yep/AppDelegate.swift | 6 +++++- Yep/Realm/Models.swift | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Yep/AppDelegate.swift b/Yep/AppDelegate.swift index 51c6f938..84c7bb2c 100644 --- a/Yep/AppDelegate.swift +++ b/Yep/AppDelegate.swift @@ -23,7 +23,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { - setSchemaVersion(14, Realm.defaultPath, { migration, oldSchemaVersion in + setSchemaVersion(15, Realm.defaultPath, { migration, oldSchemaVersion in // We haven’t migrated anything yet, so oldSchemaVersion == 0 if oldSchemaVersion < 1 { // Nothing to do! @@ -77,6 +77,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } } } + + if oldSchemaVersion < 15 { + } + }) Crashlytics.startWithAPIKey("3030ba006e21bcf8eb4a2127b6a7931ea6667486") diff --git a/Yep/Realm/Models.swift b/Yep/Realm/Models.swift index 0f2e81d0..ee545ac9 100644 --- a/Yep/Realm/Models.swift +++ b/Yep/Realm/Models.swift @@ -74,6 +74,14 @@ class UserSocialAccountProvider: Object { dynamic var enabled: Bool = false } +class UserDoNotDisturb: Object { + dynamic var isOn: Bool = false + dynamic var fromHour: Int = 22 + dynamic var fromMinute: Int = 0 + dynamic var toHour: Int = 7 + dynamic var toMinute: Int = 30 +} + class User: Object { dynamic var userID: String = "" dynamic var nickname: String = "" @@ -96,6 +104,8 @@ class User: Object { dynamic var notificationEnabled: Bool = true dynamic var blocked: Bool = false + dynamic var doNotDisturb: UserDoNotDisturb? + let learningSkills = List() let masterSkills = List() let socialAccountProviders = List()