Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:jpush/imui into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
KenChoi authored and KenChoi committed Aug 2, 2017
2 parents 80dd00f + a54e9bf commit e70d6ad
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 95 deletions.
5 changes: 4 additions & 1 deletion ReactNative/ios/RCTAuroraIMUI/MyMessageModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,14 @@ open class RCTMessageModel: IMUIMessageModel {
let statusString = messageDic.object(forKey: RCTMessageModel.kMsgKeyStatus) as? String
let isOutgoing = messageDic.object(forKey: RCTMessageModel.kMsgKeyisOutgoing) as? Bool

let timeString = messageDic.object(forKey: RCTMessageModel.ktimeString) as? String
var timeString = messageDic.object(forKey: RCTMessageModel.ktimeString) as? String
var needShowTime = false
if let timeString = timeString {
if timeString != "" {
needShowTime = true
}
} else {
timeString = ""
}

var mediaPath = messageDic.object(forKey: RCTMessageModel.kMsgKeyMediaFilePath) as? String
Expand Down Expand Up @@ -245,6 +247,7 @@ open class RCTMessageModel: IMUIMessageModel {

messageDic.setValue(userDic, forKey: "fromUser")
messageDic.setValue(self.msgId, forKey: "msgId")
messageDic.setValue(self.timeString, forKey: "timeString")
return messageDic
}
}
Expand Down
12 changes: 11 additions & 1 deletion ReactNative/ios/RCTAuroraIMUI/MyUser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ open class RCTUser: NSObject, IMUIUserProtocol {
}

public func Avatar() -> UIImage {
return UIImage(named: "defoult_header")!
if let path = self.rAvatarFilePath {
let url = NSURL(fileURLWithPath: path)
let fileManager = FileManager.default
if fileManager.fileExists(atPath: path) {
return UIImage(contentsOfFile: path)!
} else {
return UIImage(named: "defoult_header")!
}
} else {
return UIImage(named: "defoult_header")!
}
}
}
1 change: 0 additions & 1 deletion ReactNative/messagelist.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export default class MessageList extends Component {
}

_onPullToRefresh(event: Event) {
console.log("huangmin888")
if (!this.props.onPullToRefresh) {
return;
}
Expand Down
5 changes: 4 additions & 1 deletion ReactNative/sample/index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from 'react-native';

var ReactNative = require('react-native');
const AuroraIController = NativeModules.RNTAuroraIController;
const AuroraIController = NativeModules.AuroraIMUIModule;
import IMUI from 'aurora-imui-react-native'
var InputView = IMUI.ChatInput;
var MessageListView = IMUI.MessageList;
Expand Down Expand Up @@ -67,6 +67,8 @@ export default class TestRNIMUI extends Component {

onStatusViewClick = (message) => {
console.log(message)
message.status = 'send_succeed'
AuroraIController.updateMessage(message)
}

onBeginDragMessageList = () => {
Expand All @@ -84,6 +86,7 @@ export default class TestRNIMUI extends Component {

message.msgType = "text"
message.text = text
message.timeString = 'fsdafafaf'

AuroraIController.appendMessages([message])
AuroraIController.scrollToBottom(true)
Expand Down
176 changes: 91 additions & 85 deletions ReactNative/sample/ios/TestRNIMUI.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
Expand Down
15 changes: 11 additions & 4 deletions iOS/IMUIInputView/Controllers/IMUIRecordVoiceHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,17 @@ class IMUIRecordVoiceHelper: NSObject {
print(error.localizedDescription)
}

let recordSettings:[String : AnyObject] = [
AVFormatIDKey: NSNumber(value: kAudioFormatAppleIMA4 as UInt32),
AVNumberOfChannelsKey: 1 as AnyObject,
AVSampleRateKey : 16000.0 as AnyObject
// let recordSettings:[String : AnyObject] = [
// AVFormatIDKey: NSNumber(value: kAudioFormatAppleIMA4 as UInt32),
// AVNumberOfChannelsKey: 1 as AnyObject,
// AVSampleRateKey : 16000.0 as AnyObject
// ]

let recordSettings = [
AVFormatIDKey: Int(kAudioFormatMPEG4AAC),
AVSampleRateKey: 16000,
AVNumberOfChannelsKey: 1,
AVEncoderAudioQualityKey: AVAudioQuality.high.rawValue
]

do {
Expand Down
3 changes: 2 additions & 1 deletion iOS/IMUIInputView/Views/IMUIRecordVoiceCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ class IMUIRecordVoiceCell: UICollectionViewCell, IMUIFeatureCellProtocal {
recorderPath = "\(NSHomeDirectory())/Documents/"

dateFormatter.dateFormat = "yyyy-MM-dd-hh-mm-ss"
recorderPath?.append("\(dateFormatter.string(from: now))-MySound.ilbc")
recorderPath?.append("\(dateFormatter.string(from: now))-MySound.m4a")
print("\(recorderPath)")
return recorderPath!
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurora-imui-react-native",
"version": "0.4.3",
"version": "0.4.5",
"description": "aurora imui plugin for react native application",
"main": "index.js",

Expand Down

0 comments on commit e70d6ad

Please sign in to comment.