Skip to content

Commit 2e12998

Browse files
skysky
authored andcommitted
first commit
0 parents  commit 2e12998

File tree

243 files changed

+29770
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+29770
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
android/*.iml
3+
android/build
4+
android/.idea/
5+
.DS_Store
6+
.idea/

README.md

Whitespace-only changes.

Utils.js

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
'use strict'
2+
import { NativeModules,Platform, NetInfo } from 'react-native';
3+
4+
const { RNNeteaseIm,PinYin } = NativeModules;
5+
6+
class Utils {
7+
/**
8+
* 清除数据缓存
9+
*/
10+
cleanCache() {
11+
return RNNeteaseIm.cleanCache();
12+
}
13+
14+
/**
15+
* 获取缓存大小
16+
*/
17+
getCacheSize() {
18+
return RNNeteaseIm.getCacheSize();
19+
}
20+
21+
/**
22+
* 获取网络状态
23+
*/
24+
networkIsConnected() {//0:无网络,1:有网络
25+
if (Platform.OS === 'ios') {
26+
if (RNNeteaseIm.getNetWorkStatus() === '1') {
27+
return true;
28+
}
29+
return false;
30+
} else {
31+
return NetInfo.isConnected.fetch().done();
32+
}
33+
}
34+
35+
/** ******************************播放 ****************************************** **/
36+
37+
/**
38+
* 播放录音
39+
* @returns {*}
40+
*/
41+
play(filepath) {
42+
return RNNeteaseIm.play(filepath);
43+
}
44+
45+
/**
46+
* 播放本地资源音乐
47+
* name:iOS:文件名字,Android:文件路径
48+
* type:音乐类型,如:'mp3'
49+
* @returns {*}
50+
*/
51+
playLocacl(name, type) {
52+
if (Platform.OS === 'ios') {
53+
return RNNeteaseIm.playLocal(name, type);
54+
}
55+
return RNNeteaseIm.playLocal('assets:///' + name + '.' + type, type);
56+
}
57+
58+
/**
59+
* 停止播放录音
60+
* @returns {*}
61+
*/
62+
stopPlay() {
63+
return RNNeteaseIm.stopPlay();
64+
}
65+
66+
sortPinYin(o, key) {
67+
return PinYin.sortPinYin(o, key);
68+
}
69+
70+
71+
/**
72+
* 仅限Android
73+
* @returns {*}
74+
*/
75+
fetchNetInfo() {
76+
return RNNeteaseIm.fetchNetInfo();
77+
}
78+
79+
/**
80+
* 仅限IOS
81+
* 设置webview UA
82+
* @returns {*}
83+
*/
84+
setupWebViewUserAgent() {
85+
RNNeteaseIm.setupWebViewUserAgent();
86+
}
87+
88+
}
89+
90+
export default new Utils();

android/build.gradle

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apply plugin: 'com.android.library'
2+
3+
android {
4+
useLibrary 'org.apache.http.legacy'
5+
6+
compileSdkVersion 23
7+
buildToolsVersion "23.0.1"
8+
9+
defaultConfig {
10+
minSdkVersion 16
11+
targetSdkVersion 22
12+
versionCode 1
13+
versionName "1.0"
14+
}
15+
buildTypes {
16+
release {
17+
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
18+
}
19+
}
20+
sourceSets{
21+
main{
22+
jniLibs.srcDir(['libs'])
23+
}
24+
}
25+
lintOptions {
26+
abortOnError false
27+
}
28+
}
29+
30+
repositories {
31+
mavenCentral()
32+
}
33+
34+
dependencies {
35+
compile fileTree(include: '*.jar', dir: 'libs')
36+
compile 'com.facebook.react:react-native:+'
37+
}
38+
37.6 KB
Binary file not shown.
1.21 MB
Binary file not shown.
33.4 KB
Binary file not shown.
735 KB
Binary file not shown.

android/libs/cosinesdk.jar

65.2 KB
Binary file not shown.
255 KB
Binary file not shown.

0 commit comments

Comments
 (0)