From b96ec06a64db090ca0e7bdd10240d6d41311c6d6 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Wed, 24 Jun 2015 17:31:21 +0800 Subject: [PATCH] refactor --- .../ConversationViewController.swift | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/Yep/ViewControllers/Conversation/ConversationViewController.swift b/Yep/ViewControllers/Conversation/ConversationViewController.swift index 794d454f..5964fb8a 100644 --- a/Yep/ViewControllers/Conversation/ConversationViewController.swift +++ b/Yep/ViewControllers/Conversation/ConversationViewController.swift @@ -951,18 +951,6 @@ class ConversationViewController: BaseViewController { } } - func toggleNotificationEnabledForUserWithUserID(userID: String) { - let realm = Realm() - - if let user = userWithUserID(userID, inRealm: realm) { - realm.write { - user.notificationEnabled = !user.notificationEnabled - } - - moreView.notificationEnabled = user.notificationEnabled - } - } - func toggleDoNotDisturb() { if let user = conversation.withFriend { @@ -973,14 +961,14 @@ class ConversationViewController: BaseViewController { disableNotificationFromUserWithUserID(userID, failureHandler: nil, completion: { success in println("disableNotificationFromUserWithUserID \(success)") - self.toggleNotificationEnabledForUserWithUserID(userID) + self.updateNotificationEnabled(false, forUserWithUserID: userID) }) } else { enableNotificationFromUserWithUserID(userID, failureHandler: nil, completion: { success in println("enableNotificationFromUserWithUserID \(success)") - self.toggleNotificationEnabledForUserWithUserID(userID) + self.updateNotificationEnabled(true, forUserWithUserID: userID) }) } }