Merge master

This commit is contained in:
Shalom Yerushalmy 2018-12-17 10:40:13 +02:00
commit 4554460e44
10 changed files with 173 additions and 58 deletions

View File

@ -57,7 +57,7 @@ And in the package list in the same file (e.g. `getPackages`) add:
## Running the example project
- ```cd example```
- ```cd old-example```
- ```yarn``` or ```npm install``` (the ```yarn```/```npm``` should be in the example folder)
- ```react-native run-ios``` or ```react-native run-android```

View File

@ -1,7 +1,8 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion 19

View File

@ -26,12 +26,12 @@ def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 26
buildToolsVersion '26.0.3'
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.camerakit"
minSdkVersion 19
targetSdkVersion 26
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
ndk {
@ -68,10 +68,21 @@ android {
}
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion "26.0.1"
}
}
}
}
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile project(":rncamerakit")
compile "com.android.support:appcompat-v7:25.0.1"
compile "com.android.support:appcompat-v7:26.0.1"
compile 'com.android.support:multidex:1.0.3'
compile "com.facebook.react:react-native:+" // From node_modules
}

View File

@ -24,3 +24,18 @@ allprojects {
google()
}
}
subprojects {
task allDeps(type: DependencyReportTask) {}
afterEvaluate {
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
minSdkVersion 21
targetSdkVersion 25
}
}
}
}

View File

