2.0.0 • Published 1 year ago

cordova-plugin-flyff-imagepicker v2.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

cordova 图片多选插件, 也兼容 capacitor; 基于cordova-plugin-telerik-imagepicker插件修改; 使用请参考原文;

如果使用ionic,安装方式:

npm i @ionic-native/image-picker
ionic cordova plugin add cordova-plugin-flyff-imagepicker

版本限制

1.x:

<!-- cordova-android ">=5 <9" -->
<engine name="cordova-android" version="5.0.0 - 8" />

2.x:

<!-- cordova-android ">=9 <12" -->
<engine name="cordova-android" version="9.0.0 - 11" />

注意事项

cordova需要在config.xml添加权限配置

<!-- android -->
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
    <application android:requestLegacyExternalStorage="true" />
</edit-config>
<!-- ios -->
<config-file parent="NSCameraUsageDescription" target="*-Info.plist">
    <string>需要您的同意才能在使用签收功能时选择照片上传,如果不同意会导致无法使用照片证明收到货。</string>
</config-file>
<config-file parent="NSPhotoLibraryUsageDescription" target="*-Info.plist">
    <string>需要您的同意才能在使用签收功能时选择照片上传,如果不同意会导致无法使用照片证明收到货。</string>
</config-file>

capacitor需要在原生项目手动配置;

1.x调整

iOS

缩略图主线程渲染

使用GCD库调用主线程进行渲染; 涉及方法:

// GMGridViewController.m
- (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath;

图片选择未授权的情况

调整为,等授权完再重新执行一次方法; 涉及方法:

// SOSPicker.m
- (void) requestReadPermission:(CDVInvokedUrlCommand *)command;

本地化增加中文

添加了zh-Hans.lproj文件夹

Android

本地化增加中文

添加了values-zh文件文件夹

2.x调整

Android

支持AndroidX

MultiImageChooserActivity.java改动:

# android.support.v7 => androidx.appcompat
- import android.support.v7.app.ActionBar;
- import android.support.v7.app.AppCompatActivity;
+ import androidx.appcompat.app.ActionBar;
+ import androidx.appcompat.app.AppCompatActivity;
# ImageView不支持了
- private class SquareImageView extends ImageView
+ private class SquareImageView extends androidx.appcompat.widget.AppCompatImageView

ImagePicker.java改动:

# android.support.v4 => androidx.core
- import android.support.v4.app.ActivityCompat
- import android.support.v4.content.ContextCompat;
+ import androidx.core.app.ActivityCompat;
+ import androidx.core.content.ContextCompat;

相册权限

请求权限的方式改成使用cordova提供的接口

修改plugin.xml

注释代码:

<!-- 添加安卓时出现错误:`Cannot read property 'find' of null`; -->
<resource-file src="src/android/Library/res/values/themes.xml" target="res/values/themes.xml"/>
<!-- 合并出错 -->
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
    <application android:requestLegacyExternalStorage="true" />
</edit-config>
2.0.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago