diff --git a/Yep/Base.lproj/Intro.storyboard b/Yep/Base.lproj/Intro.storyboard
index b3e3dd93..22c9e92f 100644
--- a/Yep/Base.lproj/Intro.storyboard
+++ b/Yep/Base.lproj/Intro.storyboard
@@ -274,7 +274,7 @@
-
+
@@ -781,7 +781,7 @@
-
+
diff --git a/Yep/Services/FayeService.swift b/Yep/Services/FayeService.swift
index bf940d84..d7dc05b1 100644
--- a/Yep/Services/FayeService.swift
+++ b/Yep/Services/FayeService.swift
@@ -231,6 +231,7 @@ class FayeService: NSObject, MZFayeClientDelegate {
private func saveMessageWithMessageInfo(messageInfo: JSONDictionary) {
//这里不用 realmQueue 是为了下面的通知同步,用了 realmQueue 可能导致数据更新慢于通知
dispatch_async(dispatch_get_main_queue()) {
+
guard let realm = try? Realm() else {
return
}
diff --git a/Yep/Services/YepService.swift b/Yep/Services/YepService.swift
index c88a3468..7fe0d2c1 100644
--- a/Yep/Services/YepService.swift
+++ b/Yep/Services/YepService.swift
@@ -1274,6 +1274,22 @@ func joinGroup(groupID groupID: String, failureHandler: ((Reason, String?) -> Vo
}
+func leaveGroup(groupID groupID: String, failureHandler: ((Reason, String?) -> Void)?, completion: JSONDictionary -> Void) {
+
+ let parse: JSONDictionary -> JSONDictionary? = { data in
+ return data
+ }
+
+ let resource = authJsonResource(path: "/api/v1/circles/\(groupID)/leave", method: .DELETE, requestParameters: [:], parse: parse)
+
+ if let failureHandler = failureHandler {
+ apiRequest({_ in}, baseURL: baseURL, resource: resource, failure: failureHandler, completion: completion)
+ } else {
+ apiRequest({_ in}, baseURL: baseURL, resource: resource, failure: defaultFailureHandler, completion: completion)
+ }
+}
+
+
func headGroups(failureHandler failureHandler: ((Reason, String?) -> Void)?, completion: JSONDictionary -> Void) {
let requestParameters = [
"page": 1,
diff --git a/Yep/ViewControllers/Conversations/ConversationsViewController.swift b/Yep/ViewControllers/Conversations/ConversationsViewController.swift
index 3db341c8..266233e6 100644
--- a/Yep/ViewControllers/Conversations/ConversationsViewController.swift
+++ b/Yep/ViewControllers/Conversations/ConversationsViewController.swift
@@ -39,7 +39,7 @@ class ConversationsViewController: UIViewController {
}
}
- lazy var noConversationFooterView: InfoView = InfoView(NSLocalizedString("Do not do to others what you would not like to be done to you.", comment: ""))
+ lazy var noConversationFooterView: InfoView = InfoView(NSLocalizedString("All conversations will show at here.", comment: ""))
var noConversation = false {
didSet {
@@ -345,7 +345,27 @@ extension ConversationsViewController: UITableViewDataSource, UITableViewDelegat
// delete conversation, finally
realm.write {
+
+ if let group = conversation.withGroup {
+
+ if let feed = conversation.withGroup?.withFeed {
+ realm.delete(feed)
+ }
+
+ let groupID = group.groupID
+
+ leaveGroup(groupID: groupID, failureHandler: { (reason, error) -> Void in
+
+ }, completion: { (result) -> Void in
+
+ })
+
+ realm.delete(group)
+
+ }
+
realm.delete(conversation)
+
}
}
diff --git a/Yep/en.lproj/Localizable.strings b/Yep/en.lproj/Localizable.strings
index 247d482a..b540bd02 100644
--- a/Yep/en.lproj/Localizable.strings
+++ b/Yep/en.lproj/Localizable.strings
@@ -624,7 +624,7 @@
"Fetching" = "Fetching";
-"Do not do to others what you would not like to be done to you." = "Do not do to others what you would not like to be done to you.";
+"All conversations will show at here." = "All conversations will show at here.";
"No discovered users." = "No discovered users.";
diff --git a/Yep/zh-Hans.lproj/Localizable.strings b/Yep/zh-Hans.lproj/Localizable.strings
index 13765900..c04868bc 100644
--- a/Yep/zh-Hans.lproj/Localizable.strings
+++ b/Yep/zh-Hans.lproj/Localizable.strings
@@ -626,7 +626,7 @@
"Fetching" = "收取中…";
-"Do not do to others what you would not like to be done to you." = "己所不欲,勿施于人";
+"All conversations will show at here." = "所有对话都会显示在这里.";
"No discovered users." = "没有发现其他用户";