@ -83,6 +83,48 @@
remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
remoteInfo = React;
};
268B384C2187149E0054268D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 139D7ECE1E25DB7D00323FB7;
remoteInfo = "third-party";
};
268B384E2187149E0054268D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D383D3C1EBD27B6005632C8;
remoteInfo = "third-party-tvOS";
};
268B38502187149E0054268D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 139D7E881E25C6D100323FB7;
remoteInfo = "double-conversion";
};
268B38522187149E0054268D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D383D621EBD27B9005632C8;
remoteInfo = "double-conversion-tvOS";
};
268B38542187149E0054268D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 9936F3131F5F2E4B0010BF04;
remoteInfo = privatedata;
};
268B38562187149E0054268D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 9936F32F1F5F2E5B0010BF04;
remoteInfo = "privatedata-tvOS";
};
26E00E88205AA5BB0012807E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */;
@ -368,13 +410,19 @@
isa = PBXGroup;
children = (
146834041AC3E56700842450 /* libReact.a */,
3DAD3EA31DF850E9000B6D8A /* libReact-tvOS.a */,
3DAD3EA51DF850E9000B6D8A /* libyoga.a */,
3DAD3EA71DF850E9000B6D8A /* libyoga.a */,
3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */,
3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */,
3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */,
3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */,
3DAD3EA31DF850E9000B6D8A /* libReact-tvOS.a */,
268B384D2187149E0054268D /* libthird-party.a */,
268B384F2187149E0054268D /* libthird-party.a */,
268B38512187149E0054268D /* libdouble-conversion.a */,
268B38532187149E0054268D /* libdouble-conversion.a */,
268B38552187149E0054268D /* libprivatedata.a */,
268B38572187149E0054268D /* libprivatedata-tvOS.a */,
);
name = Products;
sourceTree = "<group>";
@ -500,6 +548,11 @@
attributes = {
LastUpgradeCheck = 0610;
ORGANIZATIONNAME = Facebook;
TargetAttributes = {
13B07F861A680F5B00A75B9A = {
DevelopmentTeam = S3GLW74Y8N;
};
};
};
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "CameraKit" */;
compatibilityVersion = "Xcode 3.2";
@ -630,6 +683,48 @@
remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
268B384D2187149E0054268D /* libthird-party.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libthird-party.a";
remoteRef = 268B384C2187149E0054268D /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
268B384F2187149E0054268D /* libthird-party.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libthird-party.a";
remoteRef = 268B384E2187149E0054268D /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
268B38512187149E0054268D /* libdouble-conversion.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libdouble-conversion.a";
remoteRef = 268B38502187149E0054268D /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
268B38532187149E0054268D /* libdouble-conversion.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libdouble-conversion.a";
remoteRef = 268B38522187149E0054268D /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
268B38552187149E0054268D /* libprivatedata.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libprivatedata.a;
remoteRef = 268B38542187149E0054268D /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
268B38572187149E0054268D /* libprivatedata-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libprivatedata-tvOS.a";
remoteRef = 268B38562187149E0054268D /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
26E00E89205AA5BB0012807E /* libRCTBlob-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@ -703,7 +798,7 @@
3DAD3EA31DF850E9000B6D8A /* libReact-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libReact-tvOS.a";
path = libReact.a;
remoteRef = 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
@ -846,6 +941,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = S3GLW74Y8N;
INFOPLIST_FILE = CameraKit/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = (
@ -863,6 +959,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = S3GLW74Y8N;
INFOPLIST_FILE = CameraKit/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = (

View File

@ -3,9 +3,9 @@ import {
StyleSheet,
Text,
View,
ListView,
TouchableOpacity,
Image
Image,
FlatList
} from 'react-native';
import {CameraKitGallery} from '../../src';
@ -17,10 +17,9 @@ export default class AlbumsScreen extends Component {
constructor(props) {
super(props);
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
albums:{},
albumsDS: ds,
albumsDS: [],
albumName: undefined
}
}
@ -38,30 +37,28 @@ export default class AlbumsScreen extends Component {
return (
<View style={styles.container}>
<ListView
<FlatList
style={styles.listView}
dataSource={this.state.albumsDS}
renderRow={(rowData) =>
this._renderRow(rowData)
}
data={this.state.albumsDS}
renderItem={this._renderRow}
/>
</View>
);
}
_renderRow(rowData) {
const image = 'file://' + rowData.thumbUri;
//console.error(rowData)
const item = rowData.item;
const image = 'file://' + item.thumbUri;
return (
<View style={{flex:1, backgroundColor: '#95a5a6', flexDirection: 'row', padding: 8 }}>
<View key={item.thumbUri} style={{flex:1, backgroundColor: '#95a5a6', flexDirection: 'row', padding: 8 }}>
<Image
style={{width: 60, height: 60, backgroundColor: 'white'}}
source={{uri: image, scale: 3}}
/>
<TouchableOpacity style={{alignSelf: 'center', padding: 4}} onPress={() => this.setState({albumName: rowData.albumName})}>
<Text style={{fontSize: 18}}>{rowData.albumName}</Text>
<Text style={{fontSize: 18}}>{rowData.imagesCount}</Text>
<TouchableOpacity style={{alignSelf: 'center', padding: 4}} onPress={() => this.setState({albumName: item.albumName})}>
<Text style={{fontSize: 18}}>{item.albumName}</Text>
<Text style={{fontSize: 18}}>{item.imagesCount}</Text>
</TouchableOpacity>
</View>
)
@ -70,7 +67,7 @@ export default class AlbumsScreen extends Component {
let albums = await CameraKitGallery.getAlbumsWithThumbnails();
albums = albums.albums;
this.setState({albumsDS:this.state.albumsDS.cloneWithRows(albums), albums:{albums}, shouldShowListView: true});
this.setState({albumsDS: albums, albums:{albums}, shouldShowListView: true});
}
}

View File

@ -3,7 +3,6 @@ import {
StyleSheet,
Text,
View,
ListView,
TouchableOpacity,
Image,
Switch
@ -20,7 +19,6 @@ export default class AlbumsScreen extends Component {
constructor(props) {
super(props);
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
album: {albumName: 'All Photos'},
albums: [],
@ -167,7 +165,7 @@ export default class AlbumsScreen extends Component {
let albums = await CameraKitGallery.getAlbumsWithThumbnails();
albums = albums.albums;
this.setState({albumsDS: this.state.albumsDS.cloneWithRows(albums), albums: {albums}, shouldShowListView: true});
this.setState({albums: {albums}, shouldShowListView: true});
}
}

View File

@ -41,7 +41,7 @@ export default class GalleryScreen extends Component {
<View style={{position: 'absolute', width, height, backgroundColor: 'green'}}>
<View style={styles.container}>
<Image
resizeMode={Image.resizeMode.cover}
resizeMode={'cover'}
style={{width: 300, height: 300}}
source={{uri: this.state.presentedImage.imageUri}}
/>

View File

@ -526,27 +526,25 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{
capturedImage = [UIImage imageWithCGImage:imageRef scale:capturedImage.scale orientation:UIImageOrientationUp];
imageData = UIImageJPEGRepresentation(capturedImage, 0.85f);
[PHPhotoLibrary requestAuthorization:^( PHAuthorizationStatus status ) {
if ( status == PHAuthorizationStatusAuthorized ) {
NSMutableDictionary *imageInfoDict = [[NSMutableDictionary alloc] init];
NSURL *temporaryFileURL = [CKCamera saveToTmpFolder:imageData];
if (temporaryFileURL) {
imageInfoDict[@"uri"] = temporaryFileURL.description;
imageInfoDict[@"name"] = temporaryFileURL.lastPathComponent;
}
imageInfoDict[@"size"] = [NSNumber numberWithInteger:imageData.length];
if (capturedImage && [capturedImage isKindOfClass:[UIImage class]]) {
imageInfoDict[@"width"] = [NSNumber numberWithDouble:capturedImage.size.width];
imageInfoDict[@"height"] = [NSNumber numberWithDouble:capturedImage.size.height];
}
if (shouldSaveToCameraRoll) {
NSData *compressedImageData = UIImageJPEGRepresentation(capturedImage, 1.0f);
NSMutableDictionary *imageInfoDict = [[NSMutableDictionary alloc] init];
NSURL *temporaryFileURL = [CKCamera saveToTmpFolder:imageData];
if (temporaryFileURL) {
imageInfoDict[@"uri"] = temporaryFileURL.description;
imageInfoDict[@"name"] = temporaryFileURL.lastPathComponent;
}
imageInfoDict[@"size"] = [NSNumber numberWithInteger:imageData.length];
if (capturedImage && [capturedImage isKindOfClass:[UIImage class]]) {
imageInfoDict[@"width"] = [NSNumber numberWithDouble:capturedImage.size.width];
imageInfoDict[@"height"] = [NSNumber numberWithDouble:capturedImage.size.height];
}
if (shouldSaveToCameraRoll) {
[PHPhotoLibrary requestAuthorization:^( PHAuthorizationStatus status ) {
if ( status == PHAuthorizationStatusAuthorized ) {
NSData *compressedImageData = UIImageJPEGRepresentation(capturedImage, 1.0f);
[CKGalleryManager saveImageToCameraRoll:compressedImageData temporaryFileURL:temporaryFileURL block:^(BOOL success) {
if (success) {
NSString *localIdentifier = [CKGalleryManager getImageLocalIdentifierForFetchOptions:self.fetchOptions];
@ -562,15 +560,13 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{
//NSLog( @"Could not save to camera roll");
}
}];
} else if (block) {
block(imageInfoDict);
}
}
}];
}];
} else if (block) {
block(imageInfoDict);
}
CGImageRelease(imageRef);
}
else {
} else {
//NSLog( @"Could not capture still image: %@", error );
}
}];

View File

@ -7,7 +7,7 @@
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"version": "7.1.0",
"version": "6.3.0",
"description": "Advanced native camera control with pre-defined aspect ratio, crop, etc",
"author": "Ran Greenberg <rang@wix.com>",
"nativePackage": true,
@ -24,8 +24,8 @@
},
"license": "MIT",
"devDependencies": {
"react": "16.0.0",
"react-native": "0.51.0",
"react": "16.6.0-alpha.8af6728",
"react-native": "0.57.4",
"babel-jest": "22.4.1",
"babel-preset-react-native": "4.0.0",
"jest": "22.4.2",