├── .DS_Store
├── .github
└── ISSUE_TEMPLATE
│ └── ------.md
├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── android
├── .classpath
├── .gitignore
├── .project
├── build.gradle
├── gradle.properties
├── settings.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── io
│ │ └── rong
│ │ └── flutter
│ │ └── imlib
│ │ ├── MessageFactory.java
│ │ ├── RCFlutterConfig.java
│ │ ├── RCIMFlutterWrapper.java
│ │ ├── RCListenerImpl.java
│ │ ├── RCLog.java
│ │ ├── RCMessageHandler.java
│ │ ├── RCMethodList.java
│ │ ├── ResultRecord.java
│ │ ├── RongcloudImPlugin.java
│ │ ├── Version.java
│ │ └── forward
│ │ └── CombineMessage.java
│ └── res
│ ├── layout
│ ├── conversation.xml
│ ├── conversationlist.xml
│ └── main.xml
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
├── example
├── .gitignore
├── .metadata
├── README.md
├── android
│ ├── .project
│ ├── .settings
│ │ └── org.eclipse.buildship.core.prefs
│ ├── app
│ │ ├── .classpath
│ │ ├── .project
│ │ ├── .settings
│ │ │ └── org.eclipse.buildship.core.prefs
│ │ ├── agconnect-services.json
│ │ ├── build.gradle
│ │ ├── google-services.json
│ │ ├── lib
│ │ │ ├── MiPush_SDK_Client_3_8_2.jar
│ │ │ ├── com.heytap.msp-push-2.1.0.aar
│ │ │ ├── meizu-push-4.0.7.aar
│ │ │ └── vivo_pushsdk-v2.9.0.0.aar
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ └── rongcloud_im_plugin_example
│ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ ├── TestMessage.java
│ │ │ │ │ ├── message
│ │ │ │ │ ├── LocationMessage.java
│ │ │ │ │ └── LocationMessageHandler.java
│ │ │ │ │ └── push
│ │ │ │ │ └── SealNotificationReceiver.java
│ │ │ └── res
│ │ │ │ ├── drawable
│ │ │ │ ├── app_icon.png
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ └── values
│ │ │ │ └── styles.xml
│ │ │ └── profile
│ │ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ ├── rong_flutter.key
│ └── settings.gradle
├── assets
│ ├── RCFlutterConf.json
│ ├── combine.json
│ └── images
│ │ ├── burnPicture.png
│ │ ├── burnPictureForm.png
│ │ ├── default_portrait.png
│ │ ├── file_message_icon_apk.png
│ │ ├── file_message_icon_audio.png
│ │ ├── file_message_icon_else.png
│ │ ├── file_message_icon_excel.png
│ │ ├── file_message_icon_file.png
│ │ ├── file_message_icon_key.png
│ │ ├── file_message_icon_numbers.png
│ │ ├── file_message_icon_pages.png
│ │ ├── file_message_icon_pdf.png
│ │ ├── file_message_icon_picture.png
│ │ ├── file_message_icon_ppt.png
│ │ ├── file_message_icon_video.png
│ │ ├── file_message_icon_word.png
│ │ ├── logo.png
│ │ ├── rc_ic_warning.png
│ │ ├── rich_content_msg_default.png
│ │ ├── sight_camera_switch.png
│ │ ├── sight_message_icon.png
│ │ ├── sight_preview_cancel.png
│ │ ├── sight_preview_done.png
│ │ ├── sight_top_toolbar_close.png
│ │ ├── voice_icon.png
│ │ ├── voice_icon_reverse.png
│ │ └── voice_recoder.gif
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── .last_build_id
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ ├── Flutter.podspec
│ │ ├── Release.xcconfig
│ │ └── flutter_export_environment.sh
│ ├── Podfile
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ └── Runner
│ │ ├── AppDelegate.h
│ │ ├── AppDelegate.m
│ │ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ ├── RCDLocationMessage.h
│ │ ├── RCDLocationMessage.m
│ │ ├── RCDTestMessage.h
│ │ ├── RCDTestMessage.m
│ │ ├── Runner.entitlements
│ │ └── main.m
├── lib
│ ├── im
│ │ ├── pages
│ │ │ ├── conversation_list_page.dart
│ │ │ ├── conversation_page.dart
│ │ │ ├── file_preview_page.dart
│ │ │ ├── image_preview_page.dart
│ │ │ ├── item
│ │ │ │ ├── bottom_input_bar.dart
│ │ │ │ ├── bottom_tool_bar.dart
│ │ │ │ ├── conversation_item.dart
│ │ │ │ ├── conversation_list_item.dart
│ │ │ │ ├── message_content_list.dart
│ │ │ │ ├── message_item_factory.dart
│ │ │ │ └── widget_util.dart
│ │ │ ├── sight
│ │ │ │ ├── record_bottom_item.dart
│ │ │ │ ├── record_top_item.dart
│ │ │ │ ├── video_play_page.dart
│ │ │ │ └── video_record_page.dart
│ │ │ └── webview_page.dart
│ │ ├── util
│ │ │ ├── bloc
│ │ │ │ ├── bloc_provider.dart
│ │ │ │ └── message_bloc.dart
│ │ │ ├── code_util.dart
│ │ │ ├── combine_message_util.dart
│ │ │ ├── db_manager.dart
│ │ │ ├── dialog_util.dart
│ │ │ ├── event_bus.dart
│ │ │ ├── file.dart
│ │ │ ├── file_suffix.dart
│ │ │ ├── http_util.dart
│ │ │ ├── media_util.dart
│ │ │ ├── style.dart
│ │ │ ├── time.dart
│ │ │ └── user_info_datesource.dart
│ │ └── widget
│ │ │ └── cachImage
│ │ │ ├── cached_image_widget.dart
│ │ │ └── cached_network_image_provider.dart
│ ├── location_message.dart
│ ├── main.dart
│ ├── other
│ │ ├── chat_debug_page.dart
│ │ ├── chatroom_debug_page.dart
│ │ ├── contacts_page.dart
│ │ ├── debug_page.dart
│ │ ├── home_page.dart
│ │ ├── login_page.dart
│ │ ├── message_read_page.dart
│ │ ├── search_message_page.dart
│ │ └── select_conversation_page.dart
│ ├── router.dart
│ ├── test_message.dart
│ └── user_data.dart
├── pubspec.lock
├── pubspec.yaml
└── test
│ └── widget_test.dart
├── ios
├── .gitignore
├── Assets
│ └── .gitkeep
├── Classes
│ ├── RCFlutterConfig.h
│ ├── RCFlutterConfig.m
│ ├── RCFlutterMessageFactory.h
│ ├── RCFlutterMessageFactory.m
│ ├── RCFlutterUtil.h
│ ├── RCFlutterUtil.m
│ ├── RCIMFlutterDefine.h
│ ├── RCIMFlutterLog.h
│ ├── RCIMFlutterLog.m
│ ├── RCIMFlutterWrapper.h
│ ├── RCIMFlutterWrapper.m
│ ├── RongcloudImPlugin.h
│ └── RongcloudImPlugin.m
└── rongcloud_im_plugin.podspec
├── lib
├── rongcloud_im_plugin.dart
└── src
│ ├── common_define.dart
│ ├── info
│ ├── blocked_message_info.dart
│ ├── chatroom_info.dart
│ ├── connection_status_convert.dart
│ ├── conversation.dart
│ ├── conversation_identifier.dart
│ ├── conversation_tag_info.dart
│ ├── history_message_option.dart
│ ├── message.dart
│ ├── push_config.dart
│ ├── search_conversation_result.dart
│ ├── send_message_option.dart
│ ├── tag_info.dart
│ └── typing_status.dart
│ ├── message
│ ├── chatroom_kv_notification_message.dart
│ ├── combine_message.dart
│ ├── file_message.dart
│ ├── gif_message.dart
│ ├── group_notification_message.dart
│ ├── image_message.dart
│ ├── location_message.dart
│ ├── message_content.dart
│ ├── recall_notification_message.dart
│ ├── reference_message.dart
│ ├── rich_content_message.dart
│ ├── sight_message.dart
│ ├── text_message.dart
│ └── voice_message.dart
│ ├── method_key.dart
│ ├── rong_im_client.dart
│ └── util
│ ├── message_factory.dart
│ └── type_util.dart
├── pubspec.lock
├── pubspec.yaml
├── rongcloud_im_plugin.iml
└── test
└── rongcloud_im_plugin_test.dart
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/.DS_Store
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/------.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: 问题反馈模板
3 | about: 欢迎体验使用融云 IM Flutter SDK
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | 为了快速解决问题,在寻求帮助的时候,请提供以下信息,方便我们快速定位问题
11 | * 本地 Flutter 版本信息
12 | * 异常设备是 iOS 还是 Android,列出具体机型和系统
13 | * 所调用的是什么 API 或者说是什么功能
14 | * 完整的报错信息或者问题描述
15 | * 提供问题发生时必要的日志,并以 txt 形式上传
16 |
17 | 文档链接 https://github.com/rongcloud/rongcloud-im-flutter-sdk/tree/dev/doc
18 | 文档持续更新中……
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .dart_tool/
3 | .vscode/
4 | .packages
5 | .pub/
6 |
7 | build/
8 |
9 | .idea/
10 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 融云 RongCloud
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/android/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/android/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | rongcloud_im_plugin
4 | Project rongcloud_im_plugin created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.buildship.core.gradleprojectbuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.buildship.core.gradleprojectnature
22 |
23 |
24 |
25 | 1618472525820
26 |
27 | 30
28 |
29 | org.eclipse.core.resources.regexFilterMatcher
30 | node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | group 'io.rong.flutter.imlib'
2 | version '1.0-SNAPSHOT'
3 |
4 | buildscript {
5 | repositories {
6 | google()
7 | jcenter()
8 | mavenCentral()
9 | maven { url 'https://developer.huawei.com/repo/' }
10 | }
11 |
12 | dependencies {
13 | classpath 'com.android.tools.build:gradle:3.5.4'
14 | }
15 | }
16 |
17 | rootProject.allprojects {
18 | repositories {
19 | google()
20 | jcenter()
21 | mavenCentral()
22 | maven { url 'https://developer.huawei.com/repo/' }
23 | }
24 | }
25 |
26 | apply plugin: 'com.android.library'
27 |
28 | android {
29 | compileSdkVersion 31
30 |
31 | defaultConfig {
32 | minSdkVersion 20
33 | }
34 | lintOptions {
35 | disable 'InvalidPackage'
36 | }
37 | }
38 |
39 | dependencies {
40 | api 'cn.rongcloud.sdk:im_libcore:5.2.3.2'
41 | api 'cn.rongcloud.sdk:im_chatroom:5.2.3.2'
42 | }
43 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'rongcloud_im_plugin'
2 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/android/src/main/java/io/rong/flutter/imlib/RCFlutterConfig.java:
--------------------------------------------------------------------------------
1 | package io.rong.flutter.imlib;
2 |
3 | import java.util.Map;
4 |
5 | public class RCFlutterConfig {
6 |
7 | private boolean enablePersistentUserInfoCache;
8 |
9 | RCFlutterConfig(){
10 |
11 | }
12 |
13 | public void updateConf(Map map) {
14 | Map imMap = (Map)map.get("im");
15 | if(imMap != null) {
16 | setEnablePersistentUserInfoCache((boolean)imMap.get("enablePersistentUserInfoCache"));
17 | }
18 | }
19 |
20 | public boolean isEnablePersistentUserInfoCache() {
21 | return enablePersistentUserInfoCache;
22 | }
23 |
24 | public void setEnablePersistentUserInfoCache(boolean enablePersistentUserInfoCache) {
25 | this.enablePersistentUserInfoCache = enablePersistentUserInfoCache;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/android/src/main/java/io/rong/flutter/imlib/RCListenerImpl.java:
--------------------------------------------------------------------------------
1 | package io.rong.flutter.imlib;
2 |
3 | import android.os.Handler;
4 |
5 | import java.util.HashMap;
6 | import java.util.Map;
7 |
8 | import io.flutter.plugin.common.MethodChannel;
9 | import io.rong.imlib.IRongCoreListener;
10 | import io.rong.imlib.chatroom.base.RongChatRoomClient;
11 | import io.rong.imlib.listener.OnReceiveMessageWrapperListener;
12 | import io.rong.imlib.model.Message;
13 | import io.rong.imlib.model.ReceivedProfile;
14 |
15 | /**
16 | * @author panmingda
17 | * @date 2022/1/17
18 | */
19 | public class RCListenerImpl {
20 |
21 | public RCListenerImpl(MethodChannel channel, Handler handler) {
22 | this.channel = channel;
23 | this.handler = handler;
24 |
25 | receiveMessageWrapperListener = new ReceiveMessageWrapperListenerImpl();
26 | kvStatusListener = new KVStatusListenerImpl();
27 | connectionStatusListener = new ConnectionStatusListenerImpl();
28 | }
29 |
30 | class ReceiveMessageWrapperListenerImpl extends OnReceiveMessageWrapperListener {
31 | @Override
32 | public void onReceivedMessage(final Message message, final ReceivedProfile profile) {
33 | handler.post(new Runnable() {
34 | @Override
35 | public void run() {
36 | String messageS = MessageFactory.getInstance().message2String(message);
37 | final Map map = new HashMap();
38 | map.put("message", messageS);
39 | map.put("left", profile.getLeft());
40 | map.put("offline", profile.isOffline());
41 | map.put("hasPackage", profile.hasPackage());
42 |
43 | channel.invokeMethod(RCMethodList.MethodCallBackKeyReceiveMessage, map);
44 | }
45 | });
46 | }
47 | }
48 |
49 | class KVStatusListenerImpl implements RongChatRoomClient.KVStatusListener {
50 |
51 | @Override
52 | public void onChatRoomKVSync(final String roomId) {
53 | handler.post(new Runnable() {
54 | @Override
55 | public void run() {
56 | final Map resultMap = new HashMap<>();
57 | resultMap.put("roomId", roomId);
58 | channel.invokeMethod(RCMethodList.MethodCallBackChatRoomKVDidSync, resultMap);
59 | }
60 | });
61 | }
62 |
63 | @Override
64 | public void onChatRoomKVUpdate(final String roomId, final Map chatRoomKvMap) {
65 | handler.post(new Runnable() {
66 | @Override
67 | public void run() {
68 | final Map resultMap = new HashMap<>();
69 | resultMap.put("roomId", roomId);
70 | resultMap.put("entry", chatRoomKvMap);
71 | channel.invokeMethod(RCMethodList.MethodCallBackChatRoomKVDidUpdate, resultMap);
72 | }
73 | });
74 | }
75 |
76 | @Override
77 | public void onChatRoomKVRemove(final String roomId, final Map chatRoomKvMap) {
78 | handler.post(new Runnable() {
79 | @Override
80 | public void run() {
81 | final Map resultMap = new HashMap<>();
82 | resultMap.put("roomId", roomId);
83 | resultMap.put("entry", chatRoomKvMap);
84 | channel.invokeMethod(RCMethodList.MethodCallBackChatRoomKVDidRemove, resultMap);
85 | }
86 | });
87 | }
88 | }
89 |
90 | class ConnectionStatusListenerImpl implements IRongCoreListener.ConnectionStatusListener {
91 |
92 | @Override
93 | public void onChanged(ConnectionStatus status) {
94 | Map map = new HashMap<>();
95 | map.put("status", status.getValue());
96 | channel.invokeMethod(RCMethodList.MethodCallBackKeyConnectionStatusChange, map);
97 | }
98 | }
99 |
100 | private final MethodChannel channel;
101 | private final Handler handler;
102 |
103 | public final ReceiveMessageWrapperListenerImpl receiveMessageWrapperListener;
104 | public final KVStatusListenerImpl kvStatusListener;
105 | public final ConnectionStatusListenerImpl connectionStatusListener;
106 | }
107 |
--------------------------------------------------------------------------------
/android/src/main/java/io/rong/flutter/imlib/RCLog.java:
--------------------------------------------------------------------------------
1 | package io.rong.flutter.imlib;
2 |
3 | import android.util.Log;
4 |
5 | public class RCLog {
6 | private static String TAG = "[RC-Flutter-IM] Android ";
7 | public static void i(String msg) {
8 | Log.i(TAG,msg);
9 | }
10 |
11 | public static void e(String msg) {
12 | Log.e(TAG+"error ",msg);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/android/src/main/java/io/rong/flutter/imlib/ResultRecord.java:
--------------------------------------------------------------------------------
1 | package io.rong.flutter.imlib;
2 |
3 | public class ResultRecord {
4 | public boolean isResultReturned;
5 | }
6 |
--------------------------------------------------------------------------------
/android/src/main/java/io/rong/flutter/imlib/RongcloudImPlugin.java:
--------------------------------------------------------------------------------
1 | package io.rong.flutter.imlib;
2 |
3 | import android.util.Log;
4 |
5 | import androidx.annotation.NonNull;
6 |
7 | import io.flutter.embedding.engine.plugins.FlutterPlugin;
8 | import io.flutter.plugin.common.MethodChannel;
9 | import io.flutter.plugin.common.PluginRegistry;
10 |
11 | public class RongcloudImPlugin implements FlutterPlugin {
12 |
13 | public static void registerWith(PluginRegistry.Registrar registrar) {
14 | channel = new MethodChannel(registrar.messenger(), "rongcloud_im_plugin");
15 | channel.setMethodCallHandler(RCIMFlutterWrapper.getInstance());
16 | RCIMFlutterWrapper.getInstance().saveContext(registrar.activity().getApplicationContext());
17 | RCIMFlutterWrapper.getInstance().saveChannel(channel);
18 | RCIMFlutterWrapper.getInstance().initListener();
19 | }
20 |
21 | @Override
22 | public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
23 | channel = new MethodChannel(binding.getBinaryMessenger(), "rongcloud_im_plugin");
24 | channel.setMethodCallHandler(RCIMFlutterWrapper.getInstance());
25 | RCIMFlutterWrapper.getInstance().saveContext(binding.getApplicationContext());
26 | RCIMFlutterWrapper.getInstance().saveChannel(channel);
27 | RCIMFlutterWrapper.getInstance().initListener();
28 | }
29 |
30 | @Override
31 | public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
32 | Log.e("onDetachedFromEngine", "onDetachedFromEngine");
33 | RCIMFlutterWrapper.getInstance().releaseListener();
34 | channel = null;
35 | }
36 |
37 | private static MethodChannel channel;
38 | }
--------------------------------------------------------------------------------
/android/src/main/java/io/rong/flutter/imlib/Version.java:
--------------------------------------------------------------------------------
1 | package io.rong.flutter.imlib;
2 |
3 | /**
4 | * @author panmingda
5 | * @date 2021/9/7
6 | */
7 | public class Version {
8 | public static final String SDK_VERSION = "5.1.8";
9 | }
10 |
--------------------------------------------------------------------------------
/android/src/main/res/layout/conversation.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
--------------------------------------------------------------------------------
/android/src/main/res/layout/conversationlist.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | //静态方式集成 ConversationListFragment
8 |
13 |
--------------------------------------------------------------------------------
/android/src/main/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
--------------------------------------------------------------------------------
/android/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/android/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | IMDemo
3 |
4 | true
5 |
6 |
7 | [图片]
8 | [语音]
9 | [图文]
10 | [位置]
11 | [草稿]
12 | [有人@我]
13 | [文件]
14 | [小视频]
15 | [阅后即焚]
16 | [聊天记录]
17 | [个人名片]
18 | [动态表情]
19 | [红包]
20 | [音视频通话]
21 | 聊天记录
22 |
23 |
--------------------------------------------------------------------------------
/android/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | .dart_tool/
26 | .flutter-plugins
27 | .flutter-plugins-dependencies
28 | .packages
29 | .pub-cache/
30 | .pub/
31 | /build/
32 | pubspec.lock
33 |
34 | # Android related
35 | **/android/**/gradle-wrapper.jar
36 | **/android/.gradle
37 | **/android/captures/
38 | **/android/gradlew
39 | **/android/gradlew.bat
40 | **/android/local.properties
41 | **/android/**/GeneratedPluginRegistrant.java
42 |
43 | # iOS/XCode related
44 | **/ios/**/*.mode1v3
45 | **/ios/**/*.mode2v3
46 | **/ios/**/*.moved-aside
47 | **/ios/**/*.pbxuser
48 | **/ios/**/*.perspectivev3
49 | **/ios/**/*sync/
50 | **/ios/**/.sconsign.dblite
51 | **/ios/**/.tags*
52 | **/ios/**/.vagrant/
53 | **/ios/**/DerivedData/
54 | **/ios/**/Icon?
55 | **/ios/**/Pods/
56 | **/ios/**/.symlinks/
57 | **/ios/**/profile
58 | **/ios/**/xcuserdata
59 | **/ios/.generated/
60 | **/ios/Flutter/App.framework
61 | **/ios/Flutter/Flutter.framework
62 | **/ios/Flutter/Flutter.podspec
63 | **/ios/Flutter/Generated.xcconfig
64 | **/ios/Flutter/app.flx
65 | **/ios/Flutter/app.zip
66 | **/ios/Flutter/flutter_assets/
67 | **/ios/Flutter/flutter_export_environment.sh
68 | **/ios/ServiceDefinitions.json
69 | **/ios/Runner/GeneratedPluginRegistrant.*
70 |
71 | ios/Podfile.lock
72 |
73 | # Exceptions to above rules.
74 | !**/ios/**/default.mode1v3
75 | !**/ios/**/default.mode2v3
76 | !**/ios/**/default.pbxuser
77 | !**/ios/**/default.perspectivev3
78 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
79 |
--------------------------------------------------------------------------------
/example/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 323373d3333e2cb9c2950e15e8c1cb9c73214ba9
8 | channel: master
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # 融云 IM Flutter Plugin Demo
2 |
3 | 
4 | 
5 |
6 | ##登陆账号
7 | 需要您在 [这里注册登陆账号] (https://sealtalk.rongcloud.cn/#/account/signup),然后用此账号登陆本 Demo。
8 |
9 | ## iOS 初次运行
10 |
11 | 初次安装需要从 pod 下载 IMLib 的 iOS SDK,要花费较长的时间,建议手动更新一下
12 |
13 | 1. Podfile 目录执行 `pod repo update` 命令
14 | 2. Podfile 目录执行 `pod update` 命令
15 |
16 | ### 常见问题
17 |
18 | 1. `audio_recorder` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.
19 |
20 | Podfile 上添加 `use_frameworks!` 参数
21 |
22 | Xcode 打开,选择 TARGETS -> Runnder -> Build Settings -> Levels 右边加号 -> Add User-Defined Setting -> 添加字段 `SWIFT_VERSION`,写上 Swift 版本,如 4.0
23 |
24 | ## Android 初次运行
25 |
26 | Android 依赖不同的 Flutter Plugin 可能会出现不同版本的 Gradle 导致编译不通过,可以按需做如下处理
27 |
28 | 1. `将所有的 build.gradle 的 gradle 版本统一`,例如统一改为 3.4.1
29 | 2. `将 gradle-wrapper.properties 的 distributionUrl `版本改为和上一步统一,如上一步是 3.4.1 ,那么此处应该改为 5.1.1
30 | 3. `编译后查看是否存在 AndroidX 的冲突`,如果存在 AndroidX 冲突,那么在 `gradle.properties` 增加如下配置
31 |
32 | ```
33 | android.useAndroidX=true
34 | android.enableJetifier=true
35 | ```
36 |
37 | > demo 为了考虑 CPU 架构兼容性问题,在 demo 的 `build.gradle` 中配置的 ndk 仅支持 `armeabi-v7a`
38 |
39 | ```
40 | ndk {
41 | abiFilters "armeabi-v7a"
42 | }
43 | ```
--------------------------------------------------------------------------------
/example/android/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | android
4 | Project android created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.buildship.core.gradleprojectbuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.buildship.core.gradleprojectnature
16 |
17 |
18 |
19 | 1618472525788
20 |
21 | 30
22 |
23 | org.eclipse.core.resources.regexFilterMatcher
24 | node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/example/android/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | arguments=
2 | auto.sync=false
3 | build.scans.enabled=false
4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
5 | connection.project.dir=
6 | eclipse.preferences.version=1
7 | gradle.user.home=
8 | java.home=/Library/Java/JavaVirtualMachines/jdk-12.0.1.jdk/Contents/Home
9 | jvm.arguments=
10 | offline.mode=false
11 | override.workspace.settings=true
12 | show.console.view=true
13 | show.executions.view=true
14 |
--------------------------------------------------------------------------------
/example/android/app/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/example/android/app/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | app
4 | Project app created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.buildship.core.gradleprojectbuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.buildship.core.gradleprojectnature
22 |
23 |
24 |
25 | 1618472525804
26 |
27 | 30
28 |
29 | org.eclipse.core.resources.regexFilterMatcher
30 | node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/example/android/app/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | connection.project.dir=..
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/example/android/app/agconnect-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "client": {
3 | "cp_id": "填写您自己的申请的账号信息",
4 | "product_id": "填写您自己的申请的账号信息",
5 | "client_id": "填写您自己的申请的账号信息",
6 | "client_secret": "填写您自己的申请的账号信息",
7 | "app_id": "填写您自己的申请的账号信息",
8 | "package_name": "com.example.rongcloud_im_plugin_example"
9 | },
10 | "configuration_version": "1.0"
11 | }
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26 |
27 | android {
28 | compileSdkVersion 31
29 |
30 | lintOptions {
31 | disable 'InvalidPackage'
32 | }
33 |
34 | defaultConfig {
35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
36 | applicationId "com.example.rongcloud_im_plugin_example"
37 | minSdkVersion 23
38 | targetSdkVersion 31
39 | versionCode flutterVersionCode.toInteger()
40 | versionName flutterVersionName
41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
42 |
43 | ndk {
44 | abiFilters "armeabi-v7a" , 'arm64-v8a', 'x86' , 'x86_64'
45 | }
46 | //,"x86"
47 | }
48 |
49 | signingConfigs {
50 | config {
51 | storeFile file("rong_flutter.key")
52 | storePassword "rongcloud"
53 | keyAlias "rongcloud"
54 | keyPassword "rongcloud"
55 | }
56 | }
57 |
58 | buildTypes {
59 | release {
60 | // TODO: Add your own signing config for the release build.
61 | // Signing with the debug keys for now, so `flutter run --release` works.
62 | signingConfig signingConfigs.debug
63 | shrinkResources false
64 | minifyEnabled false
65 | }
66 | }
67 |
68 | configurations.all {
69 | resolutionStrategy.eachDependency { details ->
70 | def requested = details.requested
71 | if (requested.group == 'com.android.support') {
72 | if (!requested.name.startsWith("multidex")) {
73 | details.useVersion '26.1.0'
74 | }
75 | }
76 | }
77 | }
78 | }
79 |
80 | flutter {
81 | source '../..'
82 | }
83 |
84 | dependencies {
85 | compile fileTree(include: ['*.jar', '*.aar'], dir: 'lib')
86 | testImplementation 'junit:junit:4.12'
87 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
88 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
89 |
90 | implementation 'com.android.support:appcompat-v7:26.0.0'
91 | }
92 |
93 |
--------------------------------------------------------------------------------
/example/android/app/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "396364826160",
4 | "firebase_url": "https://sealtalk-4be99.firebaseio.com",
5 | "project_id": "sealtalk-4be99",
6 | "storage_bucket": "sealtalk-4be99.appspot.com"
7 | },
8 | "client": [
9 | {
10 | "client_info": {
11 | "mobilesdk_app_id": "1:396364826160:android:a10a4a74ea61b328",
12 | "android_client_info": {
13 | "package_name": "com.example.rongcloud_im_plugin_example"
14 | }
15 | },
16 | "oauth_client": [
17 | {
18 | "client_id": "",
19 | "client_type": 3
20 | },
21 | {
22 | "client_id": "",
23 | "client_type": 3
24 | }
25 | ],
26 | "api_key": [
27 | {
28 | "current_key": ""
29 | }
30 | ],
31 | "services": {
32 | "analytics_service": {
33 | "status": 1
34 | },
35 | "appinvite_service": {
36 | "status": 1,
37 | "other_platform_oauth_client": []
38 | },
39 | "ads_service": {
40 | "status": 2
41 | }
42 | }
43 | }
44 | ],
45 | "configuration_version": "1"
46 | }
--------------------------------------------------------------------------------
/example/android/app/lib/MiPush_SDK_Client_3_8_2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/android/app/lib/MiPush_SDK_Client_3_8_2.jar
--------------------------------------------------------------------------------
/example/android/app/lib/com.heytap.msp-push-2.1.0.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/android/app/lib/com.heytap.msp-push-2.1.0.aar
--------------------------------------------------------------------------------
/example/android/app/lib/meizu-push-4.0.7.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/android/app/lib/meizu-push-4.0.7.aar
--------------------------------------------------------------------------------
/example/android/app/lib/vivo_pushsdk-v2.9.0.0.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/android/app/lib/vivo_pushsdk-v2.9.0.0.aar
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
17 |
25 |
26 |
27 |
28 |
29 |
30 |
33 |
39 |
43 |
44 |
45 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/example/rongcloud_im_plugin_example/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.rongcloud_im_plugin_example;
2 |
3 | import android.os.Bundle;
4 |
5 | import androidx.annotation.Nullable;
6 |
7 | import com.example.rongcloud_im_plugin_example.message.LocationMessage;
8 |
9 | import io.flutter.embedding.android.FlutterActivity;
10 | import io.rong.flutter.imlib.RCIMFlutterWrapper;
11 |
12 | public class MainActivity extends FlutterActivity {
13 | @Override
14 | protected void onCreate(@Nullable Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | RCIMFlutterWrapper.getInstance().registerMessage(LocationMessage.class);
17 | }
18 |
19 | // @Override
20 | // protected void onCreate(Bundle savedInstanceState) {
21 | // super.onCreate(savedInstanceState);
22 | // GeneratedPluginRegistrant.registerWith(this);
23 | // Context con = getApplicationContext();
24 | // RCIMFlutterWrapper.getInstance().registerMessage(LocationMessage.class);
25 | // //Android 注册自定义消息必须在 init 之后
26 | // //如果注册了自定义消息,但是没有注册消息模板,无法进入 SDK 的聊天页面
27 | // //https://www.rongcloud.cn/docs/android.html 参见文档的"消息自定义"
28 | //// RongIMClient.init(con,"pvxdm17jxjaor");
29 | //// RCIMFlutterWrapper.getInstance().registerMessage(TestMessage.class);
30 | //
31 | // // 测试Android往Flutter传递数据
32 | //// Timer timer = new Timer();
33 | //// timer.schedule(new TimerTask() {
34 | //// public void run() {
35 | //// Map map = new HashMap();
36 | //// map.put("key","android");
37 | //// RCIMFlutterWrapper.getInstance().sendDataToFlutter(map);
38 | //// }
39 | //// },500);
40 | // }
41 | //
42 | // @Override
43 | // public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
44 | // GeneratedPluginRegistrant.registerWith(flutterEngine);
45 | // }
46 | }
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/example/rongcloud_im_plugin_example/push/SealNotificationReceiver.java:
--------------------------------------------------------------------------------
1 | package com.example.rongcloud_im_plugin_example.push;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 |
6 | import com.example.rongcloud_im_plugin_example.MainActivity;
7 |
8 | import io.rong.push.PushType;
9 | import io.rong.push.notification.PushMessageReceiver;
10 | import io.rong.push.notification.PushNotificationMessage;
11 |
12 |
13 | /**
14 | * 通知广播, 可在此让法中进行通知消息处理和点击自定义跳转
15 | */
16 | public class SealNotificationReceiver extends PushMessageReceiver {
17 |
18 | @Override
19 | public boolean onNotificationMessageArrived(Context context, PushType pushType, PushNotificationMessage message) {
20 | return false;
21 | }
22 |
23 | @Override
24 | public boolean onNotificationMessageClicked(Context context, PushType pushType, PushNotificationMessage message) {
25 | if (!message.getSourceType().equals(PushNotificationMessage.PushSourceType.FROM_ADMIN)) {
26 | String targetId = message.getTargetId();
27 | //根据自己需求填写点击跳转逻辑
28 | Intent intentMain = new Intent(context, MainActivity.class);
29 | intentMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
30 | context.startActivity(intentMain);
31 | }
32 | return false;
33 | }
34 |
35 | @Override
36 | public void onThirdPartyPushState(PushType pushType, String action, long resultCode) {
37 | super.onThirdPartyPushState(pushType, action, resultCode);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/android/app/src/main/res/drawable/app_icon.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | jcenter()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:3.5.4'
10 | }
11 | }
12 |
13 | allprojects {
14 | repositories {
15 | google()
16 | jcenter()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 | android.enableR8=true
5 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
7 |
--------------------------------------------------------------------------------
/example/android/rong_flutter.key:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/android/rong_flutter.key
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/example/assets/RCFlutterConf.json:
--------------------------------------------------------------------------------
1 | {
2 | "im":{
3 | "enablePersistentUserInfoCache":true
4 | }
5 | }
--------------------------------------------------------------------------------
/example/assets/images/burnPicture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/burnPicture.png
--------------------------------------------------------------------------------
/example/assets/images/burnPictureForm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/burnPictureForm.png
--------------------------------------------------------------------------------
/example/assets/images/default_portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/default_portrait.png
--------------------------------------------------------------------------------
/example/assets/images/file_message_icon_apk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/file_message_icon_apk.png
--------------------------------------------------------------------------------
/example/assets/images/file_message_icon_audio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/file_message_icon_audio.png
--------------------------------------------------------------------------------
/example/assets/images/file_message_icon_else.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/file_message_icon_else.png
--------------------------------------------------------------------------------
/example/assets/images/file_message_icon_excel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/file_message_icon_excel.png
--------------------------------------------------------------------------------
/example/assets/images/file_message_icon_file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/file_message_icon_file.png
--------------------------------------------------------------------------------
/example/assets/images/file_message_icon_key.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/file_message_icon_key.png
--------------------------------------------------------------------------------
/example/assets/images/file_message_icon_numbers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/file_message_icon_numbers.png
--------------------------------------------------------------------------------
/example/assets/images/file_message_icon_pages.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/file_message_icon_pages.png
--------------------------------------------------------------------------------
/example/assets/images/file_message_icon_pdf.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/file_message_icon_pdf.png
--------------------------------------------------------------------------------
/example/assets/images/file_message_icon_picture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/file_message_icon_picture.png
--------------------------------------------------------------------------------
/example/assets/images/file_message_icon_ppt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/file_message_icon_ppt.png
--------------------------------------------------------------------------------
/example/assets/images/file_message_icon_video.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/file_message_icon_video.png
--------------------------------------------------------------------------------
/example/assets/images/file_message_icon_word.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/file_message_icon_word.png
--------------------------------------------------------------------------------
/example/assets/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/logo.png
--------------------------------------------------------------------------------
/example/assets/images/rc_ic_warning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/rc_ic_warning.png
--------------------------------------------------------------------------------
/example/assets/images/rich_content_msg_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/rich_content_msg_default.png
--------------------------------------------------------------------------------
/example/assets/images/sight_camera_switch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/sight_camera_switch.png
--------------------------------------------------------------------------------
/example/assets/images/sight_message_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/sight_message_icon.png
--------------------------------------------------------------------------------
/example/assets/images/sight_preview_cancel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/sight_preview_cancel.png
--------------------------------------------------------------------------------
/example/assets/images/sight_preview_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/sight_preview_done.png
--------------------------------------------------------------------------------
/example/assets/images/sight_top_toolbar_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/sight_top_toolbar_close.png
--------------------------------------------------------------------------------
/example/assets/images/voice_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/voice_icon.png
--------------------------------------------------------------------------------
/example/assets/images/voice_icon_reverse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/voice_icon_reverse.png
--------------------------------------------------------------------------------
/example/assets/images/voice_recoder.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/assets/images/voice_recoder.gif
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.mode1v3
2 | *.mode2v3
3 | *.moved-aside
4 | *.pbxuser
5 | *.perspectivev3
6 | **/*sync/
7 | .sconsign.dblite
8 | .tags*
9 | **/.vagrant/
10 | **/DerivedData/
11 | Icon?
12 | **/Pods/
13 | **/.symlinks/
14 | profile
15 | xcuserdata
16 | **/.generated/
17 | Flutter/App.framework
18 | Flutter/Flutter.framework
19 | Flutter/Flutter.podspec
20 | Flutter/Generated.xcconfig
21 | Flutter/app.flx
22 | Flutter/app.zip
23 | Flutter/flutter_assets/
24 | Flutter/flutter_export_environment.sh
25 | ServiceDefinitions.json
26 | Runner/GeneratedPluginRegistrant.*
27 |
28 | # Exceptions to above rules.
29 | !default.mode1v3
30 | !default.mode2v3
31 | !default.pbxuser
32 | !default.perspectivev3
33 |
34 |
--------------------------------------------------------------------------------
/example/ios/Flutter/.last_build_id:
--------------------------------------------------------------------------------
1 | 35e2f1b5ed8cfb67df85c44bff45930f
--------------------------------------------------------------------------------
/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 9.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Flutter.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # NOTE: This podspec is NOT to be published. It is only used as a local source!
3 | # This is a generated file; do not edit or check into version control.
4 | #
5 |
6 | Pod::Spec.new do |s|
7 | s.name = 'Flutter'
8 | s.version = '1.0.0'
9 | s.summary = 'High-performance, high-fidelity mobile apps.'
10 | s.homepage = 'https://flutter.io'
11 | s.license = { :type => 'MIT' }
12 | s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
13 | s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
14 | s.ios.deployment_target = '9.0'
15 | # Framework linking is handled by Flutter tooling, not CocoaPods.
16 | # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs.
17 | s.vendored_frameworks = 'path/to/nothing'
18 | end
19 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Flutter/flutter_export_environment.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # This is a generated file; do not edit or check into version control.
3 | export "FLUTTER_ROOT=/Users/panmingda/Documents/Software/flutter"
4 | export "FLUTTER_APPLICATION_PATH=/Users/panmingda/Documents/Publish/rongcloud-im-flutter-sdk/example"
5 | export "COCOAPODS_PARALLEL_CODE_SIGN=true"
6 | export "FLUTTER_TARGET=/Users/panmingda/Documents/Publish/rongcloud-im-flutter-sdk/example/lib/main.dart"
7 | export "FLUTTER_BUILD_DIR=build"
8 | export "FLUTTER_BUILD_NAME=1.0.0"
9 | export "FLUTTER_BUILD_NUMBER=1"
10 | export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
11 | export "DART_OBFUSCATION=false"
12 | export "TRACK_WIDGET_CREATION=true"
13 | export "TREE_SHAKE_ICONS=false"
14 | export "PACKAGE_CONFIG=/Users/panmingda/Documents/Publish/rongcloud-im-flutter-sdk/example/.dart_tool/package_config.json"
15 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '9.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | source 'https://github.com/CocoaPods/Specs.git'
6 |
7 |
8 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
9 |
10 | project 'Runner', {
11 | 'Debug' => :debug,
12 | 'Profile' => :release,
13 | 'Release' => :release,
14 | }
15 |
16 | def flutter_root
17 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
18 | unless File.exist?(generated_xcode_build_settings_path)
19 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
20 | end
21 |
22 | File.foreach(generated_xcode_build_settings_path) do |line|
23 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
24 | return matches[1].strip if matches
25 | end
26 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
27 | end
28 |
29 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
30 |
31 | flutter_ios_podfile_setup
32 |
33 | target 'Runner' do
34 | use_frameworks!
35 | use_modular_headers!
36 |
37 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
38 | end
39 |
40 | post_install do |installer|
41 | installer.pods_project.targets.each do |target|
42 | flutter_additional_ios_build_settings(target)
43 | end
44 | end
45 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
69 |
71 |
77 |
78 |
79 |
80 |
82 |
83 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : FlutterAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.m:
--------------------------------------------------------------------------------
1 | #include "AppDelegate.h"
2 | #include "GeneratedPluginRegistrant.h"
3 | #import
4 | #import "RCDTestMessage.h"
5 | #import "RCDLocationMessage.h"
6 | #import
7 |
8 | @implementation AppDelegate
9 |
10 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
11 | [GeneratedPluginRegistrant registerWithRegistry:self];
12 | /**
13 | //注册自定义消息流程
14 | 用户只需要调用以下方法注册自定义消息。SDK 内部会在 connectWithToken: 方法里,链接 IM 之前 把所有自定义消息注册到底层 SDK。
15 | */
16 | [[RCIMFlutterWrapper sharedWrapper] registerMessageType:[RCDTestMessage class]];
17 | [[RCIMFlutterWrapper sharedWrapper] registerMessageType:[RCDLocationMessage class]];
18 |
19 | /**
20 | * 推送处理1 (申请推送权限)
21 | */
22 | if ([application
23 | respondsToSelector:@selector(registerUserNotificationSettings:)]) {
24 | //注册推送, 用于iOS8以及iOS8之后的系统
25 | UIUserNotificationSettings *settings = [UIUserNotificationSettings
26 | settingsForTypes:(UIUserNotificationTypeBadge |
27 | UIUserNotificationTypeSound |
28 | UIUserNotificationTypeAlert)
29 | categories:nil];
30 | [application registerUserNotificationSettings:settings];
31 | }
32 |
33 | /**
34 | // 远程推送的内容
35 | NSDictionary *remoteNotificationUserInfo = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];
36 | // 传递远程推送数据
37 | if (remoteNotificationUserInfo != nil) {
38 | //远程推送的数据,延时之后再调用该接口,防止Flutter尚未初始化就调用,导致Flutter无法接受数据
39 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
40 | [[RCIMFlutterWrapper sharedWrapper] sendDataToFlutter:remoteNotificationUserInfo];
41 | });
42 | }
43 | */
44 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
45 | }
46 |
47 | /**
48 | * 推送处理2
49 | */
50 | - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
51 | // register to receive notifications
52 | [application registerForRemoteNotifications];
53 | }
54 |
55 | - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
56 |
57 | // [[RCIMFlutterWrapper sharedWrapper] sendDataToFlutter:userInfo];
58 | }
59 |
60 |
61 |
62 |
63 | @end
64 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rongcloud/rongcloud-im-flutter-sdk/116a2d9a1fb53f7b86d8d8321079fdffafad72e4/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | RC_Flutter_Demo
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0.0
23 | LSRequiresIPhoneOS
24 |
25 | NSAppTransportSecurity
26 |
27 | NSAllowsArbitraryLoads
28 |
29 | NSAllowsArbitraryLoadsInWebContent
30 |
31 | NSAllowsArbitraryLoadsForMedia
32 |
33 |
34 | io.flutter.embedded_views_preview
35 |
36 | NSCameraUsageDescription
37 | 访问相机
38 | NSMicrophoneUsageDescription
39 | 使用麦克风
40 | NSPhotoLibraryUsageDescription
41 | 访问相册
42 | NSPhotoLibraryAddUsageDescription
43 | 访问相册
44 | UILaunchStoryboardName
45 | LaunchScreen
46 | UIMainStoryboardFile
47 | Main
48 | UISupportedInterfaceOrientations
49 |
50 | UIInterfaceOrientationPortrait
51 | UIInterfaceOrientationLandscapeLeft
52 | UIInterfaceOrientationLandscapeRight
53 |
54 | UISupportedInterfaceOrientations~ipad
55 |
56 | UIInterfaceOrientationPortrait
57 | UIInterfaceOrientationPortraitUpsideDown
58 | UIInterfaceOrientationLandscapeLeft
59 | UIInterfaceOrientationLandscapeRight
60 |
61 | UIViewControllerBasedStatusBarAppearance
62 |
63 | io.flutter.embedded_views_preview
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/example/ios/Runner/RCDLocationMessage.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCDLocationMessage.h
3 | // Runner
4 | //
5 | // Created by 孙浩 on 2021/9/6.
6 | // Copyright © 2021 The Chromium Authors. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 | #import
13 |
14 | NS_ASSUME_NONNULL_BEGIN
15 |
16 | /*!
17 | 地理位置消息的类型名
18 | */
19 | #define RCDLocationMessageTypeIdentifier @"RCD:LBSMsg"
20 |
21 | /*!
22 | 地理位置消息类
23 |
24 | @discussion 地理位置消息类,此消息会进行存储并计入未读消息数。
25 |
26 | @remarks 内容类消息
27 | */
28 | @interface RCDLocationMessage : RCMessageContent
29 |
30 | /*!
31 | 地理位置的二维坐标
32 | */
33 | @property (nonatomic, assign) CLLocationCoordinate2D location;
34 |
35 | /*!
36 | 地理位置的名称
37 | */
38 | @property (nonatomic, copy) NSString *locationName;
39 |
40 | /*!
41 | 地理位置的缩略图
42 | */
43 | @property (nonatomic, strong) UIImage *thumbnailImage;
44 |
45 | /*!
46 | 初始化地理位置消息
47 |
48 | @param image 地理位置的缩略图
49 | @param location 地理位置的二维坐标
50 | @param locationName 地理位置的名称
51 | @return 地理位置消息的对象
52 | */
53 | + (instancetype)messageWithLocationImage:(UIImage *)image
54 | location:(CLLocationCoordinate2D)location
55 | locationName:(NSString *)locationName;
56 |
57 | @end
58 |
59 | NS_ASSUME_NONNULL_END
60 |
--------------------------------------------------------------------------------
/example/ios/Runner/RCDTestMessage.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCDTestMessage.h
3 | // RCloudMessage
4 | //
5 | // Created by 岑裕 on 15/12/17.
6 | // Copyright © 2015年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /*!
12 | 测试消息的类型名
13 | */
14 | #define RCDTestMessageTypeIdentifier @"RCD:TstMsg"
15 |
16 | /*!
17 | Demo测试用的自定义消息类
18 |
19 | @discussion Demo测试用的自定义消息类,此消息会进行存储并计入未读消息数。
20 | */
21 | @interface RCDTestMessage : RCMessageContent
22 |
23 | /*!
24 | 测试消息的内容
25 | */
26 | @property(nonatomic, strong) NSString *content;
27 |
28 | /*!
29 | 测试消息的附加信息
30 | */
31 | @property(nonatomic, strong) NSString *extra;
32 |
33 | /*!
34 | 初始化测试消息
35 |
36 | @param content 文本内容
37 | @return 测试消息对象
38 | */
39 | + (instancetype)messageWithContent:(NSString *)content;
40 |
41 | @end
42 |
--------------------------------------------------------------------------------
/example/ios/Runner/RCDTestMessage.m:
--------------------------------------------------------------------------------
1 | //
2 | // RCDTestMessage.m
3 | // RCloudMessage
4 | //
5 | // Created by 岑裕 on 15/12/17.
6 | // Copyright © 2015年 RongCloud. All rights reserved.
7 | //
8 |
9 | #import "RCDTestMessage.h"
10 |
11 | @implementation RCDTestMessage
12 |
13 | ///初始化
14 | + (instancetype)messageWithContent:(NSString *)content {
15 | RCDTestMessage *text = [[RCDTestMessage alloc] init];
16 | if (text) {
17 | text.content = content;
18 | }
19 | return text;
20 | }
21 |
22 | ///消息是否存储,是否计入未读数
23 | + (RCMessagePersistent)persistentFlag {
24 | return (MessagePersistent_ISPERSISTED | MessagePersistent_ISCOUNTED);
25 | }
26 |
27 | /// NSCoding
28 | - (instancetype)initWithCoder:(NSCoder *)aDecoder {
29 | self = [super init];
30 | if (self) {
31 | self.content = [aDecoder decodeObjectForKey:@"content"];
32 | self.extra = [aDecoder decodeObjectForKey:@"extra"];
33 | }
34 | return self;
35 | }
36 |
37 | /// NSCoding
38 | - (void)encodeWithCoder:(NSCoder *)aCoder {
39 | [aCoder encodeObject:self.content forKey:@"content"];
40 | [aCoder encodeObject:self.extra forKey:@"extra"];
41 | }
42 |
43 | ///将消息内容编码成json
44 | - (NSData *)encode {
45 | NSMutableDictionary *dataDict = [NSMutableDictionary dictionary];
46 | [dataDict setObject:self.content forKey:@"content"];
47 | if (self.extra) {
48 | [dataDict setObject:self.extra forKey:@"extra"];
49 | }
50 |
51 | if (self.senderUserInfo) {
52 | [dataDict setObject:[self encodeUserInfo:self.senderUserInfo] forKey:@"user"];
53 | }
54 |
55 | NSData *data = [NSJSONSerialization dataWithJSONObject:dataDict options:kNilOptions error:nil];
56 | return data;
57 | }
58 |
59 | ///将json解码生成消息内容
60 | - (void)decodeWithData:(NSData *)data {
61 | if (data) {
62 | __autoreleasing NSError *error = nil;
63 |
64 | NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
65 |
66 | if (dictionary) {
67 | self.content = dictionary[@"content"];
68 | self.extra = dictionary[@"extra"];
69 |
70 | NSDictionary *userinfoDic = dictionary[@"user"];
71 | [self decodeUserInfo:userinfoDic];
72 | }
73 | }
74 | }
75 |
76 | /// 会话列表中显示的摘要
77 | - (NSString *)conversationDigest {
78 | return self.content;
79 | }
80 |
81 | ///消息的类型名
82 | + (NSString *)getObjectName {
83 | return RCDTestMessageTypeIdentifier;
84 | }
85 |
86 | @end
87 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | aps-environment
6 | development
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner/main.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char* argv[]) {
6 | @autoreleasepool {
7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/example/lib/im/pages/image_preview_page.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:rongcloud_im_plugin/rongcloud_im_plugin.dart';
5 |
6 | import '../util/media_util.dart';
7 |
8 | class ImagePreviewPage extends StatefulWidget {
9 | final Message? message;
10 |
11 | const ImagePreviewPage({Key? key, this.message}) : super(key: key);
12 |
13 | @override
14 | State createState() {
15 | return _ImagePreviewPageState(message);
16 | }
17 | }
18 |
19 | class _ImagePreviewPageState extends State {
20 | final Message? message;
21 |
22 | _ImagePreviewPageState(this.message);
23 |
24 | //优先加载本地路径图片,否则加载网络图片
25 | Widget getImageWidget() {
26 | String? localPath;
27 | String? remoteUrl;
28 | if (message!.content is GifMessage) {
29 | GifMessage msg = message!.content as GifMessage;
30 | localPath = msg.localPath;
31 | remoteUrl = msg.remoteUrl;
32 | } else {
33 | ImageMessage msg = message!.content as ImageMessage;
34 | localPath = msg.localPath;
35 | remoteUrl = msg.imageUri;
36 | }
37 | Widget widget;
38 | if (localPath != null) {
39 | String path = MediaUtil.instance!.getCorrectedLocalPath(localPath)!;
40 | File file = File(path);
41 | if (file != null && file.existsSync()) {
42 | widget = Image.file(file);
43 | } else {
44 | widget = Image.network(
45 | remoteUrl!,
46 | fit: BoxFit.cover,
47 | loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent? loadingProgress) {
48 | if (loadingProgress == null) return child;
49 | return Center(
50 | child: CircularProgressIndicator(
51 | value: loadingProgress.expectedTotalBytes != null ? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes! : null,
52 | ),
53 | );
54 | },
55 | );
56 | }
57 | } else {
58 | widget = Image.network(
59 | remoteUrl!,
60 | fit: BoxFit.cover,
61 | loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent? loadingProgress) {
62 | if (loadingProgress == null) return child;
63 | return Center(
64 | child: CircularProgressIndicator(
65 | value: loadingProgress.expectedTotalBytes != null ? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes! : null,
66 | ),
67 | );
68 | },
69 | );
70 | }
71 | // Container container = Container(
72 | // margin: EdgeInsets.all(2),
73 | // child: widget,
74 | // alignment: Alignment.center,
75 | // );
76 | // return container;
77 | return widget;
78 | // return container;
79 | }
80 |
81 | @override
82 | Widget build(BuildContext context) {
83 | return Scaffold(
84 | appBar: AppBar(
85 | title: Text("图片预览"),
86 | ),
87 | body: SingleChildScrollView(
88 | child: getImageWidget(),
89 | ));
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/example/lib/im/pages/item/bottom_tool_bar.dart:
--------------------------------------------------------------------------------
1 | import 'dart:developer' as developer;
2 |
3 | import 'package:flutter/material.dart';
4 |
5 | import '../../util/style.dart';
6 |
7 | class BottomToolBar extends StatefulWidget {
8 | BottomToolBarDelegate? delegate;
9 |
10 | BottomToolBar(BottomToolBarDelegate delegate) {
11 | this.delegate = delegate;
12 | }
13 |
14 | @override
15 | State createState() {
16 | return _BottomToolBarState(delegate);
17 | }
18 | }
19 |
20 | class _BottomToolBarState extends State {
21 | String pageName = "example.BottomToolBar";
22 | BottomToolBarDelegate? delegate;
23 |
24 | _BottomToolBarState(BottomToolBarDelegate? delegate) {
25 | this.delegate = delegate;
26 | }
27 |
28 | @override
29 | void initState() {
30 | super.initState();
31 | }
32 |
33 | @override
34 | Widget build(BuildContext context) {
35 | return Container(
36 | color: Colors.white,
37 | child: Row(
38 | mainAxisAlignment: MainAxisAlignment.spaceEvenly,
39 | children: [
40 | IconButton(
41 | icon: Icon(Icons.delete),
42 | iconSize: RCLayout.BottomIconLayoutSize,
43 | onPressed: () {
44 | tapDelete();
45 | },
46 | ),
47 | IconButton(
48 | icon: Icon(Icons.forward),
49 | iconSize: RCLayout.BottomIconLayoutSize,
50 | onPressed: () {
51 | tapForward();
52 | },
53 | ),
54 | ],
55 | ),
56 | );
57 | }
58 |
59 | void tapDelete() {
60 | if (this.delegate != null) {
61 | this.delegate!.didTapDelete();
62 | } else {
63 | developer.log("没有实现 BottomToolBarDelegate", name: pageName);
64 | }
65 | }
66 |
67 | void tapForward() {
68 | if (this.delegate != null) {
69 | this.delegate!.didTapForward();
70 | } else {
71 | developer.log("没有实现 BottomToolBarDelegate", name: pageName);
72 | }
73 | }
74 | }
75 |
76 | abstract class BottomToolBarDelegate {
77 | void didTapDelete();
78 |
79 | void didTapForward();
80 | }
81 |
--------------------------------------------------------------------------------
/example/lib/im/pages/sight/record_top_item.dart:
--------------------------------------------------------------------------------
1 | import 'dart:developer' as developer;
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:percent_indicator/linear_percent_indicator.dart';
5 |
6 | enum RecordState {
7 | //正常 [返回,切换摄像头]
8 | Normal,
9 | // 录制前加载
10 | RecordLoading,
11 | //录制 [返回,进度条]
12 | Recording,
13 | //预览 [返回]
14 | Preview
15 | }
16 |
17 | class TopRecordItem extends StatefulWidget {
18 | TopRecordItemDelegate? delegate;
19 | late _TopRecordItemState state;
20 |
21 | TopRecordItem(TopRecordItemDelegate delegate) {
22 | this.delegate = delegate;
23 | this.state = _TopRecordItemState(delegate);
24 | }
25 |
26 | void updateRecordState(RecordState s) {
27 | state.updateRecordState(s);
28 | }
29 |
30 | @override
31 | _TopRecordItemState createState() => state;
32 | }
33 |
34 | class _TopRecordItemState extends State {
35 | String pageName = "example.TopRecordItem";
36 | TopRecordItemDelegate? delegate;
37 |
38 | RecordState currentRecordState = RecordState.Normal;
39 |
40 | _TopRecordItemState(TopRecordItemDelegate delegate) {
41 | this.delegate = delegate;
42 | }
43 |
44 | void updateRecordState(RecordState s) {
45 | setState(() {
46 | currentRecordState = s;
47 | });
48 | }
49 |
50 | Widget recordLine() {
51 | return LinearPercentIndicator(
52 | width: MediaQuery.of(context).size.width - 40 - 25 - 40 - 35 - 30,
53 | animation: true,
54 | animationDuration: 10000,
55 | percent: 1,
56 | progressColor: Colors.white,
57 | );
58 | }
59 |
60 | @override
61 | Widget build(BuildContext context) {
62 | return Container(
63 | height: 100,
64 | width: MediaQuery.of(context).size.width,
65 | child: Row(
66 | children: [
67 | SizedBox(
68 | width: 40,
69 | ),
70 | GestureDetector(
71 | onTap: () {
72 | onPop();
73 | },
74 | child: Container(
75 | width: 25,
76 | height: 25,
77 | child: currentRecordState != RecordState.Recording && currentRecordState != RecordState.RecordLoading ? Image.asset("assets/images/sight_top_toolbar_close.png") : Container(),
78 | ),
79 | ),
80 | SizedBox(
81 | width: 15,
82 | ),
83 | Expanded(
84 | child: Container(
85 | child: currentRecordState == RecordState.Recording ? recordLine() : Container(),
86 | ),
87 | ),
88 | GestureDetector(
89 | onTap: () {
90 | currentRecordState == RecordState.Normal ? onSwitchCamera() : Container();
91 | },
92 | child: Container(
93 | width: 35,
94 | height: 35,
95 | child: currentRecordState == RecordState.Normal ? Image.asset("assets/images/sight_camera_switch.png") : Container(),
96 | ),
97 | ),
98 | SizedBox(
99 | width: 40,
100 | ),
101 | ],
102 | ),
103 | );
104 | }
105 |
106 | void onPop() {
107 | if (delegate != null) {
108 | delegate!.didPop();
109 | } else {
110 | developer.log("没有实现 didPop", name: pageName);
111 | }
112 | }
113 |
114 | void onSwitchCamera() {
115 | if (delegate != null) {
116 | delegate!.didSwitchCamera();
117 | } else {
118 | developer.log("没有实现 didSwitchCamera", name: pageName);
119 | }
120 | }
121 |
122 | @override
123 | void dispose() {
124 | super.dispose();
125 | }
126 | }
127 |
128 | abstract class TopRecordItemDelegate {
129 | //点击叉号按钮
130 | void didPop();
131 |
132 | //切换摄像头
133 | void didSwitchCamera();
134 | }
135 |
--------------------------------------------------------------------------------
/example/lib/im/pages/sight/video_play_page.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:flutter/widgets.dart';
4 | import 'package:rongcloud_im_plugin/rongcloud_im_plugin.dart';
5 | import 'package:video_player/video_player.dart';
6 |
7 | class VideoPlayPage extends StatefulWidget {
8 | final Message? message;
9 |
10 | const VideoPlayPage({Key? key, this.message}) : super(key: key);
11 |
12 | @override
13 | State createState() {
14 | return _VideoPlayPageState(message);
15 | }
16 | }
17 |
18 | class _VideoPlayPageState extends State {
19 | final Message? message;
20 |
21 | VideoPlayerController? videoPlayerController;
22 | SightMessage? sightMessage;
23 |
24 | _VideoPlayPageState(this.message);
25 |
26 | @override
27 | void initState() {
28 | super.initState();
29 | initVideoController();
30 | }
31 |
32 | @override
33 | void dispose() {
34 | videoPlayerController?.dispose();
35 | super.dispose();
36 | }
37 |
38 | void initVideoController() async {
39 | sightMessage = message?.content as SightMessage?;
40 | if (sightMessage?.localPath != null && sightMessage?.localPath != "") {
41 | videoPlayerController = VideoPlayerController.file(File(sightMessage!.localPath!));
42 | } else {
43 | //TODO 是否需要做缓存? VideoPlayerController.network 每次都会下载一遍视频
44 | videoPlayerController = VideoPlayerController.network(sightMessage!.remoteUrl!);
45 | }
46 | await videoPlayerController?.initialize();
47 | await videoPlayerController?.play();
48 | setState(() {});
49 | }
50 |
51 | void onPop() {
52 | Navigator.pop(context);
53 | }
54 |
55 | @override
56 | Widget build(BuildContext context) {
57 | return Stack(
58 | children: [
59 | VideoPlayer(videoPlayerController!),
60 | Container(
61 | height: 100,
62 | width: MediaQuery.of(context).size.width,
63 | child: Row(
64 | children: [
65 | SizedBox(
66 | width: 40,
67 | ),
68 | GestureDetector(
69 | onTap: () {
70 | onPop();
71 | },
72 | child: Container(width: 25, height: 25, child: Image.asset("assets/images/sight_top_toolbar_close.png")),
73 | )
74 | ],
75 | ),
76 | )
77 | ],
78 | );
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/example/lib/im/util/bloc/bloc_provider.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | abstract class BlocBase {
4 | void dispose();
5 | }
6 |
7 | class BlocProvider extends StatefulWidget {
8 | BlocProvider({
9 | Key? key,
10 | required this.child,
11 | required this.bloc,
12 | }) : super(key: key);
13 |
14 | final T bloc;
15 | final Widget child;
16 |
17 | @override
18 | _BlocProviderState createState() => _BlocProviderState();
19 |
20 | static T of(BuildContext context) {
21 | final type = _typeOf>();
22 | BlocProvider provider = context.findAncestorWidgetOfExactType() as BlocProvider;
23 | return provider.bloc;
24 | }
25 |
26 | static Type _typeOf() => T;
27 | }
28 |
29 | class _BlocProviderState extends State> {
30 | @override
31 | void dispose() {
32 | widget.bloc.dispose();
33 | super.dispose();
34 | }
35 |
36 | @override
37 | Widget build(BuildContext context) {
38 | return widget.child;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/example/lib/im/util/bloc/message_bloc.dart:
--------------------------------------------------------------------------------
1 | import 'package:rxdart/subjects.dart';
2 |
3 | import 'bloc_provider.dart';
4 |
5 | class MessageBloc extends BlocBase {
6 | MessageInfoWrapState? warpInfo;
7 |
8 | // 列表数据
9 | BehaviorSubject _listDataController = BehaviorSubject(sync: true);
10 |
11 | Sink get inListData => _listDataController.sink;
12 |
13 | Stream get outListData => _listDataController.stream;
14 |
15 | @override
16 | void dispose() {
17 | _listDataController.close();
18 | }
19 |
20 | void updateMessageList(List messageList) {
21 | warpInfo = MessageInfoWrapState(messageList: messageList);
22 | inListData.add(warpInfo);
23 | }
24 | }
25 |
26 | class MessageInfoWrapState {
27 | MessageInfoWrapState({this.messageList});
28 |
29 | List? messageList;
30 | }
31 |
--------------------------------------------------------------------------------
/example/lib/im/util/code_util.dart:
--------------------------------------------------------------------------------
1 | class CodeUtil {
2 | /// 具体业务错误码
3 | static String? codeString(int? code) {
4 | String key = code.toString() != null ? code.toString() : "";
5 | return codeMap[key];
6 | }
7 |
8 | static Map codeMap = {
9 | "": "未找到对应错误",
10 | "-1": "未知错误(预留)",
11 | "0": "成功",
12 | "405": "已被对方加入黑名单,消息发送失败。",
13 | "5004": "超时",
14 | "20604": "发送消息频率过高,1秒钟最多只允许发送5条消息",
15 | "22406": "当前用户不在该群组中",
16 | "22408": "当前用户在群组中已被禁言",
17 | "23406": "当前用户不在该聊天室中",
18 | "23408": "当前用户在该聊天室中已被禁言",
19 | "23409": "当前用户已被踢出并禁止加入聊天室。被禁止的时间取决于服务端调用踢出接口时传入的时间。",
20 | "23410": "聊天室不存在",
21 | "23411": "聊天室成员超限",
22 | "23412": "聊天室接口参数无效。请确认参数是否为空或者有效。",
23 | "23414": "聊天室云存储业务未开通",
24 | "23423": "超过聊天室的最大状态设置数,1 个聊天室默认最多设置 100 个",
25 | "23424": "聊天室中非法覆盖状态值,状态已存在,没有权限覆盖",
26 | "23425": "超过聊天室中状态设置频率,1 个聊天室 1 秒钟最多设置和删除状态 100 次",
27 | "23426": "聊天室状态存储功能没有开通,请联系商务开通",
28 | "23427": "聊天室状态值不存在",
29 | "23428": "KV列表并未完全设置成功",
30 | "23429": "KV数量超过最大数量限制",
31 | "34004": "聊天室状态未同步完成",
32 | "30001": "当前连接不可用(连接已经被释放)",
33 | "30002": "当前连接不可用",
34 | "30003": "客户端发送消息请求,融云服务端响应超时。",
35 | "33001": "SDK没有初始化",
36 | "33002": "数据库错误",
37 | "33003": "开发者接口调用时传入的参数错误",
38 | "33007": "历史消息云存储业务未开通",
39 | "30016": "消息大小超限",
40 | "25101": "撤回消息参数无效",
41 | "26001": "push 设置参数无效",
42 | "20605": "操作被禁止",
43 | "20606": "操作不支持。仅私有云有效,服务端禁用了该操作。",
44 | "21501": "发送的消息中包含敏感词",
45 | "21502": "消息中敏感词已经被替换",
46 | "34002": "小视频时间长度超出限制",
47 | "34003": "GIF 消息文件大小超出限制",
48 | };
49 | }
50 |
--------------------------------------------------------------------------------
/example/lib/im/util/db_manager.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:path/path.dart';
4 | import 'package:sqflite/sqflite.dart';
5 |
6 | import 'user_info_datesource.dart';
7 |
8 | class DbManager {
9 | factory DbManager() => _getInstance()!;
10 |
11 | static DbManager? get instance => _getInstance();
12 | static DbManager? _instance;
13 | static Database? database;
14 | static String dbName = 'UserInfoCache.db';
15 | static String userTableName = 'users';
16 | static String groupTableName = 'groups';
17 |
18 | DbManager._internal() {
19 | // 初始化
20 | }
21 |
22 | static DbManager? _getInstance() {
23 | if (_instance == null) {
24 | _instance = new DbManager._internal();
25 | }
26 | return _instance;
27 | }
28 |
29 | Future openDb() async {
30 | database = await openDatabase(join(await getDatabasesPath(), dbName), onCreate: (db, version) {
31 | db.execute("CREATE TABLE $userTableName(userId TEXT PRIMARY KEY, name TEXT, portraitUrl TEXT) ");
32 | db.execute("CREATE TABLE $groupTableName(groupId TEXT PRIMARY KEY, name TEXT, portraitUrl TEXT)");
33 | }, version: 1);
34 | }
35 |
36 | Future setUserInfo(UserInfo info) async {
37 | if (database == null) {
38 | await openDb();
39 | }
40 | await database?.insert(userTableName, info.toMap(), conflictAlgorithm: ConflictAlgorithm.replace);
41 | }
42 |
43 | Future> getUserInfo({String? userId}) async {
44 | List