Skip to content

Commit a87d9f7

Browse files
guangyaoguangyao
authored andcommitted
修改录音长度
1 parent 8615656 commit a87d9f7

File tree

5 files changed

+122
-37
lines changed

5 files changed

+122
-37
lines changed

ios/RCTAuroraIMUI.xcodeproj/project.pbxproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
4E49AE2D1F3476E500B50439 /* NIMInputEmoticonDefine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E49AE2C1F3476E500B50439 /* NIMInputEmoticonDefine.h */; settings = {ATTRIBUTES = (Public, ); }; };
9797
4E49AE301F3476F800B50439 /* NSString+NIMKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E49AE2E1F3476F800B50439 /* NSString+NIMKit.h */; };
9898
4E49AE311F3476F800B50439 /* NSString+NIMKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E49AE2F1F3476F800B50439 /* NSString+NIMKit.m */; };
99+
4E4A6D8F1FCC04C9004A169E /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E4A6D901FCC04C9004A169E /* libRCTWebSocket.a */; };
99100
4E4EB3A01F5112F6009A5AF8 /* IMUIBaseMessageHeadCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E4EB39F1F5112F6009A5AF8 /* IMUIBaseMessageHeadCell.swift */; };
100101
4E5274CE1F3C0925005FB9B9 /* IMUILocationMessageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E5274CD1F3C0925005FB9B9 /* IMUILocationMessageCell.swift */; };
101102
4E5274D21F3C5CE2005FB9B9 /* IMUIRedPacketMessageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E5274D11F3C5CE2005FB9B9 /* IMUIRedPacketMessageCell.swift */; };
@@ -277,6 +278,8 @@
277278
4E49AE2C1F3476E500B50439 /* NIMInputEmoticonDefine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NIMInputEmoticonDefine.h; sourceTree = "<group>"; };
278279
4E49AE2E1F3476F800B50439 /* NSString+NIMKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+NIMKit.h"; sourceTree = "<group>"; };
279280
4E49AE2F1F3476F800B50439 /* NSString+NIMKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+NIMKit.m"; sourceTree = "<group>"; };
281+
4E4A6D8E1FCC04B3004A169E /* libRCTWebSocket.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libRCTWebSocket.a; sourceTree = BUILT_PRODUCTS_DIR; };
282+
4E4A6D901FCC04C9004A169E /* libRCTWebSocket.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libRCTWebSocket.a; sourceTree = BUILT_PRODUCTS_DIR; };
280283
4E4EB39F1F5112F6009A5AF8 /* IMUIBaseMessageHeadCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IMUIBaseMessageHeadCell.swift; sourceTree = "<group>"; };
281284
4E5274CD1F3C0925005FB9B9 /* IMUILocationMessageCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IMUILocationMessageCell.swift; sourceTree = "<group>"; };
282285
4E5274D11F3C5CE2005FB9B9 /* IMUIRedPacketMessageCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IMUIRedPacketMessageCell.swift; sourceTree = "<group>"; };
@@ -354,6 +357,7 @@
354357
isa = PBXFrameworksBuildPhase;
355358
buildActionMask = 2147483647;
356359
files = (
360+
4E4A6D8F1FCC04C9004A169E /* libRCTWebSocket.a in Frameworks */,
357361
);
358362
runOnlyForDeploymentPostprocessing = 0;
359363
};
@@ -535,6 +539,15 @@
535539
path = DWEmoticonView;
536540
sourceTree = "<group>";
537541
};
542+
4E4A6D8C1FCC04B3004A169E /* Frameworks */ = {
543+
isa = PBXGroup;
544+
children = (
545+
4E4A6D901FCC04C9004A169E /* libRCTWebSocket.a */,
546+
4E4A6D8E1FCC04B3004A169E /* libRCTWebSocket.a */,
547+
);
548+
name = Frameworks;
549+
sourceTree = "<group>";
550+
};
538551
4E77A3661F30840000098CAF /* IMUICommon */ = {
539552
isa = PBXGroup;
540553
children = (
@@ -716,6 +729,7 @@
716729
623EA96F1EE55CB200EC43AE /* RCTAuroraIMUI */,
717730
623EA9A51EE55D0800EC43AE /* RCTAuroraIMUITests */,
718731
626021F81ED96BA20038AB20 /* Products */,
732+
4E4A6D8C1FCC04B3004A169E /* Frameworks */,
719733
);
720734
sourceTree = "<group>";
721735
};

