Showing
84 changed files
with
103 additions
and
3148 deletions
| @@ -83,8 +83,8 @@ android { | @@ -83,8 +83,8 @@ android { | ||
| 83 | 83 | ||
| 84 | ndk { | 84 | ndk { |
| 85 | //选择要添加的对应 cpu 类型的 .so 库。 | 85 | //选择要添加的对应 cpu 类型的 .so 库。 |
| 86 | - abiFilters 'arm64-v8a', 'x86_64', 'mips64' //魅族64位,不支持32位 | ||
| 87 | - // abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86_64','x86', 'mips', 'mips64' | 86 | + // abiFilters 'arm64-v8a', 'x86_64', 'mips64' //魅族64位,不支持32位 |
| 87 | + abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86_64','x86', 'mips', 'mips64' | ||
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | lintOptions { | 90 | lintOptions { |
| @@ -2834,6 +2834,84 @@ class NotebookDetailPageState extends State<NotebookDetailPage> | @@ -2834,6 +2834,84 @@ class NotebookDetailPageState extends State<NotebookDetailPage> | ||
| 2834 | ]); | 2834 | ]); |
| 2835 | } | 2835 | } |
| 2836 | 2836 | ||
| 2837 | + _goCustomerDetail(isVVip) { | ||
| 2838 | + //管理员和店长跳转全店客情 | ||
| 2839 | + // 其他人是自己的客户跳转,不是置灰 | ||
| 2840 | + | ||
| 2841 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 2842 | + | ||
| 2843 | + if (userModel.user!.role_name == '管理员' || | ||
| 2844 | + userModel.user!.role_name == '店长') { | ||
| 2845 | + //gid 跳转客户详情页面 | ||
| 2846 | + CustomerBySellerSunModel userHistoryEntity = CustomerBySellerSunModel( | ||
| 2847 | + null, | ||
| 2848 | + null, | ||
| 2849 | + detailModel!.detailModelAllSunModel!.phone, | ||
| 2850 | + null, | ||
| 2851 | + null, | ||
| 2852 | + null, | ||
| 2853 | + null, | ||
| 2854 | + null, | ||
| 2855 | + null, | ||
| 2856 | + null, | ||
| 2857 | + null, | ||
| 2858 | + detailModel!.detailModelAllSunModel!.gid, | ||
| 2859 | + null, | ||
| 2860 | + null, | ||
| 2861 | + null, | ||
| 2862 | + null); | ||
| 2863 | + if (isVVip) { | ||
| 2864 | + NavigatorUtil.goCustomerDetailPage( | ||
| 2865 | + context, userHistoryEntity, FromPage.FromPageMessagePage); | ||
| 2866 | + } else { | ||
| 2867 | + NavigatorUtil.goCustomerDetailPageSim(context, userHistoryEntity); | ||
| 2868 | + } | ||
| 2869 | + } else if (userModel.user!.openid == | ||
| 2870 | + detailModel!.detailModelAllSunModel!.guestUid) { | ||
| 2871 | + //当前客户是登录人的客户 | ||
| 2872 | + // 进入我的客户详情 | ||
| 2873 | + CustomerListSunModel userHistoryEntity = CustomerListSunModel( | ||
| 2874 | + detailModel!.detailModelAllSunModel!.gid, | ||
| 2875 | + null, | ||
| 2876 | + null, | ||
| 2877 | + null, | ||
| 2878 | + null, | ||
| 2879 | + detailModel!.detailModelAllSunModel!.phone, | ||
| 2880 | + null, | ||
| 2881 | + null, | ||
| 2882 | + null, | ||
| 2883 | + null, | ||
| 2884 | + null, | ||
| 2885 | + null, | ||
| 2886 | + null, | ||
| 2887 | + null, | ||
| 2888 | + null, | ||
| 2889 | + null, | ||
| 2890 | + null, | ||
| 2891 | + null, | ||
| 2892 | + null, | ||
| 2893 | + null, | ||
| 2894 | + null, | ||
| 2895 | + null, | ||
| 2896 | + null, | ||
| 2897 | + null, | ||
| 2898 | + null, | ||
| 2899 | + null, | ||
| 2900 | + ); | ||
| 2901 | + if (isVVip) { | ||
| 2902 | + NavigatorUtil.goMyCustomerDetailPage(context, userHistoryEntity, | ||
| 2903 | + FromPage.FromPageMyCustomer, userModel.user!.openid); | ||
| 2904 | + } else { | ||
| 2905 | + NavigatorUtil.goMyCustomerDetailPageSim( | ||
| 2906 | + context, | ||
| 2907 | + userHistoryEntity, | ||
| 2908 | + ); | ||
| 2909 | + } | ||
| 2910 | + } else { | ||
| 2911 | + Utils.showToast('您没有权限查看'); | ||
| 2912 | + } | ||
| 2913 | + } | ||
| 2914 | + | ||
| 2837 | @override | 2915 | @override |
| 2838 | Widget build(BuildContext context) { | 2916 | Widget build(BuildContext context) { |
| 2839 | if (MediaQuery.of(context).viewInsets.bottom == 0) { | 2917 | if (MediaQuery.of(context).viewInsets.bottom == 0) { |
| @@ -4486,95 +4564,20 @@ class NotebookDetailPageState extends State<NotebookDetailPage> | @@ -4486,95 +4564,20 @@ class NotebookDetailPageState extends State<NotebookDetailPage> | ||
| 4486 | 24, | 4564 | 24, |
| 4487 | onPressed: | 4565 | onPressed: |
| 4488 | () { | 4566 | () { |
| 4489 | - if (!detailModel! | ||
| 4490 | - .sellerPreserve) { | ||
| 4491 | - //没有购买客情维护模块 | ||
| 4492 | - //提示购买 | ||
| 4493 | - | ||
| 4494 | - DialogUtil.showSellerVersionBuyDialog( | ||
| 4495 | - context, | ||
| 4496 | - '客情维护', | ||
| 4497 | - (v) {}); | ||
| 4498 | - return; | ||
| 4499 | - } | ||
| 4500 | - | ||
| 4501 | - //管理员和店长跳转全店客情 | ||
| 4502 | - // 其他人是自己的客户跳转,不是置灰 | ||
| 4503 | - | ||
| 4504 | - UserModel | ||
| 4505 | - userModel = | ||
| 4506 | - Provider.of<UserModel>(context, | ||
| 4507 | - listen: false); | ||
| 4508 | - | ||
| 4509 | - if (userModel.user!.role_name == | ||
| 4510 | - '管理员' || | ||
| 4511 | - userModel.user!.role_name == | ||
| 4512 | - '店长') { | ||
| 4513 | - //gid 跳转客户详情页面 | ||
| 4514 | - CustomerBySellerSunModel userHistoryEntity = CustomerBySellerSunModel( | ||
| 4515 | - null, | ||
| 4516 | - null, | ||
| 4517 | - detailModel!.detailModelAllSunModel!.phone, | ||
| 4518 | - null, | ||
| 4519 | - null, | ||
| 4520 | - null, | ||
| 4521 | - null, | ||
| 4522 | - null, | ||
| 4523 | - null, | ||
| 4524 | - null, | ||
| 4525 | - null, | ||
| 4526 | - detailModel!.detailModelAllSunModel!.gid, | ||
| 4527 | - null, | ||
| 4528 | - null, | ||
| 4529 | - null, | ||
| 4530 | - null); | ||
| 4531 | - NavigatorUtil.goCustomerDetailPage( | ||
| 4532 | - context, | ||
| 4533 | - userHistoryEntity, | ||
| 4534 | - FromPage.FromPageMessagePage); | ||
| 4535 | - } else if (userModel.user!.openid == | ||
| 4536 | - detailModel!.detailModelAllSunModel!.guestUid) { | ||
| 4537 | - //当前客户是登录人的客户 | ||
| 4538 | - // 进入我的客户详情 | ||
| 4539 | - CustomerListSunModel | ||
| 4540 | - userHistoryEntity = | ||
| 4541 | - CustomerListSunModel( | ||
| 4542 | - detailModel!.detailModelAllSunModel!.gid, | ||
| 4543 | - null, | ||
| 4544 | - null, | ||
| 4545 | - null, | ||
| 4546 | - null, | ||
| 4547 | - detailModel!.detailModelAllSunModel!.phone, | ||
| 4548 | - null, | ||
| 4549 | - null, | ||
| 4550 | - null, | ||
| 4551 | - null, | ||
| 4552 | - null, | ||
| 4553 | - null, | ||
| 4554 | - null, | ||
| 4555 | - null, | ||
| 4556 | - null, | ||
| 4557 | - null, | ||
| 4558 | - null, | ||
| 4559 | - null, | ||
| 4560 | - null, | ||
| 4561 | - null, | ||
| 4562 | - null, | ||
| 4563 | - null, | ||
| 4564 | - null, | ||
| 4565 | - null, | ||
| 4566 | - null, | ||
| 4567 | - null, | ||
| 4568 | - ); | ||
| 4569 | - | ||
| 4570 | - NavigatorUtil.goMyCustomerDetailPage( | ||
| 4571 | - context, | ||
| 4572 | - userHistoryEntity, | ||
| 4573 | - FromPage.FromPageMyCustomer, | ||
| 4574 | - userModel.user!.openid); | 4567 | + if (detailModel! |
| 4568 | + .sellerNormalSpecial) { | ||
| 4569 | + //标准版 | ||
| 4570 | + if (detailModel! | ||
| 4571 | + .sellerPreserve) { | ||
| 4572 | + //进入超能版客情 | ||
| 4573 | + _goCustomerDetail(true); | ||
| 4574 | + } else { | ||
| 4575 | + _goCustomerDetail(false); | ||
| 4576 | + } | ||
| 4575 | } else { | 4577 | } else { |
| 4576 | - Utils.showToast( | ||
| 4577 | - '您没有权限查看'); | 4578 | + //进入超能版客情 |
| 4579 | + _goCustomerDetail( | ||
| 4580 | + true); | ||
| 4578 | } | 4581 | } |
| 4579 | }, | 4582 | }, |
| 4580 | ), | 4583 | ), |
| @@ -161,7 +161,7 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -161,7 +161,7 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | getSellerVersion() async { | 163 | getSellerVersion() async { |
| 164 | - await collectStoreProvider.getSellerVersion(context); | 164 | + await collectStoreProvider.getSellerVersion(context,showLoading: false); |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | /// 第一个显示今天 | 167 | /// 第一个显示今天 |
| @@ -299,7 +299,7 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -299,7 +299,7 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 299 | getDzSellerConfTemp() async { | 299 | getDzSellerConfTemp() async { |
| 300 | MarketingCenterProvider marketingCenterProvider = | 300 | MarketingCenterProvider marketingCenterProvider = |
| 301 | Provider.of<MarketingCenterProvider>(context, listen: false); | 301 | Provider.of<MarketingCenterProvider>(context, listen: false); |
| 302 | - bool success = await marketingCenterProvider.getDzSellerConf(context); | 302 | + bool success = await marketingCenterProvider.getDzSellerConf(context,showLoading: false); |
| 303 | if (success && marketingCenterProvider.dzSellerConfModel != null) { | 303 | if (success && marketingCenterProvider.dzSellerConfModel != null) { |
| 304 | cancelDay = marketingCenterProvider.dzSellerConfModel!.cancelDay; | 304 | cancelDay = marketingCenterProvider.dzSellerConfModel!.cancelDay; |
| 305 | cancelShopowner = | 305 | cancelShopowner = |
library/flutter_wxwork/.gitignore
deleted
100644 → 0
| 1 | -# Miscellaneous | ||
| 2 | -*.class | ||
| 3 | -*.log | ||
| 4 | -*.pyc | ||
| 5 | -*.swp | ||
| 6 | -.DS_Store | ||
| 7 | -.atom/ | ||
| 8 | -.buildlog/ | ||
| 9 | -.history | ||
| 10 | -.svn/ | ||
| 11 | -migrate_working_dir/ | ||
| 12 | - | ||
| 13 | -# IntelliJ related | ||
| 14 | -*.iml | ||
| 15 | -*.ipr | ||
| 16 | -*.iws | ||
| 17 | -.idea/ | ||
| 18 | - | ||
| 19 | -# The .vscode folder contains launch configuration and tasks you configure in | ||
| 20 | -# VS Code which you may wish to be included in version control, so this line | ||
| 21 | -# is commented out by default. | ||
| 22 | -#.vscode/ | ||
| 23 | - | ||
| 24 | -# Flutter/Dart/Pub related | ||
| 25 | -# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. | ||
| 26 | -/pubspec.lock | ||
| 27 | -**/doc/api/ | ||
| 28 | -.dart_tool/ | ||
| 29 | -.packages | ||
| 30 | -build/ |
library/flutter_wxwork/.metadata
deleted
100644 → 0
| 1 | -# This file tracks properties of this Flutter project. | ||
| 2 | -# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
| 3 | -# | ||
| 4 | -# This file should be version controlled. | ||
| 5 | - | ||
| 6 | -version: | ||
| 7 | - revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
| 8 | - channel: stable | ||
| 9 | - | ||
| 10 | -project_type: plugin | ||
| 11 | - | ||
| 12 | -# Tracks metadata for the flutter migrate command | ||
| 13 | -migration: | ||
| 14 | - platforms: | ||
| 15 | - - platform: root | ||
| 16 | - create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
| 17 | - base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
| 18 | - - platform: android | ||
| 19 | - create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
| 20 | - base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
| 21 | - - platform: ios | ||
| 22 | - create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
| 23 | - base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
| 24 | - | ||
| 25 | - # User provided section | ||
| 26 | - | ||
| 27 | - # List of Local paths (relative to this file) that should be | ||
| 28 | - # ignored by the migrate tool. | ||
| 29 | - # | ||
| 30 | - # Files that are not part of the templates will be ignored by default. | ||
| 31 | - unmanaged_files: | ||
| 32 | - - 'lib/main.dart' | ||
| 33 | - - 'ios/Runner.xcodeproj/project.pbxproj' |
library/flutter_wxwork/CHANGELOG.md
deleted
100644 → 0
library/flutter_wxwork/LICENSE
deleted
100644 → 0
| 1 | -TODO: Add your license here. |
library/flutter_wxwork/README.md
deleted
100644 → 0
| 1 | -# flutter_wxwork | ||
| 2 | - | ||
| 3 | -A new Flutter plugin project. | ||
| 4 | - | ||
| 5 | -## Getting Started | ||
| 6 | - | ||
| 7 | -This project is a starting point for a Flutter | ||
| 8 | -[plug-in package](https://flutter.dev/developing-packages/), | ||
| 9 | -a specialized package that includes platform-specific implementation code for | ||
| 10 | -Android and/or iOS. | ||
| 11 | - | ||
| 12 | -For help getting started with Flutter development, view the | ||
| 13 | -[online documentation](https://flutter.dev/docs), which offers tutorials, | ||
| 14 | -samples, guidance on mobile development, and a full API reference. | ||
| 15 | - |
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
library/flutter_wxwork/android/.gradle/7.5.1/dependencies-accessors/gc.properties
deleted
100644 → 0
library/flutter_wxwork/android/.gradle/7.5.1/executionHistory/executionHistory.bin
deleted
100644 → 0
No preview for this file type
library/flutter_wxwork/android/.gradle/7.5.1/executionHistory/executionHistory.lock
deleted
100644 → 0
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
library/flutter_wxwork/android/.gradle/7.5/executionHistory/executionHistory.lock
deleted
100644 → 0
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
library/flutter_wxwork/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock
deleted
100644 → 0
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
| 1 | -85811fdeeab3e6378f1ae757e3e45719 |
| 1 | -e2d7230103f0366b3ab9986f409c06c6c37b398d |
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | -<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | - xmlns:xsi="http://www.w3.org/TR/xmlschema-1/"> | ||
| 4 | - <modelVersion>4.0.0</modelVersion> | ||
| 5 | - <groupId>com.tecent</groupId> | ||
| 6 | - <artifactId>sdk</artifactId> | ||
| 7 | - <version>2.0.12</version> | ||
| 8 | - <packaging>aar</packaging> | ||
| 9 | -</project> |
| 1 | -4d692fdbce7e06bf09e5154e8c7339be |
| 1 | -b104313c20c0682d7d488805d61db889a9cc7ea9 |
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | -<metadata> | ||
| 3 | - <groupId>com.tecent</groupId> | ||
| 4 | - <artifactId>sdk</artifactId> | ||
| 5 | - <versioning> | ||
| 6 | - <release>2.0.12</release> | ||
| 7 | - <versions> | ||
| 8 | - <version>2.0.12</version> | ||
| 9 | - </versions> | ||
| 10 | - <lastUpdated>20230706035721</lastUpdated> | ||
| 11 | - </versioning> | ||
| 12 | -</metadata> |
| 1 | -0845877a0e8540a7882cdc2fc4dbbc07 |
| 1 | -9d8eb88e3c52335f161001635c9a87d88388e444 |
| 1 | -import java.util.zip.ZipEntry | ||
| 2 | -import java.util.zip.ZipFile | ||
| 3 | - | ||
| 4 | -// 拷贝aar的方法 | ||
| 5 | -static aarFileCopy(String srcPath,String desPath) { | ||
| 6 | - System.out.println("copy aar from <<${srcPath}>> to <<${desPath}>>") | ||
| 7 | - try { | ||
| 8 | - FileInputStream fis = new FileInputStream(srcPath) | ||
| 9 | - FileOutputStream fos = new FileOutputStream(desPath) | ||
| 10 | - byte[] data = new byte[1024*8] | ||
| 11 | - int len = 0 | ||
| 12 | - while ((len = fis.read(data))!=-1) { | ||
| 13 | - fos.write(data,0,len) | ||
| 14 | - } | ||
| 15 | - fis.close() | ||
| 16 | - fos.close() | ||
| 17 | - }catch(Exception e) { | ||
| 18 | - e.printStackTrace() | ||
| 19 | - } | ||
| 20 | -} | ||
| 21 | -//把aar拷贝进入主项目的方法 com.example.android_control换成你自己的插件名 | ||
| 22 | -copyAar2Host('com.wxwork.flutter_wxwork') | ||
| 23 | -void copyAar2Host(String pluginGroup) { | ||
| 24 | - Project currentProject = null | ||
| 25 | - Project appProject = null | ||
| 26 | - rootProject.allprojects.each { | ||
| 27 | - p-> | ||
| 28 | - boolean isApp = p.plugins.hasPlugin("com.android.application") | ||
| 29 | - println("<<${p.name}>> isHost ? ${isApp}") | ||
| 30 | - if (p.group == pluginGroup) { | ||
| 31 | - currentProject = p | ||
| 32 | - println("Plugin project name is $currentProject") | ||
| 33 | - } | ||
| 34 | - if(isApp) { | ||
| 35 | - appProject = p | ||
| 36 | - println("Host project name is <<${p.name}>>") | ||
| 37 | - } | ||
| 38 | - } | ||
| 39 | - Set<File> aarFiles = new HashSet<File>() | ||
| 40 | - if (appProject != null && currentProject != null) { | ||
| 41 | - File libs = new File("${currentProject.projectDir}","libs") | ||
| 42 | - if(libs.isDirectory()) { | ||
| 43 | - libs.listFiles().each { | ||
| 44 | - f-> | ||
| 45 | - if(f.name.endsWith(".aar")) { | ||
| 46 | - println("The aar file name to be copied is <<${f.name}>>") | ||
| 47 | - aarFiles.add(f) | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - } | ||
| 51 | - } | ||
| 52 | - if (!aarFiles.isEmpty()) { | ||
| 53 | - File applibs = new File("${appProject.projectDir}${File.separator}libs") | ||
| 54 | - if(!applibs.isDirectory()) { | ||
| 55 | - applibs.mkdirs() | ||
| 56 | - } | ||
| 57 | - aarFiles.each { | ||
| 58 | - f-> | ||
| 59 | - File copyAar = new File("${appProject.projectDir}${File.separator}libs",f.name) | ||
| 60 | - if(!copyAar.exists()) { | ||
| 61 | - copyAar.createNewFile() | ||
| 62 | - aarFileCopy(f.path,copyAar.path) | ||
| 63 | - } else { | ||
| 64 | - | ||
| 65 | - } | ||
| 66 | - } | ||
| 67 | - appProject.dependencies { | ||
| 68 | - implementation fileTree(dir:"${appProject.projectDir}${File.separator}libs",include:["*.jar","*.aar"]) | ||
| 69 | - } | ||
| 70 | - } | ||
| 71 | - } | ||
| 72 | -} | ||
| 73 | - | ||
| 74 | -repositories{ | ||
| 75 | - flatDir { | ||
| 76 | - dirs 'libs' | ||
| 77 | - } | ||
| 78 | -} | ||
| 79 | - |
| 1 | -group 'com.wxwork.flutter_wxwork' | ||
| 2 | -version '1.0' | ||
| 3 | - | ||
| 4 | -buildscript { | ||
| 5 | - | ||
| 6 | - repositories { | ||
| 7 | - // maven { | ||
| 8 | - // url 'file:/Users/wangdongni/Desktop/oneKey_wdn_none_safty/Flutter-ReserveApp/library/flutter_wxwork/android/libs/maven/' | ||
| 9 | - // } | ||
| 10 | - // //先查找本地仓库 | ||
| 11 | - // mavenLocal() | ||
| 12 | - google() | ||
| 13 | - mavenCentral() | ||
| 14 | - | ||
| 15 | - } | ||
| 16 | - | ||
| 17 | - dependencies { | ||
| 18 | - classpath 'com.android.tools.build:gradle:7.4.1' | ||
| 19 | - } | ||
| 20 | -} | ||
| 21 | - | ||
| 22 | -allprojects { | ||
| 23 | - repositories { | ||
| 24 | - | ||
| 25 | - // maven { | ||
| 26 | - // url 'file:/Users/wangdongni/Desktop/oneKey_wdn_none_safty/Flutter-ReserveApp/library/flutter_wxwork/android/libs/maven' | ||
| 27 | - // } | ||
| 28 | - | ||
| 29 | - // //先查找本地仓库 | ||
| 30 | - // mavenLocal() | ||
| 31 | - google() | ||
| 32 | - mavenCentral() | ||
| 33 | - // google() | ||
| 34 | - // jcenter() | ||
| 35 | - } | ||
| 36 | -} | ||
| 37 | - | ||
| 38 | -apply plugin: 'com.android.library' | ||
| 39 | -apply from: './aar_tools.gradle' | ||
| 40 | - | ||
| 41 | -android { | ||
| 42 | - compileSdkVersion 33 | ||
| 43 | - | ||
| 44 | - compileOptions { | ||
| 45 | - sourceCompatibility JavaVersion.VERSION_1_8 | ||
| 46 | - targetCompatibility JavaVersion.VERSION_1_8 | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - defaultConfig { | ||
| 50 | - minSdkVersion 21 | ||
| 51 | - targetSdkVersion 30 | ||
| 52 | - } | ||
| 53 | - dependencies { | ||
| 54 | - testImplementation 'junit:junit:4.13.2' | ||
| 55 | - testImplementation 'org.mockito:mockito-core:5.0.0' | ||
| 56 | - // implementation fileTree (dir:"../libs/maven/com/example/mylibrary/1.0",include:["*.jar","*.aar"]) | ||
| 57 | - // implementation 'com.example:mylibrary:1.0' | ||
| 58 | - // implementation files('../libs/maven/com/example/mylibrary/1.0/mylibrary-1.0.aar') | ||
| 59 | - // implementation (fileTree("lib")) | ||
| 60 | - // implementation fileTree(dir: 'lib', include: ['*.aar']) | ||
| 61 | - // implementation (files ("lib/lib_wwapi-2.0.12.11.aar")) | ||
| 62 | - // implementation project(path: ':lib:wxwork') | ||
| 63 | - // implementation (fileTree("libs")) | ||
| 64 | - // api fileTree(dir: "libs", include: ["*.jar", "*.aar"]) | ||
| 65 | - // compileOnly fileTree(includes: [".aar"],dir:"libs") | ||
| 66 | - // compileOnly fileTree(includes: ["*.aar"],dir:"libs") | ||
| 67 | - // compileOnly files("$flutterRoot/bin/cache/artifacts/engine/android-arm/flutter.jar") | ||
| 68 | - // compileOnly("androidx.annotation:annotation:1.0.0") | ||
| 69 | - | ||
| 70 | - | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | - testOptions { | ||
| 74 | - unitTests.all { | ||
| 75 | - testLogging { | ||
| 76 | - events "passed", "skipped", "failed", "standardOut", "standardError" | ||
| 77 | - outputs.upToDateWhen { false } | ||
| 78 | - showStandardStreams = true | ||
| 79 | - } | ||
| 80 | - } | ||
| 81 | - } | ||
| 82 | -} | ||
| 83 | - | ||
| 84 | - | ||
| 85 | -//读取配置 | ||
| 86 | -def localProperties = new Properties() | ||
| 87 | -def localPropertiesFile = rootProject.file('local.properties') | ||
| 88 | -if (localPropertiesFile.exists()) { | ||
| 89 | - localPropertiesFile.withReader('UTF-8') { | ||
| 90 | - reader-> localProperties.load(reader) | ||
| 91 | - } | ||
| 92 | -} | ||
| 93 | -//获取flutter sdk路径 | ||
| 94 | -def flutterRoot = localProperties.getProperty('flutter.sdk') | ||
| 95 | -if(flutterRoot == null) { | ||
| 96 | - throw new GradleException('Flutter sdk not found.') | ||
| 97 | -} | ||
| 98 | -dependencies { | ||
| 99 | - compileOnly fileTree(includes: ["*.aar"],dir:"libs") | ||
| 100 | - compileOnly files("$flutterRoot/bin/cache/artifacts/engine/android-arm/flutter.jar") | ||
| 101 | - compileOnly("androidx.annotation:annotation:1.0.0") | ||
| 102 | -} | ||
| 103 | - |
No preview for this file type
| 1 | -#!/bin/sh | ||
| 2 | - | ||
| 3 | -# | ||
| 4 | -# Copyright © 2015-2021 the original authors. | ||
| 5 | -# | ||
| 6 | -# Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 7 | -# you may not use this file except in compliance with the License. | ||
| 8 | -# You may obtain a copy of the License at | ||
| 9 | -# | ||
| 10 | -# https://www.apache.org/licenses/LICENSE-2.0 | ||
| 11 | -# | ||
| 12 | -# Unless required by applicable law or agreed to in writing, software | ||
| 13 | -# distributed under the License is distributed on an "AS IS" BASIS, | ||
| 14 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 15 | -# See the License for the specific language governing permissions and | ||
| 16 | -# limitations under the License. | ||
| 17 | -# | ||
| 18 | - | ||
| 19 | -############################################################################## | ||
| 20 | -# | ||
| 21 | -# Gradle start up script for POSIX generated by Gradle. | ||
| 22 | -# | ||
| 23 | -# Important for running: | ||
| 24 | -# | ||
| 25 | -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is | ||
| 26 | -# noncompliant, but you have some other compliant shell such as ksh or | ||
| 27 | -# bash, then to run this script, type that shell name before the whole | ||
| 28 | -# command line, like: | ||
| 29 | -# | ||
| 30 | -# ksh Gradle | ||
| 31 | -# | ||
| 32 | -# Busybox and similar reduced shells will NOT work, because this script | ||
| 33 | -# requires all of these POSIX shell features: | ||
| 34 | -# * functions; | ||
| 35 | -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», | ||
| 36 | -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; | ||
| 37 | -# * compound commands having a testable exit status, especially «case»; | ||
| 38 | -# * various built-in commands including «command», «set», and «ulimit». | ||
| 39 | -# | ||
| 40 | -# Important for patching: | ||
| 41 | -# | ||
| 42 | -# (2) This script targets any POSIX shell, so it avoids extensions provided | ||
| 43 | -# by Bash, Ksh, etc; in particular arrays are avoided. | ||
| 44 | -# | ||
| 45 | -# The "traditional" practice of packing multiple parameters into a | ||
| 46 | -# space-separated string is a well documented source of bugs and security | ||
| 47 | -# problems, so this is (mostly) avoided, by progressively accumulating | ||
| 48 | -# options in "$@", and eventually passing that to Java. | ||
| 49 | -# | ||
| 50 | -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, | ||
| 51 | -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; | ||
| 52 | -# see the in-line comments for details. | ||
| 53 | -# | ||
| 54 | -# There are tweaks for specific operating systems such as AIX, CygWin, | ||
| 55 | -# Darwin, MinGW, and NonStop. | ||
| 56 | -# | ||
| 57 | -# (3) This script is generated from the Groovy template | ||
| 58 | -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt | ||
| 59 | -# within the Gradle project. | ||
| 60 | -# | ||
| 61 | -# You can find Gradle at https://github.com/gradle/gradle/. | ||
| 62 | -# | ||
| 63 | -############################################################################## | ||
| 64 | - | ||
| 65 | -# Attempt to set APP_HOME | ||
| 66 | - | ||
| 67 | -# Resolve links: $0 may be a link | ||
| 68 | -app_path=$0 | ||
| 69 | - | ||
| 70 | -# Need this for daisy-chained symlinks. | ||
| 71 | -while | ||
| 72 | - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path | ||
| 73 | - [ -h "$app_path" ] | ||
| 74 | -do | ||
| 75 | - ls=$( ls -ld "$app_path" ) | ||
| 76 | - link=${ls#*' -> '} | ||
| 77 | - case $link in #( | ||
| 78 | - /*) app_path=$link ;; #( | ||
| 79 | - *) app_path=$APP_HOME$link ;; | ||
| 80 | - esac | ||
| 81 | -done | ||
| 82 | - | ||
| 83 | -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit | ||
| 84 | - | ||
| 85 | -APP_NAME="Gradle" | ||
| 86 | -APP_BASE_NAME=${0##*/} | ||
| 87 | - | ||
| 88 | -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||
| 89 | -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' | ||
| 90 | - | ||
| 91 | -# Use the maximum available, or set MAX_FD != -1 to use that value. | ||
| 92 | -MAX_FD=maximum | ||
| 93 | - | ||
| 94 | -warn () { | ||
| 95 | - echo "$*" | ||
| 96 | -} >&2 | ||
| 97 | - | ||
| 98 | -die () { | ||
| 99 | - echo | ||
| 100 | - echo "$*" | ||
| 101 | - echo | ||
| 102 | - exit 1 | ||
| 103 | -} >&2 | ||
| 104 | - | ||
| 105 | -# OS specific support (must be 'true' or 'false'). | ||
| 106 | -cygwin=false | ||
| 107 | -msys=false | ||
| 108 | -darwin=false | ||
| 109 | -nonstop=false | ||
| 110 | -case "$( uname )" in #( | ||
| 111 | - CYGWIN* ) cygwin=true ;; #( | ||
| 112 | - Darwin* ) darwin=true ;; #( | ||
| 113 | - MSYS* | MINGW* ) msys=true ;; #( | ||
| 114 | - NONSTOP* ) nonstop=true ;; | ||
| 115 | -esac | ||
| 116 | - | ||
| 117 | -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar | ||
| 118 | - | ||
| 119 | - | ||
| 120 | -# Determine the Java command to use to start the JVM. | ||
| 121 | -if [ -n "$JAVA_HOME" ] ; then | ||
| 122 | - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then | ||
| 123 | - # IBM's JDK on AIX uses strange locations for the executables | ||
| 124 | - JAVACMD=$JAVA_HOME/jre/sh/java | ||
| 125 | - else | ||
| 126 | - JAVACMD=$JAVA_HOME/bin/java | ||
| 127 | - fi | ||
| 128 | - if [ ! -x "$JAVACMD" ] ; then | ||
| 129 | - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME | ||
| 130 | - | ||
| 131 | -Please set the JAVA_HOME variable in your environment to match the | ||
| 132 | -location of your Java installation." | ||
| 133 | - fi | ||
| 134 | -else | ||
| 135 | - JAVACMD=java | ||
| 136 | - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | ||
| 137 | - | ||
| 138 | -Please set the JAVA_HOME variable in your environment to match the | ||
| 139 | -location of your Java installation." | ||
| 140 | -fi | ||
| 141 | - | ||
| 142 | -# Increase the maximum file descriptors if we can. | ||
| 143 | -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then | ||
| 144 | - case $MAX_FD in #( | ||
| 145 | - max*) | ||
| 146 | - MAX_FD=$( ulimit -H -n ) || | ||
| 147 | - warn "Could not query maximum file descriptor limit" | ||
| 148 | - esac | ||
| 149 | - case $MAX_FD in #( | ||
| 150 | - '' | soft) :;; #( | ||
| 151 | - *) | ||
| 152 | - ulimit -n "$MAX_FD" || | ||
| 153 | - warn "Could not set maximum file descriptor limit to $MAX_FD" | ||
| 154 | - esac | ||
| 155 | -fi | ||
| 156 | - | ||
| 157 | -# Collect all arguments for the java command, stacking in reverse order: | ||
| 158 | -# * args from the command line | ||
| 159 | -# * the main class name | ||
| 160 | -# * -classpath | ||
| 161 | -# * -D...appname settings | ||
| 162 | -# * --module-path (only if needed) | ||
| 163 | -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. | ||
| 164 | - | ||
| 165 | -# For Cygwin or MSYS, switch paths to Windows format before running java | ||
| 166 | -if "$cygwin" || "$msys" ; then | ||
| 167 | - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) | ||
| 168 | - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) | ||
| 169 | - | ||
| 170 | - JAVACMD=$( cygpath --unix "$JAVACMD" ) | ||
| 171 | - | ||
| 172 | - # Now convert the arguments - kludge to limit ourselves to /bin/sh | ||
| 173 | - for arg do | ||
| 174 | - if | ||
| 175 | - case $arg in #( | ||
| 176 | - -*) false ;; # don't mess with options #( | ||
| 177 | - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath | ||
| 178 | - [ -e "$t" ] ;; #( | ||
| 179 | - *) false ;; | ||
| 180 | - esac | ||
| 181 | - then | ||
| 182 | - arg=$( cygpath --path --ignore --mixed "$arg" ) | ||
| 183 | - fi | ||
| 184 | - # Roll the args list around exactly as many times as the number of | ||
| 185 | - # args, so each arg winds up back in the position where it started, but | ||
| 186 | - # possibly modified. | ||
| 187 | - # | ||
| 188 | - # NB: a `for` loop captures its iteration list before it begins, so | ||
| 189 | - # changing the positional parameters here affects neither the number of | ||
| 190 | - # iterations, nor the values presented in `arg`. | ||
| 191 | - shift # remove old arg | ||
| 192 | - set -- "$@" "$arg" # push replacement arg | ||
| 193 | - done | ||
| 194 | -fi | ||
| 195 | - | ||
| 196 | -# Collect all arguments for the java command; | ||
| 197 | -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of | ||
| 198 | -# shell script including quotes and variable substitutions, so put them in | ||
| 199 | -# double quotes to make sure that they get re-expanded; and | ||
| 200 | -# * put everything else in single quotes, so that it's not re-expanded. | ||
| 201 | - | ||
| 202 | -set -- \ | ||
| 203 | - "-Dorg.gradle.appname=$APP_BASE_NAME" \ | ||
| 204 | - -classpath "$CLASSPATH" \ | ||
| 205 | - org.gradle.wrapper.GradleWrapperMain \ | ||
| 206 | - "$@" | ||
| 207 | - | ||
| 208 | -# Stop when "xargs" is not available. | ||
| 209 | -if ! command -v xargs >/dev/null 2>&1 | ||
| 210 | -then | ||
| 211 | - die "xargs is not available" | ||
| 212 | -fi | ||
| 213 | - | ||
| 214 | -# Use "xargs" to parse quoted args. | ||
| 215 | -# | ||
| 216 | -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. | ||
| 217 | -# | ||
| 218 | -# In Bash we could simply go: | ||
| 219 | -# | ||
| 220 | -# readarray ARGS < <( xargs -n1 <<<"$var" ) && | ||
| 221 | -# set -- "${ARGS[@]}" "$@" | ||
| 222 | -# | ||
| 223 | -# but POSIX shell has neither arrays nor command substitution, so instead we | ||
| 224 | -# post-process each arg (as a line of input to sed) to backslash-escape any | ||
| 225 | -# character that might be a shell metacharacter, then use eval to reverse | ||
| 226 | -# that process (while maintaining the separation between arguments), and wrap | ||
| 227 | -# the whole thing up as a single "set" statement. | ||
| 228 | -# | ||
| 229 | -# This will of course break if any of these variables contains a newline or | ||
| 230 | -# an unmatched quote. | ||
| 231 | -# | ||
| 232 | - | ||
| 233 | -eval "set -- $( | ||
| 234 | - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | | ||
| 235 | - xargs -n1 | | ||
| 236 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | | ||
| 237 | - tr '\n' ' ' | ||
| 238 | - )" '"$@"' | ||
| 239 | - | ||
| 240 | -exec "$JAVACMD" "$@" |
| 1 | -@rem | ||
| 2 | -@rem Copyright 2015 the original author or authors. | ||
| 3 | -@rem | ||
| 4 | -@rem Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | -@rem you may not use this file except in compliance with the License. | ||
| 6 | -@rem You may obtain a copy of the License at | ||
| 7 | -@rem | ||
| 8 | -@rem https://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | -@rem | ||
| 10 | -@rem Unless required by applicable law or agreed to in writing, software | ||
| 11 | -@rem distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | -@rem See the License for the specific language governing permissions and | ||
| 14 | -@rem limitations under the License. | ||
| 15 | -@rem | ||
| 16 | - | ||
| 17 | -@if "%DEBUG%"=="" @echo off | ||
| 18 | -@rem ########################################################################## | ||
| 19 | -@rem | ||
| 20 | -@rem Gradle startup script for Windows | ||
| 21 | -@rem | ||
| 22 | -@rem ########################################################################## | ||
| 23 | - | ||
| 24 | -@rem Set local scope for the variables with windows NT shell | ||
| 25 | -if "%OS%"=="Windows_NT" setlocal | ||
| 26 | - | ||
| 27 | -set DIRNAME=%~dp0 | ||
| 28 | -if "%DIRNAME%"=="" set DIRNAME=. | ||
| 29 | -set APP_BASE_NAME=%~n0 | ||
| 30 | -set APP_HOME=%DIRNAME% | ||
| 31 | - | ||
| 32 | -@rem Resolve any "." and ".." in APP_HOME to make it shorter. | ||
| 33 | -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi | ||
| 34 | - | ||
| 35 | -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||
| 36 | -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" | ||
| 37 | - | ||
| 38 | -@rem Find java.exe | ||
| 39 | -if defined JAVA_HOME goto findJavaFromJavaHome | ||
| 40 | - | ||
| 41 | -set JAVA_EXE=java.exe | ||
| 42 | -%JAVA_EXE% -version >NUL 2>&1 | ||
| 43 | -if %ERRORLEVEL% equ 0 goto execute | ||
| 44 | - | ||
| 45 | -echo. | ||
| 46 | -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | ||
| 47 | -echo. | ||
| 48 | -echo Please set the JAVA_HOME variable in your environment to match the | ||
| 49 | -echo location of your Java installation. | ||
| 50 | - | ||
| 51 | -goto fail | ||
| 52 | - | ||
| 53 | -:findJavaFromJavaHome | ||
| 54 | -set JAVA_HOME=%JAVA_HOME:"=% | ||
| 55 | -set JAVA_EXE=%JAVA_HOME%/bin/java.exe | ||
| 56 | - | ||
| 57 | -if exist "%JAVA_EXE%" goto execute | ||
| 58 | - | ||
| 59 | -echo. | ||
| 60 | -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% | ||
| 61 | -echo. | ||
| 62 | -echo Please set the JAVA_HOME variable in your environment to match the | ||
| 63 | -echo location of your Java installation. | ||
| 64 | - | ||
| 65 | -goto fail | ||
| 66 | - | ||
| 67 | -:execute | ||
| 68 | -@rem Setup the command line | ||
| 69 | - | ||
| 70 | -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar | ||
| 71 | - | ||
| 72 | - | ||
| 73 | -@rem Execute Gradle | ||
| 74 | -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* | ||
| 75 | - | ||
| 76 | -:end | ||
| 77 | -@rem End local scope for the variables with windows NT shell | ||
| 78 | -if %ERRORLEVEL% equ 0 goto mainEnd | ||
| 79 | - | ||
| 80 | -:fail | ||
| 81 | -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of | ||
| 82 | -rem the _cmd.exe /c_ return code! | ||
| 83 | -set EXIT_CODE=%ERRORLEVEL% | ||
| 84 | -if %EXIT_CODE% equ 0 set EXIT_CODE=1 | ||
| 85 | -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% | ||
| 86 | -exit /b %EXIT_CODE% | ||
| 87 | - | ||
| 88 | -:mainEnd | ||
| 89 | -if "%OS%"=="Windows_NT" endlocal | ||
| 90 | - | ||
| 91 | -:omega |
No preview for this file type
| 1 | -package com.wxwork.flutter_wxwork; | ||
| 2 | - | ||
| 3 | - | ||
| 4 | -import android.graphics.Bitmap; | ||
| 5 | - import android.graphics.BitmapFactory; | ||
| 6 | - import android.os.AsyncTask; | ||
| 7 | - import java.io.InputStream; | ||
| 8 | - import java.net.HttpURLConnection; | ||
| 9 | - import java.net.URL; | ||
| 10 | - | ||
| 11 | -public class DownloadImageTask extends AsyncTask<String, Void, Bitmap> { | ||
| 12 | - private OnBitmapDownloadListener listener; | ||
| 13 | - | ||
| 14 | - public DownloadImageTask(OnBitmapDownloadListener listener) { | ||
| 15 | - this.listener = listener; | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | - @Override | ||
| 19 | - protected Bitmap doInBackground(String... urls) { | ||
| 20 | - String urlString = urls[0]; | ||
| 21 | - Bitmap bitmap = null; | ||
| 22 | - try { | ||
| 23 | - URL url = new URL(urlString); | ||
| 24 | - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); | ||
| 25 | - connection.setDoInput(true); | ||
| 26 | - connection.connect(); | ||
| 27 | - InputStream inputStream = connection.getInputStream(); | ||
| 28 | - bitmap = BitmapFactory.decodeStream(inputStream); | ||
| 29 | - inputStream.close(); | ||
| 30 | - } catch (Exception e) { | ||
| 31 | - e.printStackTrace(); | ||
| 32 | - } | ||
| 33 | - return bitmap; | ||
| 34 | - } | ||
| 35 | - | ||
| 36 | - @Override | ||
| 37 | - protected void onPostExecute(Bitmap bitmap) { | ||
| 38 | - listener.onBitmapDownloaded(bitmap); | ||
| 39 | - } | ||
| 40 | - | ||
| 41 | - public interface OnBitmapDownloadListener { | ||
| 42 | - void onBitmapDownloaded(Bitmap bitmap); | ||
| 43 | - } | ||
| 44 | -} |
| 1 | -package com.wxwork.flutter_wxwork; | ||
| 2 | - | ||
| 3 | -import androidx.annotation.NonNull; | ||
| 4 | - | ||
| 5 | -import io.flutter.embedding.engine.plugins.FlutterPlugin; | ||
| 6 | -import io.flutter.plugin.common.MethodCall; | ||
| 7 | -import io.flutter.plugin.common.MethodChannel; | ||
| 8 | -import io.flutter.plugin.common.MethodChannel.MethodCallHandler; | ||
| 9 | -import io.flutter.plugin.common.MethodChannel.Result; | ||
| 10 | -import com.tencent.wework.api.model.WWMediaText; | ||
| 11 | - | ||
| 12 | -// package com.example.flutter_wxwork; | ||
| 13 | - | ||
| 14 | -import android.content.Context; | ||
| 15 | -import android.util.Log; | ||
| 16 | -import android.widget.Toast; | ||
| 17 | - | ||
| 18 | - | ||
| 19 | - | ||
| 20 | -import com.tencent.wework.api.IWWAPI; | ||
| 21 | -import com.tencent.wework.api.IWWAPIEventHandler; | ||
| 22 | -import com.tencent.wework.api.WWAPIFactory; | ||
| 23 | -import com.tencent.wework.api.model.BaseMessage; | ||
| 24 | -import com.tencent.wework.api.model.WWAuthMessage; | ||
| 25 | -import com.tencent.wework.api.model.WWMediaMiniProgram; | ||
| 26 | -import com.tencent.wework.api.model.WWSimpleRespMessage; | ||
| 27 | -import java.net.HttpURLConnection; | ||
| 28 | -import java.net.URL; | ||
| 29 | -import android.graphics.Bitmap; | ||
| 30 | -import android.graphics.BitmapFactory; | ||
| 31 | -import java.io.BufferedInputStream; | ||
| 32 | -import java.io.IOException; | ||
| 33 | -import java.nio.ByteBuffer; | ||
| 34 | -import com.wxwork.flutter_wxwork.LoadImageUtil; | ||
| 35 | -import com.wxwork.flutter_wxwork.NetWorkUtils; | ||
| 36 | -import android.os.Parcel; | ||
| 37 | -import android.os.Parcelable; | ||
| 38 | -import java.io.ByteArrayOutputStream; | ||
| 39 | -import java.io.ByteArrayInputStream; | ||
| 40 | -import android.view.View; | ||
| 41 | - | ||
| 42 | - | ||
| 43 | -import java.io.FileOutputStream; | ||
| 44 | - | ||
| 45 | -import java.io.InputStream; | ||
| 46 | -import java.io.OutputStream; | ||
| 47 | - | ||
| 48 | -import java.net.MalformedURLException; | ||
| 49 | - | ||
| 50 | -import java.net.URLConnection; | ||
| 51 | - | ||
| 52 | - | ||
| 53 | - | ||
| 54 | - | ||
| 55 | - | ||
| 56 | - | ||
| 57 | -import java.util.HashMap; | ||
| 58 | -import java.util.Map; | ||
| 59 | - | ||
| 60 | - | ||
| 61 | - | ||
| 62 | - | ||
| 63 | - | ||
| 64 | - | ||
| 65 | - | ||
| 66 | - | ||
| 67 | -/** | ||
| 68 | - * FlutterWxworkPlugin | ||
| 69 | - */ | ||
| 70 | -public class FlutterWxworkPlugin implements FlutterPlugin, MethodCallHandler { | ||
| 71 | - /// The MethodChannel that will the communication between Flutter and native Android | ||
| 72 | - /// | ||
| 73 | - /// This local reference serves to register the plugin with the Flutter Engine and unregister it | ||
| 74 | - /// when the Flutter Engine is detached from the Activity | ||
| 75 | - private MethodChannel channel; | ||
| 76 | - | ||
| 77 | - private String APPID; | ||
| 78 | - private String AGENTID; | ||
| 79 | - private String SCHEMA; | ||
| 80 | - | ||
| 81 | - private IWWAPI iwwapi; | ||
| 82 | - | ||
| 83 | - private Context context; | ||
| 84 | - | ||
| 85 | - private static final int SHARE_MINI_PROGRAM_THUMB_LENGTH = 120 ; | ||
| 86 | - | ||
| 87 | - | ||
| 88 | - | ||
| 89 | - | ||
| 90 | - | ||
| 91 | - @Override | ||
| 92 | - public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) { | ||
| 93 | - channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "flutter_wxwork"); | ||
| 94 | - channel.setMethodCallHandler(this); | ||
| 95 | - context = flutterPluginBinding.getApplicationContext(); | ||
| 96 | - iwwapi = WWAPIFactory.createWWAPI(context); | ||
| 97 | - | ||
| 98 | - | ||
| 99 | - | ||
| 100 | - | ||
| 101 | - | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - @Override | ||
| 105 | - public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { | ||
| 106 | - @SuppressWarnings("unchecked") | ||
| 107 | - Map<String, String> arguments = (Map<String, String>) call.arguments; | ||
| 108 | - | ||
| 109 | - if (call.method.equals("isAppInstalled")) { | ||
| 110 | - boolean installed = iwwapi.isWWAppInstalled(); | ||
| 111 | - // if (installed) { | ||
| 112 | - result.success(installed); | ||
| 113 | - // } else { | ||
| 114 | - // result.success("0"); | ||
| 115 | - // } | ||
| 116 | - } else if (call.method.equals("register")) { | ||
| 117 | - APPID = arguments.get("corpId"); | ||
| 118 | - SCHEMA = arguments.get("scheme"); | ||
| 119 | - AGENTID = arguments.get("agentId"); | ||
| 120 | - boolean hasRegister = iwwapi.registerApp(SCHEMA); | ||
| 121 | - // if (hasRegister) { | ||
| 122 | - result.success(hasRegister); | ||
| 123 | - // } else { | ||
| 124 | - // result.success("0"); | ||
| 125 | - // } | ||
| 126 | - } else if (call.method.equals("auth")) { | ||
| 127 | - String state = arguments.get("state"); | ||
| 128 | - | ||
| 129 | - final WWAuthMessage.Req req = new WWAuthMessage.Req(); | ||
| 130 | - req.sch = SCHEMA; | ||
| 131 | - req.appId = APPID; | ||
| 132 | - req.agentId = AGENTID; | ||
| 133 | - req.state = state; | ||
| 134 | - | ||
| 135 | -// Toast.makeText(context, "sch:" + req.sch, | ||
| 136 | -// Toast.LENGTH_SHORT).show(); | ||
| 137 | - | ||
| 138 | - iwwapi.sendMessage(req, new IWWAPIEventHandler() { | ||
| 139 | - @Override | ||
| 140 | - public void handleResp(BaseMessage resp) { | ||
| 141 | - if (resp instanceof WWAuthMessage.Resp) { | ||
| 142 | - WWAuthMessage.Resp rsp = (WWAuthMessage.Resp) resp; | ||
| 143 | - Map<String, String> map = new HashMap<>(); | ||
| 144 | - map.put("code", rsp.code); | ||
| 145 | - map.put("errCode", String.valueOf(rsp.errCode)); | ||
| 146 | - map.put("state", String.valueOf(rsp.state)); | ||
| 147 | - result.success(map); | ||
| 148 | - } | ||
| 149 | - } | ||
| 150 | - }); | ||
| 151 | - | ||
| 152 | - }else if (call.method.equals("shareImageNetWork")) { | ||
| 153 | -// APPID = arguments.get("corpId"); | ||
| 154 | -// SCHEMA = arguments.get("scheme"); | ||
| 155 | -// AGENTID = arguments.get("agentId"); | ||
| 156 | -// boolean hasRegister = iwwapi.registerApp(SCHEMA); | ||
| 157 | -// // if (hasRegister) { | ||
| 158 | -// result.success(hasRegister); | ||
| 159 | -// // } else { | ||
| 160 | -// // result.success("0"); | ||
| 161 | -// // } | ||
| 162 | - } else if (call.method.equals("shareImagePath")) { | ||
| 163 | - }else if (call.method.equals("shareMiniProgram")) { | ||
| 164 | - | ||
| 165 | - | ||
| 166 | - | ||
| 167 | - | ||
| 168 | - | ||
| 169 | - | ||
| 170 | - WWMediaMiniProgram miniProgram = new WWMediaMiniProgram(); | ||
| 171 | - miniProgram.appPkg = "com.naji.one_key"; | ||
| 172 | - miniProgram.appName = "周到安排商家";//app name of this android pkg | ||
| 173 | - miniProgram.appId = APPID; //企业唯一标识。创建企业后显示在,我的企业 CorpID字段 | ||
| 174 | - miniProgram.agentId = AGENTID; //应用唯一标识。显示在具体应用下的 AgentId字段 | ||
| 175 | - miniProgram.schema = SCHEMA; | ||
| 176 | - | ||
| 177 | - miniProgram.username = arguments.get("userName"); //必须是应用关联的小程序,注意要有@app后缀 | ||
| 178 | - miniProgram.description = arguments.get("description"); | ||
| 179 | - miniProgram.path = arguments.get("path"); | ||
| 180 | - | ||
| 181 | - | ||
| 182 | - | ||
| 183 | - //得到图片 | ||
| 184 | - DownloadImageTask task = new DownloadImageTask(new DownloadImageTask.OnBitmapDownloadListener() { | ||
| 185 | - @Override | ||
| 186 | - public void onBitmapDownloaded(Bitmap bitmap) { | ||
| 187 | - | ||
| 188 | - | ||
| 189 | - //缩略图建议不超过32kb | ||
| 190 | - Bitmap thumbBmp = Bitmap.createScaledBitmap(bitmap, 500, 400, true); | ||
| 191 | - bitmap.recycle(); | ||
| 192 | - miniProgram.hdImageData = bmpToByteArray(thumbBmp, true); | ||
| 193 | - // 在这里处理下载到的Bitmap对象 | ||
| 194 | -// miniProgram.hdImageData = getBytesFromBitmap(bitmap); | ||
| 195 | - miniProgram.title = arguments.get("title"); | ||
| 196 | - // 数据加载完毕后隐藏加载动画 | ||
| 197 | - result.success(true); | ||
| 198 | - iwwapi.sendMessage(miniProgram, new IWWAPIEventHandler() { | ||
| 199 | - @Override | ||
| 200 | - public void handleResp(BaseMessage resp) { | ||
| 201 | - | ||
| 202 | - if(resp instanceof WWSimpleRespMessage){ | ||
| 203 | - WWSimpleRespMessage rsp = (WWSimpleRespMessage)resp; | ||
| 204 | -// String t = ""; | ||
| 205 | -// Toast.makeText(MainActivity.this, | ||
| 206 | -// t = "发小程序," + rsp.errCode + "," + rsp.errMsg, | ||
| 207 | -// Toast.LENGTH_LONG).show(); | ||
| 208 | - | ||
| 209 | - Map<String, String> map = new HashMap<>(); | ||
| 210 | - map.put("code", String.valueOf(rsp.errCode)); | ||
| 211 | - map.put("errCode", String.valueOf(rsp.errMsg)); | ||
| 212 | - | ||
| 213 | - | ||
| 214 | -// result.success(map); | ||
| 215 | - }else{ | ||
| 216 | -// result.success(true); | ||
| 217 | - } | ||
| 218 | - } | ||
| 219 | - }); | ||
| 220 | - } | ||
| 221 | - }); | ||
| 222 | - | ||
| 223 | - Log.i("ExampleClass", "Value: " + arguments.get("hdImageData")); | ||
| 224 | - task.execute(arguments.get("hdImageData")); | ||
| 225 | -// LoadImageUtil loadImageUtil = new LoadImageUtil(context); | ||
| 226 | -// Bitmap bitmap = loadImageUtil.loadBitmapByImgUrl(arguments.get("hdImageData"), new LoadImageUtil.CallBack() { | ||
| 227 | -// @Override | ||
| 228 | -// public void callBack(String imgUrl, Bitmap bitmap) { | ||
| 229 | -// if(bitmap != null){ | ||
| 230 | -//// ImageView img = (ImageView) parent.findViewWithTag(imgUrl); | ||
| 231 | -//// img.setImageBitmap(bitmap); | ||
| 232 | -// miniProgram.hdImageData = getBytesFromBitmap(bitmap); | ||
| 233 | -// miniProgram.title = arguments.get("title"); | ||
| 234 | -// iwwapi.sendMessage(miniProgram, new IWWAPIEventHandler() { | ||
| 235 | -// @Override | ||
| 236 | -// public void handleResp(BaseMessage resp) { | ||
| 237 | -// if(resp instanceof WWSimpleRespMessage){ | ||
| 238 | -// WWSimpleRespMessage rsp = (WWSimpleRespMessage)resp; | ||
| 239 | -//// String t = ""; | ||
| 240 | -//// Toast.makeText(MainActivity.this, | ||
| 241 | -//// t = "发小程序," + rsp.errCode + "," + rsp.errMsg, | ||
| 242 | -//// Toast.LENGTH_LONG).show(); | ||
| 243 | -// | ||
| 244 | -// Map<String, String> map = new HashMap<>(); | ||
| 245 | -// map.put("code", String.valueOf(rsp.errCode)); | ||
| 246 | -// map.put("errCode", String.valueOf(rsp.errMsg)); | ||
| 247 | -// | ||
| 248 | -// | ||
| 249 | -// result.success(map); | ||
| 250 | -// } | ||
| 251 | -// } | ||
| 252 | -// }); | ||
| 253 | -// } | ||
| 254 | -// | ||
| 255 | -// } | ||
| 256 | -// }); | ||
| 257 | -// if(bitmap != null){//如果图片在缓存中,直接获取展示 | ||
| 258 | -// miniProgram.hdImageData = getBytesFromBitmap(bitmap); | ||
| 259 | -// miniProgram.title = arguments.get("title"); | ||
| 260 | -// iwwapi.sendMessage(miniProgram, new IWWAPIEventHandler() { | ||
| 261 | -// @Override | ||
| 262 | -// public void handleResp(BaseMessage resp) { | ||
| 263 | -// if(resp instanceof WWSimpleRespMessage){ | ||
| 264 | -// WWSimpleRespMessage rsp = (WWSimpleRespMessage)resp; | ||
| 265 | -//// String t = ""; | ||
| 266 | -//// Toast.makeText(MainActivity.this, | ||
| 267 | -//// t = "发小程序," + rsp.errCode + "," + rsp.errMsg, | ||
| 268 | -//// Toast.LENGTH_LONG).show(); | ||
| 269 | -// | ||
| 270 | -// Map<String, String> map = new HashMap<>(); | ||
| 271 | -// map.put("code", String.valueOf(rsp.errCode)); | ||
| 272 | -// map.put("errCode", String.valueOf(rsp.errMsg)); | ||
| 273 | -// | ||
| 274 | -// | ||
| 275 | -// result.success(map); | ||
| 276 | -// } | ||
| 277 | -// } | ||
| 278 | -// }); | ||
| 279 | -// } | ||
| 280 | - | ||
| 281 | - | ||
| 282 | - | ||
| 283 | -// Bitmap bitmap = getBitmapFromURL(arguments.get("hdImageData")); | ||
| 284 | -// ByteArrayOutputStream stream = new ByteArrayOutputStream(); | ||
| 285 | -// bitmap.compress(Bitmap.CompressFormat.JPEG, 0, stream); | ||
| 286 | -// byte[] byteArray = stream.toByteArray(); | ||
| 287 | -// | ||
| 288 | - | ||
| 289 | - | ||
| 290 | - | ||
| 291 | - | ||
| 292 | - }else if (call.method.equals("shareText")) { | ||
| 293 | - | ||
| 294 | - | ||
| 295 | - | ||
| 296 | - WWMediaText txt = new WWMediaText( arguments.get("text") | ||
| 297 | - ); | ||
| 298 | - txt.appPkg = "com.naji.one_key"; | ||
| 299 | - txt.appName = "周到安排商家" ; | ||
| 300 | - txt.appId = APPID; //企业唯一标识。创建企业后显示在,我的企业 CorpID字段 | ||
| 301 | - txt.agentId = AGENTID; //应用唯一标识。显示在具体应用下的 AgentId字段 | ||
| 302 | - iwwapi.sendMessage(txt); | ||
| 303 | - } | ||
| 304 | - | ||
| 305 | - | ||
| 306 | - | ||
| 307 | - else { | ||
| 308 | - // result(FlutterMethodNotImplemented); | ||
| 309 | - } | ||
| 310 | - | ||
| 311 | - | ||
| 312 | - | ||
| 313 | - } | ||
| 314 | - | ||
| 315 | - | ||
| 316 | - | ||
| 317 | - | ||
| 318 | - // 转换图片格式为字节数组 | ||
| 319 | - public static byte[] bmpToByteArray(final Bitmap bmp, final boolean needRecycle) { | ||
| 320 | - ByteArrayOutputStream output = new ByteArrayOutputStream(); | ||
| 321 | - bmp.compress(Bitmap.CompressFormat.PNG, 100, output); | ||
| 322 | - if (needRecycle) { | ||
| 323 | - bmp.recycle(); | ||
| 324 | - } | ||
| 325 | - byte[] result = output.toByteArray(); | ||
| 326 | - try { | ||
| 327 | - output.close(); | ||
| 328 | - } catch (Exception e) { | ||
| 329 | - e.printStackTrace(); | ||
| 330 | - } | ||
| 331 | - return result; | ||
| 332 | - } | ||
| 333 | - | ||
| 334 | - | ||
| 335 | - public static Bitmap compressBitmap(String imgPath, int targetWidth, int targetHeight, int quality, Bitmap.CompressFormat compressFormat) { | ||
| 336 | - BitmapFactory.Options options = new BitmapFactory.Options(); | ||
| 337 | - options.inJustDecodeBounds = true; | ||
| 338 | - BitmapFactory.decodeFile(imgPath, options); | ||
| 339 | - int actualHeight = options.outHeight; | ||
| 340 | - int actualWidth = options.outWidth; | ||
| 341 | - | ||
| 342 | - float ratio = actualWidth / (float) actualHeight; | ||
| 343 | - options.inSampleSize = 1; | ||
| 344 | - while ((actualWidth / 2) > targetWidth && (actualHeight / 2) > targetHeight) { | ||
| 345 | - actualWidth /= 2; | ||
| 346 | - actualHeight /= 2; | ||
| 347 | - options.inSampleSize *= 2; | ||
| 348 | - } | ||
| 349 | - | ||
| 350 | - options.inJustDecodeBounds = false; | ||
| 351 | - Bitmap bitmap = BitmapFactory.decodeFile(imgPath, options); | ||
| 352 | - | ||
| 353 | - Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, targetWidth, (int) (targetWidth / ratio), true); | ||
| 354 | - bitmap.recycle(); | ||
| 355 | - | ||
| 356 | - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); | ||
| 357 | - scaledBitmap.compress(compressFormat, quality, byteArrayOutputStream); | ||
| 358 | - scaledBitmap.recycle(); | ||
| 359 | - | ||
| 360 | - return BitmapFactory.decodeByteArray(byteArrayOutputStream.toByteArray(), 0, byteArrayOutputStream.size()); | ||
| 361 | - } | ||
| 362 | - | ||
| 363 | - | ||
| 364 | - | ||
| 365 | - | ||
| 366 | - | ||
| 367 | - | ||
| 368 | - | ||
| 369 | - | ||
| 370 | - | ||
| 371 | - public static byte[] getBytesFromBitmap(Bitmap bitmap) { | ||
| 372 | -// Bitmap compressedImage = compressBitmap(bitmap,100); | ||
| 373 | - | ||
| 374 | - | ||
| 375 | - | ||
| 376 | - | ||
| 377 | - ByteBuffer byteBuffer = ByteBuffer.allocate(bitmap.getByteCount()); | ||
| 378 | - bitmap.copyPixelsToBuffer(byteBuffer); | ||
| 379 | - | ||
| 380 | - return byteBuffer.array(); | ||
| 381 | - } | ||
| 382 | - /** | ||
| 383 | - * 压缩图片 | ||
| 384 | - * | ||
| 385 | - * @param bitmap | ||
| 386 | - * 被压缩的图片 | ||
| 387 | - * @param sizeLimit | ||
| 388 | - * 大小限制 | ||
| 389 | - * @return | ||
| 390 | - * 压缩后的图片 | ||
| 391 | - */ | ||
| 392 | - private static Bitmap compressBitmap(Bitmap bitmap, long sizeLimit) { | ||
| 393 | - ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||
| 394 | - int quality = 10; | ||
| 395 | - bitmap.compress(Bitmap.CompressFormat.JPEG, quality, baos); | ||
| 396 | - | ||
| 397 | - // 循环判断压缩后图片是否超过限制大小 | ||
| 398 | - while(baos.toByteArray().length / 1024 > sizeLimit) { | ||
| 399 | - // 清空baos | ||
| 400 | - baos.reset(); | ||
| 401 | - bitmap.compress(Bitmap.CompressFormat.JPEG, quality, baos); | ||
| 402 | - quality -= 10; | ||
| 403 | - } | ||
| 404 | - | ||
| 405 | - Bitmap newBitmap = BitmapFactory.decodeStream(new ByteArrayInputStream(baos.toByteArray()), null, null); | ||
| 406 | - | ||
| 407 | - return newBitmap; | ||
| 408 | - } | ||
| 409 | - | ||
| 410 | -// public static Bitmap compressBitmapToSize(Bitmap bitmap, int maxSizeKB) { | ||
| 411 | -// ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||
| 412 | -// bitmap.compress(getBitmapCompressFormat(bitmap), 100, baos); // 假设压缩格式为JPEG | ||
| 413 | -// int options = 100; | ||
| 414 | -// | ||
| 415 | -// int bytes = baos.toByteArray().length/1024; | ||
| 416 | -//// | ||
| 417 | -// // 如果Bitmap的大小已经小于或等于指定的大小,则不需要进一步压缩 | ||
| 418 | -// while (bytes > maxSizeKB ) { | ||
| 419 | -// // 每次减少质量,然后重新压缩 | ||
| 420 | -// options -= 5; // 降低质量 | ||
| 421 | -// baos.reset(); // 重置baos来清除数据 | ||
| 422 | -// bitmap.compress(getBitmapCompressFormat(bitmap), options, baos); | ||
| 423 | -// | ||
| 424 | -// | ||
| 425 | -// bytes = baos.toByteArray().length/1024; | ||
| 426 | -// } | ||
| 427 | -// | ||
| 428 | -// | ||
| 429 | -// | ||
| 430 | -//// while (baos.toByteArray().length / 1024 > maxSizeKB && options != 10) { | ||
| 431 | -//// baos.reset(); // 清空baos以复用 | ||
| 432 | -//// options -= 10; // 每次减少10 | ||
| 433 | -//// bitmap.compress(getBitmapCompressFormat(bitmap), options, baos); | ||
| 434 | -//// } | ||
| 435 | -// ByteArrayInputStream isBm = new ByteArrayInputStream(baos.toByteArray()); | ||
| 436 | -// Bitmap compressedBitmap = BitmapFactory.decodeStream(isBm, null, null); | ||
| 437 | -// // 释放资源 | ||
| 438 | -// baos.reset(); | ||
| 439 | -// try { | ||
| 440 | -// baos.close(); | ||
| 441 | -// isBm.close(); | ||
| 442 | -// } catch (IOException e) { | ||
| 443 | -// e.printStackTrace(); | ||
| 444 | -// } | ||
| 445 | -// return compressedBitmap; | ||
| 446 | -// } | ||
| 447 | - | ||
| 448 | -// public static Bitmap compressImage(Bitmap bitmap){ | ||
| 449 | -// int height = (int) ( bitmap.getHeight() * (512.0 / bitmap.getWidth()) ); | ||
| 450 | -// bitmap = Bitmap.createScaledBitmap(bitmap, 512, height, true); | ||
| 451 | -// return bitmap; | ||
| 452 | -// } | ||
| 453 | - | ||
| 454 | - | ||
| 455 | -// public static Bitmap compressBitmapToSize(Bitmap image, int maxSizeKB) { | ||
| 456 | -// ByteArrayOutputStream stream = new ByteArrayOutputStream(); | ||
| 457 | -// // 计算压缩比例 | ||
| 458 | -// int quality = 100; | ||
| 459 | -// image.compress(Bitmap.CompressFormat.JPEG, quality, stream); | ||
| 460 | -// // 如果图片大小大于指定大小,则以压缩质量为基准重复压缩 | ||
| 461 | -// while ((stream.toByteArray().length / 1024) > maxSizeKB && quality > 0) { | ||
| 462 | -// stream.reset(); // 重置流以复用 | ||
| 463 | -// quality -= 5; // 每次减少5%的质量 | ||
| 464 | -// image.compress(getBitmapCompressFormat(image), quality, stream); | ||
| 465 | -// } | ||
| 466 | -// // 将流转换为字节 | ||
| 467 | -// byte[] imageBytes = stream.toByteArray(); | ||
| 468 | -// // 将字节转换为Bitmap | ||
| 469 | -// Bitmap compressedImage = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length); | ||
| 470 | -// // 释放资源 | ||
| 471 | -// | ||
| 472 | -//// 关闭流 | ||
| 473 | -// try { | ||
| 474 | -// stream.close(); | ||
| 475 | -// } catch (IOException e) { | ||
| 476 | -// e.printStackTrace(); | ||
| 477 | -// } | ||
| 478 | -// return compressedImage; | ||
| 479 | -// } | ||
| 480 | - | ||
| 481 | - | ||
| 482 | -// public static Bitmap compressBitmapToSize(Bitmap bitmap, int maxSizeKB) { | ||
| 483 | -// ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||
| 484 | -// int quality = 100; | ||
| 485 | -// int bytes = baos.toByteArray().length; | ||
| 486 | -// | ||
| 487 | -// // 如果Bitmap的大小已经小于或等于指定的大小,则不需要进一步压缩 | ||
| 488 | -// while (bytes > maxSizeKB ) { | ||
| 489 | -// // 每次减少质量,然后重新压缩 | ||
| 490 | -// quality -= 5; // 降低质量 | ||
| 491 | -// baos.reset(); // 重置baos来清除数据 | ||
| 492 | -// bitmap.compress(getBitmapCompressFormat(bitmap), quality, baos); | ||
| 493 | -// | ||
| 494 | -// | ||
| 495 | -// bytes = baos.toByteArray().length; | ||
| 496 | -// } | ||
| 497 | -// | ||
| 498 | -// // 将压缩后的数据转换回Bitmap对象 | ||
| 499 | -// ByteArrayInputStream isBm = new ByteArrayInputStream(baos.toByteArray()); | ||
| 500 | -// Bitmap compressedBitmap = BitmapFactory.decodeStream(isBm, null, null); | ||
| 501 | -// // 关闭流 | ||
| 502 | -// try { | ||
| 503 | -// baos.close(); | ||
| 504 | -// isBm.close(); | ||
| 505 | -// } catch (IOException e) { | ||
| 506 | -// e.printStackTrace(); | ||
| 507 | -// } | ||
| 508 | -// return compressedBitmap; | ||
| 509 | -// } | ||
| 510 | - | ||
| 511 | - public static Bitmap.CompressFormat getBitmapCompressFormat(Bitmap bitmap) { | ||
| 512 | - Bitmap.Config config = bitmap.getConfig(); | ||
| 513 | - if (config == null) { | ||
| 514 | - return Bitmap.CompressFormat.PNG; | ||
| 515 | - } | ||
| 516 | - switch (config) { | ||
| 517 | - case RGB_565: | ||
| 518 | - return Bitmap.CompressFormat.JPEG; | ||
| 519 | - case ALPHA_8: | ||
| 520 | - case ARGB_4444: | ||
| 521 | - case ARGB_8888: | ||
| 522 | - return Bitmap.CompressFormat.PNG; | ||
| 523 | - default: | ||
| 524 | - return Bitmap.CompressFormat.WEBP; | ||
| 525 | - } | ||
| 526 | - } | ||
| 527 | - | ||
| 528 | - | ||
| 529 | - | ||
| 530 | - | ||
| 531 | - | ||
| 532 | -// public static Bitmap getBitmapFromURL(String imageUrl) { | ||
| 533 | -// HttpURLConnection connection = null; | ||
| 534 | -// try { | ||
| 535 | -// URL url = new URL(imageUrl); | ||
| 536 | -// connection = (HttpURLConnection) url.openConnection(); | ||
| 537 | -// connection.setDoInput(true); | ||
| 538 | -// connection.connect(); | ||
| 539 | -// BufferedInputStream inputStream = new BufferedInputStream(connection.getInputStream()); | ||
| 540 | -// Bitmap myBitmap = BitmapFactory.decodeStream(inputStream); | ||
| 541 | -// inputStream.close(); | ||
| 542 | -// return myBitmap; | ||
| 543 | -// } catch (IOException e) { | ||
| 544 | -// e.printStackTrace(); | ||
| 545 | -// return null; | ||
| 546 | -// } finally { | ||
| 547 | -// if (connection != null) { | ||
| 548 | -// connection.disconnect(); | ||
| 549 | -// } | ||
| 550 | -// } | ||
| 551 | -// } | ||
| 552 | - | ||
| 553 | - @Override | ||
| 554 | - public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { | ||
| 555 | - channel.setMethodCallHandler(null); | ||
| 556 | - } | ||
| 557 | -} |
library/flutter_wxwork/android/src/main/java/com/wxwork/flutter_wxwork/LoadImageUtil.java
deleted
100644 → 0
| 1 | -package com.wxwork.flutter_wxwork; | ||
| 2 | - | ||
| 3 | - | ||
| 4 | - | ||
| 5 | - import android.content.Context; | ||
| 6 | - import android.graphics.Bitmap; | ||
| 7 | - import android.os.Handler; | ||
| 8 | - import android.os.Message; | ||
| 9 | - | ||
| 10 | - import java.lang.ref.SoftReference; | ||
| 11 | - import java.util.HashMap; | ||
| 12 | - | ||
| 13 | - | ||
| 14 | -/** | ||
| 15 | - * Created by Administrator on 2017/9/5. | ||
| 16 | - */ | ||
| 17 | - | ||
| 18 | -public class LoadImageUtil { | ||
| 19 | - private Context context; | ||
| 20 | - private HashMap<String,SoftReference<Bitmap>> bitMaps; | ||
| 21 | - | ||
| 22 | - public LoadImageUtil(Context context) { | ||
| 23 | - this.context = context; | ||
| 24 | - this.bitMaps = new HashMap<String,SoftReference<Bitmap>>();//实例化缓存容器 | ||
| 25 | - } | ||
| 26 | - //回调的接口 | ||
| 27 | - public interface CallBack{ | ||
| 28 | - public void callBack(String imgUrl,Bitmap bitmap); | ||
| 29 | - } | ||
| 30 | - //加载图片,进行缓存 | ||
| 31 | - public Bitmap loadBitmapByImgUrl(final String imgUrl, final CallBack callBack){ | ||
| 32 | -// //先判断缓存中有没有图片,得到图片 | ||
| 33 | -// SoftReference<Bitmap> soft = bitMaps.get(imgUrl); | ||
| 34 | -// if(soft != null){ | ||
| 35 | -// Bitmap bitmap = soft.get();//从软引用中获得bitmap | ||
| 36 | -// if(bitmap != null){//缓存中有次图片,直接用 | ||
| 37 | -// return bitmap; | ||
| 38 | -// }else{ | ||
| 39 | -// bitMaps.remove(imgUrl);//key(图片的url)对应的bitmap消耗了,key也没有意义 | ||
| 40 | -// } | ||
| 41 | -// } | ||
| 42 | - //代码走到此处,说明缓存中没有图片,需要到第三级缓存:网络缓存去取 | ||
| 43 | - //通过handler实现子线程和ui主线程的通信 | ||
| 44 | - final Handler handler = new Handler(){ | ||
| 45 | - @Override | ||
| 46 | - public void handleMessage(Message msg) { | ||
| 47 | - super.handleMessage(msg); | ||
| 48 | - Bitmap bitmap = (Bitmap) msg.obj; | ||
| 49 | - callBack.callBack(imgUrl,bitmap); | ||
| 50 | - } | ||
| 51 | - }; | ||
| 52 | - //启动线程访问图片 | ||
| 53 | - new Thread(){ | ||
| 54 | - @Override | ||
| 55 | - public void run() { | ||
| 56 | - super.run(); | ||
| 57 | - //加载图片 | ||
| 58 | - Bitmap bitmap = new NetWorkUtils().getBitmapByHttpUrlConnectionGet(imgUrl); | ||
| 59 | - //压缩图片 | ||
| 60 | - | ||
| 61 | - | ||
| 62 | - //把bitmap缓存到缓存中,通过软引用 | ||
| 63 | - bitMaps.put(imgUrl,new SoftReference<Bitmap>(bitmap)); | ||
| 64 | - | ||
| 65 | - handler.sendMessage(handler.obtainMessage(1,bitmap));//发给handler | ||
| 66 | - } | ||
| 67 | - }.start(); | ||
| 68 | - | ||
| 69 | - | ||
| 70 | - | ||
| 71 | -// //内存中没有图片,通过次线程去加载,然后放在缓存中 | ||
| 72 | -// bitMaps.put(imgUrl,bitmap); | ||
| 73 | - | ||
| 74 | - return null; | ||
| 75 | - } | ||
| 76 | -} |
library/flutter_wxwork/android/src/main/java/com/wxwork/flutter_wxwork/NetWorkUtils.java
deleted
100644 → 0
| 1 | -package com.wxwork.flutter_wxwork; | ||
| 2 | - | ||
| 3 | - | ||
| 4 | - | ||
| 5 | - import android.graphics.Bitmap; | ||
| 6 | - import android.graphics.BitmapFactory; | ||
| 7 | - | ||
| 8 | - import java.io.IOException; | ||
| 9 | - import java.io.InputStream; | ||
| 10 | - import java.net.HttpURLConnection; | ||
| 11 | - import java.net.MalformedURLException; | ||
| 12 | - import java.net.URL; | ||
| 13 | - | ||
| 14 | -/** | ||
| 15 | - * 网络请求的工具类 | ||
| 16 | - * Created by Administrator on 2017/9/1. | ||
| 17 | - */ | ||
| 18 | - | ||
| 19 | -public class NetWorkUtils { | ||
| 20 | - | ||
| 21 | - //获得json串的方法,通过HttpClient get | ||
| 22 | - public String getJsonByHttpClientGet(String url){ | ||
| 23 | - | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - return ""; | ||
| 27 | - } | ||
| 28 | - //获得json串的方法,通过HttpClient get | ||
| 29 | - public String getJsonByHttpUrlConnectionGet(String jsonUrl){ | ||
| 30 | - | ||
| 31 | - URL url = null; | ||
| 32 | - HttpURLConnection httpURLConnection = null; | ||
| 33 | - String strJson = ""; | ||
| 34 | - InputStream inputStream = null; | ||
| 35 | - try { | ||
| 36 | - url = new URL(jsonUrl); | ||
| 37 | - httpURLConnection = (HttpURLConnection) url.openConnection(); | ||
| 38 | - | ||
| 39 | - int responseCode = httpURLConnection.getResponseCode(); | ||
| 40 | - if(responseCode == 200){ | ||
| 41 | - inputStream = httpURLConnection.getInputStream(); | ||
| 42 | - byte[] b = new byte[1024]; | ||
| 43 | - int length = 0; | ||
| 44 | - | ||
| 45 | - while((length = inputStream.read(b)) != -1){//循环读取json串,拼装 | ||
| 46 | - strJson += new String(b,0,length); | ||
| 47 | - } | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - } catch (MalformedURLException e) { | ||
| 51 | - e.printStackTrace(); | ||
| 52 | - } catch (IOException e) { | ||
| 53 | - e.printStackTrace(); | ||
| 54 | - }finally { | ||
| 55 | - if(inputStream != null){ | ||
| 56 | - try { | ||
| 57 | - inputStream.close(); | ||
| 58 | - } catch (IOException e) { | ||
| 59 | - e.printStackTrace(); | ||
| 60 | - } | ||
| 61 | - } | ||
| 62 | - } | ||
| 63 | - return strJson;//返回最终的json数据 | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | - //获得json串的方法,通过HttpClient get | ||
| 67 | - public Bitmap getBitmapByHttpUrlConnectionGet(String imageUrl){ | ||
| 68 | - URL url = null; | ||
| 69 | - HttpURLConnection httpURLConnection = null; | ||
| 70 | - Bitmap bitmap = null; | ||
| 71 | - InputStream inputStream = null; | ||
| 72 | - try { | ||
| 73 | - url = new URL(imageUrl); | ||
| 74 | - httpURLConnection = (HttpURLConnection) url.openConnection(); | ||
| 75 | - | ||
| 76 | - int responseCode = httpURLConnection.getResponseCode(); | ||
| 77 | - if(responseCode == 200){ | ||
| 78 | - inputStream = httpURLConnection.getInputStream(); | ||
| 79 | - bitmap = BitmapFactory.decodeStream(inputStream);//把图片信息(输入流) | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | - } catch (MalformedURLException e) { | ||
| 83 | - e.printStackTrace(); | ||
| 84 | - } catch (IOException e) { | ||
| 85 | - e.printStackTrace(); | ||
| 86 | - }finally { | ||
| 87 | - if(inputStream != null){ | ||
| 88 | - try { | ||
| 89 | - inputStream.close(); | ||
| 90 | - } catch (IOException e) { | ||
| 91 | - e.printStackTrace(); | ||
| 92 | - } | ||
| 93 | - } | ||
| 94 | - } | ||
| 95 | - return bitmap;//返回最终的json数据 | ||
| 96 | - } | ||
| 97 | -} |
| 1 | -.idea/ | ||
| 2 | -.vagrant/ | ||
| 3 | -.sconsign.dblite | ||
| 4 | -.svn/ | ||
| 5 | - | ||
| 6 | -.DS_Store | ||
| 7 | -*.swp | ||
| 8 | -profile | ||
| 9 | - | ||
| 10 | -DerivedData/ | ||
| 11 | -build/ | ||
| 12 | -GeneratedPluginRegistrant.h | ||
| 13 | -GeneratedPluginRegistrant.m | ||
| 14 | - | ||
| 15 | -.generated/ | ||
| 16 | - | ||
| 17 | -*.pbxuser | ||
| 18 | -*.mode1v3 | ||
| 19 | -*.mode2v3 | ||
| 20 | -*.perspectivev3 | ||
| 21 | - | ||
| 22 | -!default.pbxuser | ||
| 23 | -!default.mode1v3 | ||
| 24 | -!default.mode2v3 | ||
| 25 | -!default.perspectivev3 | ||
| 26 | - | ||
| 27 | -xcuserdata | ||
| 28 | - | ||
| 29 | -*.moved-aside | ||
| 30 | - | ||
| 31 | -*.pyc | ||
| 32 | -*sync/ | ||
| 33 | -Icon? | ||
| 34 | -.tags* | ||
| 35 | - | ||
| 36 | -/Flutter/Generated.xcconfig | ||
| 37 | -/Flutter/ephemeral/ | ||
| 38 | -/Flutter/flutter_export_environment.sh |
| 1 | -#import "FlutterWxworkPlugin.h" | ||
| 2 | - | ||
| 3 | -#import "WWKApiObject.h" | ||
| 4 | - | ||
| 5 | -@implementation FlutterWxworkPlugin | ||
| 6 | - | ||
| 7 | -FlutterResult authResult; | ||
| 8 | -FlutterMethodChannel *channel; | ||
| 9 | -+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar { | ||
| 10 | - channel = [FlutterMethodChannel | ||
| 11 | - methodChannelWithName:@"flutter_wxwork" | ||
| 12 | - binaryMessenger:[registrar messenger]]; | ||
| 13 | - FlutterWxworkPlugin* instance = [[FlutterWxworkPlugin alloc] init]; | ||
| 14 | - [registrar addMethodCallDelegate:instance channel:channel]; | ||
| 15 | -} | ||
| 16 | - | ||
| 17 | - | ||
| 18 | - | ||
| 19 | -- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { | ||
| 20 | - if([@"isAppInstalled" isEqualToString:call.method]){ | ||
| 21 | - | ||
| 22 | - result(@([WWKApi isAppInstalled])); | ||
| 23 | - }else if ([@"register" isEqualToString:call.method]) { | ||
| 24 | - NSDictionary *dic = call.arguments; | ||
| 25 | - NSString *scheme = dic[@"scheme"]; | ||
| 26 | - NSString *corpId = dic[@"corpId"]; | ||
| 27 | - NSString *agentId = dic[@"agentId"]; | ||
| 28 | - result(@([WWKApi registerApp:scheme corpId:corpId agentId:agentId])); | ||
| 29 | - } else if ([@"auth" isEqualToString:call.method]){ | ||
| 30 | - WWKSSOReq *req = [[WWKSSOReq alloc] init]; | ||
| 31 | - // state参数为这次请求的唯一标示,客户端需要维护其唯一性。SSO回调时会原样返回 | ||
| 32 | - req.state = call.arguments[@"state"]; | ||
| 33 | - [WWKApi sendReq:req]; | ||
| 34 | - authResult = result; | ||
| 35 | - } | ||
| 36 | - else if ([@"shareImageNetWork" isEqualToString:call.method]) { | ||
| 37 | - [self shareImageNetWork:call result:result]; | ||
| 38 | - } | ||
| 39 | - else if([@"shareImagePath" isEqualToString:call.method]) { | ||
| 40 | - [self shareImagePath:call result:result]; | ||
| 41 | - } | ||
| 42 | - else if ([@"shareMiniProgram" isEqualToString:call.method]) { | ||
| 43 | - [self shareMiniProgram:call result:result]; | ||
| 44 | - }else if ([@"shareText" isEqualToString:call.method]) { | ||
| 45 | - [self shareText:call result:result]; | ||
| 46 | - } else { | ||
| 47 | - result(FlutterMethodNotImplemented); | ||
| 48 | - } | ||
| 49 | -} | ||
| 50 | - | ||
| 51 | - | ||
| 52 | -- (void)shareText:(FlutterMethodCall *)call result:(FlutterResult)result { | ||
| 53 | - | ||
| 54 | - WWKSendMessageReq *req = [[WWKSendMessageReq alloc] init]; | ||
| 55 | - WWKMessageTextAttachment *attachment = [[WWKMessageTextAttachment alloc] init]; | ||
| 56 | - attachment.text = @"分享的文本内容"; | ||
| 57 | - req.attachment = attachment; | ||
| 58 | - [WWKApi sendReq:req]; | ||
| 59 | - | ||
| 60 | -} | ||
| 61 | - | ||
| 62 | -- (void)shareImageNetWork:(FlutterMethodCall *)call result:(FlutterResult)result { | ||
| 63 | - // [WWKApi registerApp:@"wwauthbdca186ec4257973000006" corpId:@"wwbdca186ec4257973" agentId:@"1000006"]; | ||
| 64 | - | ||
| 65 | - dispatch_queue_t globalQueue = dispatch_get_global_queue(0, 0); | ||
| 66 | - dispatch_async(globalQueue, ^{ | ||
| 67 | - | ||
| 68 | - | ||
| 69 | - // 使用NSURLSession异步请求网络图片 | ||
| 70 | - NSURL *imageURL = [NSURL URLWithString:call.arguments[@"path"]]; | ||
| 71 | - NSURLRequest *request = [NSURLRequest requestWithURL:imageURL]; | ||
| 72 | - | ||
| 73 | - // 创建URLSession并开始任务 | ||
| 74 | - NSURLSession *session = [NSURLSession sharedSession]; | ||
| 75 | - NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler: | ||
| 76 | - ^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { | ||
| 77 | - if (error) { | ||
| 78 | - // 处理错误 | ||
| 79 | - NSLog(@"Error: %@", error); | ||
| 80 | - } else { | ||
| 81 | - // 成功获取数据,转换为NSData | ||
| 82 | - NSData *imageData = data; | ||
| 83 | - | ||
| 84 | - dispatch_async(dispatch_get_main_queue(), ^{ | ||
| 85 | - WWKSendMessageReq *req = [[WWKSendMessageReq alloc] init]; | ||
| 86 | - WWKMessageImageAttachment *attachment = [[WWKMessageImageAttachment alloc] init]; | ||
| 87 | - // attachment.filename = @"icon.jpg"; | ||
| 88 | - // attachment.path = [[NSBundle mainBundle] pathForResource:@"icon" ofType:@"jpg"]; | ||
| 89 | - // NSURL *imageURL = [NSURL URLWithString:@"http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png"]; | ||
| 90 | - // //下载图片 | ||
| 91 | - // NSData *data= [NSData dataWithContentsOfURL:imageURL]; | ||
| 92 | - attachment.filename = @"share_image"; | ||
| 93 | - attachment.data = imageData; | ||
| 94 | - req.attachment = attachment; | ||
| 95 | - [WWKApi sendReq:req]; | ||
| 96 | - authResult = result; | ||
| 97 | - }); | ||
| 98 | - | ||
| 99 | - | ||
| 100 | - | ||
| 101 | - // 此处可以使用imageData,例如保存到本地或者用于其他处理 | ||
| 102 | - // 保存到本地示例代码 | ||
| 103 | - // [imageData writeToFile:@"/path/to/save/image.png" atomically:YES]; | ||
| 104 | - | ||
| 105 | - // 或者直接使用 | ||
| 106 | - // UIImage *image = [UIImage imageWithData:imageData]; | ||
| 107 | - } | ||
| 108 | - }]; | ||
| 109 | - | ||
| 110 | - // 启动任务 | ||
| 111 | - [task resume]; | ||
| 112 | - | ||
| 113 | - | ||
| 114 | - }); | ||
| 115 | - | ||
| 116 | - // WWKSendMessageReq *req = [[WWKSendMessageReq alloc] init]; | ||
| 117 | - // WWKMessageImageAttachment *attachment = [[WWKMessageImageAttachment alloc] init]; | ||
| 118 | - // attachment.filename = @"icon.jpg"; | ||
| 119 | - // attachment.path = [[NSBundle mainBundle] pathForResource:@"icon" ofType:@"jpg"]; | ||
| 120 | - // // NSURL *imageURL = [NSURL URLWithString:@"http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png"]; | ||
| 121 | - // // //下载图片 | ||
| 122 | - // // NSData *data= [NSData dataWithContentsOfURL:imageURL]; | ||
| 123 | - // // attachment.data = data; | ||
| 124 | - // req.attachment = attachment; | ||
| 125 | - // [WWKApi sendReq:req]; | ||
| 126 | - | ||
| 127 | -} | ||
| 128 | - | ||
| 129 | -- (void)shareImagePath:(FlutterMethodCall *)call result:(FlutterResult)result { | ||
| 130 | - // [WWKApi registerApp:@"wwauthbdca186ec4257973000006" corpId:@"wwbdca186ec4257973" agentId:@"1000006"]; | ||
| 131 | - | ||
| 132 | - dispatch_queue_t globalQueue = dispatch_get_global_queue(0, 0); | ||
| 133 | - dispatch_async(globalQueue, ^{ | ||
| 134 | - | ||
| 135 | - NSData *imageData= [NSData dataWithContentsOfFile:call.arguments[@"path"]]; | ||
| 136 | - dispatch_async(dispatch_get_main_queue(), ^{ | ||
| 137 | - WWKSendMessageReq *req = [[WWKSendMessageReq alloc] init]; | ||
| 138 | - WWKMessageImageAttachment *attachment = [[WWKMessageImageAttachment alloc] init]; | ||
| 139 | - // attachment.filename = @"icon.jpg"; | ||
| 140 | - // attachment.path = [[NSBundle mainBundle] pathForResource:@"icon" ofType:@"jpg"]; | ||
| 141 | - // NSURL *imageURL = [NSURL URLWithString:@"http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png"]; | ||
| 142 | - // //下载图片 | ||
| 143 | - // NSData *data= [NSData dataWithContentsOfURL:imageURL]; | ||
| 144 | - attachment.filename = @"share_image"; | ||
| 145 | - attachment.data = imageData; | ||
| 146 | - req.attachment = attachment; | ||
| 147 | - [WWKApi sendReq:req]; | ||
| 148 | - authResult = result; | ||
| 149 | - }); | ||
| 150 | - | ||
| 151 | - | ||
| 152 | - | ||
| 153 | - | ||
| 154 | - }); | ||
| 155 | - | ||
| 156 | - // WWKSendMessageReq *req = [[WWKSendMessageReq alloc] init]; | ||
| 157 | - // WWKMessageImageAttachment *attachment = [[WWKMessageImageAttachment alloc] init]; | ||
| 158 | - // attachment.filename = @"icon.jpg"; | ||
| 159 | - // attachment.path = [[NSBundle mainBundle] pathForResource:@"icon" ofType:@"jpg"]; | ||
| 160 | - // // NSURL *imageURL = [NSURL URLWithString:@"http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png"]; | ||
| 161 | - // // //下载图片 | ||
| 162 | - // // NSData *data= [NSData dataWithContentsOfURL:imageURL]; | ||
| 163 | - // // attachment.data = data; | ||
| 164 | - // req.attachment = attachment; | ||
| 165 | - // [WWKApi sendReq:req]; | ||
| 166 | - | ||
| 167 | -} | ||
| 168 | - | ||
| 169 | - | ||
| 170 | -- (void)shareMiniProgram:(FlutterMethodCall *)call result:(FlutterResult)result { | ||
| 171 | - | ||
| 172 | -// WWKSendMessageReq *req = [[WWKSendMessageReq alloc] init]; | ||
| 173 | -// WWKMessageMiniAppAttachment *attachment = [[WWKMessageMiniAppAttachment alloc] init]; | ||
| 174 | -// attachment.userName = @"gh_487873d353b3@app"; //必须是应用关联的小程序,注意要有@app后缀 | ||
| 175 | -// attachment.path = @"pages/customer/index.html?id=563971&hasInvitation=1&hasSellerShare=1&uid=7035"; | ||
| 176 | -// // attachment.hdImageData = UIImageJPEGRepresentation([UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"bg_error" ofType:@"png"]], 1.0f); | ||
| 177 | -// NSString *hdImageData = call.arguments[@"hdImageData"]; | ||
| 178 | -// NSURL *imageURL = [NSURL URLWithString:hdImageData]; | ||
| 179 | -// //下载图片 | ||
| 180 | -// NSData *data= [NSData dataWithContentsOfURL:imageURL]; | ||
| 181 | -// attachment.hdImageData = data; | ||
| 182 | -// // attachment.hdImageData = UIImageJPEGRepresentation([UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"test" ofType:@"jpg"]], 1.0f); | ||
| 183 | -// attachment.title = @"您预订的长安大排档总店(测试),已经安排,点击查看详情"; | ||
| 184 | -// req.attachment = attachment; | ||
| 185 | -// [WWKApi sendReq:req]; | ||
| 186 | -// authResult = result; | ||
| 187 | - | ||
| 188 | - dispatch_queue_t globalQueue = dispatch_get_global_queue(0, 0); | ||
| 189 | - dispatch_async(globalQueue, ^{ | ||
| 190 | - | ||
| 191 | - | ||
| 192 | - // 使用NSURLSession异步请求网络图片 | ||
| 193 | - NSURL *imageURL = [NSURL URLWithString:call.arguments[@"hdImageData"]]; | ||
| 194 | - NSURLRequest *request = [NSURLRequest requestWithURL:imageURL]; | ||
| 195 | - | ||
| 196 | - // 创建URLSession并开始任务 | ||
| 197 | - NSURLSession *session = [NSURLSession sharedSession]; | ||
| 198 | - NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler: | ||
| 199 | - ^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { | ||
| 200 | - if (error) { | ||
| 201 | - // 处理错误 | ||
| 202 | - NSLog(@"Error: %@", error); | ||
| 203 | - } else { | ||
| 204 | - // 成功获取数据,转换为NSData | ||
| 205 | - NSData *imageData = data; | ||
| 206 | - | ||
| 207 | - dispatch_async(dispatch_get_main_queue(), ^{ | ||
| 208 | - NSMutableDictionary *mDic = [[NSMutableDictionary alloc]init]; | ||
| 209 | - result(mDic); | ||
| 210 | - WWKSendMessageReq *req = [[WWKSendMessageReq alloc] init]; | ||
| 211 | - WWKMessageMiniAppAttachment *attachment = [[WWKMessageMiniAppAttachment alloc] init]; | ||
| 212 | - attachment.userName = call.arguments[@"userName"]; //必须是应用关联的小程序,注意要有@app后缀 | ||
| 213 | - attachment.path = call.arguments[@"path"]; | ||
| 214 | - attachment.hdImageData =imageData; | ||
| 215 | - | ||
| 216 | - attachment.title = call.arguments[@"title"]; | ||
| 217 | - req.attachment = attachment; | ||
| 218 | - [WWKApi sendReq:req]; | ||
| 219 | - authResult = result; | ||
| 220 | - | ||
| 221 | - }); | ||
| 222 | - | ||
| 223 | - }}]; | ||
| 224 | - | ||
| 225 | - | ||
| 226 | - // 启动任务 | ||
| 227 | - [task resume]; | ||
| 228 | - | ||
| 229 | - | ||
| 230 | - }); | ||
| 231 | - | ||
| 232 | - | ||
| 233 | - | ||
| 234 | - | ||
| 235 | - | ||
| 236 | - | ||
| 237 | - | ||
| 238 | -} | ||
| 239 | - | ||
| 240 | - | ||
| 241 | - | ||
| 242 | - | ||
| 243 | -// - (void)handleShare:(FlutterMethodCall *)call result:(FlutterResult)result { | ||
| 244 | -// if ([@"shareText" isEqualToString:call.method]) { | ||
| 245 | -// [self shareText:call result:result]; | ||
| 246 | -// } else if ([@"shareImage" isEqualToString:call.method]) { | ||
| 247 | -// [self shareImage:call result:result]; | ||
| 248 | -// } else if ([@"shareWebPage" isEqualToString:call.method]) { | ||
| 249 | -// [self shareWebPage:call result:result]; | ||
| 250 | -// } else if ([@"shareMusic" isEqualToString:call.method]) { | ||
| 251 | -// [self shareMusic:call result:result]; | ||
| 252 | -// } else if ([@"shareVideo" isEqualToString:call.method]) { | ||
| 253 | -// [self shareVideo:call result:result]; | ||
| 254 | -// } else if ([@"shareMiniProgram" isEqualToString:call.method]) { | ||
| 255 | -// [self shareMiniProgram:call result:result]; | ||
| 256 | -// } else if ([@"shareFile" isEqualToString:call.method]) { | ||
| 257 | -// [self shareFile:call result:result]; | ||
| 258 | -// } | ||
| 259 | -// } | ||
| 260 | - | ||
| 261 | -- (void)checkWWorkInstallation:(FlutterMethodCall *)call result:(FlutterResult)result { | ||
| 262 | - NSString *str = [NSString stringWithFormat:@"%hhd",[WWKApi isAppInstalled]]; | ||
| 263 | - result(str); | ||
| 264 | - | ||
| 265 | - // result(@([WWKApi isAppInstalled])); | ||
| 266 | -} | ||
| 267 | - | ||
| 268 | -- (void)registerApp:(FlutterMethodCall *)call result:(FlutterResult)result { | ||
| 269 | - // NSNumber* doOnIOS =call.arguments[@"iOS"]; | ||
| 270 | - | ||
| 271 | - // if (![doOnIOS boolValue]) { | ||
| 272 | - // result(@NO); | ||
| 273 | - // return; | ||
| 274 | - // } | ||
| 275 | - | ||
| 276 | - // NSString *appId = call.arguments[@"appId"]; | ||
| 277 | - // if ([FluwxStringUtil isBlank:appId]) { | ||
| 278 | - // result([FlutterError errorWithCode:@"invalid app id" message:@"are you sure your app id is correct ? " details:appId]); | ||
| 279 | - // return; | ||
| 280 | - // } | ||
| 281 | - | ||
| 282 | - // NSString *universalLink = call.arguments[@"universalLink"]; | ||
| 283 | - | ||
| 284 | - // if ([FluwxStringUtil isBlank:universalLink]) { | ||
| 285 | - // result([FlutterError errorWithCode:@"invalid universal link" message:@"are you sure your universal link is correct ? " details:universalLink]); | ||
| 286 | - // return; | ||
| 287 | - // } | ||
| 288 | - | ||
| 289 | - | ||
| 290 | - NSString *scheme = call.arguments[@"scheme"]; // 第三方App的Schema | ||
| 291 | - NSString *corpId = call.arguments[@"corpId"]; // 第三方App所属企业的ID | ||
| 292 | - NSString *agentId = call.arguments[@"agentId"]; // 第三方App在企业内部的ID | ||
| 293 | - // BOOL isWeChatRegistered = [WXApi registerApp:appId universalLink:universalLink]; | ||
| 294 | - BOOL isWWKRegistered = [WWKApi registerApp:scheme corpId:corpId agentId:agentId]; | ||
| 295 | - result(@(isWWKRegistered)); | ||
| 296 | - // result(@(isWeChatRegistered)); | ||
| 297 | -} | ||
| 298 | - | ||
| 299 | -#pragma mark - AppDelegate | ||
| 300 | - | ||
| 301 | -- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options{ | ||
| 302 | - return [WWKApi handleOpenURL:url delegate:self]; | ||
| 303 | -} | ||
| 304 | - | ||
| 305 | -- (BOOL)isBlankString:(NSString *)string{ | ||
| 306 | - | ||
| 307 | - if (string == nil) { | ||
| 308 | - | ||
| 309 | - return YES; | ||
| 310 | - | ||
| 311 | - } | ||
| 312 | - | ||
| 313 | - if (string == NULL) { | ||
| 314 | - | ||
| 315 | - return YES; | ||
| 316 | - | ||
| 317 | - } | ||
| 318 | - | ||
| 319 | - if ([string isKindOfClass:[NSNull class]]) { | ||
| 320 | - | ||
| 321 | - return YES; | ||
| 322 | - | ||
| 323 | - } | ||
| 324 | - | ||
| 325 | - if ([[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length]==0) { | ||
| 326 | - | ||
| 327 | - return YES; | ||
| 328 | - | ||
| 329 | - } | ||
| 330 | - | ||
| 331 | - return NO; | ||
| 332 | - | ||
| 333 | -} | ||
| 334 | - | ||
| 335 | -- (void)onResp:(WWKBaseResp *)resp { | ||
| 336 | - /*! @brief 所有通过sendReq发送的SDK请求的结果都在这个函数内部进行异步回调 | ||
| 337 | - * @param resp SDK处理请求后的返回结果 需要判断具体是哪项业务的回调 | ||
| 338 | - */ | ||
| 339 | - /* SSO的回调 */ | ||
| 340 | - if ([resp isKindOfClass:[WWKSSOResp class]]) { | ||
| 341 | - WWKSSOResp *r = (WWKSSOResp *)resp; | ||
| 342 | - NSMutableDictionary *mDic = [[NSMutableDictionary alloc]init]; | ||
| 343 | - if([self isBlankString:r.code]){ | ||
| 344 | - [mDic setObject:@"1" forKey:@"errCode"]; | ||
| 345 | - [mDic setObject:@"" forKey:@"code"]; | ||
| 346 | - }else{ | ||
| 347 | - [mDic setObject:@"0" forKey:@"errCode"]; | ||
| 348 | - [mDic setObject:r.code forKey:@"code"]; | ||
| 349 | - } | ||
| 350 | - [mDic setObject:r.state forKey:@"state"]; | ||
| 351 | - authResult(mDic); | ||
| 352 | - // [channel invokeMethod:@"auth" arguments:mDic]; | ||
| 353 | - }else if([resp isKindOfClass:[WWKSendMessageResp class]]){ | ||
| 354 | - | ||
| 355 | - // NSMutableDictionary *mDic = [[NSMutableDictionary alloc]init]; | ||
| 356 | - | ||
| 357 | - // [mDic setObject:[NSString stringWithFormat:@"%@",resp.errStr]] forKey:@"errStr"]; | ||
| 358 | - // [mDic setObject:[NSString stringWithFormat:@"%d",resp.errCode]] forKey:@"errCode"]; | ||
| 359 | - // authResult(mDic); | ||
| 360 | - } | ||
| 361 | - | ||
| 362 | -} | ||
| 363 | - | ||
| 364 | - | ||
| 365 | - | ||
| 366 | -@end |
| 1 | -// | ||
| 2 | -// WWKApi.h | ||
| 3 | -// wxwork | ||
| 4 | -// | ||
| 5 | -// Created by WXWork on 16/5/25. | ||
| 6 | -// Copyright © 2019年 Tencent. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import <Foundation/Foundation.h> | ||
| 10 | -#import <UIKit/UIKit.h> | ||
| 11 | -#import "WWKApiObject.h" | ||
| 12 | - | ||
| 13 | -#pragma mark - WWKApiDelegate | ||
| 14 | -/*! @brief 接收并处理来自企业微信终端程序的事件消息 | ||
| 15 | - * | ||
| 16 | - * 接收并处理来自企业微信终端程序的事件消息,期间企业微信界面会切换到第三方应用程序。 | ||
| 17 | - * WWKApiDelegate 会在handleOpenURL:delegate:中使用并触发。 | ||
| 18 | - */ | ||
| 19 | -@protocol WWKApiDelegate <NSObject> | ||
| 20 | -@optional | ||
| 21 | - | ||
| 22 | -// 企业微信展示对外名称. | ||
| 23 | -typedef NS_ENUM(NSInteger, WWKDiplayNameType) { | ||
| 24 | - WWKDefaultName = 0, // 企业微信 | ||
| 25 | - WWKLocalName = 1 // 政务微信 | ||
| 26 | -}; | ||
| 27 | - | ||
| 28 | -/*! @brief 收到一个来自企业微信的请求,第三方应用程序处理完后调用sendResp向企业微信发送结果 | ||
| 29 | - * | ||
| 30 | - * 收到一个来自企业微信的请求,异步处理完成后必须调用sendResp发送处理结果给企业微信。 | ||
| 31 | - * 目前并未使用。 | ||
| 32 | - * @param req 具体请求内容,是自动释放的 | ||
| 33 | - */ | ||
| 34 | -- (void)onReq:(WWKBaseReq *)req; | ||
| 35 | - | ||
| 36 | -/*! @brief 发送一个sendReq后,收到企业微信的回应 | ||
| 37 | - * | ||
| 38 | - * 收到一个来自企业微信的处理结果。调用一次sendReq后会收到onResp。 | ||
| 39 | - * 可能收到的处理结果有WWKSendMessageResp等。 | ||
| 40 | - * @param resp 具体的回应内容,是自动释放的 | ||
| 41 | - */ | ||
| 42 | -- (void)onResp:(WWKBaseResp *)resp; | ||
| 43 | - | ||
| 44 | -/*! @brief SessionKey更新回调 | ||
| 45 | - * | ||
| 46 | - * 需要设置updateSessionKeyIfNeeded:YES,并且满足企业微信sessionKey更新策略才会调用 | ||
| 47 | - * @param | ||
| 48 | - */ | ||
| 49 | -- (void)onSessionKeyUpdate:(NSString *)newSessionKey; | ||
| 50 | -@end | ||
| 51 | - | ||
| 52 | - | ||
| 53 | -#pragma mark - WWKApi | ||
| 54 | - | ||
| 55 | -/*! @brief 企业微信Api接口函数类 | ||
| 56 | - * | ||
| 57 | - * 该类封装了企业微信终端SDK的所有接口 | ||
| 58 | - */ | ||
| 59 | -@interface WWKApi : NSObject | ||
| 60 | - | ||
| 61 | -/*! @brief WWKApi的成员函数,向企业微信终端程序注册第三方应用。 | ||
| 62 | - * | ||
| 63 | - * 需要在每次启动第三方应用程序时调用。第一次调用后,会在企业微信的可用应用列表中出现。 | ||
| 64 | - * iOS7及以上系统需要调起一次企业微信才会出现在企业微信的可用应用列表中。 | ||
| 65 | - * @attention 请保证在主线程中调用此函数 | ||
| 66 | - * @param appid 企业微信开发者ID | ||
| 67 | - * @return 成功返回YES,失败返回NO。 | ||
| 68 | - */ | ||
| 69 | -+ (BOOL)registerApp:(NSString *)appid; | ||
| 70 | - | ||
| 71 | -/*! @brief WWKApi的成员函数,向企业微信终端程序注册第三方应用。 | ||
| 72 | - * | ||
| 73 | - * 需要在每次启动第三方应用程序时调用。第一次调用后,会在企业微信的可用应用列表中出现。 | ||
| 74 | - * iOS7及以上系统需要调起一次企业微信才会出现在企业微信的可用应用列表中。 | ||
| 75 | - * @attention 请保证在主线程中调用此函数 | ||
| 76 | - * @param appid 第三方应用的appid | ||
| 77 | - * @param scheme 当前app的scheme | ||
| 78 | - * @return 成功返回YES,失败返回NO。 | ||
| 79 | - */ | ||
| 80 | -+ (BOOL)registerAppID:(NSString *)appid schema:(NSString *)schema; | ||
| 81 | - | ||
| 82 | - | ||
| 83 | - | ||
| 84 | -/*! @brief WWKApi的成员函数,向企业微信终端程序注册企业应用。 | ||
| 85 | - * | ||
| 86 | - * 需要在每次启动第三方应用程序时调用。第一次调用后,会在企业微信的可用应用列表中出现。 | ||
| 87 | - * @see registerApp | ||
| 88 | - * @param appid 企业微信开发者ID | ||
| 89 | - * @param corpid 企业微信企业ID | ||
| 90 | - * @param agentid 企业微信企业应用ID | ||
| 91 | - * @return 成功返回YES,失败返回NO。 | ||
| 92 | - */ | ||
| 93 | -+ (BOOL)registerApp:(NSString *)appid corpId:(NSString *)corpid agentId:(NSString *)agentid; | ||
| 94 | - | ||
| 95 | - | ||
| 96 | -/*! @brief 是否必要时更新sessionKey,默认为NO | ||
| 97 | - * | ||
| 98 | - * @param url 企业微信根据安全策略自动更新sessionKey,如果有更新,会触发onSessionKeyUpdate:回调 | ||
| 99 | - */ | ||
| 100 | -+ (void)updateSessionKeyIfNeeded:(BOOL)enable; | ||
| 101 | - | ||
| 102 | -/*! @brief 处理企业微信通过URL启动App时传递的数据 | ||
| 103 | - * | ||
| 104 | - * 需要在 application:openURL:sourceApplication:annotation:或者application:handleOpenURL中调用。 | ||
| 105 | - * @param url 企业微信启动第三方应用时传递过来的URL | ||
| 106 | - * @param delegate WWKApiDelegate对象,用来接收企业微信触发的消息。 | ||
| 107 | - * @return 成功返回YES,失败返回NO。 | ||
| 108 | - */ | ||
| 109 | -+ (BOOL)handleOpenURL:(NSURL *)url delegate:(id<WWKApiDelegate>) delegate; | ||
| 110 | - | ||
| 111 | - | ||
| 112 | - | ||
| 113 | -/*! @brief 检查企业微信是否已被用户安装 | ||
| 114 | - * | ||
| 115 | - * @return 企业微信已安装返回YES,未安装返回NO。 | ||
| 116 | - * @note 由于iOS系统的限制,在iOS9及以上系统检测企业微信是否安装,需要将企业微信的scheme"wxwork"(云端版本)及"wxworklocal"(本地部署版本)添加到工程的Info.plist中的LSApplicationQueriesSchemes白名单里,否则此方法总是会返回NO。 | ||
| 117 | - * 详情参考 https://developer.apple.com/documentation/uikit/uiapplication/1622952-canopenurl | ||
| 118 | - */ | ||
| 119 | -+ (BOOL)isAppInstalled; | ||
| 120 | - | ||
| 121 | - | ||
| 122 | - | ||
| 123 | -/*! @brief 获取企业微信的itunes安装地址 | ||
| 124 | - * | ||
| 125 | - * @return 企业微信的安装地址字符串。 | ||
| 126 | - */ | ||
| 127 | -+ (NSString *)getAppInstallUrl; | ||
| 128 | - | ||
| 129 | - | ||
| 130 | - | ||
| 131 | -/*! @brief 获取当前企业微信SDK的版本号 | ||
| 132 | - * | ||
| 133 | - * @return 返回当前企业微信SDK的版本号 | ||
| 134 | - */ | ||
| 135 | -+ (NSString *)getApiVersion; | ||
| 136 | - | ||
| 137 | - | ||
| 138 | - | ||
| 139 | -/*! @brief 打开企业微信 | ||
| 140 | - * | ||
| 141 | - * @return 成功返回YES,失败返回NO。 | ||
| 142 | - */ | ||
| 143 | -+ (BOOL)openApp; | ||
| 144 | - | ||
| 145 | -/*! | ||
| 146 | - * @brief 启动登录流程。 | ||
| 147 | - * @param navigationController 当前页面的导航栏控制器 | ||
| 148 | - * @param state 第三方应用传入的值,登录成功后会透传给第三方应用 | ||
| 149 | - * @see WWKSSOReq | ||
| 150 | - */ | ||
| 151 | -+ (void)startSSOLogin:(NSString *)state fromNavigationController:(UINavigationController *)navigationController; | ||
| 152 | - | ||
| 153 | -/*! @brief 发送请求到企业微信,等待企业微信返回onResp | ||
| 154 | - * | ||
| 155 | - * 函数调用后,会切换到企业微信的界面。第三方应用程序等待企业微信返回onResp。企业微信在异步处理完成后一定会调用onResp。支持以下类型 | ||
| 156 | - * WWKSendMessageReq等。 | ||
| 157 | - * @param req 具体的发送请求,在调用函数后,请自己释放。 | ||
| 158 | - * @return 成功返回YES,失败返回NO。 | ||
| 159 | - */ | ||
| 160 | -+ (BOOL)sendReq:(WWKBaseReq *)req; | ||
| 161 | - | ||
| 162 | - | ||
| 163 | - | ||
| 164 | -/*! @brief 收到企业微信onReq的请求,发送对应的应答给企业微信,并切换到企业微信界面 | ||
| 165 | - * | ||
| 166 | - * 函数调用后,会切换到企业微信的界面。第三方应用程序收到企业微信onReq的请求,异步处理该请求,完成后必须调用该函数。 | ||
| 167 | - * 目前暂未使用 | ||
| 168 | - * @param resp 具体的应答内容,调用函数后,请自己释放 | ||
| 169 | - * @return 成功返回YES,失败返回NO。 | ||
| 170 | - */ | ||
| 171 | -+ (BOOL)sendResp:(WWKBaseResp *)resp; | ||
| 172 | - | ||
| 173 | - | ||
| 174 | -/*! @brief 获取当前企业微信展示名称 | ||
| 175 | - * | ||
| 176 | - * @return 返回当前企业微信展示名称 | ||
| 177 | - */ | ||
| 178 | -+ (WWKDiplayNameType)displayNameType; | ||
| 179 | - | ||
| 180 | -/*! @brief 设置登录态返回的sessionKey | ||
| 181 | - * | ||
| 182 | - */ | ||
| 183 | -+ (void)setSessionKey:(NSString *)sessionKey; | ||
| 184 | - | ||
| 185 | -/*! @brief 初始化OpenData | ||
| 186 | -* | ||
| 187 | -* @以block的形式返回成功或者失败 | ||
| 188 | -*/ | ||
| 189 | -+(void)initOpenData:(void (^)(BOOL isSucc))completion; | ||
| 190 | - | ||
| 191 | -/*! @brief 获取成员或者部门的详细信息 | ||
| 192 | -* | ||
| 193 | -* @param 传入WWKOpenDataItem输入,SDK会获取部门或用户名并以block的形式返回 | ||
| 194 | -* 需要initOpenData返回成功后才能调用 | ||
| 195 | -* @see WWKOpenDataItem | ||
| 196 | -*/ | ||
| 197 | -+(void)getOpenData:(NSArray<WWKOpenDataItem *> *)dataList completion:(void (^)(NSError *error,NSArray<WWKOpenDataItem *> *dataArray))completion; | ||
| 198 | -@end |
| 1 | -// | ||
| 2 | -// WWKApiObject.h | ||
| 3 | -// wxwork | ||
| 4 | -// | ||
| 5 | -// Created by WXWork on 16/5/25. | ||
| 6 | -// Copyright © 2019年 Tencent. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import <Foundation/Foundation.h> | ||
| 10 | - | ||
| 11 | -NS_ASSUME_NONNULL_BEGIN | ||
| 12 | - | ||
| 13 | -@class WWKBaseResp; | ||
| 14 | -@protocol WWKApiSerializable <NSObject> | ||
| 15 | -- (BOOL)deserializeWithDictionary:(NSDictionary *)dict; | ||
| 16 | -@end | ||
| 17 | - | ||
| 18 | -@interface WWKBaseObject : NSObject | ||
| 19 | -@property (nonatomic, copy) NSString *bundleID; | ||
| 20 | -@property (nonatomic, copy) NSString *bundleName; | ||
| 21 | -@property (nonatomic, assign) NSUInteger sequence; | ||
| 22 | -@property (nonatomic, readonly, nullable) NSData *serializedData; | ||
| 23 | -@property (nonatomic, readonly, nullable) NSMutableDictionary *serializedDict; | ||
| 24 | -+ (instancetype)deserializeWithData:(NSData *)data appid:(NSString *)appid; | ||
| 25 | -@end | ||
| 26 | - | ||
| 27 | -#pragma mark - WWKBaseReq | ||
| 28 | -/*! @brief 该类为企业微信终端SDK所有请求类的基类 | ||
| 29 | - * | ||
| 30 | - */ | ||
| 31 | -@interface WWKBaseReq : WWKBaseObject | ||
| 32 | -- (WWKBaseResp *)respObj; // 对应返回的结构 | ||
| 33 | -@end | ||
| 34 | - | ||
| 35 | - | ||
| 36 | - | ||
| 37 | -#pragma mark - WWKBaseResp | ||
| 38 | - | ||
| 39 | -extern const int WWKBaseRespErrCodeOK; // 操作成功 | ||
| 40 | -extern const int WWKBaseRespErrCodeCancelled; // 操作被取消 | ||
| 41 | -extern const int WWKBaseRespErrCodeFailed; // 操作失败 | ||
| 42 | -extern const int WWKBaseRespErrCodeNotSupported; // 操作不支持(不能识别请求) | ||
| 43 | -extern const int WWKBaseRespErrCodeLowAppVer; // 操作不支持(用户安装的App版本过低) | ||
| 44 | -extern const int WWKBaseRespErrCodeNoPrivileges; // 没有此API的调用权限 | ||
| 45 | -extern const int WWKBaseRespErrCodeInvalidCall; // 调用出错(例如传入参数不正确) | ||
| 46 | -extern const int WWKBaseRespErrCodeNetWork; // 网络出错(例如请求超时) | ||
| 47 | -extern const int WWKBaseRespErrCodeSessonKeyTimeOut; // sessionkey超时 | ||
| 48 | - | ||
| 49 | -/*! @brief 该类为企业微信终端SDK所有响应类的基类 | ||
| 50 | - * | ||
| 51 | - */ | ||
| 52 | -@interface WWKBaseResp : WWKBaseObject | ||
| 53 | -/** 错误码 */ | ||
| 54 | -@property (nonatomic, assign) int errCode; | ||
| 55 | -/** 错误提示字符串 */ | ||
| 56 | -@property (nonatomic, retain, nullable) NSString *errStr; | ||
| 57 | -@end | ||
| 58 | - | ||
| 59 | -#pragma mark - WWKSendMessageReq | ||
| 60 | - | ||
| 61 | -/*! | ||
| 62 | - * @brief 带在 @c WWKSendMessageReq 中的消息对象基类。实际必须使用其子类 | ||
| 63 | - */ | ||
| 64 | -@interface WWKMessageAttachment : NSObject | ||
| 65 | -@end | ||
| 66 | - | ||
| 67 | -/*! | ||
| 68 | - * @brief 文本消息 | ||
| 69 | - */ | ||
| 70 | -@interface WWKMessageTextAttachment : WWKMessageAttachment | ||
| 71 | -@property (nonatomic, copy) NSString *text; | ||
| 72 | -@end | ||
| 73 | - | ||
| 74 | -/*! | ||
| 75 | - * @brief 文件消息 | ||
| 76 | - */ | ||
| 77 | -@interface WWKMessageFileAttachment : WWKMessageAttachment | ||
| 78 | -@property (nonatomic, copy) NSString *filename; | ||
| 79 | -@property (nonatomic, copy, nullable) NSString *path; | ||
| 80 | -@property (nonatomic, retain, nullable) NSData *data; | ||
| 81 | -@end | ||
| 82 | - | ||
| 83 | -/*! | ||
| 84 | - * @brief 图片消息 | ||
| 85 | - */ | ||
| 86 | -@interface WWKMessageImageAttachment : WWKMessageFileAttachment | ||
| 87 | -@end | ||
| 88 | - | ||
| 89 | -/*! | ||
| 90 | - * @brief 视频消息 | ||
| 91 | - */ | ||
| 92 | -@interface WWKMessageVideoAttachment : WWKMessageFileAttachment | ||
| 93 | -@end | ||
| 94 | - | ||
| 95 | -/*! | ||
| 96 | - * @brief 链接消息 | ||
| 97 | - */ | ||
| 98 | -@interface WWKMessageLinkAttachment : WWKMessageAttachment | ||
| 99 | -@property (nonatomic, copy, nullable) NSString *title; // 不能超过512bytes | ||
| 100 | -@property (nonatomic, copy, nullable) NSString *summary; // 不能超过1k | ||
| 101 | -@property (nonatomic, copy, nullable) NSString *url; | ||
| 102 | -@property (nonatomic, copy, nullable) NSString *iconurl; | ||
| 103 | -@property (nonatomic, retain, nullable) NSData *icon; // 不能超过32K | ||
| 104 | -// 是否使用带 shareTicket 的转发,只有注册了企业应用的agentid才有效;只能为单条转发,放在WWKMessageGroupAttachment中会被过滤 | ||
| 105 | -@property (nonatomic, assign) BOOL withShareTicket; | ||
| 106 | -@property (nonatomic, copy, nullable) NSString *shareTicketState; | ||
| 107 | -@end | ||
| 108 | - | ||
| 109 | -/*! | ||
| 110 | - * @brief 小程序消息 | ||
| 111 | - */ | ||
| 112 | -@interface WWKMessageMiniAppAttachment : WWKMessageAttachment | ||
| 113 | -@property (nonatomic, copy) NSString *userName; // 小程序username | ||
| 114 | -@property (nonatomic, copy, nullable) NSString *path; // 小程序页面的路径 | ||
| 115 | -@property (nonatomic, strong, nullable) NSData *hdImageData; // 小程序预览图 不能超过128k | ||
| 116 | -@property (nonatomic, copy, nullable) NSString *title; // 小程序 当前页title 不能超过512bytes | ||
| 117 | -@end | ||
| 118 | - | ||
| 119 | -/*! | ||
| 120 | - * @brief 位置消息 | ||
| 121 | - */ | ||
| 122 | -@interface WWKMessageLocationAttachment : WWKMessageAttachment | ||
| 123 | -@property (nonatomic, copy, nullable) NSString *title; | ||
| 124 | -@property (nonatomic, copy, nullable) NSString *address; | ||
| 125 | -@property (nonatomic, assign) double lat; | ||
| 126 | -@property (nonatomic, assign) double lng; | ||
| 127 | -@property (nonatomic, assign) double zoom; | ||
| 128 | -@end | ||
| 129 | - | ||
| 130 | -/*! | ||
| 131 | - * @brief 单条聊天记录消息 | ||
| 132 | - */ | ||
| 133 | -@interface WWKMessageAttachmentWrapper : NSObject | ||
| 134 | -@property (nonatomic, copy) NSString *name; | ||
| 135 | -@property (nonatomic, copy) NSDate *date; | ||
| 136 | -@property (nonatomic, copy, nullable) NSString *avatarUrl; | ||
| 137 | -@property (nonatomic, copy, nullable) NSData *avatarData; | ||
| 138 | -@property (nonatomic, retain) WWKMessageAttachment *attachment; | ||
| 139 | -@end | ||
| 140 | - | ||
| 141 | -/*! | ||
| 142 | - * @brief 聊天记录消息组 | ||
| 143 | - */ | ||
| 144 | -@interface WWKMessageGroupAttachment : WWKMessageAttachment | ||
| 145 | -@property (nonatomic, copy) NSArray<WWKMessageAttachmentWrapper *> *contents; | ||
| 146 | -@property (nonatomic, copy) NSString *title; | ||
| 147 | -@end | ||
| 148 | - | ||
| 149 | - | ||
| 150 | -typedef NS_ENUM(NSUInteger, WWKOpenIdType) { | ||
| 151 | - WWKOpenIdTypeUnKnown = 0, | ||
| 152 | - WWKOpenIdTypeUser, // 成员 | ||
| 153 | - WWKOpenIdTypeDepartment //部门 | ||
| 154 | -}; | ||
| 155 | - | ||
| 156 | -@interface WWKOpenIdInfo : NSObject | ||
| 157 | -@property (nonatomic, copy, nullable) NSString *openid; | ||
| 158 | -@property (nonatomic, assign) WWKOpenIdType idType; | ||
| 159 | -@end | ||
| 160 | - | ||
| 161 | - | ||
| 162 | -/*! @brief 第三方程序发送消息至企业微信终端程序的消息结构体 | ||
| 163 | - * | ||
| 164 | - * 第三方程序向企业微信发送信息需要传入WWKSendMessageReq结构体,信息类型包括文本消息和多媒体消息, | ||
| 165 | - * 分别对应于text和message成员。调用该方法后,企业微信处理完信息会向第三方程序发送一个处理结果。 | ||
| 166 | - * @see WWKSendMessageResp | ||
| 167 | - */ | ||
| 168 | -@interface WWKSendMessageReq : WWKBaseReq <WWKApiSerializable> | ||
| 169 | -/** 发送消息的多媒体内容 | ||
| 170 | - * @see WWKMessageAttachment | ||
| 171 | - */ | ||
| 172 | -@property (nonatomic, retain, nullable) WWKMessageAttachment *attachment; | ||
| 173 | - | ||
| 174 | -@end | ||
| 175 | - | ||
| 176 | - | ||
| 177 | - | ||
| 178 | -#pragma mark - WWKSendMessageResp | ||
| 179 | -/*! @brief 企业微信终端向第三方程序返回的WWKSendMessageReq处理结果。 | ||
| 180 | - * | ||
| 181 | - * 第三方程序向企业微信终端发送WWKSendMessageReq后,企业微信发送回来的处理结果,该结果用WWKSendMessageResp表示。 | ||
| 182 | - */ | ||
| 183 | -@interface WWKSendMessageResp : WWKBaseResp <WWKApiSerializable> | ||
| 184 | -@end | ||
| 185 | - | ||
| 186 | -#pragma mark - WWKPickContactReq | ||
| 187 | -/*! @brief 第三方程序从企业微信终端程序选人的消息结构体 | ||
| 188 | -* | ||
| 189 | -* 本接口无需登录态,只能选择邮箱联系人。如果需要选择所有联系人,请使用WWKSelectContactReq接口 | ||
| 190 | -* | ||
| 191 | -* | ||
| 192 | -*/ | ||
| 193 | -@interface WWKPickContactReq : WWKBaseReq <WWKApiSerializable> | ||
| 194 | -@property (nonatomic, copy) NSString *type; | ||
| 195 | -@end | ||
| 196 | - | ||
| 197 | -#pragma mark - WWKPickContactResp | ||
| 198 | - | ||
| 199 | -@interface WWKContactInfo : NSObject | ||
| 200 | -@property (nonatomic, copy) NSString *name; | ||
| 201 | -@property (nonatomic, copy, nullable) NSString *email; | ||
| 202 | -@end | ||
| 203 | - | ||
| 204 | -@interface WWKPickContactResp : WWKBaseResp <WWKApiSerializable> | ||
| 205 | -@property (nonatomic, retain, nullable) NSArray<WWKContactInfo *> *contacts; | ||
| 206 | -@end | ||
| 207 | - | ||
| 208 | -#pragma mark - WWKOpenConversationReq | ||
| 209 | - | ||
| 210 | -@interface WWKOpenConversationReq : WWKBaseReq <WWKApiSerializable> | ||
| 211 | -@property (nonatomic, assign) uint64_t conversationType; | ||
| 212 | -@property (nonatomic, assign) uint64_t conversationId; | ||
| 213 | -@end | ||
| 214 | - | ||
| 215 | -#pragma mark - WWKOpenConversationResp | ||
| 216 | - | ||
| 217 | -@interface WWKOpenConversationResp : WWKBaseResp <WWKApiSerializable> | ||
| 218 | -@end | ||
| 219 | - | ||
| 220 | -#pragma mark - WWKSSOReq | ||
| 221 | - | ||
| 222 | -@interface WWKSSOReq : WWKBaseReq <WWKApiSerializable> | ||
| 223 | -@property (nonatomic, copy) NSString *state; | ||
| 224 | -@end | ||
| 225 | - | ||
| 226 | -@interface WWKSSOResp : WWKBaseResp <WWKApiSerializable> | ||
| 227 | -@property (nonatomic, retain, nullable) NSString *state; | ||
| 228 | -@property (nonatomic, retain, nullable) NSString *code; | ||
| 229 | -@end | ||
| 230 | - | ||
| 231 | - | ||
| 232 | - | ||
| 233 | -/*! @brief 第三方程序创建群聊并发送消息至企业微信终端程序的消息结构体(需登录态) | ||
| 234 | - * | ||
| 235 | - * 第三方程序向企业微信发送信息需要传入WWKSendMessageReq结构体,创建群聊成员的openid列表 | ||
| 236 | - * (只支持成员,不支持部门),当前登录态返回的openUserid,信息类型包括文本消息和多媒体消息, | ||
| 237 | - * 分别对应于text和message成员。调用该方法后,企业微信处理完信息会向第三方程序发送一个处理结果。 | ||
| 238 | - * @see WWKOpenChatWithMessageResp | ||
| 239 | - */ | ||
| 240 | -@interface WWKOpenChatWithMessageReq : WWKBaseReq <WWKApiSerializable> | ||
| 241 | -/** 发送消息的多媒体内容 | ||
| 242 | - * @see WWKMessageAttachment | ||
| 243 | - */ | ||
| 244 | -@property (nonatomic, retain, nullable) WWKMessageAttachment *attachment; | ||
| 245 | - | ||
| 246 | -/** 发送消息的到新创建的群聊 | ||
| 247 | -* 暂不支持传入部门信息 | ||
| 248 | -*/ | ||
| 249 | -@property (nonatomic, retain, nullable) NSArray<NSString *> *userOpenidList; | ||
| 250 | - | ||
| 251 | -/** | ||
| 252 | -* 从后台登录获取的openUserid | ||
| 253 | -*/ | ||
| 254 | -@property (nonatomic, retain, nullable) NSString *openUserid; | ||
| 255 | -@end | ||
| 256 | - | ||
| 257 | - | ||
| 258 | - | ||
| 259 | -#pragma mark - WWKOpenChatWithMessageResp | ||
| 260 | -/*! @brief 企业微信终端向第三方程序返回的WWKOpenChatWithMessageReq处理结果。 | ||
| 261 | - * | ||
| 262 | - * 第三方程序向企业微信终端发送WWKOpenChatWithMessageReq后,企业微信发送回来的处理结果,该结果用WWKOpenChatWithMessageResp表示。 | ||
| 263 | - */ | ||
| 264 | -@interface WWKOpenChatWithMessageResp : WWKBaseResp <WWKApiSerializable> | ||
| 265 | -@end | ||
| 266 | - | ||
| 267 | - | ||
| 268 | - | ||
| 269 | - | ||
| 270 | -#pragma mark - WWKSelectContactReq | ||
| 271 | -/*! @brief 第三方程序从企业微信终端程序选人的消息结构体(需登录态) | ||
| 272 | -* | ||
| 273 | -* 第三方程序向企业微信发送信息需要传入当前登录态返回的openUserid。调用该方法后,企业微信调起选人流程,结束后会向第三方程序发送一个处理结果。 | ||
| 274 | -* @see WWKSelectContactResp | ||
| 275 | -*/ | ||
| 276 | -@interface WWKSelectContactReq : WWKBaseReq <WWKApiSerializable> | ||
| 277 | -/** | ||
| 278 | -* 从后台登录获取的openUserid,必须填写这个字段 | ||
| 279 | -*/ | ||
| 280 | -@property (nonatomic, retain) NSString *openUserid; | ||
| 281 | -@end | ||
| 282 | - | ||
| 283 | -#pragma mark - WWKSelectContactResp | ||
| 284 | - | ||
| 285 | -/*! @brief 选人回包 | ||
| 286 | -* | ||
| 287 | -* 从这个接口返回的数据不会带人名或部门名,需要调用getOpenData接口获取名字等详细信息 | ||
| 288 | -* 目前仅支持选择成员,暂不支持选择部门 | ||
| 289 | -*/ | ||
| 290 | -@interface WWKSelectContactResp : WWKBaseResp <WWKApiSerializable> | ||
| 291 | -@property (nonatomic, retain, nullable) NSArray<WWKOpenIdInfo *> *openids; | ||
| 292 | -@end | ||
| 293 | - | ||
| 294 | -/*! @brief getOpenData接口使用的结构 | ||
| 295 | -* @param openid 部门或成员openid信息 | ||
| 296 | -* @param type 需要查询的类型,目前仅支持userName(用户名称)、userDepartment(用户主部门名称)以及userGender(用户性别)、departmentName(部门名称),其中userName、userDepartment、userGender在openid为用成员时有效,departmentName在openid为部门时有效 | ||
| 297 | -* @param data 传入时不需要填写,getOpenData返回会填充该字段 | ||
| 298 | -*/ | ||
| 299 | -@interface WWKOpenDataItem : NSObject | ||
| 300 | -@property (nonatomic, copy) NSString *openid; | ||
| 301 | -@property (nonatomic, copy) NSString *type; | ||
| 302 | -@property (nonatomic, copy, nullable) NSString *data; | ||
| 303 | -@end | ||
| 304 | - | ||
| 305 | - | ||
| 306 | -#pragma mark - WWKSelectPrivilegedContactReq | ||
| 307 | -/*! @brief 第三方程序从企业微信终端程序选人的消息结构体(需登录态) | ||
| 308 | -* | ||
| 309 | -* 选择范围限定为企业通讯录 | ||
| 310 | -* 只支持成员,若勾选部门,则对应展开勾选部门下的成员。 | ||
| 311 | -* 与WWKSelectContactReq接口的区分是,返回的选择范围,需要经过第三方权限过滤。只返回在可见范围的列表,而完整的列表存在ticket给第三方,用于jsapi/api接口调用。 | ||
| 312 | -* @see WWKSelectPrivilegedContactResp | ||
| 313 | -*/ | ||
| 314 | -@interface WWKSelectPrivilegedContactReq : WWKBaseReq <WWKApiSerializable> | ||
| 315 | -/** | ||
| 316 | -* 从后台登录获取的loginOpenUserid,必须填写这个字段 | ||
| 317 | -* selectedOpenUserIds 预选用户openUserId列表 | ||
| 318 | -* selectedTickets 预选ticket列表 | ||
| 319 | -*/ | ||
| 320 | -@property (nonatomic, copy) NSString *loginOpenUserid; | ||
| 321 | -@property (nonatomic, copy) NSArray<NSString *> *selectedOpenUserIds; | ||
| 322 | -@property (nonatomic, copy) NSArray<NSString *> *selectedTickets; | ||
| 323 | -@end | ||
| 324 | - | ||
| 325 | -#pragma mark - WWKSelectPrivilegedContactResp | ||
| 326 | - | ||
| 327 | -/*! @brief 选人回包 | ||
| 328 | -* | ||
| 329 | -* openUserIdList 返回openid的列表 | ||
| 330 | -* selectedTicket 选择的集合Ticket,用于对该选择集合操作的调用凭证。 | ||
| 331 | -* expiresIn selectedTicket的有效期,单位为秒 | ||
| 332 | -* selectedUserCount 选择的集合Ticket包含的用户数 | ||
| 333 | -*/ | ||
| 334 | -@interface WWKSelectPrivilegedContactResp : WWKBaseResp <WWKApiSerializable> | ||
| 335 | -@property (nonatomic, copy) NSArray<NSString *> *openUserIdList; | ||
| 336 | -@property (nonatomic, copy) NSString *selectedTicket; | ||
| 337 | -@property (nonatomic, assign) uint32_t expiresIn; | ||
| 338 | -@property (nonatomic, assign) uint32_t selectedUserCount; | ||
| 339 | - | ||
| 340 | -@end | ||
| 341 | - | ||
| 342 | - | ||
| 343 | - | ||
| 344 | -#pragma mark - WWKCreateChatWithMsgReq | ||
| 345 | -/*! @brief 新建群聊发消息(需登录态) | ||
| 346 | -* | ||
| 347 | -* 选人范围包括企业通讯录和外部联系人。 | ||
| 348 | -* 支持用户传入openUserId,和selectedTicket | ||
| 349 | -* @see WWKCreateChatWithMsgResp | ||
| 350 | -*/ | ||
| 351 | -@interface WWKCreateChatWithMsgReq : WWKBaseReq <WWKApiSerializable> | ||
| 352 | -/** | ||
| 353 | -* loginOpenUserid 从后台登录获取的loginOpenUserid,必须填写这个字段 | ||
| 354 | -* selectedOpenUserIdList 创建会话的企业通讯录成员信息,格式为字符串,内容为成员的openid列表(可以从WWKSelectPrivilegedContactResp获取),限定必须为应用的可见范围内。列表最多2000项。 | ||
| 355 | -* selectedTicketList 已选择的成员集合凭证列表,(可以从WWKSelectPrivilegedContactResp获取)。列表最多10个。 | ||
| 356 | -* attachment 消息内容结构体,支持文本、文件、图片、视频、链接、聊天内容,参考WWKMessageAttachment | ||
| 357 | -* chatName 群聊名称 | ||
| 358 | -* state 透传参数,最长256,用于回调第三方应用创建群聊事件 | ||
| 359 | -* | ||
| 360 | -*/ | ||
| 361 | - | ||
| 362 | -@property (nonatomic, copy) NSString *loginOpenUserid; | ||
| 363 | -@property (nonatomic, copy) NSArray<NSString *> *selectedOpenUserIdList; | ||
| 364 | -@property (nonatomic, copy) NSArray<NSString *> *selectedTicketList; | ||
| 365 | -@property (nonatomic, retain) WWKMessageAttachment *attachment; | ||
| 366 | -@property (nonatomic, copy, nullable) NSString *chatName; | ||
| 367 | -@property (nonatomic, copy, nullable) NSString *state; | ||
| 368 | -@end | ||
| 369 | - | ||
| 370 | -#pragma mark - WWKCreateChatWithMsgResp | ||
| 371 | - | ||
| 372 | -/*! @brief 新建群聊发消息回包 | ||
| 373 | -* | ||
| 374 | -* errorCode 错误码 | ||
| 375 | -* errorMsg 错误码描述 | ||
| 376 | -* chatId 若创建群成功,返回群ID | ||
| 377 | -*/ | ||
| 378 | -@interface WWKCreateChatWithMsgResp : WWKBaseResp <WWKApiSerializable> | ||
| 379 | -@property (nonatomic, copy, nullable) NSString *chatId; | ||
| 380 | -@end | ||
| 381 | - | ||
| 382 | - | ||
| 383 | - | ||
| 384 | -#pragma mark - WWKOpenExistedChatWithMsgReq | ||
| 385 | -/*! @brief 打开群聊发消息(需登录态) | ||
| 386 | -*/ | ||
| 387 | -@interface WWKOpenExistedChatWithMsgReq : WWKBaseReq <WWKApiSerializable> | ||
| 388 | -/** | ||
| 389 | -* loginOpenUserid 从后台登录获取的loginOpenUserid,必须填写这个字段 | ||
| 390 | -* attachment 消息内容结构体,支持文本、文件、图片、视频、链接、聊天内容,参考WWKMessageAttachment attachment为可选。若不传参数,则无消息发送确认行为。 | ||
| 391 | -* chatId 打开群聊ID,chatId必须是当前用户所在的群聊 | ||
| 392 | -* | ||
| 393 | -*/ | ||
| 394 | - | ||
| 395 | -@property (nonatomic, copy) NSString *loginOpenUserid; | ||
| 396 | -@property (nonatomic, retain, nullable) WWKMessageAttachment *attachment; | ||
| 397 | -@property (nonatomic, copy) NSString *chatId; | ||
| 398 | -@end | ||
| 399 | - | ||
| 400 | -#pragma mark - WWKOpenExistedChatWithMsgResp | ||
| 401 | - | ||
| 402 | -/*! @brief 打开群聊发消息回包 | ||
| 403 | -* | ||
| 404 | -* errorCode 错误码 | ||
| 405 | -* errorMsg 错误码描述 | ||
| 406 | -*/ | ||
| 407 | -@interface WWKOpenExistedChatWithMsgResp : WWKBaseResp <WWKApiSerializable> | ||
| 408 | -@end | ||
| 409 | - | ||
| 410 | - | ||
| 411 | -NS_ASSUME_NONNULL_END |
6.3 KB
No preview for this file type
| 1 | -# | ||
| 2 | -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. | ||
| 3 | -# Run `pod lib lint flutter_wxwork.podspec` to validate before publishing. | ||
| 4 | -# | ||
| 5 | -Pod::Spec.new do |s| | ||
| 6 | - s.name = 'flutter_wxwork' | ||
| 7 | - s.version = '0.0.1' | ||
| 8 | - s.summary = 'A new Flutter plugin project.' | ||
| 9 | - s.description = <<-DESC | ||
| 10 | -A new Flutter plugin project. | ||
| 11 | - DESC | ||
| 12 | - s.homepage = 'http://example.com' | ||
| 13 | - s.license = { :file => '../LICENSE' } | ||
| 14 | - s.author = { 'Your Company' => 'email@example.com' } | ||
| 15 | - s.source = { :path => '.' } | ||
| 16 | - s.source_files = 'Classes/**/*' | ||
| 17 | - s.public_header_files = 'Classes/**/*.h' | ||
| 18 | - s.dependency 'Flutter' | ||
| 19 | - s.platform = :ios, '9.0' | ||
| 20 | - # s.dependency 'Classes/libWXWorkApi.a' | ||
| 21 | - s.vendored_libraries = 'Classes/libWXWorkApi.a' | ||
| 22 | - # 依赖的第三方库用到了静态库,还需要添加: | ||
| 23 | - # s.static_framework = true | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - # Flutter.framework does not contain a i386 slice. | ||
| 27 | - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } | ||
| 28 | -end |
| 1 | - | ||
| 2 | -import 'dart:async'; | ||
| 3 | -import 'dart:io'; | ||
| 4 | - | ||
| 5 | -import 'package:flutter_wxwork/flutter_wxwork_method_channel.dart'; | ||
| 6 | - | ||
| 7 | -import 'flutter_wxwork_platform_interface.dart'; | ||
| 8 | - | ||
| 9 | -class FlutterWxwork { | ||
| 10 | - Future<String?> getPlatformVersion() { | ||
| 11 | - return FlutterWxworkPlatform.instance.getPlatformVersion(); | ||
| 12 | - } | ||
| 13 | - | ||
| 14 | - Future<bool?> registerApp(scheme, corpId, agentId) { | ||
| 15 | - return FlutterWxworkPlatform.instance.registerApp(scheme, corpId, agentId); | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | - Future<AuthModel> auth({String state = 'state'}) async { | ||
| 19 | - return FlutterWxworkPlatform.instance.auth(); | ||
| 20 | - } | ||
| 21 | - | ||
| 22 | - Future<bool?> isAppInstalled() { | ||
| 23 | - return FlutterWxworkPlatform.instance.isAppInstalled(); | ||
| 24 | - } | ||
| 25 | - | ||
| 26 | - Future<bool?> shareImageNetWork(String path) { | ||
| 27 | - return FlutterWxworkPlatform.instance.shareImageNetWork(path); | ||
| 28 | - } | ||
| 29 | -FutureOr<bool?> shareImagePath(String path) { | ||
| 30 | - return FlutterWxworkPlatform.instance.shareImagePath(path); | ||
| 31 | - } | ||
| 32 | - | ||
| 33 | - Future<dynamic> shareMiniProgram( | ||
| 34 | - {String? userName, //必须是应用关联的小程序,注意要有@app后缀 | ||
| 35 | - String? path, | ||
| 36 | - String? hdImageData, | ||
| 37 | - String title = "分享标题", | ||
| 38 | - String description = ""}) { | ||
| 39 | - return FlutterWxworkPlatform.instance.shareMiniProgram( | ||
| 40 | - userName: userName, path: path, hdImageData: hdImageData, title: title,description:description); | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - Future<bool?> shareText({String text = "分享内容"}) { | ||
| 44 | - return FlutterWxworkPlatform.instance.shareText( | ||
| 45 | - text: text, | ||
| 46 | - ); | ||
| 47 | - } | ||
| 48 | -} |
| 1 | - | ||
| 2 | -import 'dart:async'; | ||
| 3 | -import 'dart:convert'; | ||
| 4 | -import 'dart:io'; | ||
| 5 | - | ||
| 6 | -import 'package:flutter/foundation.dart'; | ||
| 7 | -import 'package:flutter/services.dart'; | ||
| 8 | - | ||
| 9 | -import 'flutter_wxwork_platform_interface.dart'; | ||
| 10 | - | ||
| 11 | -/// An implementation of [FlutterWxworkPlatform] that uses method channels. | ||
| 12 | -class MethodChannelFlutterWxwork extends FlutterWxworkPlatform { | ||
| 13 | - /// The method channel used to interact with the native platform. | ||
| 14 | - @visibleForTesting | ||
| 15 | - final methodChannel = const MethodChannel('flutter_wxwork'); | ||
| 16 | - | ||
| 17 | - @override | ||
| 18 | - Future<String?> getPlatformVersion() async { | ||
| 19 | - final version = | ||
| 20 | - await methodChannel.invokeMethod<String>('getPlatformVersion'); | ||
| 21 | - return version; | ||
| 22 | - } | ||
| 23 | - | ||
| 24 | - @override | ||
| 25 | - Future<bool?> registerApp(scheme, corpId, agentId) async { | ||
| 26 | - bool? result = | ||
| 27 | - await methodChannel.invokeMethod<bool>('register', <String, String>{ | ||
| 28 | - 'scheme': scheme, | ||
| 29 | - 'corpId': corpId, | ||
| 30 | - 'agentId': agentId, | ||
| 31 | - }); | ||
| 32 | - return result; | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | - @override | ||
| 36 | - Future<bool?> isAppInstalled() async { | ||
| 37 | - final isAppInstalled = | ||
| 38 | - await methodChannel.invokeMethod<bool>('isAppInstalled'); | ||
| 39 | - return isAppInstalled; | ||
| 40 | - } | ||
| 41 | - | ||
| 42 | - @override | ||
| 43 | - Future<bool?> shareImageNetWork(String path) async { | ||
| 44 | - final shareImageNetWork = await methodChannel | ||
| 45 | - .invokeMethod<bool>('shareImageNetWork', <String, String>{ | ||
| 46 | - 'path': path, | ||
| 47 | - }); | ||
| 48 | - return shareImageNetWork; | ||
| 49 | - } | ||
| 50 | - | ||
| 51 | - @override | ||
| 52 | - Future<bool?> shareImagePath(String path) async { | ||
| 53 | - final shareImagePath = await methodChannel | ||
| 54 | - .invokeMethod<bool>('shareImagePath', <String, String>{ | ||
| 55 | - 'path': path, | ||
| 56 | - }); | ||
| 57 | - return shareImagePath; | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | - @override | ||
| 61 | - Future<dynamic> shareMiniProgram( | ||
| 62 | - {String? userName, //必须是应用关联的小程序,注意要有@app后缀 | ||
| 63 | - String? path, | ||
| 64 | - String? hdImageData, | ||
| 65 | - String title = "分享标题", | ||
| 66 | - String description= ""}) async { | ||
| 67 | - final shareMiniProgram = await methodChannel.invokeMethod<dynamic>( | ||
| 68 | - 'shareMiniProgram', <String, String?>{ | ||
| 69 | - 'userName': userName, | ||
| 70 | - 'path': path, | ||
| 71 | - 'hdImageData': hdImageData, | ||
| 72 | - 'title': title, | ||
| 73 | - "description":description | ||
| 74 | - }); | ||
| 75 | - return shareMiniProgram; | ||
| 76 | - } | ||
| 77 | - | ||
| 78 | - @override | ||
| 79 | - Future<bool?> shareText({String text = "分享内容"}) async { | ||
| 80 | - final shareText = | ||
| 81 | - await methodChannel.invokeMethod<bool>('shareText', <String, String>{ | ||
| 82 | - 'text': text, | ||
| 83 | - }); | ||
| 84 | - return shareText; | ||
| 85 | - } | ||
| 86 | - | ||
| 87 | - @override | ||
| 88 | - Future<AuthModel> auth({String state = 'state'}) async { | ||
| 89 | - var content = await methodChannel.invokeMethod('auth', {"state": state}); | ||
| 90 | - return AuthModel.fromJson(Map<String, dynamic>.from(content)); | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | - bool _stringToBool(String string) { | ||
| 94 | - if (string == '1') { | ||
| 95 | - return true; | ||
| 96 | - } else { | ||
| 97 | - return false; | ||
| 98 | - } | ||
| 99 | - } | ||
| 100 | -} | ||
| 101 | - | ||
| 102 | -class AuthModel { | ||
| 103 | - /// 1.取消 0.成功 2.失败 | ||
| 104 | - String? errCode; | ||
| 105 | - String? code; | ||
| 106 | - String? state; | ||
| 107 | - | ||
| 108 | - bool get isSuccess => errCode == '1'; | ||
| 109 | - AuthModel(); | ||
| 110 | - | ||
| 111 | - factory AuthModel.fromJson(Map<String, dynamic> json) { | ||
| 112 | - AuthModel model = AuthModel(); | ||
| 113 | - model.errCode = json['errCode']; | ||
| 114 | - model.code = json['code']; | ||
| 115 | - model.state = json['state']; | ||
| 116 | - return model; | ||
| 117 | - } | ||
| 118 | - | ||
| 119 | - Map<String, dynamic> toJson() { | ||
| 120 | - return {'errorCode': errCode, 'code': code, 'state': state}; | ||
| 121 | - } | ||
| 122 | - | ||
| 123 | - @override | ||
| 124 | - String toString() { | ||
| 125 | - return jsonEncode(this); | ||
| 126 | - } | ||
| 127 | -} |
| 1 | - | ||
| 2 | -import 'dart:async'; | ||
| 3 | -import 'dart:io'; | ||
| 4 | - | ||
| 5 | -import 'package:plugin_platform_interface/plugin_platform_interface.dart'; | ||
| 6 | - | ||
| 7 | -import 'flutter_wxwork_method_channel.dart'; | ||
| 8 | - | ||
| 9 | -abstract class FlutterWxworkPlatform extends PlatformInterface { | ||
| 10 | - /// Constructs a FlutterWxworkPlatform. | ||
| 11 | - FlutterWxworkPlatform() : super(token: _token); | ||
| 12 | - | ||
| 13 | - static final Object _token = Object(); | ||
| 14 | - | ||
| 15 | - static FlutterWxworkPlatform _instance = MethodChannelFlutterWxwork(); | ||
| 16 | - | ||
| 17 | - /// The default instance of [FlutterWxworkPlatform] to use. | ||
| 18 | - /// | ||
| 19 | - /// Defaults to [MethodChannelFlutterWxwork]. | ||
| 20 | - static FlutterWxworkPlatform get instance => _instance; | ||
| 21 | - | ||
| 22 | - /// Platform-specific implementations should set this with their own | ||
| 23 | - /// platform-specific class that extends [FlutterWxworkPlatform] when | ||
| 24 | - /// they register themselves. | ||
| 25 | - static set instance(FlutterWxworkPlatform instance) { | ||
| 26 | - PlatformInterface.verifyToken(instance, _token); | ||
| 27 | - _instance = instance; | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | - Future<String?> getPlatformVersion() { | ||
| 31 | - throw UnimplementedError('platformVersion() has not been implemented.'); | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | - Future<bool?> registerApp(scheme, corpId, agentId) { | ||
| 35 | - throw UnimplementedError('registerApp() has not been implemented.'); | ||
| 36 | - } | ||
| 37 | - | ||
| 38 | - Future<bool?> isAppInstalled() { | ||
| 39 | - throw UnimplementedError('isAppInstalled() has not been implemented.'); | ||
| 40 | - } | ||
| 41 | - | ||
| 42 | - Future<bool?> shareImageNetWork(String path) { | ||
| 43 | - throw UnimplementedError('shareImageNetWork() has not been implemented.'); | ||
| 44 | - } | ||
| 45 | - | ||
| 46 | - Future<bool?> shareImagePath(String path) { | ||
| 47 | - throw UnimplementedError('shareImagePath() has not been implemented.'); | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - Future<AuthModel> auth() { | ||
| 51 | - throw UnimplementedError('auth() has not been implemented.'); | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | - Future<dynamic> shareMiniProgram( | ||
| 55 | - {String? userName, //必须是应用关联的小程序,注意要有@app后缀 | ||
| 56 | - String? path, | ||
| 57 | - String? hdImageData, | ||
| 58 | - String title = "分享标题", | ||
| 59 | - String description = ""}) { | ||
| 60 | - throw UnimplementedError('shareMiniProgram() has not been implemented.'); | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - Future<bool?> shareText({String text = "分享内容"}) { | ||
| 64 | - throw UnimplementedError('shareText() has not been implemented.'); | ||
| 65 | - } | ||
| 66 | -} |
library/flutter_wxwork/pubspec.lock
deleted
100644 → 0
| 1 | -# Generated by pub | ||
| 2 | -# See https://dart.dev/tools/pub/glossary#lockfile | ||
| 3 | -packages: | ||
| 4 | - async: | ||
| 5 | - dependency: transitive | ||
| 6 | - description: | ||
| 7 | - name: async | ||
| 8 | - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" | ||
| 9 | - url: "https://pub.flutter-io.cn" | ||
| 10 | - source: hosted | ||
| 11 | - version: "2.11.0" | ||
| 12 | - boolean_selector: | ||
| 13 | - dependency: transitive | ||
| 14 | - description: | ||
| 15 | - name: boolean_selector | ||
| 16 | - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" | ||
| 17 | - url: "https://pub.flutter-io.cn" | ||
| 18 | - source: hosted | ||
| 19 | - version: "2.1.1" | ||
| 20 | - characters: | ||
| 21 | - dependency: transitive | ||
| 22 | - description: | ||
| 23 | - name: characters | ||
| 24 | - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" | ||
| 25 | - url: "https://pub.flutter-io.cn" | ||
| 26 | - source: hosted | ||
| 27 | - version: "1.3.0" | ||
| 28 | - clock: | ||
| 29 | - dependency: transitive | ||
| 30 | - description: | ||
| 31 | - name: clock | ||
| 32 | - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf | ||
| 33 | - url: "https://pub.flutter-io.cn" | ||
| 34 | - source: hosted | ||
| 35 | - version: "1.1.1" | ||
| 36 | - collection: | ||
| 37 | - dependency: transitive | ||
| 38 | - description: | ||
| 39 | - name: collection | ||
| 40 | - sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf | ||
| 41 | - url: "https://pub.flutter-io.cn" | ||
| 42 | - source: hosted | ||
| 43 | - version: "1.19.0" | ||
| 44 | - fake_async: | ||
| 45 | - dependency: transitive | ||
| 46 | - description: | ||
| 47 | - name: fake_async | ||
| 48 | - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" | ||
| 49 | - url: "https://pub.flutter-io.cn" | ||
| 50 | - source: hosted | ||
| 51 | - version: "1.3.1" | ||
| 52 | - flutter: | ||
| 53 | - dependency: "direct main" | ||
| 54 | - description: flutter | ||
| 55 | - source: sdk | ||
| 56 | - version: "0.0.0" | ||
| 57 | - flutter_lints: | ||
| 58 | - dependency: "direct dev" | ||
| 59 | - description: | ||
| 60 | - name: flutter_lints | ||
| 61 | - sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4" | ||
| 62 | - url: "https://pub.flutter-io.cn" | ||
| 63 | - source: hosted | ||
| 64 | - version: "2.0.2" | ||
| 65 | - flutter_test: | ||
| 66 | - dependency: "direct dev" | ||
| 67 | - description: flutter | ||
| 68 | - source: sdk | ||
| 69 | - version: "0.0.0" | ||
| 70 | - leak_tracker: | ||
| 71 | - dependency: transitive | ||
| 72 | - description: | ||
| 73 | - name: leak_tracker | ||
| 74 | - sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" | ||
| 75 | - url: "https://pub.flutter-io.cn" | ||
| 76 | - source: hosted | ||
| 77 | - version: "10.0.7" | ||
| 78 | - leak_tracker_flutter_testing: | ||
| 79 | - dependency: transitive | ||
| 80 | - description: | ||
| 81 | - name: leak_tracker_flutter_testing | ||
| 82 | - sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" | ||
| 83 | - url: "https://pub.flutter-io.cn" | ||
| 84 | - source: hosted | ||
| 85 | - version: "3.0.8" | ||
| 86 | - leak_tracker_testing: | ||
| 87 | - dependency: transitive | ||
| 88 | - description: | ||
| 89 | - name: leak_tracker_testing | ||
| 90 | - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" | ||
| 91 | - url: "https://pub.flutter-io.cn" | ||
| 92 | - source: hosted | ||
| 93 | - version: "3.0.1" | ||
| 94 | - lints: | ||
| 95 | - dependency: transitive | ||
| 96 | - description: | ||
| 97 | - name: lints | ||
| 98 | - sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" | ||
| 99 | - url: "https://pub.flutter-io.cn" | ||
| 100 | - source: hosted | ||
| 101 | - version: "2.0.1" | ||
| 102 | - matcher: | ||
| 103 | - dependency: transitive | ||
| 104 | - description: | ||
| 105 | - name: matcher | ||
| 106 | - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb | ||
| 107 | - url: "https://pub.flutter-io.cn" | ||
| 108 | - source: hosted | ||
| 109 | - version: "0.12.16+1" | ||
| 110 | - material_color_utilities: | ||
| 111 | - dependency: transitive | ||
| 112 | - description: | ||
| 113 | - name: material_color_utilities | ||
| 114 | - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec | ||
| 115 | - url: "https://pub.flutter-io.cn" | ||
| 116 | - source: hosted | ||
| 117 | - version: "0.11.1" | ||
| 118 | - meta: | ||
| 119 | - dependency: transitive | ||
| 120 | - description: | ||
| 121 | - name: meta | ||
| 122 | - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 | ||
| 123 | - url: "https://pub.flutter-io.cn" | ||
| 124 | - source: hosted | ||
| 125 | - version: "1.15.0" | ||
| 126 | - path: | ||
| 127 | - dependency: transitive | ||
| 128 | - description: | ||
| 129 | - name: path | ||
| 130 | - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" | ||
| 131 | - url: "https://pub.flutter-io.cn" | ||
| 132 | - source: hosted | ||
| 133 | - version: "1.9.0" | ||
| 134 | - plugin_platform_interface: | ||
| 135 | - dependency: "direct main" | ||
| 136 | - description: | ||
| 137 | - name: plugin_platform_interface | ||
| 138 | - sha256: "43798d895c929056255600343db8f049921cbec94d31ec87f1dc5c16c01935dd" | ||
| 139 | - url: "https://pub.flutter-io.cn" | ||
| 140 | - source: hosted | ||
| 141 | - version: "2.1.5" | ||
| 142 | - sky_engine: | ||
| 143 | - dependency: transitive | ||
| 144 | - description: flutter | ||
| 145 | - source: sdk | ||
| 146 | - version: "0.0.0" | ||
| 147 | - source_span: | ||
| 148 | - dependency: transitive | ||
| 149 | - description: | ||
| 150 | - name: source_span | ||
| 151 | - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" | ||
| 152 | - url: "https://pub.flutter-io.cn" | ||
| 153 | - source: hosted | ||
| 154 | - version: "1.10.0" | ||
| 155 | - stack_trace: | ||
| 156 | - dependency: transitive | ||
| 157 | - description: | ||
| 158 | - name: stack_trace | ||
| 159 | - sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" | ||
| 160 | - url: "https://pub.flutter-io.cn" | ||
| 161 | - source: hosted | ||
| 162 | - version: "1.12.0" | ||
| 163 | - stream_channel: | ||
| 164 | - dependency: transitive | ||
| 165 | - description: | ||
| 166 | - name: stream_channel | ||
| 167 | - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 | ||
| 168 | - url: "https://pub.flutter-io.cn" | ||
| 169 | - source: hosted | ||
| 170 | - version: "2.1.2" | ||
| 171 | - string_scanner: | ||
| 172 | - dependency: transitive | ||
| 173 | - description: | ||
| 174 | - name: string_scanner | ||
| 175 | - sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" | ||
| 176 | - url: "https://pub.flutter-io.cn" | ||
| 177 | - source: hosted | ||
| 178 | - version: "1.3.0" | ||
| 179 | - term_glyph: | ||
| 180 | - dependency: transitive | ||
| 181 | - description: | ||
| 182 | - name: term_glyph | ||
| 183 | - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 | ||
| 184 | - url: "https://pub.flutter-io.cn" | ||
| 185 | - source: hosted | ||
| 186 | - version: "1.2.1" | ||
| 187 | - test_api: | ||
| 188 | - dependency: transitive | ||
| 189 | - description: | ||
| 190 | - name: test_api | ||
| 191 | - sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" | ||
| 192 | - url: "https://pub.flutter-io.cn" | ||
| 193 | - source: hosted | ||
| 194 | - version: "0.7.3" | ||
| 195 | - vector_math: | ||
| 196 | - dependency: transitive | ||
| 197 | - description: | ||
| 198 | - name: vector_math | ||
| 199 | - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" | ||
| 200 | - url: "https://pub.flutter-io.cn" | ||
| 201 | - source: hosted | ||
| 202 | - version: "2.1.4" | ||
| 203 | - vm_service: | ||
| 204 | - dependency: transitive | ||
| 205 | - description: | ||
| 206 | - name: vm_service | ||
| 207 | - sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b | ||
| 208 | - url: "https://pub.flutter-io.cn" | ||
| 209 | - source: hosted | ||
| 210 | - version: "14.3.0" | ||
| 211 | -sdks: | ||
| 212 | - dart: ">=3.4.0 <4.0.0" | ||
| 213 | - flutter: ">=3.18.0-18.0.pre.54" |
library/flutter_wxwork/pubspec.yaml
deleted
100644 → 0
| 1 | -name: flutter_wxwork | ||
| 2 | -description: A new Flutter plugin project. | ||
| 3 | -version: 0.0.1 | ||
| 4 | -homepage: | ||
| 5 | - | ||
| 6 | -environment: | ||
| 7 | - sdk: '>=2.12.0 <3.0.0' | ||
| 8 | - # flutter: ">=2.5.0" | ||
| 9 | - | ||
| 10 | -dependencies: | ||
| 11 | - flutter: | ||
| 12 | - sdk: flutter | ||
| 13 | - plugin_platform_interface: ^2.0.2 | ||
| 14 | - | ||
| 15 | -dev_dependencies: | ||
| 16 | - flutter_test: | ||
| 17 | - sdk: flutter | ||
| 18 | - flutter_lints: ^2.0.0 | ||
| 19 | - | ||
| 20 | -# For information on the generic Dart part of this file, see the | ||
| 21 | -# following page: https://dart.dev/tools/pub/pubspec | ||
| 22 | - | ||
| 23 | -# The following section is specific to Flutter packages. | ||
| 24 | -flutter: | ||
| 25 | - # This section identifies this Flutter project as a plugin project. | ||
| 26 | - # The 'pluginClass' specifies the class (in Java, Kotlin, Swift, Objective-C, etc.) | ||
| 27 | - # which should be registered in the plugin registry. This is required for | ||
| 28 | - # using method channels. | ||
| 29 | - # The Android 'package' specifies package in which the registered class is. | ||
| 30 | - # This is required for using method channels on Android. | ||
| 31 | - # The 'ffiPlugin' specifies that native code should be built and bundled. | ||
| 32 | - # This is required for using `dart:ffi`. | ||
| 33 | - # All these are used by the tooling to maintain consistency when | ||
| 34 | - # adding or updating assets for this project. | ||
| 35 | - plugin: | ||
| 36 | - platforms: | ||
| 37 | - android: | ||
| 38 | - package: com.wxwork.flutter_wxwork | ||
| 39 | - pluginClass: FlutterWxworkPlugin | ||
| 40 | - ios: | ||
| 41 | - pluginClass: FlutterWxworkPlugin | ||
| 42 | - | ||
| 43 | - # To add assets to your plugin package, add an assets section, like this: | ||
| 44 | - # assets: | ||
| 45 | - # - images/a_dot_burr.jpeg | ||
| 46 | - # - images/a_dot_ham.jpeg | ||
| 47 | - # | ||
| 48 | - # For details regarding assets in packages, see | ||
| 49 | - # https://flutter.dev/assets-and-images/#from-packages | ||
| 50 | - # | ||
| 51 | - # An image asset can refer to one or more resolution-specific "variants", see | ||
| 52 | - # https://flutter.dev/assets-and-images/#resolution-aware | ||
| 53 | - | ||
| 54 | - # To add custom fonts to your plugin package, add a fonts section here, | ||
| 55 | - # in this "flutter" section. Each entry in this list should have a | ||
| 56 | - # "family" key with the font family name, and a "fonts" key with a | ||
| 57 | - # list giving the asset and other descriptors for the font. For | ||
| 58 | - # example: | ||
| 59 | - # fonts: | ||
| 60 | - # - family: Schyler | ||
| 61 | - # fonts: | ||
| 62 | - # - asset: fonts/Schyler-Regular.ttf | ||
| 63 | - # - asset: fonts/Schyler-Italic.ttf | ||
| 64 | - # style: italic | ||
| 65 | - # - family: Trajan Pro | ||
| 66 | - # fonts: | ||
| 67 | - # - asset: fonts/TrajanPro.ttf | ||
| 68 | - # - asset: fonts/TrajanPro_Bold.ttf | ||
| 69 | - # weight: 700 | ||
| 70 | - # | ||
| 71 | - # For details regarding fonts in packages, see | ||
| 72 | - # https://flutter.dev/custom-fonts/#from-packages |
| 1 | -import 'package:flutter/services.dart'; | ||
| 2 | -import 'package:flutter_test/flutter_test.dart'; | ||
| 3 | -import 'package:flutter_wxwork/flutter_wxwork_method_channel.dart'; | ||
| 4 | - | ||
| 5 | -void main() { | ||
| 6 | - MethodChannelFlutterWxwork platform = MethodChannelFlutterWxwork(); | ||
| 7 | - const MethodChannel channel = MethodChannel('flutter_wxwork'); | ||
| 8 | - | ||
| 9 | - TestWidgetsFlutterBinding.ensureInitialized(); | ||
| 10 | - | ||
| 11 | - setUp(() { | ||
| 12 | - channel.setMockMethodCallHandler((MethodCall methodCall) async { | ||
| 13 | - return '42'; | ||
| 14 | - }); | ||
| 15 | - }); | ||
| 16 | - | ||
| 17 | - tearDown(() { | ||
| 18 | - channel.setMockMethodCallHandler(null); | ||
| 19 | - }); | ||
| 20 | - | ||
| 21 | - test('getPlatformVersion', () async { | ||
| 22 | - expect(await platform.getPlatformVersion(), '42'); | ||
| 23 | - }); | ||
| 24 | -} |
| 1 | -// import 'package:flutter_test/flutter_test.dart'; | ||
| 2 | -// import 'package:flutter_wxwork/flutter_wxwork.dart'; | ||
| 3 | -// import 'package:flutter_wxwork/flutter_wxwork_platform_interface.dart'; | ||
| 4 | -// import 'package:flutter_wxwork/flutter_wxwork_method_channel.dart'; | ||
| 5 | -// import 'package:plugin_platform_interface/plugin_platform_interface.dart'; | ||
| 6 | - | ||
| 7 | -// class MockFlutterWxworkPlatform | ||
| 8 | -// with MockPlatformInterfaceMixin | ||
| 9 | -// implements FlutterWxworkPlatform { | ||
| 10 | - | ||
| 11 | -// @override | ||
| 12 | -// Future<String?> getPlatformVersion() => Future.value('42'); | ||
| 13 | -// } | ||
| 14 | - | ||
| 15 | -// void main() { | ||
| 16 | -// final FlutterWxworkPlatform initialPlatform = FlutterWxworkPlatform.instance; | ||
| 17 | - | ||
| 18 | -// test('$MethodChannelFlutterWxwork is the default instance', () { | ||
| 19 | -// expect(initialPlatform, isInstanceOf<MethodChannelFlutterWxwork>()); | ||
| 20 | -// }); | ||
| 21 | - | ||
| 22 | -// test('getPlatformVersion', () async { | ||
| 23 | -// FlutterWxwork flutterWxworkPlugin = FlutterWxwork(); | ||
| 24 | -// MockFlutterWxworkPlatform fakePlatform = MockFlutterWxworkPlatform(); | ||
| 25 | -// FlutterWxworkPlatform.instance = fakePlatform; | ||
| 26 | - | ||
| 27 | -// expect(await flutterWxworkPlugin.getPlatformVersion(), '42'); | ||
| 28 | -// }); | ||
| 29 | -// } |
| 1 | // This is a generated file; do not edit or check into version control. | 1 | // This is a generated file; do not edit or check into version control. |
| 2 | -FLUTTER_ROOT=/Users/naji2021/Documents/flutter | 2 | +FLUTTER_ROOT=/Users/naji2021/fvm/versions/3.27.3 |
| 3 | FLUTTER_APPLICATION_PATH=/Users/naji2021/Desktop/Flutter-ReserveApp/library/table_calendar-3.1.3/example | 3 | FLUTTER_APPLICATION_PATH=/Users/naji2021/Desktop/Flutter-ReserveApp/library/table_calendar-3.1.3/example |
| 4 | COCOAPODS_PARALLEL_CODE_SIGN=true | 4 | COCOAPODS_PARALLEL_CODE_SIGN=true |
| 5 | FLUTTER_TARGET=lib/main.dart | 5 | FLUTTER_TARGET=lib/main.dart |
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | # This is a generated file; do not edit or check into version control. | 2 | # This is a generated file; do not edit or check into version control. |
| 3 | -export "FLUTTER_ROOT=/Users/naji2021/Documents/flutter" | 3 | +export "FLUTTER_ROOT=/Users/naji2021/fvm/versions/3.27.3" |
| 4 | export "FLUTTER_APPLICATION_PATH=/Users/naji2021/Desktop/Flutter-ReserveApp/library/table_calendar-3.1.3/example" | 4 | export "FLUTTER_APPLICATION_PATH=/Users/naji2021/Desktop/Flutter-ReserveApp/library/table_calendar-3.1.3/example" |
| 5 | export "COCOAPODS_PARALLEL_CODE_SIGN=true" | 5 | export "COCOAPODS_PARALLEL_CODE_SIGN=true" |
| 6 | export "FLUTTER_TARGET=lib/main.dart" | 6 | export "FLUTTER_TARGET=lib/main.dart" |
| 1 | // This is a generated file; do not edit or check into version control. | 1 | // This is a generated file; do not edit or check into version control. |
| 2 | -FLUTTER_ROOT=/Users/naji2021/Documents/flutter | 2 | +FLUTTER_ROOT=/Users/naji2021/fvm/versions/3.27.3 |
| 3 | FLUTTER_APPLICATION_PATH=/Users/naji2021/Desktop/Flutter-ReserveApp/library/webview_flutter-2.0.13-copy_inappwebview_select_file_20210930/example | 3 | FLUTTER_APPLICATION_PATH=/Users/naji2021/Desktop/Flutter-ReserveApp/library/webview_flutter-2.0.13-copy_inappwebview_select_file_20210930/example |
| 4 | COCOAPODS_PARALLEL_CODE_SIGN=true | 4 | COCOAPODS_PARALLEL_CODE_SIGN=true |
| 5 | FLUTTER_TARGET=lib/main.dart | 5 | FLUTTER_TARGET=lib/main.dart |
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | # This is a generated file; do not edit or check into version control. | 2 | # This is a generated file; do not edit or check into version control. |
| 3 | -export "FLUTTER_ROOT=/Users/naji2021/Documents/flutter" | 3 | +export "FLUTTER_ROOT=/Users/naji2021/fvm/versions/3.27.3" |
| 4 | export "FLUTTER_APPLICATION_PATH=/Users/naji2021/Desktop/Flutter-ReserveApp/library/webview_flutter-2.0.13-copy_inappwebview_select_file_20210930/example" | 4 | export "FLUTTER_APPLICATION_PATH=/Users/naji2021/Desktop/Flutter-ReserveApp/library/webview_flutter-2.0.13-copy_inappwebview_select_file_20210930/example" |
| 5 | export "COCOAPODS_PARALLEL_CODE_SIGN=true" | 5 | export "COCOAPODS_PARALLEL_CODE_SIGN=true" |
| 6 | export "FLUTTER_TARGET=lib/main.dart" | 6 | export "FLUTTER_TARGET=lib/main.dart" |
| @@ -927,13 +927,6 @@ packages: | @@ -927,13 +927,6 @@ packages: | ||
| 927 | description: flutter | 927 | description: flutter |
| 928 | source: sdk | 928 | source: sdk |
| 929 | version: "0.0.0" | 929 | version: "0.0.0" |
| 930 | - flutter_wxwork: | ||
| 931 | - dependency: "direct main" | ||
| 932 | - description: | ||
| 933 | - path: "library/flutter_wxwork" | ||
| 934 | - relative: true | ||
| 935 | - source: path | ||
| 936 | - version: "0.0.1" | ||
| 937 | fluttertoast: | 930 | fluttertoast: |
| 938 | dependency: "direct main" | 931 | dependency: "direct main" |
| 939 | description: | 932 | description: |
| @@ -226,8 +226,8 @@ dependencies: | @@ -226,8 +226,8 @@ dependencies: | ||
| 226 | path: library/sendsms-1.0.3 | 226 | path: library/sendsms-1.0.3 |
| 227 | device_utils_my: | 227 | device_utils_my: |
| 228 | path: library/device_utils_my | 228 | path: library/device_utils_my |
| 229 | - flutter_wxwork: | ||
| 230 | - path: library/flutter_wxwork | 229 | + # flutter_wxwork: |
| 230 | + # path: library/flutter_wxwork | ||
| 231 | calendar_date_picker2: | 231 | calendar_date_picker2: |
| 232 | path: library/calendar_date_picker2-1.1.5 | 232 | path: library/calendar_date_picker2-1.1.5 |
| 233 | table_calendar: | 233 | table_calendar: |
-
Please register or login to post a comment