|
2 | 2 |
|
3 | 3 | import android.os.Environment; |
4 | 4 | import android.text.TextUtils; |
5 | | -import android.util.Log; |
6 | 5 |
|
7 | 6 | /** |
8 | 7 | * Created by heavyrain lee on 2017/11/24. |
9 | 8 | */ |
10 | 9 |
|
11 | | -public interface Config { |
| 10 | +public class Config { |
12 | 11 |
|
13 | 12 | // 仅仅是host,没有http开头,不可配置为127.0.0.1 或者 192.168.0.1 |
14 | 13 | // 可以是IP,可以是域名,如果是域名的话只支持主域名或www域名或im的二级域名,其它二级域名不支持!建议使用域名。 |
15 | 14 | // 例如:example.com或www.example.com或im.example.com是支持的;xx.example.com或xx.yy.example.com是不支持的。 |
16 | | - String IM_SERVER_HOST = "wildfirechat.cn"; |
| 15 | + public static String IM_SERVER_HOST = "wildfirechat.cn"; |
17 | 16 |
|
18 | 17 | // App Server默认使用的是8888端口,替换为自己部署的服务时需要注意端口别填错了 |
19 | 18 | // 正式商用时,建议用https,确保token安全 |
20 | | - String APP_SERVER_ADDRESS = "http://wildfirechat.cn:8888"; |
| 19 | + public static String APP_SERVER_ADDRESS = "http://wildfirechat.cn:8888"; |
21 | 20 |
|
22 | | - String ICE_ADDRESS = "turn:turn.wildfirechat.cn:3478"; |
23 | | - String ICE_ADDRESS2 = "turn:117.51.153.82:3478"; |
24 | | - String ICE_USERNAME = "wfchat"; |
25 | | - String ICE_PASSWORD = "wfchat"; |
| 21 | + public static String ICE_ADDRESS = "turn:turn.wildfirechat.cn:3478"; |
| 22 | + public static String ICE_ADDRESS2 = "turn:117.51.153.82:3478"; |
| 23 | + public static String ICE_USERNAME = "wfchat"; |
| 24 | + public static String ICE_PASSWORD = "wfchat"; |
26 | 25 |
|
27 | | - // 一定记得替换为你们自己的,ID请从BUGLY官网申请。关于BUGLY,可以从BUGLY官网了解,或者百度。 |
28 | | - String BUGLY_ID = "34490ba79f"; |
29 | | - |
30 | | - int DEFAULT_MAX_AUDIO_RECORD_TIME_SECOND = 120; |
| 26 | + public static int DEFAULT_MAX_AUDIO_RECORD_TIME_SECOND = 120; |
31 | 27 |
|
32 | 28 | // 支持多人音视频时有效 |
33 | | - int MAX_VIDEO_PARTICIPANT_COUNT = 4; |
34 | | - int MAX_AUDIO_PARTICIPANT_COUNT = 9; |
| 29 | + public static int MAX_VIDEO_PARTICIPANT_COUNT = 4; |
| 30 | + public static int MAX_AUDIO_PARTICIPANT_COUNT = 9; |
35 | 31 |
|
36 | | - String VIDEO_SAVE_DIR = Environment.getExternalStorageDirectory().getPath() + "/wfc/video"; |
37 | | - String AUDIO_SAVE_DIR = Environment.getExternalStorageDirectory().getPath() + "/wfc/audio"; |
38 | | - String PHOTO_SAVE_DIR = Environment.getExternalStorageDirectory().getPath() + "/wfc/photo"; |
39 | | - String FILE_SAVE_DIR = Environment.getExternalStorageDirectory().getPath() + "/wfc/file"; |
| 32 | + public static String VIDEO_SAVE_DIR = Environment.getExternalStorageDirectory().getPath() + "/wfc/video"; |
| 33 | + public static String AUDIO_SAVE_DIR = Environment.getExternalStorageDirectory().getPath() + "/wfc/audio"; |
| 34 | + public static String PHOTO_SAVE_DIR = Environment.getExternalStorageDirectory().getPath() + "/wfc/photo"; |
| 35 | + public static String FILE_SAVE_DIR = Environment.getExternalStorageDirectory().getPath() + "/wfc/file"; |
40 | 36 |
|
41 | | - static void validateConfig() { |
| 37 | + public static void validateConfig() { |
42 | 38 | if (TextUtils.isEmpty(IM_SERVER_HOST) |
43 | | - || IM_SERVER_HOST.startsWith("http") |
44 | | - || TextUtils.isEmpty(APP_SERVER_ADDRESS) |
45 | | - || (!APP_SERVER_ADDRESS.startsWith("http") && !APP_SERVER_ADDRESS.startsWith("https")) |
46 | | - || IM_SERVER_HOST.equals("127.0.0.1") |
47 | | - || APP_SERVER_ADDRESS.contains("127.0.0.1") |
| 39 | + || IM_SERVER_HOST.startsWith("http") |
| 40 | + || TextUtils.isEmpty(APP_SERVER_ADDRESS) |
| 41 | + || (!APP_SERVER_ADDRESS.startsWith("http") && !APP_SERVER_ADDRESS.startsWith("https")) |
| 42 | + || IM_SERVER_HOST.equals("127.0.0.1") |
| 43 | + || APP_SERVER_ADDRESS.contains("127.0.0.1") |
48 | 44 | ) { |
49 | 45 | throw new IllegalStateException("im server host config error"); |
50 | 46 | } |
51 | 47 |
|
52 | | - if (!IM_SERVER_HOST.equals("wildfirechat.cn")) { |
53 | | - if ("34490ba79f".equals(BUGLY_ID)) { |
54 | | - Log.e("wfc config", "二次开发一定需要将buglyId替换为自己的!!!!1"); |
55 | | - } |
56 | | - } |
57 | 48 | } |
58 | 49 | } |
0 commit comments