增加群组通知过滤
This commit is contained in:
4
example/.gitignore
vendored
4
example/.gitignore
vendored
@@ -41,3 +41,7 @@ app.*.map.json
|
||||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
|
||||
# 本地调试 AAR 文件
|
||||
/libs/*.aar
|
||||
/android/local-maven/
|
||||
|
||||
@@ -49,6 +49,7 @@ android {
|
||||
// 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
|
||||
minifyEnabled true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<application
|
||||
android:label="example"
|
||||
android:name="${applicationName}"
|
||||
|
||||
@@ -1,10 +1,54 @@
|
||||
buildscript {
|
||||
// 1. 修改这里:将 Kotlin 版本升级到 1.9.24 以解决 "Module was compiled with... 1.9.0" 报错
|
||||
ext.kotlin_version = '1.9.24'
|
||||
|
||||
repositories {
|
||||
// 2. 优化网络:优先使用阿里云镜像,解决下载慢/超时/握手失败问题
|
||||
maven { url 'https://maven.aliyun.com/repository/google' }
|
||||
maven { url 'https://maven.aliyun.com/repository/public' }
|
||||
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
|
||||
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Android Gradle 插件版本 (保持您当前的 7.3.0 即可,如果报错提示不兼容再升级到 7.4.2)
|
||||
classpath 'com.android.tools.build:gradle:7.3.0'
|
||||
|
||||
// Kotlin 插件 (这里引用了上面定义的 ext.kotlin_version)
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
// === 本地 AAR 调试配置 ===
|
||||
// 启用本地调试: 取消下面这行的注释
|
||||
maven { url 'file://' + projectDir.absolutePath + '/local-maven' }
|
||||
// === 本地 AAR 配置结束 ===
|
||||
|
||||
// 3. 优化网络:allprojects 也要加镜像
|
||||
maven { url 'https://maven.aliyun.com/repository/google' }
|
||||
maven { url 'https://maven.aliyun.com/repository/public' }
|
||||
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
|
||||
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
// === 强制使用本地 AAR 版本 (调试时取消注释) ===
|
||||
// 注意: 必须配合上面的本地 Maven 仓库一起使用
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
force 'com.openim:sdkcore:1.0.15-local'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
rootProject.buildDir = "../build"
|
||||
subprojects {
|
||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||
@@ -15,4 +59,4 @@ subprojects {
|
||||
|
||||
tasks.register("clean", Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ pluginManagement {
|
||||
plugins {
|
||||
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||
id "com.android.application" version "7.3.0" apply false
|
||||
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
|
||||
id "org.jetbrains.kotlin.android" version "1.9.24" apply false
|
||||
}
|
||||
|
||||
include ":app"
|
||||
|
||||
@@ -7,16 +7,15 @@
|
||||
// https://flutter.dev/to/integration-testing
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:integration_test/integration_test.dart';
|
||||
|
||||
void main() {
|
||||
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
// IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
testWidgets('getPlatformVersion test', (WidgetTester tester) async {
|
||||
final FlutterOpenimSdk plugin = FlutterOpenimSdk();
|
||||
final String? version = await plugin.getPlatformVersion();
|
||||
// The version string depends on the host platform running the test, so
|
||||
// just assert that some non-empty string is returned.
|
||||
expect(version?.isNotEmpty, true);
|
||||
});
|
||||
// testWidgets('getPlatformVersion test', (WidgetTester tester) async {
|
||||
// final FlutterOpenimSdk plugin = FlutterOpenimSdk();
|
||||
// final String? version = await plugin.getPlatformVersion();
|
||||
// // The version string depends on the host platform running the test, so
|
||||
// // just assert that some non-empty string is returned.
|
||||
// expect(version?.isNotEmpty, true);
|
||||
// });
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
import 'package:flutter_openim_sdk/src/enum/group_notify_filter.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
void main() {
|
||||
try {
|
||||
@@ -18,6 +22,165 @@ class MyApp extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MyAppState extends State<MyApp> {
|
||||
bool _isLoading = true;
|
||||
bool _isLoggedIn = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_init();
|
||||
}
|
||||
|
||||
Future<void> _init() async {
|
||||
await _requestPermissions();
|
||||
await _initSDK();
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _requestPermissions() async {
|
||||
// 请求存储权限
|
||||
var status = await Permission.storage.request();
|
||||
if (status.isGranted) {
|
||||
// 权限已授予,可以读写文件
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _initSDK() async {
|
||||
var directory = await getApplicationDocumentsDirectory();
|
||||
|
||||
final rootPath = directory.path;
|
||||
OpenIM.iMManager
|
||||
.initSDK(
|
||||
platformID: 2,
|
||||
apiAddr: 'http://192.168.77.135:10002',
|
||||
wsAddr: 'ws://192.168.77.135:10001',
|
||||
dataDir: '$rootPath/',
|
||||
listener: OnConnectListener(onConnectSuccess: () {
|
||||
// Already connected to the server
|
||||
_isLoggedIn = true;
|
||||
}, onConnecting: () {
|
||||
// Connecting to the server, can be used for UI prompts
|
||||
}, onUserTokenExpired: () {
|
||||
// User token has expired, can be used for UI prompts
|
||||
_isLoggedIn = false;
|
||||
}, onKickedOffline: () {
|
||||
// The current user is kicked offline, and the user needs to be prompted to log in again
|
||||
_isLoggedIn = false;
|
||||
}))
|
||||
.then((value) {
|
||||
if (value) {
|
||||
OpenIM.iMManager.userManager.setUserListener(OnUserListener(
|
||||
onSelfInfoUpdated: (userInfo) {
|
||||
debugPrint('onSelfInfoUpdated: ${userInfo.toJson()}');
|
||||
},
|
||||
));
|
||||
|
||||
OpenIM.iMManager.setNotificationVisibilityRule(
|
||||
notificationType: MessageType.memberQuitNotification,
|
||||
visibilityType:
|
||||
GroupNotifyFilter.notificationVisibleToOperatorAndAdmin);
|
||||
|
||||
OpenIM.iMManager.setNotificationVisibilityRule(
|
||||
notificationType: MessageType.memberKickedNotification,
|
||||
visibilityType:
|
||||
GroupNotifyFilter.notificationVisibleToOperatorAndAdmin);
|
||||
|
||||
// success
|
||||
} else {
|
||||
// fail
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _login() async {
|
||||
try {
|
||||
await OpenIM.iMManager
|
||||
.login(
|
||||
userID: "8bfe13b5eac44e87963652abb91d80d2",
|
||||
token:
|
||||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiI4YmZlMTNiNWVhYzQ0ZTg3OTYzNjUyYWJiOTFkODBkMiIsIlBsYXRmb3JtSUQiOjIsImV4cCI6MTc3MTIzNzE1NywiaWF0IjoxNzYzNDYxMTUyfQ.J0WCPoGAJAV8dn8F5vfan0WPn_DOFmc4pg93V7W6VZ0")
|
||||
.then((value) {
|
||||
_isLoggedIn = true;
|
||||
List<String> list = [];
|
||||
OpenIM.iMManager.userManager.subscribeUsersStatus(list);
|
||||
//send();
|
||||
|
||||
OpenIM.iMManager.messageManager
|
||||
.setAdvancedMsgListener(OnAdvancedMsgListener(
|
||||
// 当消息被撤回时调用
|
||||
onRecvNewMessage: (msg) {
|
||||
debugPrint('Received onRecvNewMessage: ${msg.toJson()}');
|
||||
},
|
||||
onRecvOnlineOnlyMessage: (msg) =>
|
||||
debugPrint('Received online-only message: ${msg.toJson()}'),
|
||||
onRecvOfflineNewMessage: (msg) =>
|
||||
debugPrint('Received offline message: ${msg.toJson()}'),
|
||||
));
|
||||
|
||||
OpenIM.iMManager.groupManager.setGroupListener(OnGroupListener(
|
||||
// 当群组申请被接受时调用
|
||||
onGroupApplicationAccepted: (groupApplication) {},
|
||||
// 当群组申请被添加时调用
|
||||
onGroupApplicationAdded: (groupApplication) {},
|
||||
// 当群组申请被删除时调用
|
||||
onGroupApplicationDeleted: (groupApplication) {},
|
||||
// 当群组申请被拒绝时调用
|
||||
onGroupApplicationRejected: (groupApplication) {
|
||||
debugPrint('Group application rejected: $groupApplication');
|
||||
},
|
||||
// 当群组信息发生变化时调用
|
||||
onGroupInfoChanged: (groupInfo) {
|
||||
debugPrint('Group info changed: $groupInfo');
|
||||
//等待一段时间,获得会话的最后一条消息
|
||||
Future.delayed(const Duration(seconds: 2), () {
|
||||
OpenIM.iMManager.conversationManager
|
||||
.getOneConversation(
|
||||
sourceID: groupInfo.groupID,
|
||||
sessionType: ConversationType.superGroup)
|
||||
.then((conversation) {
|
||||
debugPrint(
|
||||
'Updated conversation last message: ${conversation.latestMsg}');
|
||||
});
|
||||
});
|
||||
},
|
||||
// 当群组成员被添加时调用
|
||||
onGroupMemberAdded: (groupMember) {
|
||||
debugPrint('Group member added: $groupMember');
|
||||
},
|
||||
// 当群组成员被删除时调用
|
||||
onGroupMemberDeleted: (groupMember) {
|
||||
debugPrint('Group member deleted: $groupMember');
|
||||
},
|
||||
// 当群组成员信息发生变化时调用
|
||||
onGroupMemberInfoChanged: (groupMember) {
|
||||
debugPrint('Group member info changed: $groupMember');
|
||||
},
|
||||
// 当加入的群组被添加时调用
|
||||
onJoinedGroupAdded: (groupInfo) {
|
||||
debugPrint('Joined group added: $groupInfo');
|
||||
},
|
||||
// 当加入的群组被删除时调用
|
||||
onJoinedGroupDeleted: (groupInfo) {
|
||||
debugPrint('Joined group deleted: $groupInfo');
|
||||
},
|
||||
));
|
||||
OpenIM.iMManager.conversationManager
|
||||
.getAllConversationList()
|
||||
.then((value) {
|
||||
print('Get all conversation list successful');
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
_isLoggedIn = false;
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> send() async {
|
||||
OpenIM.iMManager.messageManager
|
||||
.sendMessage(
|
||||
@@ -32,36 +195,6 @@ class _MyAppState extends State<MyApp> {
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
OpenIM.iMManager
|
||||
.initSDK(
|
||||
platformID: 3,
|
||||
apiAddr: 'http://192.168.77.135:10002',
|
||||
wsAddr: 'ws://192.168.77.135:10001',
|
||||
dataDir: './',
|
||||
listener: OnConnectListener())
|
||||
.then((value) {});
|
||||
OpenIM.iMManager.userManager.setUserListener(OnUserListener());
|
||||
|
||||
OpenIM.iMManager
|
||||
.login(
|
||||
userID: "8bfe13b5eac44e87963652abb91d80d2",
|
||||
token:
|
||||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiI4YmZlMTNiNWVhYzQ0ZTg3OTYzNjUyYWJiOTFkODBkMiIsIlBsYXRmb3JtSUQiOjMsImV4cCI6MTc1NDM2NDkwNCwiaWF0IjoxNzQ2NTg4ODk5fQ.575xwR9lzJo1i5Te-Ul-99odONfxbzDXW0_2Kv3nFEE")
|
||||
.then((value) {
|
||||
List<String> list = [];
|
||||
OpenIM.iMManager.userManager.subscribeUsersStatus(list);
|
||||
send();
|
||||
OpenIM.iMManager.conversationManager
|
||||
.getAllConversationList()
|
||||
.then((value) {
|
||||
print('Get all conversation list successful');
|
||||
});
|
||||
}).catchError((error) {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
@@ -69,11 +202,35 @@ class _MyAppState extends State<MyApp> {
|
||||
appBar: AppBar(
|
||||
title: const Text('Plugin example app'),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
TextButton(onPressed: () {}, child: const Text('login')),
|
||||
],
|
||||
),
|
||||
body: _isLoading
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: _isLoggedIn
|
||||
? Column(
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
OpenIM.iMManager.logout().then((_) {
|
||||
setState(() {
|
||||
_isLoggedIn = false;
|
||||
});
|
||||
});
|
||||
},
|
||||
child: const Text('logout')),
|
||||
],
|
||||
)
|
||||
: Center(
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
_login().then((_) {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
});
|
||||
},
|
||||
child: const Text('login'))),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
114
example/libs/README.md
Normal file
114
example/libs/README.md
Normal file
@@ -0,0 +1,114 @@
|
||||
# 本地 AAR 调试配置
|
||||
|
||||
此目录用于放置本地编译的 OpenIM SDK AAR 文件,仅在 example 项目调试时使用。
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 步骤 1: 准备 AAR 文件
|
||||
|
||||
将你的 AAR 文件重命名为 `sdkcore-debug.aar` 并放在本目录:
|
||||
|
||||
```
|
||||
example/libs/
|
||||
└── sdkcore-debug.aar (你的本地编译 AAR 文件)
|
||||
```
|
||||
|
||||
### 步骤 2: 复制到 Maven 仓库结构
|
||||
|
||||
```bash
|
||||
# Linux/Mac/Git Bash
|
||||
cd example
|
||||
cp libs/sdkcore-debug.aar android/local-maven/com/openim/sdkcore/1.0.15-local/sdkcore-1.0.15-local.aar
|
||||
|
||||
# Windows PowerShell
|
||||
cd example
|
||||
Copy-Item libs\sdkcore-debug.aar android\local-maven\com\openim\sdkcore\1.0.15-local\sdkcore-1.0.15-local.aar
|
||||
```
|
||||
|
||||
**注意**: POM 文件已自动创建在 `android/local-maven/com/openim/sdkcore/1.0.15-local/sdkcore-1.0.15-local.pom`
|
||||
|
||||
### 步骤 3: 启用本地 AAR
|
||||
|
||||
编辑 `example/android/build.gradle`,取消以下两处注释:
|
||||
|
||||
**1. 第 28 行 - 启用本地 Maven 仓库:**
|
||||
```gradle
|
||||
maven { url 'file://' + projectDir.absolutePath + '/local-maven' }
|
||||
```
|
||||
|
||||
**2. 第 43-49 行 - 强制使用本地版本:**
|
||||
```gradle
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
force 'com.openim:sdkcore:1.0.15-local'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 步骤 4: 清理并重新构建
|
||||
|
||||
```bash
|
||||
cd example
|
||||
flutter clean
|
||||
flutter pub get
|
||||
flutter build apk # 或 flutter run
|
||||
```
|
||||
|
||||
## 更新 AAR 后快速替换
|
||||
|
||||
如果你已经配置过一次,只是更新了 AAR 文件:
|
||||
|
||||
```bash
|
||||
cd example
|
||||
# 复制新的 AAR 文件
|
||||
cp libs/sdkcore-debug.aar android/local-maven/com/openim/sdkcore/1.0.15-local/sdkcore-1.0.15-local.aar
|
||||
|
||||
# 清理并重新构建
|
||||
flutter clean && flutter pub get && flutter run
|
||||
```
|
||||
|
||||
## 调试完成后恢复
|
||||
|
||||
重新注释掉 `example/android/build.gradle` 中的两处配置即可恢复使用远程 Maven 仓库的版本。
|
||||
|
||||
## 目录结构
|
||||
|
||||
```
|
||||
example/
|
||||
├── libs/
|
||||
│ ├── README.md (本文件)
|
||||
│ └── sdkcore-debug.aar (你的 AAR 源文件)
|
||||
└── android/
|
||||
└── local-maven/ (Git 已忽略)
|
||||
└── com/openim/sdkcore/1.0.15-local/
|
||||
├── sdkcore-1.0.15-local.aar (Maven 仓库中的 AAR)
|
||||
└── sdkcore-1.0.15-local.pom (Maven 元数据)
|
||||
```
|
||||
|
||||
## 注意事项
|
||||
|
||||
- ✅ 此配置只影响 example 项目,不会修改插件本身
|
||||
- ✅ 切换远程/本地版本只需注释/取消注释即可
|
||||
- ✅ `.gitignore` 已配置忽略 `android/local-maven/` 目录
|
||||
- ⚠️ 每次修改 AAR 文件后需要重新复制到 Maven 目录并运行 `flutter clean`
|
||||
- ⚠️ 确保 AAR 文件名和版本号匹配
|
||||
|
||||
## 故障排查
|
||||
|
||||
### 问题 1: Kotlin 版本不兼容错误
|
||||
已修复:插件的 `android/build.gradle` 已添加 Kotlin 插件和正确的配置。
|
||||
|
||||
### 问题 2: "Zip file already contains entry" 错误
|
||||
运行彻底清理:
|
||||
```bash
|
||||
cd example
|
||||
flutter clean
|
||||
rm -rf build
|
||||
cd android && ./gradlew clean
|
||||
```
|
||||
|
||||
### 问题 3: 找不到 sdkcore 依赖
|
||||
确保:
|
||||
1. `android/build.gradle` 中的本地 Maven 仓库已取消注释
|
||||
2. `resolutionStrategy.force` 配置已取消注释
|
||||
3. AAR 文件已正确复制到 Maven 目录结构中
|
||||
@@ -57,6 +57,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.1"
|
||||
ffi:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: ffi
|
||||
sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.3"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@@ -82,6 +90,11 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_web_plugins:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -146,6 +159,118 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.0"
|
||||
path_provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: path_provider
|
||||
sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.5"
|
||||
path_provider_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_android
|
||||
sha256: "4adf4fd5423ec60a29506c76581bc05854c55e3a0b72d35bb28d661c9686edf2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.15"
|
||||
path_provider_foundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_foundation
|
||||
sha256: "4843174df4d288f5e29185bd6e72a6fbdf5a4a4602717eed565497429f179942"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
path_provider_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_linux
|
||||
sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
path_provider_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_platform_interface
|
||||
sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
path_provider_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_windows
|
||||
sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.0"
|
||||
permission_handler:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: permission_handler
|
||||
sha256: "59adad729136f01ea9e35a48f5d1395e25cba6cea552249ddbe9cf950f5d7849"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "11.4.0"
|
||||
permission_handler_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_android
|
||||
sha256: d3971dcdd76182a0c198c096b5db2f0884b0d4196723d21a866fc4cdea057ebc
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "12.1.0"
|
||||
permission_handler_apple:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_apple
|
||||
sha256: f000131e755c54cf4d84a5d8bd6e4149e262cc31c5a8b1d698de1ac85fa41023
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.4.7"
|
||||
permission_handler_html:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_html
|
||||
sha256: "38f000e83355abb3392140f6bc3030660cfaef189e1f87824facb76300b4ff24"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.3+5"
|
||||
permission_handler_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_platform_interface
|
||||
sha256: eb99b295153abce5d683cac8c02e22faab63e50679b937fa1bf67d58bb282878
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.3.0"
|
||||
permission_handler_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_windows
|
||||
sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.1"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: platform
|
||||
sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.6"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: plugin_platform_interface
|
||||
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.8"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@@ -215,6 +340,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "14.2.5"
|
||||
web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web
|
||||
sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xdg_directories
|
||||
sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
sdks:
|
||||
dart: ">=3.4.4 <4.0.0"
|
||||
flutter: ">=3.18.0-18.0.pre.54"
|
||||
dart: ">=3.5.0 <4.0.0"
|
||||
flutter: ">=3.24.0"
|
||||
|
||||
@@ -43,6 +43,10 @@ dependencies:
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.6
|
||||
permission_handler: ^11.3.1
|
||||
path_provider: ^2.1.4
|
||||
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
34
example/update-local-aar.bat
Normal file
34
example/update-local-aar.bat
Normal file
@@ -0,0 +1,34 @@
|
||||
@echo off
|
||||
REM ====================================
|
||||
REM 更新本地 AAR 并重新构建
|
||||
REM ====================================
|
||||
|
||||
echo [1/5] 复制 AAR 文件到 Maven 仓库...
|
||||
copy /Y libs\sdkcore-debug.aar android\local-maven\com\openim\sdkcore\1.0.15-local\sdkcore-1.0.15-local.aar
|
||||
if %errorlevel% neq 0 (
|
||||
echo 错误: AAR 文件复制失败,请检查 libs\sdkcore-debug.aar 是否存在
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [2/5] 清理 Flutter 缓存...
|
||||
flutter clean
|
||||
|
||||
echo [3/5] 删除构建目录...
|
||||
if exist build rmdir /S /Q build
|
||||
|
||||
echo [4/5] 清理 Gradle 缓存...
|
||||
cd android
|
||||
call gradlew.bat clean
|
||||
cd ..
|
||||
|
||||
echo [5/5] 重新获取依赖...
|
||||
flutter pub get
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo 更新完成!现在可以运行:
|
||||
echo flutter run (运行应用)
|
||||
echo flutter build apk (构建 APK)
|
||||
echo ========================================
|
||||
pause
|
||||
34
example/update-local-aar.sh
Normal file
34
example/update-local-aar.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
####################################
|
||||
# 更新本地 AAR 并重新构建
|
||||
####################################
|
||||
|
||||
set -e # 遇到错误立即退出
|
||||
|
||||
echo "[1/5] 复制 AAR 文件到 Maven 仓库..."
|
||||
if [ ! -f "libs/sdkcore-debug.aar" ]; then
|
||||
echo "错误: libs/sdkcore-debug.aar 不存在"
|
||||
exit 1
|
||||
fi
|
||||
cp libs/sdkcore-debug.aar android/local-maven/com/openim/sdkcore/1.0.15-local/sdkcore-1.0.15-local.aar
|
||||
|
||||
echo "[2/5] 清理 Flutter 缓存..."
|
||||
flutter clean
|
||||
|
||||
echo "[3/5] 删除构建目录..."
|
||||
rm -rf build
|
||||
|
||||
echo "[4/5] 清理 Gradle 缓存..."
|
||||
cd android
|
||||
./gradlew clean
|
||||
cd ..
|
||||
|
||||
echo "[5/5] 重新获取依赖..."
|
||||
flutter pub get
|
||||
|
||||
echo ""
|
||||
echo "========================================"
|
||||
echo "更新完成!现在可以运行:"
|
||||
echo " flutter run (运行应用)"
|
||||
echo " flutter build apk (构建 APK)"
|
||||
echo "========================================"
|
||||
@@ -7,8 +7,11 @@
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <flutter_openim_sdk/flutter_openim_sdk_plugin.h>
|
||||
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
FlutterOpenimSdkPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("FlutterOpenimSdkPlugin"));
|
||||
PermissionHandlerWindowsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
flutter_openim_sdk
|
||||
permission_handler_windows
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
|
||||
Reference in New Issue
Block a user