fix ios bug

This commit is contained in:
yaw
2018-10-26 17:25:15 +08:00
parent 6e41b646f0
commit e0a8543e10
9 changed files with 63 additions and 20 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-mediapicker-dmcsdk",
"version": "2.3.7",
"version": "2.3.8",
"description": "android ios mediaPicker support selection of multiple image and video",
"cordova": {
"id": "cordova-plugin-mediapicker-dmcsdk",
+4 -2
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-mediapicker-dmcsdk" version="2.3.8">
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-mediapicker-dmcsdk" version="2.3.9">
<name>MediaPicker</name>
<js-module name="MediaPicker" src="www/MediaPicker.js">
<clobbers target="window.MediaPicker"/>
@@ -50,7 +50,9 @@
<resource-file src="src/ios/DMCMediaPicker/dmcPicker.bundle"/>
<resource-file src="src/ios/DMCMediaPicker/en.lproj"/>
<resource-file src="src/ios/DMCMediaPicker/zh-Hans.lproj"/>
<resource-file src="src/ios/DMCMediaPicker/es.lproj"/>
<resource-file src="src/ios/DMCMediaPicker/pt-BR.lproj"/>
<resource-file src="src/ios/DMCMediaPicker/pt-PT.lproj"/>
<config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
<string>$IOS_PHOTO_LIBRARY_USAGE_DESCRIPTION</string>
</config-file>
Binary file not shown.
+7 -8
View File
@@ -28,21 +28,20 @@
self.labelR = [[UILabel alloc]initWithFrame:CGRectMake(width/2, width-labelH, width/2, labelH)];
self.labelR.textColor=[UIColor whiteColor];
self.labelR.font=[UIFont systemFontOfSize:13.0];
self.labelR.textAlignment=NSTextAlignmentRight;
//self.labelR.textAlignment=NSTextAlignmentRight;
self.labelR.backgroundColor= [[UIColor blackColor] colorWithAlphaComponent:0.3f];
self.labeGIF = [[UILabel alloc] initWithFrame:CGRectMake(width-width/5-5, width-labelH-2, width/5, labelH-5)];
self.labeGIF.backgroundColor = [UIColor clearColor];
self.labeGIF.textColor=[UIColor whiteColor];
self.labeGIF.text=@"\tGIF\t";
self.labeGIF.layer.cornerRadius =4;
self.labeGIF.layer.masksToBounds =YES;
self.labeGIF.textAlignment= NSTextAlignmentCenter;
self.labeGIF.baselineAdjustment= UIBaselineAdjustmentAlignCenters;
NSAttributedString *attrText = [[NSAttributedString alloc] initWithString:@" GIF " attributes:@{ NSParagraphStyleAttributeName : [[NSParagraphStyle defaultParagraphStyle] mutableCopy]}];
self.labeGIF.attributedText = attrText;
self.labeGIF.layer.cornerRadius = 4;
self.labeGIF.layer.masksToBounds = YES;
self.labeGIF.font=[UIFont systemFontOfSize:13.0];
self.labeGIF.adjustsFontSizeToFitWidth = YES;
//self.labeGIF.textAlignment=NSTextAlignmentRight;
self.labeGIF.backgroundColor= [[UIColor blackColor] colorWithAlphaComponent:0.4f];
@@ -326,12 +326,12 @@
CollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identify forIndexPath:indexPath];
[cell sizeToFit];
PHAsset *asset=fetchResult[indexPath.item];
[_manager requestImageForAsset:asset
targetSize:CGSizeMake(200 , 200)
contentMode:PHImageContentModeAspectFill
options:nil
[_manager requestImageForAsset:asset targetSize:CGSizeMake(200 , 200) contentMode:PHImageContentModeAspectFill options:nil
resultHandler:^(UIImage * _Nullable result, NSDictionary * _Nullable info) {
cell.imgView.image = result;
BOOL downloadFinined = (![[info objectForKey:PHImageCancelledKey] boolValue] && ![info objectForKey:PHImageErrorKey] && ![[info objectForKey:PHImageResultIsDegradedKey] boolValue]);
if (downloadFinined && result) {
cell.imgView.image = result;
}
}];
NSInteger i=[self isSelect:asset];
if(asset.mediaType==PHAssetMediaTypeVideo){
@@ -340,8 +340,14 @@
cell.labeGIF.hidden=YES;
NSString *dtime=[NSString stringWithFormat:@"%.0f",asset.duration];
cell.labelL.text=[@"\t"stringByAppendingString:NSLocalizedString(@"Video",nil)];
cell.labelR.text=[[self getNewTimeFromDurationSecond:dtime.integerValue]stringByAppendingString:@"\t"];
cell.labelL.text = [@" "stringByAppendingString:NSLocalizedString(@"Video",nil)];
//Uilable默认会去除尾部空格所以处理一下
NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
style.tailIndent = -3.0f;
style.alignment=NSTextAlignmentRight;
NSString *dtimeStr=[self getNewTimeFromDurationSecond:dtime.integerValue];
NSAttributedString *attrTextR = [[NSAttributedString alloc] initWithString:dtimeStr attributes:@{ NSParagraphStyleAttributeName : style}];
cell.labelR.attributedText=attrTextR;
}else{
NSString *fileName =[asset valueForKey:@"filename"];
NSString * fileExtension = [fileName pathExtension];
@@ -148,12 +148,18 @@
if([@"GIF" caseInsensitiveCompare:fileExtension]){
cell.gifView.hidden=YES;
[[PHImageManager defaultManager] requestImageForAsset:asset targetSize:CGSizeMake(SCREEN_WIDTH*3 , SCREENH_HEIGHT*3) contentMode:PHImageContentModeAspectFill options:option resultHandler:^(UIImage * _Nullable result, NSDictionary * _Nullable info) {
[cell setImg:result];
BOOL downloadFinined = (![[info objectForKey:PHImageCancelledKey] boolValue] && ![info objectForKey:PHImageErrorKey] && ![[info objectForKey:PHImageResultIsDegradedKey] boolValue]);
if (downloadFinined && result) {
[cell setImg:result];
}
}];
}else{
cell.imgView.hidden=YES;
[[PHImageManager defaultManager] requestImageDataForAsset:asset options:nil resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
[cell setGifImg:imageData];
BOOL downloadFinined = (![[info objectForKey:PHImageCancelledKey] boolValue] && ![info objectForKey:PHImageErrorKey] && ![[info objectForKey:PHImageResultIsDegradedKey] boolValue]);
if (downloadFinined && imageData) {
[cell setGifImg:imageData];
}
}];
}
@@ -0,0 +1,10 @@
"Cancel"="Cancelar";
"Done"="hecho";
"All"="Todas las fotos";
"Video"="Video";
"maxSelectAlert"="Has alcanzado el número maximo de selecciones";
"ok"="OK";
"Unable to access album" = "Denegado el acceso al album";
"Please allow to access your album" = "Por favor permita el acceso a sus albums en \"Configuraciones -> Privacidad -> Album\"";
"Setting" = "Configuraciones";
"Preview" = "Vista previa";
@@ -0,0 +1,10 @@
"Cancel"="Cancelar";
"Done"="Pronto";
"All"="Todas as fotos";
"Video"="Vídeo";
"maxSelectAlert”=“Atingiu o limite máximo de escolhas";
"ok"="OK";
"Unable to access album" = "Impossibilitado de acessar o álbum";
"Please allow to access your album" = "Por favor permita acessar o seu álbum em \“Configurações -> Privacidade -> Álbum\"";
"Setting" = "Configuração";
"Preview" = "Prévia";
@@ -0,0 +1,10 @@
"Cancel"="Cancelar";
"Done"="Pronto";
"All"="Todas as fotos";
"Video"="Vídeo";
"maxSelectAlert”=“Atingiu o limite máximo de escolhas";
"ok"="OK";
"Unable to access album" = "Impossibilitado de acessar o álbum";
"Please allow to access your album" = "Por favor permita acessar o seu álbum em \“Configurações -> Privacidade -> Álbum\"";
"Setting" = "Configuração";
"Preview" = "Prévia";