rename messagesCount of Feed

This commit is contained in:
nixzhu
2015-11-11 17:15:49 +08:00
parent c3169b683b
commit 021663e170
5 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let directory: NSURL = NSFileManager.defaultManager().containerURLForSecurityApplicationGroupIdentifier(YepConfig.appGroupID)!
let realmPath = directory.URLByAppendingPathComponent("db.realm").path!
return Realm.Configuration(path: realmPath, schemaVersion: 5, migrationBlock: { migration, oldSchemaVersion in
return Realm.Configuration(path: realmPath, schemaVersion: 6, migrationBlock: { migration, oldSchemaVersion in
})
}
+2 -2
View File
@@ -504,7 +504,7 @@ class Feed: Object {
dynamic var creator: User?
dynamic var distance: Double = 0
dynamic var messageCount: Int = 0
dynamic var messagesCount: Int = 0
dynamic var body: String = ""
var attachments = List<Attachment>()
@@ -681,7 +681,7 @@ func saveFeedWithFeedDataWithFullGroup(feedData: DiscoveredFeed, group: Group, i
newFeed.distance = distance
}
newFeed.messageCount = feedData.messageCount
newFeed.messagesCount = feedData.messagesCount
if let feedSkill = feedData.skill {
let _ = try? realm.write {
+3 -3
View File
@@ -2504,7 +2504,7 @@ struct DiscoveredFeed: Hashable {
let skill: Skill?
let groupID: String
var messageCount: Int
var messagesCount: Int
static func fromJSONDictionary(json: JSONDictionary) -> DiscoveredFeed? {
@@ -2518,7 +2518,7 @@ struct DiscoveredFeed: Hashable {
attachmentsData = json["attachments"] as? [JSONDictionary],
//skill // TODO: skill
groupInfo = json["circle"] as? JSONDictionary,
messageCount = json["message_count"] as? Int else {
messagesCount = json["message_count"] as? Int else {
return nil
}
@@ -2535,7 +2535,7 @@ struct DiscoveredFeed: Hashable {
skill = Skill.fromJSONDictionary(skillInfo)
}
return DiscoveredFeed(id: id, allowComment: allowComment, createdUnixTime: createdUnixTime, updatedUnixTime: updatedUnixTime, creator: creator, body: body, attachments: attachments, distance: distance, skill: skill, groupID: groupID, messageCount: messageCount)
return DiscoveredFeed(id: id, allowComment: allowComment, createdUnixTime: createdUnixTime, updatedUnixTime: updatedUnixTime, creator: creator, body: body, attachments: attachments, distance: distance, skill: skill, groupID: groupID, messagesCount: messagesCount)
}
}
@@ -473,7 +473,7 @@ class FeedsViewController: BaseViewController {
guard var updatedFeed = self?.feeds[safe: index] else {
return
}
updatedFeed.messageCount += newMessagesCount
updatedFeed.messagesCount += newMessagesCount
self?.feeds.removeAtIndex(index)
self?.feeds.insert(updatedFeed, atIndex: index)
+1 -1
View File
@@ -216,7 +216,7 @@ class FeedCell: UITableViewCell {
}
timeLabel.text = "\(NSDate(timeIntervalSince1970: feed.createdUnixTime).timeAgo)"
messageCountLabel.text = "\(feed.messageCount)"
messageCountLabel.text = "\(feed.messagesCount)"
}
}