ios/RCTAuroraIMUI.xcodeproj/xcuserdata/dowin.xcuserdatad/xcschemes/xcschememanagement.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
<key>AuroraIMUI.xcscheme</key>
88
<dict>
99
<key>orderHint</key>
10-
<integer>25</integer>
10+
<integer>10</integer>
1111
</dict>
1212
<key>RCTAuroraIMUI.xcscheme</key>
1313
<dict>
1414
<key>orderHint</key>
15-
<integer>26</integer>
15+
<integer>11</integer>
1616
</dict>
1717
</dict>
1818
<key>SuppressBuildableAutocreation</key>

ios/RCTAuroraIMUI/IMUIMessageCollectionView/Models/IMUIMessageModel.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,15 @@ open class IMUIMessageModel: NSObject, IMUIMessageModelProtocol {
147147
// }
148148
break
149149
case .voice:
150-
bubbleContentSize = CGSize(width: 80, height: 40)
150+
let strDuration:NSString = self.customDict.object(forKey: "duration") as! NSString
151+
var widthF :CGFloat = 0
152+
if strDuration.floatValue > 10 {
153+
widthF = 40 + 10*8 + CGFloat(strDuration.floatValue - 10) * (screenW / 240)
154+
}else{
155+
widthF = 40 + CGFloat(strDuration.floatValue * 8)
156+
}
157+
158+
bubbleContentSize = CGSize(width: widthF, height: 40)
151159
break
152160
case .video:
153161
bubbleContentSize = CGSize(width: 120, height: 160)

ios/RCTAuroraIMUI/RCTMessageListView.m

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -367,28 +367,29 @@ - (void)clickLongTouchShowMenu:(NSNotification *)noti{
367367

368368

369369
- (void)clickShowOrigImgView:(NSNotification *)noti{
370-
NSString *strMsgID = noti.object;
371-
UIView *topView = [[[[UIApplication sharedApplication] keyWindow] subviews] lastObject];
372-
if ([topView isKindOfClass:[DWRecoderCoveView class]]) {
373-
NSInteger count = [[UIApplication sharedApplication] keyWindow].subviews.count;
374-
topView = [[UIApplication sharedApplication] keyWindow].subviews[count - 2];
375-
}
376-
BOOL isEdit = (self.height >= screenH*0.7) ? NO : YES;
377-
NSMutableArray *rectArr = [NSMutableArray array];
378-
for (UIView *tmpView in self.messageList.messageCollectionView.subviews) {
379-
if ([tmpView isKindOfClass:[IMUIBaseMessageCell class]] ) {
380-
IMUIBaseMessageCell *cell = (IMUIBaseMessageCell *)tmpView;
381-
if ([cell.cellType isEqualToString:@"image"]) {
382-
CGPoint imgPoint = [topView convertPoint:CGPointMake(0, 0) fromView:cell.bubbleView];
383-
CGSize imgSize = cell.bubbleView.frame.size;
384-
NSMutableDictionary *rectDict = [NSMutableDictionary dictionary];
385-
[rectDict setObject:cell.cellMsgId forKey:@"msgId"];
386-
[rectDict setObject:NSStringFromCGRect(CGRectMake(imgPoint.x, imgPoint.y, imgSize.width, imgSize.height)) forKey:@"rect"];
387-
[rectArr addObject:rectDict];
370+
dispatch_async(dispatch_get_main_queue(), ^{
371+
NSString *strMsgID = noti.object;
372+
UIView *topView = [[[[UIApplication sharedApplication] keyWindow] subviews] lastObject];
373+
if ([topView isKindOfClass:[DWRecoderCoveView class]]) {
374+
NSInteger count = [[UIApplication sharedApplication] keyWindow].subviews.count;
375+
topView = [[UIApplication sharedApplication] keyWindow].subviews[count - 2];
376+
}
377+
BOOL isEdit = (self.height >= screenH*0.7) ? NO : YES;
378+
NSMutableArray *rectArr = [NSMutableArray array];
379+
for (UIView *tmpView in self.messageList.messageCollectionView.subviews) {
380+
if ([tmpView isKindOfClass:[IMUIBaseMessageCell class]] ) {
381+
IMUIBaseMessageCell *cell = (IMUIBaseMessageCell *)tmpView;
382+
if ([cell.cellType isEqualToString:@"image"]) {
383+
CGPoint imgPoint = [topView convertPoint:CGPointMake(0, 0) fromView:cell.bubbleView];
384+
CGSize imgSize = cell.bubbleView.frame.size;
385+
NSMutableDictionary *rectDict = [NSMutableDictionary dictionary];
386+
[rectDict setObject:cell.cellMsgId forKey:@"msgId"];
387+
[rectDict setObject:NSStringFromCGRect(CGRectMake(imgPoint.x, imgPoint.y, imgSize.width, imgSize.height)) forKey:@"rect"];
388+
[rectArr addObject:rectDict];
389+
}
388390
}
389391
}
390-
}
391-
dispatch_async(dispatch_get_main_queue(), ^{
392+
392393
if (_imageArr.count) {
393394
NSInteger index = 0;
394395
NSInteger imgIndex = 0;
@@ -414,7 +415,6 @@ - (void)clickShowOrigImgView:(NSNotification *)noti{
414415
DWShowImageVC *vc = [[DWShowImageVC alloc]init];
415416
vc.modalPresentationStyle = UIModalPresentationOverCurrentContext;
416417
vc.imageArr = _imageArr;
417-
// vc.backgroundImg = [self getScreenshots];
418418
vc.index = imgIndex;
419419
[rootVC presentViewController:vc animated:NO completion:nil];
420420
}

package.json

Lines changed: 76 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,85 @@
1-
21
{
3-
"name": "react-native-imui",
4-
"version": "1.0.3",
5-
"description": "react-native im ui",
6-
"main": "index.js",
7-
"scripts": {
8-
"test": "echo \"Error: no test specified\" && exit 1"
2+
"_args": [
3+
[
4+
{
5+
"raw": "react-native-imui@git+https://github.com/reactnativecomponent/react-native-imui.git",
6+
"scope": null,
7+
"escapedName": "react-native-imui",
8+
"name": "react-native-imui",
9+
"rawSpec": "git+https://github.com/reactnativecomponent/react-native-imui.git",
10+
"spec": "git+https://github.com/reactnativecomponent/react-native-imui.git",
11+
"type": "hosted",
12+
"hosted": {
13+
"type": "github",
14+
"ssh": "[email protected]:reactnativecomponent/react-native-imui.git",
15+
"sshUrl": "git+ssh://[email protected]/reactnativecomponent/react-native-imui.git",
16+
"httpsUrl": "git+https://github.com/reactnativecomponent/react-native-imui.git",
17+
"gitUrl": "git://github.com/reactnativecomponent/react-native-imui.git",
18+
"shortcut": "github:reactnativecomponent/react-native-imui",
19+
"directUrl": "https://raw.githubusercontent.com/reactnativecomponent/react-native-imui/master/package.json"
20+
}
21+
},
22+
"/Users/dowin/KinoooProject/CompanyApp/react-native-wallet"
23+
]
24+
],
25+
"_from": "git+https://github.com/reactnativecomponent/react-native-imui.git",
26+
27+
"_inCache": true,
28+
"_location": "/react-native-imui",
29+
"_phantomChildren": {},
30+
"_requested": {
31+
"raw": "react-native-imui@git+https://github.com/reactnativecomponent/react-native-imui.git",
32+
"scope": null,
33+
"escapedName": "react-native-imui",
34+
"name": "react-native-imui",
35+
"rawSpec": "git+https://github.com/reactnativecomponent/react-native-imui.git",
36+
"spec": "git+https://github.com/reactnativecomponent/react-native-imui.git",
37+
"type": "hosted",
38+
"hosted": {
39+
"type": "github",
40+
"ssh": "[email protected]:reactnativecomponent/react-native-imui.git",
41+
"sshUrl": "git+ssh://[email protected]/reactnativecomponent/react-native-imui.git",
42+
"httpsUrl": "git+https://github.com/reactnativecomponent/react-native-imui.git",
43+
"gitUrl": "git://github.com/reactnativecomponent/react-native-imui.git",
44+
"shortcut": "github:reactnativecomponent/react-native-imui",
45+
"directUrl": "https://raw.githubusercontent.com/reactnativecomponent/react-native-imui/master/package.json"
46+
}
947
},
48+
"_requiredBy": [
49+
"/"
50+
],
51+
"_resolved": "git+https://github.com/reactnativecomponent/react-native-imui.git#8615656d916352a430e4a6312b4357ac5d6b04f6",
52+
"_shasum": "335e972a8a57c354ee30da9d8466d91d7e4a12aa",
53+
"_shrinkwrap": null,
54+
"_spec": "react-native-imui@git+https://github.com/reactnativecomponent/react-native-imui.git",
55+
"_where": "/Users/dowin/KinoooProject/CompanyApp/react-native-wallet",
56+
"author": "",
57+
"bugs": {
58+
"url": "https://github.com/reactnativecomponent/react-native-imui/issues"
59+
},
60+
"dependencies": {},
61+
"description": "react-native im ui",
62+
"devDependencies": {},
63+
"gitHead": "8615656d916352a430e4a6312b4357ac5d6b04f6",
64+
"homepage": "https://github.com/reactnativecomponent/react-native-imui#readme",
1065
"keywords": [
1166
"react-native"
1267
],
13-
"repository" :
14-
{ "type" : "git",
15-
"url" : "https://github.com/reactnativecomponent/react-native-imui.git"
16-
},
17-
"author": "",
1868
"license": "",
69+
"main": "index.js",
70+
"name": "react-native-imui",
71+
"optionalDependencies": {},
1972
"peerDependencies": {
2073
"react-native": ">=0.47.0"
21-
}
74+
},
75+
"readme": "# ReactNative IMUI\n项目fork自 jpush 的 [Aurora IMUI](https://github.com/jpush/aurora-imui/tree/master/ReactNative)\n\n## 使用\n参考[demo](https://github.com/reactnativecomponent/react-native-chat-demo)\n## 安装\n\n```\nnpm install react-native-imui --save\n```\n `settings.gradle` 中的引用路径:\n```\ninclude ':app', ':react-native-imui'\nproject(':react-native-imui').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-imui/android')\ninclude ':react-native-imui:chatinput'\ninclude ':react-native-imui:messagelist'\ninclude ':react-native-imui:popuptool'\ninclude ':react-native-imui:emoji'\ninclude ':react-native-imui:photoViewPagerview'\ninclude ':react-native-imui:photoViewPagerview:photodraweeview'\n```\n\n然后在 app 的 `build.gradle`中引用:\n\n```\ndependencies {\n compile project(':react-native-imui')\n}\n```\n\n**注意事项(Android):我们使用了 support v4, v7 25.3.1 版本,因此需要将你的 build.gradle 中 buildToolsVersion 及 compiledSdkVersion 改为 25 以上。可以参考 demo 的配置。**\n\n## 配置\n\n- ### Android\n\n - 引入 Package:\n\n > MainApplication.java\n\n ```\n import cn.jiguang.imui.messagelist.ReactIMUIPackage;\n ...\n\n @Override\n protected List<ReactPackage> getPackages() {\n return Arrays.<ReactPackage>asList(\n new MainReactPackage(),\n new ReactIMUIPackage()\n );\n }\n ```\n\n\n\n- ### iOS\n - Find PROJECT -> TARGETS -> General -> Embedded Binaries and add RCTAuroraIMUI.framework\n  - 把 `iOSResourcePacket` 目录`NIMKitEmoticon.bundle`拖到Xcode`Resources`目录下\n - 把 `iOSResourcePacket` 目录`IMGS`拖到Xcode`Images.xcassets`下\n\n## 数据格式\n\n使用 MessageList,你需要定义 `message` 对象和 `fromUser` 对象。\n\n- `message` 对象格式:\n\n**status 必须为以下四个值之一: \"send_succeed\", \"send_failed\", \"send_going\", \"download_failed\",如果没有定义这个属性, 默认值是 \"send_succeed\".**\n\n ```\n message = { // text message\n msgId: \"msgid\",\n status: \"send_going\",\n msgType: \"text\",\n isOutgoing: true,\n text: \"text\"\n fromUser: {}\n}\n\nmessage = { // image message\n msgId: \"msgid\",\n msgType: \"image\",\n isOutGoing: true,\n progress: \"progress string\"\n mediaPath: \"image path\"\n fromUser: {}\n}\n\n\nmessage = { // voice message\n msgId: \"msgid\",\n msgType: \"voice\",\n isOutGoing: true,\n duration: number, // 注意这个值有用户自己设置时长,单位秒\n mediaPath: \"voice path\"\n fromUser: {}\n}\n\nmessage = { // video message\n msgId: \"msgid\",\n status: \"send_failed\",\n msgType: \"video\",\n isOutGoing: true,\n druation: number\n mediaPath: \"voice path\"\n fromUser: {}\n}\n\nmessage = { // event message\n msgId: \"msgid\",\n msgType: \"event\",\n text: \"the event text\"\n}\n ```\n\n- `fromUser` 对象格式:\n\n ```\n fromUser = {\n userId: \"\"\n displayName: \"\"\n avatarPath: \"avatar image path\"\n }\n ```\n\n",
76+
"readmeFilename": "README.md",
77+
"repository": {
78+
"type": "git",
79+
"url": "git+https://github.com/reactnativecomponent/react-native-imui.git"
80+
},
81+
"scripts": {
82+
"test": "echo \"Error: no test specified\" && exit 1"
83+
},
84+
"version": "1.0.3"
2285
}

0 commit comments

Comments
 (0)