diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..41cc7d8 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.0.1 + +* TODO: Describe initial release. diff --git a/LICENSE b/LICENSE index 261eeb9..ba75c69 100644 --- a/LICENSE +++ b/LICENSE @@ -1,201 +1 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +TODO: Add your license here. diff --git a/README.md b/README.md new file mode 100644 index 0000000..9146470 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# flutter_openim_sdk + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter +[plug-in package](https://flutter.dev/developing-packages/), +a specialized package that includes platform-specific implementation code for +Android and/or iOS. + +For help getting started with Flutter, view our +[online documentation](https://flutter.dev/docs), which offers tutorials, +samples, guidance on mobile development, and a full API reference. + diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..c6cbe56 --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/android/build.gradle b/android/build.gradle new file mode 100644 index 0000000..34ff708 --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,52 @@ +group 'io.openim.flutter_openim_sdk' +version '1.0' + +buildscript { + repositories { + maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } + maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } + maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' } + maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' } + google() + maven { + url 'http://127.0.0.1:8081/repository/maven-releases/' //这个路径就是Browse下maven-release右边有一个copy按钮,复制出来的。 + } + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.5.1' + } +} + +rootProject.allprojects { + repositories { + maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } + maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } + maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' } + maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' } + google() + maven { + url 'http://127.0.0.1:8081/repository/maven-releases' //这个路径就是Browse下maven-release右边有一个copy按钮,复制出来的。 + } + mavenCentral() + } +} + +apply plugin: 'com.android.library' + +android { + compileSdkVersion 30 + + defaultConfig { + minSdkVersion 21 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} +dependencies { + implementation 'com.alibaba:fastjson:1.1.72.android' + implementation 'io.openim:localsdk:1.1.4@aar'//graoupId:artifactId:version@aar +} \ No newline at end of file diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..be9024e --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,4 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true +android.enableDexingArtifactTransform=false \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..3c9d085 --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip diff --git a/android/settings.gradle b/android/settings.gradle new file mode 100644 index 0000000..dc38937 --- /dev/null +++ b/android/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'flutter_openim_sdk' diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml new file mode 100644 index 0000000..20bc59f --- /dev/null +++ b/android/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/FlutterOpenimSdkPlugin.java b/android/src/main/java/io/openim/flutter_openim_sdk/FlutterOpenimSdkPlugin.java new file mode 100644 index 0000000..62bdc3e --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/FlutterOpenimSdkPlugin.java @@ -0,0 +1,82 @@ +package io.openim.flutter_openim_sdk; + +import android.content.Context; + +import androidx.annotation.NonNull; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import io.flutter.embedding.engine.plugins.FlutterPlugin; +import io.flutter.plugin.common.EventChannel; +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.flutter.plugin.common.MethodChannel.MethodCallHandler; +import io.flutter.plugin.common.MethodChannel.Result; +import io.openim.flutter_openim_sdk.manager.ConversationManager; +import io.openim.flutter_openim_sdk.manager.FriendshipManager; +import io.openim.flutter_openim_sdk.manager.IMManager; +import io.openim.flutter_openim_sdk.manager.MessageManager; +import io.openim.flutter_openim_sdk.util.CommonUtil; + + +/** + * FlutterOpenimSdkPlugin + */ +public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler { + /// The MethodChannel that will the communication between Flutter and native Android + /// + /// This local reference serves to register the plugin with the Flutter Engine and unregister it + /// when the Flutter Engine is detached from the Activity + public static MethodChannel channel; + private static IMManager imManager; + private static FriendshipManager friendshipManager; + private static MessageManager messageManager; + private static ConversationManager conversationManager; + + public FlutterOpenimSdkPlugin() { + } + + private FlutterOpenimSdkPlugin(Context context, MethodChannel channel) { + FlutterOpenimSdkPlugin.imManager = new IMManager(channel); + FlutterOpenimSdkPlugin.friendshipManager = new FriendshipManager(channel); + FlutterOpenimSdkPlugin.messageManager = new MessageManager(channel); + FlutterOpenimSdkPlugin.conversationManager = new ConversationManager(channel); + } + + @Override + public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) { + channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "flutter_openim_sdk"); + channel.setMethodCallHandler(new FlutterOpenimSdkPlugin(flutterPluginBinding.getApplicationContext(), channel)); +// channel.setMethodCallHandler(this); + } + + @Override + public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { + parse(call, result); + } + + @Override + public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { + channel.setMethodCallHandler(null); + } + + void parse(@NonNull MethodCall call, @NonNull Result result) { + try { + String managerName = CommonUtil.getParamValue(call, "ManagerName"); + Field field = FlutterOpenimSdkPlugin.class.getDeclaredField(managerName); + Method method = field.get(new Object()).getClass().getDeclaredMethod(call.method, MethodCall.class, Result.class); + System.out.println("flutter call native { class:" + managerName + ", method:" + method.getName() + " }"); + method.invoke(field.get(new Object()), call, result); + } catch (NoSuchFieldException e) { + e.printStackTrace(); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } + } +} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/AdvancedMsgListenerImpl.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/AdvancedMsgListenerImpl.java new file mode 100644 index 0000000..80c8b70 --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/AdvancedMsgListenerImpl.java @@ -0,0 +1,36 @@ +package io.openim.flutter_openim_sdk.listener; + +import java.util.HashMap; +import java.util.Map; + +import io.flutter.plugin.common.MethodChannel; +import io.openim.flutter_openim_sdk.util.CommonUtil; +import open_im_sdk.OnAdvancedMsgListener; + +public class AdvancedMsgListenerImpl implements OnAdvancedMsgListener { + final MethodChannel channel; + final Map values = new HashMap<>(); + + public AdvancedMsgListenerImpl(MethodChannel channel, String id) { + this.channel = channel; + this.values.put("id", id); + } + + @Override + public void onRecvC2CReadReceipt(String s) { + values.put("message", s); + CommonUtil.emitEvent(channel, "advancedMsgListener", "onRecvC2CReadReceipt", values); + } + + @Override + public void onRecvMessageRevoked(String s) { + values.put("message", s); + CommonUtil.emitEvent(channel, "advancedMsgListener", "onRecvMessageRevoked", values); + } + + @Override + public void onRecvNewMessage(String s) { + values.put("message", s); + CommonUtil.emitEvent(channel, "advancedMsgListener", "onRecvNewMessage", values); + } +} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/BaseImpl.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/BaseImpl.java new file mode 100644 index 0000000..f3a8f15 --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/BaseImpl.java @@ -0,0 +1,27 @@ +package io.openim.flutter_openim_sdk.listener; + + +import io.flutter.plugin.common.MethodChannel; +import io.openim.flutter_openim_sdk.util.CommonUtil; +import open_im_sdk.Base; + +public class BaseImpl implements Base { + + MethodChannel.Result result; + + public BaseImpl(MethodChannel.Result result) { + this.result = result; + } + + @Override + public void onError(long l, String s) { + System.out.println("BaseImpl:" + s); + CommonUtil.runMainThreadReturnError(result, l, s, null); + } + + @Override + public void onSuccess(String s) { + System.out.println("BaseImpl:" + s); + CommonUtil.runMainThreadReturn(result, s); + } +} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/ConversationListenerImpl.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/ConversationListenerImpl.java new file mode 100644 index 0000000..fea99c6 --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/ConversationListenerImpl.java @@ -0,0 +1,43 @@ +package io.openim.flutter_openim_sdk.listener; + +import io.flutter.plugin.common.MethodChannel; +import io.openim.flutter_openim_sdk.util.CommonUtil; +import open_im_sdk.OnConversationListener; + +public class ConversationListenerImpl implements OnConversationListener { + private final MethodChannel channel; + + public ConversationListenerImpl(MethodChannel channel) { + this.channel = channel; + } + + @Override + public void onConversationChanged(String s) { + CommonUtil.emitEvent(channel, "conversationListener", "onConversationChanged", s); + } + + @Override + public void onNewConversation(String s) { + CommonUtil.emitEvent(channel, "conversationListener", "onNewConversation", s); + } + + @Override + public void onSyncServerFailed() { + CommonUtil.emitEvent(channel, "conversationListener", "onSyncServerFailed", null); + } + + @Override + public void onSyncServerFinish() { + CommonUtil.emitEvent(channel, "conversationListener", "onSyncServerFinish", null); + } + + @Override + public void onSyncServerStart() { + CommonUtil.emitEvent(channel, "conversationListener", "onSyncServerStart", null); + } + + @Override + public void onTotalUnreadMessageCountChanged(int i) { + CommonUtil.emitEvent(channel, "conversationListener", "onTotalUnreadMessageCountChanged", i); + } +} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/FriendshipListenerImpl.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/FriendshipListenerImpl.java new file mode 100644 index 0000000..cca93b6 --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/FriendshipListenerImpl.java @@ -0,0 +1,58 @@ +package io.openim.flutter_openim_sdk.listener; + +import io.flutter.plugin.common.MethodChannel; +import io.openim.flutter_openim_sdk.util.CommonUtil; +import open_im_sdk.OnFriendshipListener; + +public class FriendshipListenerImpl implements OnFriendshipListener { + private final MethodChannel channel; + + public FriendshipListenerImpl(MethodChannel channel) { + this.channel = channel; + } + + @Override + public void onBlackListAdd(String s) { + CommonUtil.emitEvent(channel, "friendListener", "onBlackListAdd", s); + } + + @Override + public void onBlackListDeleted(String s) { + CommonUtil.emitEvent(channel, "friendListener", "onBlackListDeleted", s); + } + + @Override + public void onFriendApplicationListAccept(String s) { + CommonUtil.emitEvent(channel, "friendListener", "onFriendApplicationListAccept", s); + } + + @Override + public void onFriendApplicationListAdded(String s) { + CommonUtil.emitEvent(channel, "friendListener", "onFriendApplicationListAdded", s); + } + + @Override + public void onFriendApplicationListDeleted(String s) { + CommonUtil.emitEvent(channel, "friendListener", "onFriendApplicationListDeleted", s); + } + + @Override + public void onFriendApplicationListReject(String s) { + CommonUtil.emitEvent(channel, "friendListener", "onFriendApplicationListReject", s); + } + + @Override + public void onFriendInfoChanged(String s) { + CommonUtil.emitEvent(channel, "friendListener", "onFriendInfoChanged", s); + } + + @Override + public void onFriendListAdded(String s) { + CommonUtil.emitEvent(channel, "friendListener", "onFriendListAdded", s); + } + + @Override + public void onFriendListDeleted(String s) { + CommonUtil.emitEvent(channel, "friendListener", "onFriendListDeleted", s); + } +} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/SDKListenerImpl.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/SDKListenerImpl.java new file mode 100644 index 0000000..fc775e7 --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/SDKListenerImpl.java @@ -0,0 +1,44 @@ +package io.openim.flutter_openim_sdk.listener; + + +import io.flutter.plugin.common.MethodChannel; +import io.openim.flutter_openim_sdk.util.CommonUtil; +import open_im_sdk.IMSDKListener; + +public class SDKListenerImpl implements IMSDKListener { + final private MethodChannel channel; + + public SDKListenerImpl(MethodChannel channel) { + this.channel = channel; + } + + @Override + public void onConnectFailed(long l, String s) { + CommonUtil.emitEvent(channel, "initSDKListener", "onConnectFailed", l, s, null); + } + + @Override + public void onConnectSuccess() { + CommonUtil.emitEvent(channel, "initSDKListener", "onConnectSuccess", null); + } + + @Override + public void onConnecting() { + CommonUtil.emitEvent(channel, "initSDKListener", "onConnecting", null); + } + + @Override + public void onKickedOffline() { + CommonUtil.emitEvent(channel, "initSDKListener", "onKickedOffline", null); + } + + @Override + public void onSelfInfoUpdated(String s) { + CommonUtil.emitEvent(channel, "initSDKListener", "onSelfInfoUpdated", s); + } + + @Override + public void onUserTokenExpired() { + CommonUtil.emitEvent(channel, "initSDKListener", "onUserTokenExpired", null); + } +} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/SendMsgProgressListener.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/SendMsgProgressListener.java new file mode 100644 index 0000000..17ad4de --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/SendMsgProgressListener.java @@ -0,0 +1,45 @@ +package io.openim.flutter_openim_sdk.listener; + +import java.util.HashMap; +import java.util.Map; + +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.openim.flutter_openim_sdk.util.CommonUtil; +import open_im_sdk.SendMsgCallBack; + +public class SendMsgProgressListener implements SendMsgCallBack { + + + public SendMsgProgressListener(MethodChannel.Result result, MethodChannel channel, MethodCall call) { + this.result = result; + this.channel = channel; + this.call = call; + } + + final private MethodChannel.Result result; + final private MethodChannel channel; + final private MethodCall call; + final Map values = new HashMap<>(); + + + @Override + public void onError(long l, String s) { + System.out.println("=================onError============" + s); + CommonUtil.runMainThreadReturnError(result, l, s, null); + } + + @Override + public void onProgress(long l) { + System.out.println("================onProgress============" + l); + values.put("clientMsgID", CommonUtil.getSendMessageClientMsgID(call)); + values.put("progress", l); + CommonUtil.emitEvent(channel, "messageProgressListener", "onProgress", values); + } + + @Override + public void onSuccess(String s) { + System.out.println("=================onSuccess============" + s); + CommonUtil.runMainThreadReturn(result, s); + } +} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/ConversationManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/ConversationManager.java new file mode 100644 index 0000000..0276a50 --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/ConversationManager.java @@ -0,0 +1,48 @@ +package io.openim.flutter_openim_sdk.manager; + +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.openim.flutter_openim_sdk.listener.BaseImpl; +import io.openim.flutter_openim_sdk.listener.ConversationListenerImpl; +import io.openim.flutter_openim_sdk.util.CommonUtil; +import open_im_sdk.Open_im_sdk; + +public class ConversationManager { + final private MethodChannel channel; + + public ConversationManager(MethodChannel channel) { + this.channel = channel; + } + + public void setConversationListener(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.setConversationListener(new ConversationListenerImpl(channel)); + } + + public void getAllConversationList(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getAllConversationList(new BaseImpl(result)); + } + + public void getOneConversation(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getOneConversation(CommonUtil.getConversationId(methodCall), new BaseImpl(result)); + } + + public void getMultipleConversation(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getMultipleConversation(CommonUtil.getConversationIds(methodCall), new BaseImpl(result)); + } + + public void deleteConversation(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.deleteConversation(CommonUtil.getConversationId(methodCall), new BaseImpl(result)); + } + + public void setConversationDraft(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.setConversationDraft(CommonUtil.getConversationId(methodCall), CommonUtil.getConversationDraft(methodCall), new BaseImpl(result)); + } + + public void pinConversation(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.pinConversation(CommonUtil.getConversationId(methodCall), CommonUtil.isPinnedConversation(methodCall), new BaseImpl(result)); + } + + public void getTotalUnreadMsgCount(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getTotalUnreadMsgCount(new BaseImpl(result)); + } +} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/FriendshipManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/FriendshipManager.java new file mode 100644 index 0000000..fc6d90b --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/FriendshipManager.java @@ -0,0 +1,81 @@ +package io.openim.flutter_openim_sdk.manager; + +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.openim.flutter_openim_sdk.listener.BaseImpl; +import io.openim.flutter_openim_sdk.listener.FriendshipListenerImpl; +import io.openim.flutter_openim_sdk.util.CommonUtil; +import open_im_sdk.Open_im_sdk; + +public class FriendshipManager { + + final private MethodChannel channel; + + public FriendshipManager(MethodChannel channel) { + this.channel = channel; + } + + public void setFriendListener(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.setFriendListener(new FriendshipListenerImpl(channel)); + } + + public void getFriendsInfo(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getFriendsInfo(new BaseImpl(result), CommonUtil.getSDKJsonParam(methodCall)); + } + + public void addFriend(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.addFriend(new BaseImpl(result), CommonUtil.getSDKJsonParam(methodCall)); + } + + public void getFriendApplicationList(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getFriendApplicationList(new BaseImpl(result)); + } + + public void getFriendList(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getFriendList(new BaseImpl(result)); + } + + public void setFriendInfo(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.setFriendInfo(CommonUtil.getSDKJsonParam(methodCall), new BaseImpl(result)); + } + + public void addToBlackList(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.addToBlackList(new BaseImpl(result), CommonUtil.getSDKJsonParam(methodCall)); + } + + public void getBlackList(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getBlackList(new BaseImpl(result)); + } + + public void deleteFromBlackList(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.deleteFromBlackList(new BaseImpl(result), CommonUtil.getSDKJsonParam(methodCall)); + } + + public void checkFriend(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.checkFriend(new BaseImpl(result), CommonUtil.getSDKJsonParam(methodCall)); + } + + public void deleteFromFriendList(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.deleteFromFriendList(CommonUtil.getSDKJsonParam(methodCall), new BaseImpl(result)); + } + + public void acceptFriendApplication(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.acceptFriendApplication(new BaseImpl(result), CommonUtil.getSDKJsonParam(methodCall)); + } + + public void refuseFriendApplication(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.refuseFriendApplication(new BaseImpl(result), CommonUtil.getSDKJsonParam(methodCall)); + } + + public void forceSyncFriendApplication(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.forceSyncFriendApplication(); + } + + public void forceSyncFriend(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.forceSyncFriend(); + } + + public void forceSyncBlackList(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.forceSyncBlackList(); + } +} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/IMManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/IMManager.java new file mode 100644 index 0000000..b47ab80 --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/IMManager.java @@ -0,0 +1,50 @@ +package io.openim.flutter_openim_sdk.manager; + +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.openim.flutter_openim_sdk.listener.BaseImpl; +import io.openim.flutter_openim_sdk.listener.SDKListenerImpl; +import io.openim.flutter_openim_sdk.util.CommonUtil; +import open_im_sdk.Open_im_sdk; + +public class IMManager { + + final private MethodChannel channel; + + public IMManager(MethodChannel channel) { + this.channel = channel; + } + + public void initSDK(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.initSDK(CommonUtil.getSDKJsonParam(methodCall), new SDKListenerImpl(channel)); + CommonUtil.runMainThreadReturn(result, null); + } + + public void login(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.login(CommonUtil.getUid(methodCall), CommonUtil.getToken(methodCall), new BaseImpl(result)); + } + + public void logout(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.logout(new BaseImpl(result)); + } + + public void getLoginStatus(MethodCall methodCall, MethodChannel.Result result) { + CommonUtil.runMainThreadReturn(result, Open_im_sdk.getLoginStatus()); + } + + public void getLoginUid(MethodCall methodCall, MethodChannel.Result result) { + CommonUtil.runMainThreadReturn(result, Open_im_sdk.getLoginUid()); + } + + public void getUsersInfo(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getUsersInfo(CommonUtil.getSDKJsonParam(methodCall), new BaseImpl(result)); + } + + public void setSelfInfo(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.setSelfInfo(CommonUtil.getSDKJsonParam(methodCall), new BaseImpl(result)); + } + + public void forceSyncLoginUerInfo(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.forceSyncLoginUerInfo(); + } +} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/MessageManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/MessageManager.java new file mode 100644 index 0000000..f45bef1 --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/MessageManager.java @@ -0,0 +1,108 @@ +package io.openim.flutter_openim_sdk.manager; + +import java.util.HashMap; +import java.util.Map; + +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.openim.flutter_openim_sdk.listener.AdvancedMsgListenerImpl; +import io.openim.flutter_openim_sdk.listener.BaseImpl; +import io.openim.flutter_openim_sdk.listener.SendMsgProgressListener; +import io.openim.flutter_openim_sdk.util.CommonUtil; +import open_im_sdk.OnAdvancedMsgListener; +import open_im_sdk.Open_im_sdk; + + +public class MessageManager { + private final static String KEY_ID = "id"; + private final MethodChannel channel; + private final static Map listeners = new HashMap<>(); + + + public MessageManager(MethodChannel channel) { + this.channel = channel; + } + + public void addAdvancedMsgListener(MethodCall methodCall, MethodChannel.Result result) { + String key = methodCall.argument(KEY_ID); + if (!listeners.containsKey(key)) { + AdvancedMsgListenerImpl listener = new AdvancedMsgListenerImpl(channel, key); + listeners.put(methodCall.argument(KEY_ID), listener); + Open_im_sdk.addAdvancedMsgListener(listener); + System.out.println("=================add msg listener======" + listener); + } + } + + public void removeAdvancedMsgListener(MethodCall methodCall, MethodChannel.Result result) { + String key = methodCall.argument(KEY_ID); + OnAdvancedMsgListener listener = listeners.remove(key); + Open_im_sdk.removeAdvancedMsgListener(listener); + System.out.println("=================remove msg listener======" + listener); + } + + public void sendMessage(MethodCall methodCall, MethodChannel.Result result) { + SendMsgProgressListener listener = new SendMsgProgressListener(result, channel, methodCall); + System.out.println("===============sendMessage==============="); + Open_im_sdk.sendMessage(listener, CommonUtil.getSendMessageContent(methodCall), CommonUtil.getSendMessageReceiver(methodCall), CommonUtil.geSendMessageGroupId(methodCall), CommonUtil.getSendMessageOnlineOnly(methodCall)); + } + + public void getHistoryMessageList(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getHistoryMessageList(new BaseImpl(result), CommonUtil.getSDKJsonParam(methodCall)); + } + + public void revokeMessage(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.revokeMessage(new BaseImpl(result), CommonUtil.getSDKJsonParam(methodCall)); + } + + public void deleteMessageFromLocalStorage(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.deleteMessageFromLocalStorage(new BaseImpl(result), CommonUtil.getSDKJsonParam(methodCall)); + } + + public void deleteMessages(MethodCall methodCall, MethodChannel.Result result) { +// Open_im_sdk.deleteMessages(new BaseImpl(result), CommonUtil.getSDKJsonParam(methodCall)); + } + + public void insertSingleMessageToLocalStorage(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.insertSingleMessageToLocalStorage(new BaseImpl(result), CommonUtil.getSingleMessageContent(methodCall), CommonUtil.getSingleMessageUserid(methodCall), CommonUtil.getSingleMessageSender(methodCall)); + } + + public void findMessages(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.findMessages(new BaseImpl(result), CommonUtil.getFindMessageIds(methodCall)); + } + + public void markSingleMessageHasRead(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.markSingleMessageHasRead(new BaseImpl(result), CommonUtil.getSingleMessageUserid(methodCall)); + } + + public void createTextMessage(MethodCall methodCall, MethodChannel.Result result) { + CommonUtil.runMainThreadReturn(result, Open_im_sdk.createTextMessage(CommonUtil.getMessageText(methodCall))); + } + + public void createTextAtMessage(MethodCall methodCall, MethodChannel.Result result) { + CommonUtil.runMainThreadReturn(result, Open_im_sdk.createTextAtMessage(CommonUtil.getMessageText(methodCall), CommonUtil.getAtUserList(methodCall))); + } + + public void createImageMessage(MethodCall methodCall, MethodChannel.Result result) { + CommonUtil.runMainThreadReturn(result, Open_im_sdk.createImageMessage(CommonUtil.getImagePath(methodCall))); + } + + public void createSoundMessage(MethodCall methodCall, MethodChannel.Result result) { + CommonUtil.runMainThreadReturn(result, Open_im_sdk.createSoundMessage(CommonUtil.getSoundPath(methodCall), CommonUtil.getSoundDuration(methodCall))); + } + + public void createVideoMessage(MethodCall methodCall, MethodChannel.Result result) { + CommonUtil.runMainThreadReturn(result, Open_im_sdk.createVideoMessage(CommonUtil.getVideoPath(methodCall), CommonUtil.getVideoType(methodCall), CommonUtil.getVideoDuration(methodCall), CommonUtil.getVideoSnapshotPath(methodCall))); + } + + public void createFileMessage(MethodCall methodCall, MethodChannel.Result result) { + CommonUtil.runMainThreadReturn(result, Open_im_sdk.createFileMessage(CommonUtil.getFilePath(methodCall), CommonUtil.getFileName(methodCall))); + } + + public void createMergerMessage(MethodCall methodCall, MethodChannel.Result result) { + CommonUtil.runMainThreadReturn(result, Open_im_sdk.createMergerMessage(CommonUtil.getMergerMessageList(methodCall), CommonUtil.getMergerMessageTitle(methodCall), CommonUtil.getSummaryList(methodCall))); + } + + public void createForwardMessage(MethodCall methodCall, MethodChannel.Result result) { + CommonUtil.runMainThreadReturn(result, Open_im_sdk.createForwardMessage(CommonUtil.getForwardMessage(methodCall))); + } +} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/util/CommonUtil.java b/android/src/main/java/io/openim/flutter_openim_sdk/util/CommonUtil.java new file mode 100644 index 0000000..1970761 --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/util/CommonUtil.java @@ -0,0 +1,286 @@ +package io.openim.flutter_openim_sdk.util; + +import android.os.Handler; +import android.os.Looper; + +import java.util.HashMap; +import java.util.Map; + +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.openim.flutter_openim_sdk.FlutterOpenimSdkPlugin; + + +public class CommonUtil { + /** + * 主线程处理器 + */ + private final static Handler MAIN_HANDLER = new Handler(Looper.getMainLooper()); + + public static T getParamValue(MethodCall methodCall, String param) { + return methodCall.argument(param); + } + + public static String getSDKJsonParam(MethodCall methodCall, String key) { + return JsonUtil.toString(methodCall.argument(key)); + } + + public static String getSDKJsonParam(MethodCall methodCall) { + return JsonUtil.toString(methodCall.arguments); + } + + public static void runMainThreadReturn(final MethodChannel.Result result, final Object param) { + MAIN_HANDLER.post(new Runnable() { + @Override + public void run() { + result.success(param); + } + }); + } + + public static void runMainThread(Runnable runnable) { + MAIN_HANDLER.post(runnable); + } + + /** + * 运行主线程返回错误结果执行 + * + * @param result 返回结果对象 + * @param errorCode 错误码 + * @param errorMessage 错误信息 + * @param errorDetails 错误内容 + */ + public static void runMainThreadReturnError(final MethodChannel.Result result, final String errorCode, final String errorMessage, final Object errorDetails) { + MAIN_HANDLER.post(new Runnable() { + @Override + public void run() { + result.error(errorCode, errorMessage, errorDetails); + } + }); + } + + public static void runMainThreadReturnError(final MethodChannel.Result result, final long errorCode, final String errorMessage, final Object errorDetails) { + runMainThreadReturnError(result, String.valueOf(errorCode), errorMessage, errorDetails); + } + +/* + + public static void returnError(final MethodChannel.Result result, int i, String s) { + HashMap err = new HashMap(); + err.put("code", i); + err.put("desc", s); + result.success(err); + } + + public static void returnError(final MethodChannel.Result result, int i, String s, HashMap data) { + HashMap err = new HashMap(); + err.put("code", i); + err.put("desc", s); + err.put("data", data); + result.success(err); + } + + public static void returnSuccess(final MethodChannel.Result result, T data) { + HashMap succ = new HashMap(); + succ.put("code", 0); + succ.put("desc", "ok"); + succ.put("data", data); + result.success(succ); + } +*/ + + + public static void emitEvent(MethodChannel channel, String method, String type, Long errCode, String errMsg, T data) { + runMainThread(new Runnable() { + @Override + public void run() { + HashMap res = new HashMap(); +// if (null != type) { + res.put("type", type); +// } + if (null != data) { + res.put("data", data); + } + if (null != errCode) { + res.put("errCode", errCode); + } + if (null != errMsg) { + res.put("errMsg", errMsg); + } + System.out.println("native call flutter { method:" + method + ", type:" + type + " }"); + FlutterOpenimSdkPlugin.channel.invokeMethod(method, res); + } + }); + } + + public static void emitEvent(MethodChannel channel, String method, String type, T data) { + emitEvent(channel, method, type, null, null, data); + } + + + /////////////////////////////////////// + ////////////////////////////////////// + public static String getUid(MethodCall methodCall) { + return getParamValue(methodCall, KEY_LOGIN_UID); + } + + public static String getToken(MethodCall methodCall) { + return getParamValue(methodCall, KEY_LOGIN_TOKEN); + } + + public static String getMessageText(MethodCall methodCall) { + return getParamValue(methodCall, KEY_TEXT); + } + + public static String getAtUserList(MethodCall methodCall) { +// return methodCall.argument(KEY_AT_USER_LIST); + return getSDKJsonParam(methodCall, KEY_AT_USER_LIST); + } + + public static String getImagePath(MethodCall methodCall) { + return getParamValue(methodCall, KEY_IMAGE_PATH); + } + + public static String getSoundPath(MethodCall methodCall) { + return getParamValue(methodCall, KEY_SOUND_PATH); + } + + public static long getSoundDuration(MethodCall methodCall) { + Integer i = getParamValue(methodCall, KEY_SOUND_DURATION); + return Long.valueOf(i); + } + + public static String getVideoPath(MethodCall methodCall) { + return getParamValue(methodCall, KEY_VIDEO_PATH); + } + + public static String getVideoType(MethodCall methodCall) { + return getParamValue(methodCall, KEY_VIDEO_TYPE); + } + + public static long getVideoDuration(MethodCall methodCall) { + Integer i = getParamValue(methodCall, KEY_VIDEO_DURATION); + return Long.valueOf(i); + } + + public static String getVideoSnapshotPath(MethodCall methodCall) { + return getParamValue(methodCall, KEY_VIDEO_SNAPSHOT_PATH); + } + + public static String getFilePath(MethodCall methodCall) { + return getParamValue(methodCall, KEY_FILE_PATH); + } + + public static String getFileName(MethodCall methodCall) { + return getParamValue(methodCall, KEY_FILE_NAME); + } + + public static String getMergerMessageList(MethodCall methodCall) { +// return methodCall.argument(KEY_MERGER_MESSAGE_LIST); + return getSDKJsonParam(methodCall, KEY_MERGER_MESSAGE_LIST); + } + + public static String getMergerMessageTitle(MethodCall methodCall) { + return getParamValue(methodCall, KEY_MERGER_MESSAGE_TITLE); + } + + public static String getSummaryList(MethodCall methodCall) { +// return methodCall.argument(KEY_SUMMARY_LIST); + return getSDKJsonParam(methodCall, KEY_SUMMARY_LIST); + } + + public static String getForwardMessage(MethodCall methodCall) { +// return methodCall.argument(KEY_FORWARD_MESSAGE); + return getSDKJsonParam(methodCall, KEY_FORWARD_MESSAGE); + } + + public static String getSendMessageContent(MethodCall methodCall) { + return getSDKJsonParam(methodCall, KEY_SEND_MESSAGE_CONTENT); + } + + public static Object getSendMessageClientMsgID(MethodCall methodCall) { + Map map = getParamValue(methodCall, KEY_SEND_MESSAGE_CONTENT); + return map.get(KEY_SEND_MESSAGE_CONTENT_CLIENT_ID); + } + + public static String getSendMessageReceiver(MethodCall methodCall) { + return getParamValue(methodCall, KEY_SEND_MESSAGE_RECEIVER); + } + + public static String geSendMessageGroupId(MethodCall methodCall) { + return getParamValue(methodCall, KEY_SEND_MESSAGE_GROUP_ID); + } + + public static boolean getSendMessageOnlineOnly(MethodCall methodCall) { + return getParamValue(methodCall, KEY_SEND_MESSAGE_ONLINE_ONLY); + } + + public static String getSingleMessageContent(MethodCall methodCall) { + return getParamValue(methodCall, KEY_SINGLE_MESSAGE_CONTENT); + } + + public static String getSingleMessageUserid(MethodCall methodCall) { + return getParamValue(methodCall, KEY_SINGLE_MESSAGE_USERID); + } + + public static String getSingleMessageSender(MethodCall methodCall) { + return getParamValue(methodCall, KEY_SINGLE_MESSAGE_SENDER); + } + + public static String getFindMessageIds(MethodCall methodCall) { + return getSDKJsonParam(methodCall, KEY_FIND_MESSAGE_IDS); + } + + public static String getConversationId(MethodCall methodCall) { + return getParamValue(methodCall, KEY_CONVERSATION_ID); + } + + public static String getConversationIds(MethodCall methodCall) { + return getSDKJsonParam(methodCall, KEY_CONVERSATION_IDS); + } + + public static String getConversationDraft(MethodCall methodCall) { + return getParamValue(methodCall, KEY_CONVERSATION_DRAFT); + } + + public static boolean isPinnedConversation(MethodCall methodCall) { + return getParamValue(methodCall, KEY_CONVERSATION_PINNED); + } + + //login + final static String KEY_LOGIN_UID = "uid"; + final static String KEY_LOGIN_TOKEN = "token"; + //create message body + final static String KEY_TEXT = "text"; + final static String KEY_AT_USER_LIST = "atUserList"; + final static String KEY_IMAGE_PATH = "imagePath"; + final static String KEY_SOUND_PATH = "soundPath"; + final static String KEY_SOUND_DURATION = "duration"; + final static String KEY_VIDEO_PATH = "videoPath"; + final static String KEY_VIDEO_TYPE = "videoType"; + final static String KEY_VIDEO_DURATION = "duration"; + final static String KEY_VIDEO_SNAPSHOT_PATH = "snapshotPath"; + final static String KEY_FILE_PATH = "filePath"; + final static String KEY_FILE_NAME = "fileName"; + final static String KEY_MERGER_MESSAGE_LIST = "messageList"; + final static String KEY_MERGER_MESSAGE_TITLE = "title"; + final static String KEY_SUMMARY_LIST = "summaryList"; + final static String KEY_FORWARD_MESSAGE = "message"; + //send message + final static String KEY_SEND_MESSAGE_CONTENT = "message"; + final static String KEY_SEND_MESSAGE_CONTENT_CLIENT_ID = "clientMsgID"; + final static String KEY_SEND_MESSAGE_RECEIVER = "receiver"; + final static String KEY_SEND_MESSAGE_GROUP_ID = "groupID"; + final static String KEY_SEND_MESSAGE_ONLINE_ONLY = "onlineUserOnly"; + //single chat + final static String KEY_SINGLE_MESSAGE_CONTENT = "message"; + final static String KEY_SINGLE_MESSAGE_USERID = "userID"; + final static String KEY_SINGLE_MESSAGE_SENDER = "sender"; + // find message + final static String KEY_FIND_MESSAGE_IDS = "messageIDList"; + // conversation + final static String KEY_CONVERSATION_ID = "conversationID"; + final static String KEY_CONVERSATION_IDS = "conversationIDList"; + final static String KEY_CONVERSATION_DRAFT = "draftText"; + final static String KEY_CONVERSATION_PINNED = "isPinned"; +} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/util/JsonUtil.java b/android/src/main/java/io/openim/flutter_openim_sdk/util/JsonUtil.java new file mode 100644 index 0000000..498ad9d --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/util/JsonUtil.java @@ -0,0 +1,70 @@ +package io.openim.flutter_openim_sdk.util; + + +import android.text.TextUtils; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; + +import java.util.List; +import java.util.Map; + +import static com.alibaba.fastjson.JSON.parseObject; + +public class JsonUtil { + + public static String toString(Object object) { + if (object == null) { + return ""; + } + try { + return JSON.toJSONString(object); + } catch (Exception e) { + e.printStackTrace(); + } + return ""; + } + + + public static T toObj(String jsonData, Class clazz) { + T t = null; + if (TextUtils.isEmpty(jsonData)) { + return null; + } + try { + t = parseObject(jsonData, clazz); + } catch (Exception e) { + e.printStackTrace(); + } + return t; + } + + + public static List toList(String jsonData, Class clazz) { + List list = null; + try { + list = JSON.parseArray(jsonData, clazz); + } catch (Exception e) { + e.printStackTrace(); + } + return list; + } + + + /** + * json转化为Map fastjson 使用方式 + */ + public static Map toMap(String jsonData) { + if (TextUtils.isEmpty(jsonData)) { + return null; + } + Map map = null; + try { + map = parseObject(jsonData, new TypeReference() { + }); + } catch (Exception e) { + e.printStackTrace(); + } + return map; + } +} \ No newline at end of file diff --git a/build/test_cache/build/c075001b96339384a97db4862b8ab8db.cache.dill.track.dill b/build/test_cache/build/c075001b96339384a97db4862b8ab8db.cache.dill.track.dill new file mode 100644 index 0000000..cb72e47 Binary files /dev/null and b/build/test_cache/build/c075001b96339384a97db4862b8ab8db.cache.dill.track.dill differ diff --git a/example/.gitignore b/example/.gitignore new file mode 100644 index 0000000..0fa6b67 --- /dev/null +++ b/example/.gitignore @@ -0,0 +1,46 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Web related +lib/generated_plugin_registrant.dart + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/example/.metadata b/example/.metadata new file mode 100644 index 0000000..54ec0a8 --- /dev/null +++ b/example/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: b22742018b3edf16c6cadd7b76d9db5e7f9064b5 + channel: stable + +project_type: app diff --git a/example/README.md b/example/README.md new file mode 100644 index 0000000..b429779 --- /dev/null +++ b/example/README.md @@ -0,0 +1,16 @@ +# flutter_openim_sdk_example + +Demonstrates how to use the flutter_openim_sdk plugin. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) + +For help getting started with Flutter, view our +[online documentation](https://flutter.dev/docs), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/example/android/.gitignore b/example/android/.gitignore new file mode 100644 index 0000000..0a741cb --- /dev/null +++ b/example/android/.gitignore @@ -0,0 +1,11 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle new file mode 100644 index 0000000..03d1377 --- /dev/null +++ b/example/android/app/build.gradle @@ -0,0 +1,69 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +apply plugin: 'com.android.application' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 30 + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "io.openim.flutter_openim_sdk_example" + minSdkVersion 21 + targetSdkVersion 30 + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + buildTypes { + debug { + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + // signingConfig signingConfigs.debug + + signingConfig signingConfigs.debug + + minifyEnabled false + shrinkResources false + + useProguard true + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + + repositories{ + flatDir { + dirs 'libs' + } + } +} +dependencies { + +} +flutter { + source '../..' +} diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..d986b22 --- /dev/null +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..50b8b5b --- /dev/null +++ b/example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + diff --git a/example/android/app/src/main/java/io/openim/flutter_openim_sdk_example/MainActivity.java b/example/android/app/src/main/java/io/openim/flutter_openim_sdk_example/MainActivity.java new file mode 100644 index 0000000..9741c22 --- /dev/null +++ b/example/android/app/src/main/java/io/openim/flutter_openim_sdk_example/MainActivity.java @@ -0,0 +1,6 @@ +package io.openim.flutter_openim_sdk_example; + +import io.flutter.embedding.android.FlutterActivity; + +public class MainActivity extends FlutterActivity { +} diff --git a/example/android/app/src/main/res/drawable-v21/launch_background.xml b/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/android/app/src/main/res/drawable/launch_background.xml b/example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/example/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..449a9f9 --- /dev/null +++ b/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/android/app/src/main/res/values/styles.xml b/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..d74aa35 --- /dev/null +++ b/example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/android/app/src/profile/AndroidManifest.xml b/example/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..d986b22 --- /dev/null +++ b/example/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/example/android/build.gradle b/example/android/build.gradle new file mode 100644 index 0000000..d2e9080 --- /dev/null +++ b/example/android/build.gradle @@ -0,0 +1,35 @@ +buildscript { + repositories { + maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } + maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } + maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' } + maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' } + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.5.1' + } +} + +allprojects { + repositories { + maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } + maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } + maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' } + maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' } + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/example/android/gradle.properties b/example/android/gradle.properties new file mode 100644 index 0000000..94adc3a --- /dev/null +++ b/example/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..bc6a58a --- /dev/null +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip diff --git a/example/android/proguard-rules.pro b/example/android/proguard-rules.pro new file mode 100644 index 0000000..a97d2a6 --- /dev/null +++ b/example/android/proguard-rules.pro @@ -0,0 +1,107 @@ +#默认的proguard-android.txt已经增加了Annotation、native、view的setget方法、Activity参数为view的 方法、Enum枚举、Parcelable、R,此处不再写 +#------------------------------------------通用区域---------------------------------------------------- +#----------------------基本指令------------------------ +-optimizationpasses 5 +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-dontskipnonpubliclibraryclassmembers +-dontpreverify +-verbose +-printmapping proguardMapping.txt +-optimizations !code/simplification/cast,!field/*,!class/merging/* +-keepattributes *Annotation*,InnerClasses +-keepattributes Signature +-keepattributes SourceFile,LineNumberTable + +#如果引用了v4或者v7包 +-dontwarn android.support.** +-keep class android.support.** { *; } +-keep interface android.support.** { *; } +-keep public class * extends android.support.** +-dontwarn android.support.** + +#如果引用了androidx包 +-keep class com.google.android.material.** {*;} +-keep class androidx.** {*;} +-keep public class * extends androidx.** +-keep interface androidx.** {*;} +-dontwarn com.google.android.material.** +-dontnote com.google.android.material.** +-dontwarn androidx.** + +#---------------------默认保留------------------------- +## 基础保留 ## +-keep public class * extends android.app.Fragment +-keep public class * extends android.app.Activity +-keep public class * extends android.app.Application +-keep public class * extends android.app.Service +-keep public class * extends android.content.BroadcastReceiver +-keep public class * extends android.content.ContentProvider +-keep public class * extends android.app.backup.BackupAgentHelper +-keep public class * extends android.preference.Preference +-keep public class com.android.vending.licensing.ILicensingService + +-keep public class * extends android.view.View { + public (android.content.Context); + public (android.content.Context, android.util.AttributeSet); + public (android.content.Context, android.util.AttributeSet, int); + public void set*(...); +} +# 保持自定义控件类不被混淆 +-keepclasseswithmembers class * { + public (android.content.Context, android.util.AttributeSet); + public (android.content.Context, android.util.AttributeSet, int); +} +#保持自定义控件类不被混淆 +-keepclassmembers class * extends android.app.Activity { + public void *(android.view.View); +} +-keepclassmembers enum * { # 保持枚举 enum 类不被混淆 + public static **[] values(); + public static ** valueOf(java.lang.String); +} +-keep class * implements android.os.Parcelable { # 保持 Parcelable 不被混淆 + public static final android.os.Parcelable$Creator *; +} +-keep class * implements java.io.Serializable # 保持 Serializable 不被混淆 +#保持 Serializable 不被混淆并且enum 类也不被混淆 +-keepclassmembers class * implements java.io.Serializable { + static final long serialVersionUID; + private static final java.io.ObjectStreamField[] serialPersistentFields; + !static !transient ; + !private ; + !private ; + private void writeObject(java.io.ObjectOutputStream); + private void readObject(java.io.ObjectInputStream); + java.lang.Object writeReplace(); + java.lang.Object readResolve(); +} +#不混淆资源类 +-keepclassmembers class **.R$* { + public static ; +} +# 保持 native 方法不被混淆 +-keepclasseswithmembernames class * { + native ; +} + +#WebView +-keepclassmembers class * extends android.webkit.WebView {*;} +-keepclassmembers class * extends android.webkit.WebViewClient {*;} +-keepclassmembers class * extends android.webkit.WebChromeClient {*;} +-keepclassmembers class * { + @android.webkit.JavascriptInterface ; +} + +-keep class androidx.lifecycle.DefaultLifecycleObserver +#-------------------------------------------项目定义区------------------------------------------------- +#im +-keep class io.openim.flutter_openim_sdk.** { *; } +#Flutter Wrapper +#-dontwarn io.flutter.** +#-keep class io.flutter.app.** { *; } +#-keep class io.flutter.plugin.** { *; } +#-keep class io.flutter.util.** { *; } +#-keep class io.flutter.view.** { *; } +#-keep class io.flutter.** { *; } +#-keep class io.flutter.plugins.** { *; } \ No newline at end of file diff --git a/example/android/settings.gradle b/example/android/settings.gradle new file mode 100644 index 0000000..44e62bc --- /dev/null +++ b/example/android/settings.gradle @@ -0,0 +1,11 @@ +include ':app' + +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() + +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/example/ios/.gitignore b/example/ios/.gitignore new file mode 100644 index 0000000..151026b --- /dev/null +++ b/example/ios/.gitignore @@ -0,0 +1,33 @@ +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000..9367d48 --- /dev/null +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 8.0 + + diff --git a/example/ios/Flutter/Debug.xcconfig b/example/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..ec97fc6 --- /dev/null +++ b/example/ios/Flutter/Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/example/ios/Flutter/Release.xcconfig b/example/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..c4855bf --- /dev/null +++ b/example/ios/Flutter/Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/example/ios/Podfile b/example/ios/Podfile new file mode 100644 index 0000000..1e8c3c9 --- /dev/null +++ b/example/ios/Podfile @@ -0,0 +1,41 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '9.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..33f0685 --- /dev/null +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,471 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1020; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.openim.flutterOpenimSdkExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.openim.flutterOpenimSdkExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.openim.flutterOpenimSdkExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..a28140c --- /dev/null +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d526a1 --- /dev/null +++ b/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/ios/Runner/AppDelegate.swift b/example/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..70693e4 --- /dev/null +++ b/example/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d36b1fa --- /dev/null +++ b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000..dc9ada4 Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..28c6bf0 Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..2ccbfd9 Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..f091b6b Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..4cde121 Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..d0ef06e Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..dcdc230 Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..2ccbfd9 Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..c8f9ed8 Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..a6d6b86 Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..a6d6b86 Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..75b2d16 Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..c4df70d Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..6a84f41 Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..d0e1f58 Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..0bedcf2 --- /dev/null +++ b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000..89c2725 --- /dev/null +++ b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +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. \ No newline at end of file diff --git a/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/example/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f2e259c --- /dev/null +++ b/example/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/ios/Runner/Base.lproj/Main.storyboard b/example/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f3c2851 --- /dev/null +++ b/example/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist new file mode 100644 index 0000000..e4f9c9b --- /dev/null +++ b/example/ios/Runner/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + flutter_openim_sdk_example + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/example/ios/Runner/Runner-Bridging-Header.h b/example/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..308a2a5 --- /dev/null +++ b/example/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/example/lib/main.dart b/example/lib/main.dart new file mode 100644 index 0000000..6670eb6 --- /dev/null +++ b/example/lib/main.dart @@ -0,0 +1,48 @@ +import 'package:flutter/material.dart'; +import 'dart:async'; + +import 'package:flutter/services.dart'; +import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; + +void main() { + runApp(MyApp()); +} + +class MyApp extends StatefulWidget { + @override + _MyAppState createState() => _MyAppState(); +} + +class _MyAppState extends State { + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: AppBar( + title: const Text('Plugin example app'), + ), + body: Column( + children: [ + TextButton(onPressed: _testApi, child: Text('api')), + ], + ), + ), + ); + } + + void _testApi() { + // FlutterOpenimSdk.iMManager.initSDK( + // platform: platform, + // ipApi: ipApi, + // ipWs: ipWs, + // dbPath: dbPath, + // listener: listener, + // ); + + } +} diff --git a/example/pubspec.lock b/example/pubspec.lock new file mode 100644 index 0000000..332db41 --- /dev/null +++ b/example/pubspec.lock @@ -0,0 +1,161 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.6.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.15.0" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.3" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_openim_sdk: + dependency: "direct main" + description: + path: ".." + relative: true + source: path + version: "0.0.1" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.12.10" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.0" + path: + dependency: transitive + description: + name: path + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.8.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.8.1" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.10.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.3.0" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.0" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" +sdks: + dart: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml new file mode 100644 index 0000000..9153888 --- /dev/null +++ b/example/pubspec.yaml @@ -0,0 +1,71 @@ +name: flutter_openim_sdk_example +description: Demonstrates how to use the flutter_openim_sdk plugin. + +# The following line prevents the package from being accidentally published to +# pub.dev using `pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +environment: + sdk: ">=2.12.0 <3.0.0" + +dependencies: + flutter: + sdk: flutter + + flutter_openim_sdk: + # When depending on this package from a real application you should use: + # flutter_openim_sdk: ^x.y.z + # See https://dart.dev/tools/pub/dependencies#version-constraints + # The example app is bundled with the plugin so we use a path dependency on + # the parent directory to use the current plugin's version. + path: ../ + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 + +dev_dependencies: + flutter_test: + sdk: flutter + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware. + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart new file mode 100644 index 0000000..6357ca5 --- /dev/null +++ b/example/test/widget_test.dart @@ -0,0 +1,27 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility that Flutter provides. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:flutter_openim_sdk_example/main.dart'; + +void main() { + testWidgets('Verify Platform version', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(MyApp()); + + // Verify that platform version is retrieved. + expect( + find.byWidgetPredicate( + (Widget widget) => widget is Text && + widget.data!.startsWith('Running on:'), + ), + findsOneWidget, + ); + }); +} diff --git a/flutter_openim_sdk.iml b/flutter_openim_sdk.iml new file mode 100644 index 0000000..54882b9 --- /dev/null +++ b/flutter_openim_sdk.iml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ios/.gitignore b/ios/.gitignore new file mode 100644 index 0000000..0c88507 --- /dev/null +++ b/ios/.gitignore @@ -0,0 +1,38 @@ +.idea/ +.vagrant/ +.sconsign.dblite +.svn/ + +.DS_Store +*.swp +profile + +DerivedData/ +build/ +GeneratedPluginRegistrant.h +GeneratedPluginRegistrant.m + +.generated/ + +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 + +!default.pbxuser +!default.mode1v3 +!default.mode2v3 +!default.perspectivev3 + +xcuserdata + +*.moved-aside + +*.pyc +*sync/ +Icon? +.tags* + +/Flutter/Generated.xcconfig +/Flutter/ephemeral/ +/Flutter/flutter_export_environment.sh \ No newline at end of file diff --git a/ios/Assets/.gitkeep b/ios/Assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/ios/Classes/FlutterOpenimSdkPlugin.h b/ios/Classes/FlutterOpenimSdkPlugin.h new file mode 100644 index 0000000..8fe1e4d --- /dev/null +++ b/ios/Classes/FlutterOpenimSdkPlugin.h @@ -0,0 +1,4 @@ +#import + +@interface FlutterOpenimSdkPlugin : NSObject +@end diff --git a/ios/Classes/FlutterOpenimSdkPlugin.m b/ios/Classes/FlutterOpenimSdkPlugin.m new file mode 100644 index 0000000..39585b8 --- /dev/null +++ b/ios/Classes/FlutterOpenimSdkPlugin.m @@ -0,0 +1,15 @@ +#import "FlutterOpenimSdkPlugin.h" +#if __has_include() +#import +#else +// Support project import fallback if the generated compatibility header +// is not copied when this plugin is created as a library. +// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 +#import "flutter_openim_sdk-Swift.h" +#endif + +@implementation FlutterOpenimSdkPlugin ++ (void)registerWithRegistrar:(NSObject*)registrar { + [SwiftFlutterOpenimSdkPlugin registerWithRegistrar:registrar]; +} +@end diff --git a/ios/Classes/SwiftFlutterOpenimSdkPlugin.swift b/ios/Classes/SwiftFlutterOpenimSdkPlugin.swift new file mode 100644 index 0000000..c71358a --- /dev/null +++ b/ios/Classes/SwiftFlutterOpenimSdkPlugin.swift @@ -0,0 +1,14 @@ +import Flutter +import UIKit + +public class SwiftFlutterOpenimSdkPlugin: NSObject, FlutterPlugin { + public static func register(with registrar: FlutterPluginRegistrar) { + let channel = FlutterMethodChannel(name: "flutter_openim_sdk", binaryMessenger: registrar.messenger()) + let instance = SwiftFlutterOpenimSdkPlugin() + registrar.addMethodCallDelegate(instance, channel: channel) + } + + public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { + result("iOS " + UIDevice.current.systemVersion) + } +} diff --git a/ios/flutter_openim_sdk.podspec b/ios/flutter_openim_sdk.podspec new file mode 100644 index 0000000..512e000 --- /dev/null +++ b/ios/flutter_openim_sdk.podspec @@ -0,0 +1,23 @@ +# +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. +# Run `pod lib lint flutter_openim_sdk.podspec` to validate before publishing. +# +Pod::Spec.new do |s| + s.name = 'flutter_openim_sdk' + s.version = '0.0.1' + s.summary = 'A new Flutter project.' + s.description = <<-DESC +A new Flutter project. + DESC + s.homepage = 'http://example.com' + s.license = { :file => '../LICENSE' } + s.author = { 'Your Company' => 'email@example.com' } + s.source = { :path => '.' } + s.source_files = 'Classes/**/*' + s.dependency 'Flutter' + s.platform = :ios, '8.0' + + # Flutter.framework does not contain a i386 slice. + s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } + s.swift_version = '5.0' +end diff --git a/lib/enum/listener_type.dart b/lib/enum/listener_type.dart new file mode 100644 index 0000000..6e1768d --- /dev/null +++ b/lib/enum/listener_type.dart @@ -0,0 +1,36 @@ +/// 事件监听类型 +/// +/// {@category Enums} +/// +class ListenerType { + ///简单监听 + /// + static const String simpleMsgListener = 'simpleMsgListener'; + + ///初始化监听 + /// + static const String initSDKListener = 'initSDKListener'; + + ///群组监听 + /// + static const String groupListener = 'groupListener'; + + ///高级消息监听 + /// + static const String advancedMsgListener = 'advancedMsgListener'; + + ///会话监听 + /// + static const String conversationListener = 'conversationListener'; + + ///好友关系链监听 + /// + static const String friendListener = 'friendListener'; + + ///信令监听 + /// + static const String signalingListener = 'signalingListener'; + + static const String messageProgressListener = + "messageProgressListener"; +} diff --git a/lib/enum/message_type.dart b/lib/enum/message_type.dart new file mode 100644 index 0000000..6a10a75 --- /dev/null +++ b/lib/enum/message_type.dart @@ -0,0 +1,18 @@ +class MessageType { + /// + static const text = 101; + + /// + static const picture = 102; + + /// + static const voice = 103; + + /// + static const video = 104; + + /// + static const file = 105; + + static const accept_friend = 201; +} diff --git a/lib/flutter_openim_sdk.dart b/lib/flutter_openim_sdk.dart new file mode 100644 index 0000000..ab80c45 --- /dev/null +++ b/lib/flutter_openim_sdk.dart @@ -0,0 +1,9 @@ +import 'package:flutter/services.dart'; +import 'package:flutter_openim_sdk/manager/im_manager.dart'; + +class FlutterOpenimSdk { + static const MethodChannel _channel = + const MethodChannel('flutter_openim_sdk'); + + static IMManager iMManager = IMManager(_channel); +} diff --git a/lib/listener/advanced_msg_listener.dart b/lib/listener/advanced_msg_listener.dart new file mode 100644 index 0000000..b6b7d3e --- /dev/null +++ b/lib/listener/advanced_msg_listener.dart @@ -0,0 +1,14 @@ +import 'package:flutter_openim_sdk/models/message.dart'; + +class AdvancedMsgListener { + /// listener uniquely identifies + final String id; + + AdvancedMsgListener({required this.id}); + + void onRecvNewMessage(Message msg) {} + + void onRecvC2CReadReceipt(Message msg) {} + + void onRecvMessageRevoked(Message msg) {} +} diff --git a/lib/listener/conversation_listener.dart b/lib/listener/conversation_listener.dart new file mode 100644 index 0000000..76c5a91 --- /dev/null +++ b/lib/listener/conversation_listener.dart @@ -0,0 +1,15 @@ +import 'package:flutter_openim_sdk/models/conversation_info.dart'; + +class ConversationListener { + void onConversationChanged(List list) {} + + void onNewConversation(List list) {} + + void onSyncServerFailed() {} + + void onSyncServerFinish() {} + + void onSyncServerStart() {} + + void onTotalUnreadMessageCountChanged(int i) {} +} diff --git a/lib/listener/friendship_listener.dart b/lib/listener/friendship_listener.dart new file mode 100644 index 0000000..3baad76 --- /dev/null +++ b/lib/listener/friendship_listener.dart @@ -0,0 +1,19 @@ +class FriendshipListener { + void onBlackListAdd(dynamic u) {} + + void onBlackListDeleted(dynamic u) {} + + void onFriendApplicationListAccept(dynamic u) {} + + void onFriendApplicationListAdded(dynamic u) {} + + void onFriendApplicationListDeleted(dynamic u) {} + + void onFriendApplicationListReject(dynamic u) {} + + void onFriendInfoChanged(dynamic u) {} + + void onFriendListAdded(dynamic u) {} + + void onFriendListDeleted(dynamic u) {} +} diff --git a/lib/listener/int_sdk_listener.dart b/lib/listener/int_sdk_listener.dart new file mode 100644 index 0000000..41f2f41 --- /dev/null +++ b/lib/listener/int_sdk_listener.dart @@ -0,0 +1,21 @@ +import 'package:flutter_openim_sdk/models/user_info.dart'; + +class InitSDKListener { + /// SDK 正在连接到服务器 + void onConnecting() {} + + /// SDK 已经成功连接到服务器 + void onConnectSuccess() {} + + /// SDK 连接服务器失败 + void onConnectFailed(int? int, String? errorMsg) {} + + /// 当前用户被踢下线,此时可以 UI 提示用户,并再次调用 IMManager 的 login() 函数重新登录。 + void onKickedOffline() {} + + /// 在线时票据过期:此时您需要生成新的 userSig 并再次调用 IMManager 的 login() 函数重新登录 + void onUserSigExpired() {} + + /// 登录用户的资料发生了更新 + void onSelfInfoUpdated(UserInfo info) {} +} diff --git a/lib/listener/msg_send_progress_listener.dart b/lib/listener/msg_send_progress_listener.dart new file mode 100644 index 0000000..10fd4e4 --- /dev/null +++ b/lib/listener/msg_send_progress_listener.dart @@ -0,0 +1,3 @@ +class MsgSendProgressListener { + void onProgress(String msgID, int progress) {} +} diff --git a/lib/manager/im_conversation_manager.dart b/lib/manager/im_conversation_manager.dart new file mode 100644 index 0000000..790fd7a --- /dev/null +++ b/lib/manager/im_conversation_manager.dart @@ -0,0 +1,97 @@ +import 'dart:convert'; + +import 'package:flutter/services.dart'; +import 'package:flutter_openim_sdk/listener/conversation_listener.dart'; +import 'package:flutter_openim_sdk/models/conversation_info.dart'; + +class ConversationManager { + MethodChannel _channel; + late ConversationListener conversationListener; + + ConversationManager(this._channel); + + void setConversationListener(ConversationListener listener) { + this.conversationListener = listener; + _channel.invokeMethod('setConversationListener', _buildParam({})); + } + + Future> getAllConversationList() { + return _channel + .invokeMethod('getAllConversationList', _buildParam({})) + .then((value) => _toList(value)); + } + + Future getSingleConversation( + {required String conversationID}) { + return _channel + .invokeMethod( + 'getOneConversation', + _buildParam({ + "conversationID": conversationID, + })) + .then((value) => _toObj(value)); + } + + Future> getMultipleConversation( + {required List conversationIDList}) { + return _channel + .invokeMethod('getMultipleConversation', + _buildParam({"conversationIDList": conversationIDList})) + .then((value) => _toList(value)); + } + + void deleteConversation({required String conversationID}) { + _channel + .invokeMethod('deleteConversation', + _buildParam({"conversationID": conversationID})) + .then((value) => _printValue(value)); + } + + void setConversationDraft( + {required String conversationID, required String draftText}) { + _channel + .invokeMethod( + 'setConversationDraft', + _buildParam( + {"conversationID": conversationID, "draftText": draftText})) + .then((value) => _printValue(value)); + } + + void pinConversation( + {required String conversationID, required bool isPinned}) { + _channel + .invokeMethod( + 'pinConversation', + _buildParam( + {"conversationID": conversationID, "isPinned": isPinned})) + .then((value) => _printValue(value)); + } + + Future getTotalUnreadMsgCount() { + return _channel.invokeMethod('getTotalUnreadMsgCount', _buildParam({})); + } + + ///@nodoc + static Map _buildParam(Map param) { + param["ManagerName"] = "conversationManager"; + return param; + } + + static List _toList(String? value) { + var list = _formatJson(value); + if (null == list) return []; + return (list as List).map((e) => ConversationInfo.fromJson(e)).toList(); + } + + static ConversationInfo _toObj(String value) => + ConversationInfo.fromJson(_formatJson(value)); + + ///@nodoc + static dynamic _formatJson(value) { + return jsonDecode(_printValue(value)); + } + + static String _printValue(value) { + return value; + } +} diff --git a/lib/manager/im_friendship_manager.dart b/lib/manager/im_friendship_manager.dart new file mode 100644 index 0000000..dacfb6a --- /dev/null +++ b/lib/manager/im_friendship_manager.dart @@ -0,0 +1,115 @@ +import 'dart:convert'; + +import 'package:flutter/services.dart'; +import 'package:flutter_openim_sdk/listener/friendship_listener.dart'; +import 'package:flutter_openim_sdk/models/user_info.dart'; + +class FriendshipManager { + MethodChannel _channel; + late FriendshipListener friendshipListener; + + FriendshipManager(this._channel); + + void setFriendshipListener(FriendshipListener listener) { + this.friendshipListener = listener; + _channel.invokeMethod('setFriendListener', _buildParam({})); + } + + Future> getFriendsInfo({required List uidList}) { + return _channel + .invokeMethod('getFriendsInfo', _buildParam({"uidList": uidList})) + .then((value) => _toList(value)); + } + + Future addFriend({required String uid, required String reason}) { + return _channel.invokeMethod( + 'addFriend', _buildParam({"uid": uid, "reqMessage": reason})); + } + + Future> getFriendApplicationList() { + return _channel + .invokeMethod('getFriendApplicationList', _buildParam({})) + .then((value) => _toList(value)); + } + + Future> getFriendList() { + return _channel + .invokeMethod('getFriendList', _buildParam({})) + .then((value) => _toList(value)); + } + + Future setFriendInfo({required UserInfo info}) { + return _channel.invokeMethod('setFriendInfo', _buildParam(info.toJson())); + } + + Future addToBlackList({required String uid}) { + return _channel.invokeMethod('addToBlackList', _buildParam({"uid": uid})); + } + + Future> getBlackList() { + return _channel + .invokeMethod('getBlackList', _buildParam({})) + .then((value) => _toList(value)); + } + + Future deleteFromBlackList({required String uid}) { + return _channel.invokeMethod( + 'deleteFromBlackList', _buildParam({"uid": uid})); + } + + Future> checkFriend(List uidList) { + return _channel + .invokeMethod('checkFriend', _buildParam({'uidList': uidList})) + .then((value) => _toList(value)); + } + + Future deleteFromFriendList({required String uid}) { + return _channel.invokeMethod( + 'deleteFromFriendList', _buildParam({"uid": uid})); + } + + Future acceptFriendApplication({required String uid}) { + return _channel.invokeMethod( + 'acceptFriendApplication', _buildParam({"uid": uid})); + } + + Future refuseFriendApplication({required String uid}) { + return _channel.invokeMethod( + 'refuseFriendApplication', _buildParam({"uid": uid})); + } + + Future forceSyncFriendApplication() { + return _channel.invokeMethod('forceSyncFriendApplication', _buildParam({})); + } + + Future forceSyncFriend() { + return _channel.invokeMethod('forceSyncFriend', _buildParam({})); + } + + Future forceSyncBlackList() { + return _channel.invokeMethod('forceSyncBlackList', _buildParam({})); + } + + ///@nodoc + static Map _buildParam(Map param) { + param["ManagerName"] = "friendshipManager"; + return param; + } + + static List _toList(String? value) { + var list = _formatJson(value); + if (null == list) return []; + return (list as List).map((e) => UserInfo.fromJson(e)).toList(); + } + + static UserInfo _toObj(String value) => UserInfo.fromJson(_formatJson(value)); + + ///@nodoc + static dynamic _formatJson(value) { + return jsonDecode(_printValue(value)); + } + + static String _printValue(value) { + return value; + } +} diff --git a/lib/manager/im_group_manager.dart b/lib/manager/im_group_manager.dart new file mode 100644 index 0000000..c077212 --- /dev/null +++ b/lib/manager/im_group_manager.dart @@ -0,0 +1,7 @@ +import 'package:flutter/services.dart'; + +class GroupManager{ + MethodChannel _channel; + + GroupManager(this._channel); +} \ No newline at end of file diff --git a/lib/manager/im_manager.dart b/lib/manager/im_manager.dart new file mode 100644 index 0000000..bb581e2 --- /dev/null +++ b/lib/manager/im_manager.dart @@ -0,0 +1,377 @@ +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_openim_sdk/enum/listener_type.dart'; +import 'package:flutter_openim_sdk/listener/int_sdk_listener.dart'; +import 'package:flutter_openim_sdk/manager/im_conversation_manager.dart'; +import 'package:flutter_openim_sdk/manager/im_friendship_manager.dart'; +import 'package:flutter_openim_sdk/manager/im_group_manager.dart'; +import 'package:flutter_openim_sdk/manager/im_message_manager.dart'; +import 'package:flutter_openim_sdk/manager/im_offline_push_manager.dart'; +import 'package:flutter_openim_sdk/manager/im_signaling_manager.dart'; +import 'package:flutter_openim_sdk/models/conversation_info.dart'; +import 'package:flutter_openim_sdk/models/message.dart'; +import 'package:flutter_openim_sdk/models/user_info.dart'; + +class IMManager { + MethodChannel _channel; + late ConversationManager conversationManager; + late FriendshipManager friendshipManager; + late MessageManager messageManager; + late GroupManager groupManager; + late OfflinePushManager offlinePushManager; + late SignalingManager signalingManager; + late InitSDKListener _initSDKListener; + + IMManager(this._channel) { + conversationManager = ConversationManager(_channel); + friendshipManager = FriendshipManager(_channel); + messageManager = MessageManager(_channel); + groupManager = GroupManager(_channel); + offlinePushManager = OfflinePushManager(_channel); + signalingManager = SignalingManager(_channel); + addNativeCallback(_channel); + } + + void addNativeCallback(MethodChannel _channel) { + _channel.setMethodCallHandler((call) { + try { + /*if (call.method == ListenerType.simpleMsgListener) { + var args = call.arguments; + var data = args['data']; + String type = args['type']; + switch (type) { + case 'onRecvC2CCustomMessage': + break; + case 'onRecvC2CTextMessage': + break; + case 'onRecvGroupCustomMessage': + break; + case 'onRecvGroupTextMessage': + break; + } + } else */ + if (call.method == ListenerType.initSDKListener) { + String type = call.arguments['type']; + dynamic data = call.arguments['data']; + switch (type) { + case 'onSelfInfoUpdated': + var u = UserInfo.fromJson(_formatJson(data)); + _initSDKListener.onSelfInfoUpdated(u); + break; + case 'onConnectFailed': + int? errCode = call.arguments['errCode']; + String? errMsg = call.arguments['errMsg']; + _initSDKListener.onConnectFailed(errCode, errMsg); + break; + case 'onConnecting': + _initSDKListener.onConnecting(); + break; + case 'onConnectSuccess': + _initSDKListener.onConnectSuccess(); + break; + case 'onKickedOffline': + _initSDKListener.onKickedOffline(); + break; + case 'onUserSigExpired': + _initSDKListener.onUserSigExpired(); + break; + } + } else if (call.method == ListenerType.groupListener) { + var args = call.arguments; + String type = args['type']; + Map params = args['data'] == null + ? new Map() + : new Map.from(args['data']); + + String groupID = params['groupID'] == null ? '' : params['groupID']; + String opReason = + params['opReason'] == null ? '' : params['opReason']; + bool isAgreeJoin = + params['isAgreeJoin'] == null ? false : params['isAgreeJoin']; + String customData = + params['customData'] == null ? '' : params['customData']; + + Map groupAttributeMap = + params['groupAttributeMap'] == null + ? new Map() + : new Map.from(params['groupAttributeMap']); + + List> memberListMap = + params['memberList'] == null + ? List.empty(growable: true) + : List.from(params['memberList']); + + List> groupMemberChangeInfoListMap = + params['groupMemberChangeInfoList'] == null + ? List.empty(growable: true) + : List.from(params['groupMemberChangeInfoList']); + + List> groupChangeInfoListMap = + params['groupChangeInfoList'] == null + ? List.empty(growable: true) + : List.from(params['groupChangeInfoList']); + + switch (type) { + case 'onMemberEnter': + break; + case 'onMemberLeave': + break; + case 'onMemberInvited': + break; + case 'onMemberKicked': + break; + case 'onMemberInfoChanged': + break; + case 'onGroupCreated': + break; + case 'onGroupDismissed': + break; + case 'onGroupRecycled': + break; + case 'onGroupInfoChanged': + break; + case 'onReceiveJoinApplication': + break; + case 'onApplicationProcessed': + break; + case 'onGrantAdministrator': + break; + case 'onRevokeAdministrator': + break; + case 'onQuitFromGroup': + break; + case 'onReceiveRESTCustomData': + break; + case 'onGroupAttributeChanged': + break; + } + } else if (call.method == ListenerType.advancedMsgListener) { + var type = call.arguments['type']; + var id = call.arguments['data']['id']; + var msg = Message.fromJson(_formatJson(call.arguments['data']['message'])); + switch (type) { + case 'onRecvNewMessage': + for (var listener in messageManager.advancedMsgListeners) { + if (listener.id == id) { + listener.onRecvNewMessage(msg); + } + } + break; + case 'onRecvMessageRevoked': + for (var listener in messageManager.advancedMsgListeners) { + if (listener.id == id) { + listener.onRecvMessageRevoked(msg); + } + } + break; + case 'onRecvC2CReadReceipt': + for (var listener in messageManager.advancedMsgListeners) { + if (listener.id == id) { + listener.onRecvC2CReadReceipt(msg); + } + } + break; + } + } else if (call.method == ListenerType.messageProgressListener) { + String type = call.arguments['type']; + dynamic data = call.arguments['data']; + String msgID = data['clientMsgID'] ?? ''; + int progress = data['progress'] ?? 100; + switch (type) { + case 'onProgress': + print('===========$msgID======$progress'); + messageManager.msgSendProgressListener?.onProgress( + msgID, + progress, + ); + break; + } + } else if (call.method == ListenerType.conversationListener) { + String type = call.arguments['type']; + dynamic data = call.arguments['data']; + switch (type) { + case 'onSyncServerStart': + conversationManager.conversationListener.onSyncServerStart(); + break; + case 'onSyncServerFinish': + conversationManager.conversationListener.onSyncServerFinish(); + break; + + case 'onSyncServerFailed': + conversationManager.conversationListener.onSyncServerFailed(); + break; + case 'onNewConversation': + List list = List.empty(growable: true); + if (null != data) { + list = (_formatJson(data) as List) + .map((e) => ConversationInfo.fromJson(e)) + .toList(); + } + conversationManager.conversationListener.onNewConversation(list); + break; + case 'onConversationChanged': + List list = List.empty(growable: true); + if (null != data) { + list = (_formatJson(data) as List) + .map((e) => ConversationInfo.fromJson(e)) + .toList(); + } + conversationManager.conversationListener + .onConversationChanged(list); + break; + case 'onTotalUnreadMessageCountChanged': + conversationManager.conversationListener + .onTotalUnreadMessageCountChanged(data ?? 0); + break; + } + } else if (call.method == ListenerType.friendListener) { + // int errCode = call.arguments['errCode']; + // String errMsg = call.arguments['errMsg']; + String type = call.arguments['type']; + dynamic data = call.arguments['data']; + switch (type) { + case 'onBlackListAdd': + friendshipManager.friendshipListener.onBlackListAdd(data); + break; + case 'onBlackListDeleted': + friendshipManager.friendshipListener.onBlackListDeleted(data); + break; + case 'onFriendApplicationListAccept': + friendshipManager.friendshipListener + .onFriendApplicationListAccept(data); + break; + case 'onFriendApplicationListAdded': + friendshipManager.friendshipListener + .onFriendApplicationListAdded(data); + break; + case 'onFriendApplicationListDeleted': + friendshipManager.friendshipListener + .onFriendApplicationListDeleted(data); + break; + case 'onFriendApplicationListReject': + friendshipManager.friendshipListener + .onFriendApplicationListReject(data); + break; + case 'onFriendInfoChanged': + friendshipManager.friendshipListener.onFriendInfoChanged(data); + break; + case 'onFriendListAdded': + friendshipManager.friendshipListener.onFriendListAdded(data); + break; + case 'onFriendListDeleted': + friendshipManager.friendshipListener.onFriendListDeleted(data); + break; + } + } + /*else if (call.method == 'logFromSwift') { + var data = call.arguments["data"]; + var msg = call.arguments["msg"]; + } else if (call.method == ListenerType.signalingListener) { + var args = call.arguments; + String type = args['type']; + Map params = args['data']; + String inviteID = + params['inviteID'] == null ? '' : params['inviteID']; + String inviter = params['inviter'] == null ? '' : params['inviter']; + String groupID = params['groupID'] == null ? '' : params['groupID']; + List? inviteeList = params['inviteeList'] == null + ? null + : List.from(params['inviteeList']); + String data = params['data'] == null ? '' : params['data']; + String invitee = params['invitee'] == null ? '' : params['invitee']; + + switch (type) { + case 'onReceiveNewInvitation': + break; + case 'onInviteeAccepted': + break; + case 'onInviteeRejected': + break; + case 'onInvitationCancelled': + break; + case 'onInvitationTimeout': + break; + } + }*/ + } catch (err) { + print( + "回调失败了,数据类型异常。$err ${call.method} ${call.arguments['type']} ${call.arguments['data']}"); + } + return Future.value(null); + }); + } + + Future initSDK({ + required int platform, + required String ipApi, + required String ipWs, + required String dbPath, + required InitSDKListener listener, + }) { + _initSDKListener = listener; + return _channel.invokeMethod( + 'initSDK', + _buildParam( + {"platform": platform, "ipApi": ipApi, "ipWs": ipWs, "dbDir": dbPath}, + ), + ); + } + + Future unInitSDK() { + return _channel.invokeMethod('unInitSDK', _buildParam({})); + } + + Future login({required String uid, required String token}) { + return _channel.invokeMethod( + 'login', + _buildParam({'uid': uid, 'token': token}), + ); + } + + Future logout() { + return _channel.invokeMethod('logout', _buildParam({})); + } + + Future getLoginStatus() { + return _channel.invokeMethod('getLoginStatus', _buildParam({})); + } + + Future getLoginUid() { + return _channel.invokeMethod('getLoginUid', _buildParam({})); + } + + Future setSelfInfo(UserInfo info) { + return _channel.invokeMethod('setSelfInfo', _buildParam(info.toJson())); + // .then((value) => UserInfo.fromJson(value)); + } + + Future> getUsersInfo(List uidList) { + return _channel + .invokeMethod('getUsersInfo', _buildParam({'uidList': uidList})) + .then((value) => _toList(value)); + } + + Future forceSyncLoginUerInfo(List uidList) { + return _channel.invokeMethod('forceSyncLoginUerInfo', _buildParam({})); + } + + ///@nodoc + static Map _buildParam(Map param) { + param["ManagerName"] = "imManager"; + return param; + } + + static List _toList(String value) => + (_formatJson(value) as List).map((e) => UserInfo.fromJson(e)).toList(); + + ///@nodoc + static dynamic _formatJson(value) { + return jsonDecode(_printValue(value)); + } + + static String _printValue(value) { + return value; + } +} diff --git a/lib/manager/im_message_manager.dart b/lib/manager/im_message_manager.dart new file mode 100644 index 0000000..ecaac5d --- /dev/null +++ b/lib/manager/im_message_manager.dart @@ -0,0 +1,217 @@ +import 'dart:convert'; + +import 'package:flutter/services.dart'; +import 'package:flutter_openim_sdk/listener/advanced_msg_listener.dart'; +import 'package:flutter_openim_sdk/listener/msg_send_progress_listener.dart'; +import 'package:flutter_openim_sdk/models/message.dart'; + +class MessageManager { + MethodChannel _channel; + List advancedMsgListeners = List.empty(growable: true); + MsgSendProgressListener? msgSendProgressListener; + + MessageManager(this._channel); + + void addAdvancedMsgListener(AdvancedMsgListener listener) { + advancedMsgListeners.add(listener); + _channel.invokeMethod( + 'addAdvancedMsgListener', _buildParam({'id': listener.id})); + } + + void removeAdvancedMsgListener(AdvancedMsgListener listener) { + advancedMsgListeners.remove(listener); + _channel.invokeMethod( + 'removeAdvancedMsgListener', _buildParam({'id': listener.id})); + } + + void setMsgProgressListener(MsgSendProgressListener listener) { + msgSendProgressListener = listener; + } + + /*Future */ + Future sendMessage({ + required Message message, + String? receiver, + String? groupID, + required bool onlineUserOnly, + }) { + return _channel.invokeMethod( + 'sendMessage', + _buildParam({ + 'message': message.toJson(), + 'receiver': receiver ?? '', + 'groupID': groupID ?? '', + 'onlineUserOnly': onlineUserOnly, + })) + /*.then((value) => _toObj(value))*/; + } + + Future> getHistoryMessageList({ + String? userID, + Message? startMsg, + String? groupID, + int? count, + }) { + return _channel + .invokeMethod( + 'getHistoryMessageList', + _buildParam({ + 'userID': userID ?? '', + 'startMsg': startMsg?.toJson() /*?? {}*/, + 'groupID': groupID ?? '', + 'count': count ?? 10, + })) + .then((value) => _toList(value)); + } + + void revokeMessage({required Message message}) { + _channel.invokeMethod('revokeMessage', _buildParam(message.toJson())); + } + + Future deleteMessageFromLocalStorage({required Message message}) { + return _channel.invokeMethod( + 'deleteMessageFromLocalStorage', _buildParam(message.toJson())); + } + + void deleteMessages({required List msgList}) { + // _channel.invokeMethod('deleteMessages', _buildParam(msgList.toJson())); + } + + void insertSingleMessageToLocalStorage({ + String? userID, + Message? message, + String? sender, + }) { + _channel.invokeMethod( + 'insertSingleMessageToLocalStorage', + _buildParam({ + "userID": userID, + "message": message?.toJson(), + "sender": sender, + })); + } + + void findMessages({required List messageIDList}) { + _channel.invokeMethod( + 'findMessages', + _buildParam({ + "messageIDList": messageIDList, + })); + } + + Future markSingleMessageHasRead({required String userID}) { + return _channel.invokeMethod( + 'markSingleMessageHasRead', _buildParam({'userID': userID})); + } + + Future createTextMessage({required String text}) { + return _channel + .invokeMethod('createTextMessage', _buildParam({'text': text})) + .then((value) => _toObj(value)); + } + + Future createTextAtMessage({ + required String text, + required List atUserList, + }) { + return _channel + .invokeMethod( + 'createTextAtMessage', + _buildParam({ + 'text': text, + 'atUserList': atUserList, + }), + ) + .then((value) => _toObj(value)); + } + + Future createImageMessage({required String imagePath}) { + return _channel + .invokeMethod( + 'createImageMessage', + _buildParam({'imagePath': imagePath}), + ) + .then((value) => _toObj(value)); + } + + Future createSoundMessage( + {required String soundPath, required int duration}) { + return _channel + .invokeMethod( + 'createSoundMessage', + _buildParam({'soundPath': soundPath, "duration": duration}), + ) + .then((value) => _toObj(value)); + } + + Future createVideoMessage({ + required String videoPath, + required String videoType, + required int duration, + required String snapshotPath, + }) { + return _channel + .invokeMethod( + 'createVideoMessage', + _buildParam({ + 'videoPath': videoPath, + 'videoType': videoType, + 'duration': duration, + 'snapshotPath': snapshotPath, + })) + .then((value) => _toObj(value)); + } + + Future createFileMessage( + {required String filePath, required String fileName}) { + return _channel + .invokeMethod('createFileMessage', + _buildParam({'filePath': filePath, 'fileName': fileName})) + .then((value) => _toObj(value)); + } + + Future createMergerMessage( + {required List messageList, + required String title, + required List summaryList}) { + return _channel + .invokeMethod( + 'createMergerMessage', + _buildParam({ + 'messageList': messageList.map((e) => e.toJson()).toList(), + 'title': title, + 'summaryList': summaryList, + })) + .then((value) => _toObj(value)); + } + + Future createForwardMessage({required List messageList}) { + return _channel + .invokeMethod( + 'createForwardMessage', + _buildParam( + {'message': messageList.map((e) => e.toJson()).toList()})) + .then((value) => _toObj(value)); + } + + ///@nodoc + static Map _buildParam(Map param) { + print('param:$param'); + param["ManagerName"] = "messageManager"; + return param; + } + + static List _toList(String value) => + (_formatJson(value) as List).map((e) => Message.fromJson(e)).toList(); + + static Message _toObj(String value) => Message.fromJson(_formatJson(value)); + + ///@nodoc + static dynamic _formatJson(value) { + return jsonDecode(_printValue(value)); + } + + static String _printValue(value) { + return value; + } +} diff --git a/lib/manager/im_offline_push_manager.dart b/lib/manager/im_offline_push_manager.dart new file mode 100644 index 0000000..c6c8256 --- /dev/null +++ b/lib/manager/im_offline_push_manager.dart @@ -0,0 +1,7 @@ +import 'package:flutter/services.dart'; + +class OfflinePushManager{ + MethodChannel _channel; + + OfflinePushManager(this._channel); +} \ No newline at end of file diff --git a/lib/manager/im_signaling_manager.dart b/lib/manager/im_signaling_manager.dart new file mode 100644 index 0000000..adaa4c0 --- /dev/null +++ b/lib/manager/im_signaling_manager.dart @@ -0,0 +1,7 @@ +import 'package:flutter/services.dart'; + +class SignalingManager { + MethodChannel _channel; + + SignalingManager(this._channel); +} diff --git a/lib/models/conversation_info.dart b/lib/models/conversation_info.dart new file mode 100644 index 0000000..b0f967e --- /dev/null +++ b/lib/models/conversation_info.dart @@ -0,0 +1,77 @@ +import 'dart:convert'; + +import 'package:flutter_openim_sdk/models/message.dart'; + +class ConversationInfo { + String conversationID; + int? conversationType; + String? userID; + String? groupID; + String? showName; + String? faceUrl; + int? recvMsgOpt; + int? unreadCount; + Message? latestMsg; + int? latestMsgSendTime; + String? draftText; + int? draftTimestamp; + dynamic isPinned; + + ConversationInfo( + {required this.conversationID, + this.conversationType, + this.userID, + this.groupID, + this.showName, + this.faceUrl, + this.recvMsgOpt, + this.unreadCount, + this.latestMsg, + this.latestMsgSendTime, + this.draftText, + this.draftTimestamp, + this.isPinned}); + + ConversationInfo.fromJson(Map json) + : conversationID = json['conversationID'] { + // conversationID = json['conversationID']; + conversationType = json['conversationType']; + userID = json['userID']; + groupID = json['groupID']; + showName = json['showName']; + faceUrl = json['faceUrl']; + recvMsgOpt = json['recvMsgOpt']; + unreadCount = json['unreadCount']; + // latestMsg = json['latestMsg']; + // if (null != json['latestMsg']) { + if (json['latestMsg'] is String) { + latestMsg = Message.fromJson(jsonDecode(json['latestMsg'])); + } else if (json['latestMsg'] is Map) { + latestMsg = Message.fromJson(json['latestMsg']); + } + // } + + latestMsgSendTime = json['latestMsgSendTime']; + draftText = json['draftText']; + draftTimestamp = json['draftTimestamp']; + isPinned = json['isPinned']; + } + + Map toJson() { + final Map data = new Map(); + data['conversationID'] = this.conversationID; + data['conversationType'] = this.conversationType; + data['userID'] = this.userID; + data['groupID'] = this.groupID; + data['showName'] = this.showName; + data['faceUrl'] = this.faceUrl; + data['recvMsgOpt'] = this.recvMsgOpt; + data['unreadCount'] = this.unreadCount; + data['latestMsg'] = this.latestMsg?.toJson(); + data['latestMsgSendTime'] = this.latestMsgSendTime; + data['draftText'] = this.draftText; + data['draftTimestamp'] = this.draftTimestamp; + data['isPinned'] = this.isPinned; + return data; + } +} diff --git a/lib/models/message.dart b/lib/models/message.dart new file mode 100644 index 0000000..758b299 --- /dev/null +++ b/lib/models/message.dart @@ -0,0 +1,337 @@ +class Message { + String? clientMsgID; + String? serverMsgID; + int? createTime; + int? sendTime; + String? sendID; + String? recvID; + int? msgFrom; + int? contentType; + int? platformID; + List? forceList; + String? senderNickName; + String? senderFaceUrl; + String? groupID; + String? content; + int? seq; + bool? isRead; + int? status; + String? remark; + dynamic ext; + int? sessionType; + PictureElem? pictureElem; + SoundElem? soundElem; + VideoElem? videoElem; + FileElem? fileElem; + + Message( + {this.clientMsgID, + this.serverMsgID, + this.createTime, + this.sendTime, + this.sendID, + this.recvID, + this.msgFrom, + this.contentType, + this.platformID, + this.forceList, + this.senderNickName, + this.senderFaceUrl, + this.groupID, + this.content, + this.seq, + this.isRead, + this.status, + this.remark, + this.ext, + this.sessionType, + this.pictureElem, + this.soundElem, + this.videoElem, + this.fileElem}); + + Message.fromJson(Map json) + /* : clientMsgID = json['clientMsgID']*/ { + clientMsgID = json['clientMsgID']; + serverMsgID = json['serverMsgID']; + createTime = json['createTime']; + sendTime = json['sendTime']; + sendID = json['sendID']; + recvID = json['RecvID']; + msgFrom = json['msgFrom']; + contentType = json['contentType']; + platformID = json['platformID']; + forceList = json['forceList']; + senderNickName = json['senderNickName']; + senderFaceUrl = json['senderFaceUrl']; + groupID = json['groupID']; + content = json['content']; + seq = json['seq']; + isRead = json['isRead']; + status = json['status']; + remark = json['remark']; + ext = json['ext']; + sessionType = json['sessionType']; + pictureElem = json['pictureElem'] != null + ? new PictureElem.fromJson(json['pictureElem']) + : null; + soundElem = json['soundElem'] != null + ? new SoundElem.fromJson(json['soundElem']) + : null; + videoElem = json['videoElem'] != null + ? new VideoElem.fromJson(json['videoElem']) + : null; + fileElem = json['fileElem'] != null + ? new FileElem.fromJson(json['fileElem']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['clientMsgID'] = this.clientMsgID; + data['serverMsgID'] = this.serverMsgID; + data['createTime'] = this.createTime; + data['sendTime'] = this.sendTime; + data['sendID'] = this.sendID; + data['RecvID'] = this.recvID; + data['msgFrom'] = this.msgFrom; + data['contentType'] = this.contentType; + data['platformID'] = this.platformID; + data['forceList'] = this.forceList; + data['senderNickName'] = this.senderNickName; + data['senderFaceUrl'] = this.senderFaceUrl; + data['groupID'] = this.groupID; + data['content'] = this.content; + data['seq'] = this.seq; + data['isRead'] = this.isRead; + data['status'] = this.status; + data['remark'] = this.remark; + data['ext'] = this.ext; + data['sessionType'] = this.sessionType; + if (this.pictureElem != null) { + data['pictureElem'] = this.pictureElem?.toJson(); + } + if (this.soundElem != null) { + data['soundElem'] = this.soundElem?.toJson(); + } + if (this.videoElem != null) { + data['videoElem'] = this.videoElem?.toJson(); + } + if (this.fileElem != null) { + data['fileElem'] = this.fileElem?.toJson(); + } + return data; + } + + @override + bool operator ==(Object other) { + // TODO: implement == + if (other is Message) { + return other.id == id; + } + return super == other; + } + + @override + // TODO: implement hashCode + int get hashCode => super.hashCode; + + String? get id => + clientMsgID == null || clientMsgID!.isEmpty ? serverMsgID : clientMsgID; +} + +class PictureElem { + String? sourcePath; + PictureInfo? sourcePicture; + PictureInfo? bigPicture; + PictureInfo? snapshotPicture; + + PictureElem( + {this.sourcePath, + this.sourcePicture, + this.bigPicture, + this.snapshotPicture}); + + PictureElem.fromJson(Map json) { + sourcePath = json['sourcePath']; + sourcePicture = json['sourcePicture'] != null + ? new PictureInfo.fromJson(json['sourcePicture']) + : null; + bigPicture = json['bigPicture'] != null + ? new PictureInfo.fromJson(json['bigPicture']) + : null; + snapshotPicture = json['snapshotPicture'] != null + ? new PictureInfo.fromJson(json['snapshotPicture']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['sourcePath'] = this.sourcePath; + if (this.sourcePicture != null) { + data['sourcePicture'] = this.sourcePicture?.toJson(); + } + if (this.bigPicture != null) { + data['bigPicture'] = this.bigPicture?.toJson(); + } + if (this.snapshotPicture != null) { + data['snapshotPicture'] = this.snapshotPicture?.toJson(); + } + return data; + } +} + +class PictureInfo { + String? uuID; + String? type; + int? size; + int? width; + int? height; + String? url; + + PictureInfo( + {this.uuID, this.type, this.size, this.width, this.height, this.url}); + + PictureInfo.fromJson(Map json) { + uuID = json['uuID']; + type = json['type']; + size = json['size']; + width = json['width']; + height = json['height']; + url = json['url']; + } + + Map toJson() { + final Map data = new Map(); + data['uuID'] = this.uuID; + data['type'] = this.type; + data['size'] = this.size; + data['width'] = this.width; + data['height'] = this.height; + data['url'] = this.url; + return data; + } +} + +class SoundElem { + String? uuID; + String? soundPath; + String? sourceUrl; + int? dataSize; + int? duration; + + SoundElem( + {this.uuID, + this.soundPath, + this.sourceUrl, + this.dataSize, + this.duration}); + + SoundElem.fromJson(Map json) { + uuID = json['uuID']; + soundPath = json['soundPath']; + sourceUrl = json['sourceUrl']; + dataSize = json['dataSize']; + duration = json['duration']; + } + + Map toJson() { + final Map data = new Map(); + data['uuID'] = this.uuID; + data['soundPath'] = this.soundPath; + data['sourceUrl'] = this.sourceUrl; + data['dataSize'] = this.dataSize; + data['duration'] = this.duration; + return data; + } +} + +class VideoElem { + String? videoPath; + String? videoUUID; + String? videoUrl; + String? videoType; + int? videoSize; + int? duration; + String? snapshotPath; + String? snapshotUUID; + int? snapshotSize; + String? snapshotUrl; + int? snapshotWidth; + int? snapshotHeight; + + VideoElem( + {this.videoPath, + this.videoUUID, + this.videoUrl, + this.videoType, + this.videoSize, + this.duration, + this.snapshotPath, + this.snapshotUUID, + this.snapshotSize, + this.snapshotUrl, + this.snapshotWidth, + this.snapshotHeight}); + + VideoElem.fromJson(Map json) { + videoPath = json['videoPath']; + videoUUID = json['videoUUID']; + videoUrl = json['videoUrl']; + videoType = json['videoType']; + videoSize = json['videoSize']; + duration = json['duration']; + snapshotPath = json['snapshotPath']; + snapshotUUID = json['snapshotUUID']; + snapshotSize = json['snapshotSize']; + snapshotUrl = json['snapshotUrl']; + snapshotWidth = json['snapshotWidth']; + snapshotHeight = json['snapshotHeight']; + } + + Map toJson() { + final Map data = new Map(); + data['videoPath'] = this.videoPath; + data['videoUUID'] = this.videoUUID; + data['videoUrl'] = this.videoUrl; + data['videoType'] = this.videoType; + data['videoSize'] = this.videoSize; + data['duration'] = this.duration; + data['snapshotPath'] = this.snapshotPath; + data['snapshotUUID'] = this.snapshotUUID; + data['snapshotSize'] = this.snapshotSize; + data['snapshotUrl'] = this.snapshotUrl; + data['snapshotWidth'] = this.snapshotWidth; + data['snapshotHeight'] = this.snapshotHeight; + return data; + } +} + +class FileElem { + String? filePath; + String? uuID; + String? sourceUrl; + String? fileName; + int? fileSize; + + FileElem( + {this.filePath, this.uuID, this.sourceUrl, this.fileName, this.fileSize}); + + FileElem.fromJson(Map json) { + filePath = json['filePath']; + uuID = json['uuID']; + sourceUrl = json['sourceUrl']; + fileName = json['fileName']; + fileSize = json['fileSize']; + } + + Map toJson() { + final Map data = new Map(); + data['filePath'] = this.filePath; + data['uuID'] = this.uuID; + data['sourceUrl'] = this.sourceUrl; + data['fileName'] = this.fileName; + data['fileSize'] = this.fileSize; + return data; + } +} diff --git a/lib/models/user_info.dart b/lib/models/user_info.dart new file mode 100644 index 0000000..f87b953 --- /dev/null +++ b/lib/models/user_info.dart @@ -0,0 +1,65 @@ +class UserInfo { + String uid; + String? name; + String? icon; + int? gender; // 0 未知,1 男,2 女 + String? mobile; + String? birth; + String? email; + String? ex; + String? comment; + int? isInBlackList; // 0 不在黑名单,1 在黑名单 + String? reqMessage; + String? applyTime; + int? flag; // //0请求添加好友,1同意添加好友,-1拒绝添加好友 + + UserInfo( + {required this.uid, + this.name, + this.icon, + this.gender, + this.mobile, + this.birth, + this.email, + this.ex, + this.comment, + this.isInBlackList, + this.reqMessage, + this.applyTime, + this.flag}); + + UserInfo.fromJson(Map json) : uid = json['uid'] { + name = json['name']; + icon = json['icon']; + gender = json['gender']; + mobile = json['mobile']; + birth = json['birth']; + email = json['email']; + ex = json['ex']; + comment = json['comment']; + isInBlackList = json['isInBlackList']; + reqMessage = json['reqMessage']; + applyTime = json['applyTime']; + flag = json['flag']; + } + + Map toJson() { + final Map data = new Map(); + data['uid'] = this.uid; + data['name'] = this.name; + data['icon'] = this.icon; + data['gender'] = this.gender; + data['mobile'] = this.mobile; + data['birth'] = this.birth; + data['email'] = this.email; + data['ex'] = this.ex; + data['comment'] = this.comment; + data['isInBlackList'] = this.isInBlackList; + data['reqMessage'] = this.reqMessage; + data['applyTime'] = this.applyTime; + data['flag'] = this.flag; + return data; + } + + String get nickname => comment ?? name ?? uid; +} diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..42b0ce7 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,147 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.6.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.15.0" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.12.10" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.0" + path: + dependency: transitive + description: + name: path + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.8.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.8.1" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.10.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.3.0" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.0" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" +sdks: + dart: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..18dccc7 --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,64 @@ +name: flutter_openim_sdk +description: A new Flutter project. +version: 0.0.1 +homepage: + +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" + +dependencies: + flutter: + sdk: flutter + +dev_dependencies: + flutter_test: + sdk: flutter + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter. +flutter: + # This section identifies this Flutter project as a plugin project. + # The 'pluginClass' and Android 'package' identifiers should not ordinarily + # be modified. They are used by the tooling to maintain consistency when + # adding or updating assets for this project. + plugin: + platforms: + android: + package: io.openim.flutter_openim_sdk + pluginClass: FlutterOpenimSdkPlugin + ios: + pluginClass: FlutterOpenimSdkPlugin + + # To add assets to your plugin package, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + # + # For details regarding assets in packages, see + # https://flutter.dev/assets-and-images/#from-packages + # + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware. + + # To add custom fonts to your plugin package, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts in packages, see + # https://flutter.dev/custom-fonts/#from-packages diff --git a/test/flutter_openim_sdk_test.dart b/test/flutter_openim_sdk_test.dart new file mode 100644 index 0000000..ca9c774 --- /dev/null +++ b/test/flutter_openim_sdk_test.dart @@ -0,0 +1,34 @@ +import 'package:flutter/services.dart'; +import 'package:flutter_openim_sdk/models/message.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; + +void main() { + /* const MethodChannel channel = MethodChannel('flutter_openim_sdk'); + + TestWidgetsFlutterBinding.ensureInitialized(); + + setUp(() { + channel.setMockMethodCallHandler((MethodCall methodCall) async { + return '42'; + }); + }); + + tearDown(() { + channel.setMockMethodCallHandler(null); + }); + + test('getPlatformVersion', () async {});*/ + + Message m1= new Message(clientMsgID: '1',content: 'c1'); + Message m2= new Message(clientMsgID: '2',content: 'c2'); + Message m3= new Message(clientMsgID: '3',content: 'c3'); + Message m4= new Message(clientMsgID: '3',content: 'c4'); + List list = List.of([m1,m2,m3]); + + + print(list.contains(m4)); + print(m1==m4); + print(m2==m4); + print(m3==m4); +}