Skip to content

Commit

Permalink
adjust remove imageUrl to mediaPath
Browse files Browse the repository at this point in the history
  • Loading branch information
huangminlinux committed Aug 28, 2018
1 parent 0ea3668 commit 75760e8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
17 changes: 7 additions & 10 deletions ReactNative/ios/RCTAuroraIMUI/MyMessageModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,17 @@ open class RCTMessageModel: IMUIMessageModel {
}

var mediaPath = messageDic.object(forKey: RCTMessageModel.kMsgKeyMediaFilePath) as? String
var imgUrl = ""
if let _ = mediaPath {

if FileManager.default.fileExists(atPath: mediaPath!) {
} else {
imgUrl = mediaPath!
mediaPath = ""
}
} else {
mediaPath = ""
}

var imgUrl = messageDic.object(forKey: RCTMessageModel.kMsgKeyImageUrl) as? String

if let _ = imgUrl {

} else {
imgUrl = ""
}

var text = messageDic.object(forKey: RCTMessageModel.kMsgKeyText) as? String
if let _ = text {

Expand Down Expand Up @@ -237,7 +234,7 @@ open class RCTMessageModel: IMUIMessageModel {

}

self.init(msgId: msgId, messageStatus: msgStatus, fromUser: user, isOutGoing: isOutgoing ?? true, time: timeString!, type: msgType!, text: text!, mediaPath: mediaPath!,imageUrl: imgUrl!, layout: messageLayout!,duration: durationTime, extras: extras)
self.init(msgId: msgId, messageStatus: msgStatus, fromUser: user, isOutGoing: isOutgoing ?? true, time: timeString!, type: msgType!, text: text!, mediaPath: mediaPath!,imageUrl: imgUrl, layout: messageLayout!,duration: durationTime, extras: extras)

}

Expand Down
10 changes: 8 additions & 2 deletions ReactNative/ios/RCTAuroraIMUI/MyUser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ open class RCTUser: NSObject, IMUIUserProtocol {
self.rUserId = userDic.object(forKey: "userId") as? String
self.rDisplayName = userDic.object(forKey: "displayName") as? String
self.rAvatarFilePath = userDic.object(forKey: "avatarPath") as? String
self.rAvatarFilePath = userDic.object(forKey: "avatarUrl") as? String
if FileManager.default.fileExists(atPath: self.rAvatarFilePath ?? "") {

} else {
self.rAvatarUrl = self.rAvatarFilePath
self.rAvatarFilePath = ""
}

}

public func userId() -> String {
Expand Down Expand Up @@ -53,6 +59,6 @@ open class RCTUser: NSObject, IMUIUserProtocol {
}

public func avatarUrlString() -> String? {
return self.rAvatarFilePath
return self.rAvatarUrl
}
}

0 comments on commit 75760e8

Please sign in to comment.