Commit e698ab04 authored by 刘阳's avatar 刘阳

Initial commit

parents
*.pbxproj -text
\ No newline at end of file
# OSX
#
.DS_Store
# node.js
#
node_modules/
npm-debug.log
yarn-error.log
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
# BUCK
buck-out/
\.buckd/
*.keystore
\ No newline at end of file
# react-native-protogenesis
## Getting started
`$ npm install react-native-protogenesis --save`
### Mostly automatic installation
`$ react-native link react-native-protogenesis`
### Manual installation
#### iOS
1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
2. Go to `node_modules` ➜ `react-native-protogenesis` and add `RNProtogenesis.xcodeproj`
3. In XCode, in the project navigator, select your project. Add `libRNProtogenesis.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
4. Run your project (`Cmd+R`)<
#### Android
1. Open up `android/app/src/main/java/[...]/MainActivity.java`
- Add `import com.geek.protogenesis.RNProtogenesisPackage;` to the imports at the top of the file
- Add `new RNProtogenesisPackage()` to the list returned by the `getPackages()` method
2. Append the following lines to `android/settings.gradle`:
```
include ':react-native-protogenesis'
project(':react-native-protogenesis').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-protogenesis/android')
```
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
```
compile project(':react-native-protogenesis')
```
#### Windows
[Read it! :D](https://github.com/ReactWindows/react-native)
1. In Visual Studio add the `RNProtogenesis.sln` in `node_modules/react-native-protogenesis/windows/RNProtogenesis.sln` folder to their solution, reference from their app.
2. Open up your `MainPage.cs` app
- Add `using Protogenesis.RNProtogenesis;` to the usings at the top of the file
- Add `new RNProtogenesisPackage()` to the `List<IReactPackage>` returned by the `Packages` method
## Usage
```javascript
import RNProtogenesis from 'react-native-protogenesis';
// TODO: What to do with the module?
RNProtogenesis;
```
\ No newline at end of file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.facebook.react:react-native:+'
implementation 'com.tencent.qcloud:cosxml:5.6.0'
implementation "androidx.exifinterface:exifinterface:1.3.1"
}
\ No newline at end of file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.geek.protogenesis">
<application>
<provider
android:name=".imageHelper.ImagePickerProvider"
android:authorities="${applicationId}.imagepickerprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/imagepicker_provider_paths" />
</provider>
</application>
</manifest>
\ No newline at end of file
package com.geek.protogenesis;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.net.Uri;
import android.os.Build;
import android.provider.MediaStore;
import android.util.Log;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.facebook.react.bridge.ActivityEventListener;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.geek.protogenesis.fileHelper.fileUploadUtils;
import com.geek.protogenesis.imageHelper.Options;
import com.tencent.cos.xml.CosXmlService;
import com.tencent.cos.xml.CosXmlServiceConfig;
import com.tencent.cos.xml.exception.CosXmlClientException;
import com.tencent.cos.xml.exception.CosXmlServiceException;
import com.tencent.cos.xml.listener.CosXmlProgressListener;
import com.tencent.cos.xml.listener.CosXmlResultListener;
import com.tencent.cos.xml.model.CosXmlRequest;
import com.tencent.cos.xml.model.CosXmlResult;
import com.tencent.cos.xml.transfer.COSXMLUploadTask;
import com.tencent.cos.xml.transfer.TransferConfig;
import com.tencent.cos.xml.transfer.TransferManager;
import com.tencent.cos.xml.transfer.TransferState;
import com.tencent.cos.xml.transfer.TransferStateListener;
import com.tencent.qcloud.core.auth.BasicLifecycleCredentialProvider;
import com.tencent.qcloud.core.auth.QCloudCredentialProvider;
import com.tencent.qcloud.core.auth.QCloudLifecycleCredentials;
import com.tencent.qcloud.core.auth.SessionQCloudCredentials;
import com.tencent.qcloud.core.common.QCloudClientException;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Objects;
import static com.geek.protogenesis.fileHelper.fileUploadUtils.copyFile;
import static com.geek.protogenesis.fileHelper.fileUploadUtils.deleteSaveFile;
import static com.geek.protogenesis.fileHelper.fileUploadUtils.getFileName;
import static com.geek.protogenesis.imageHelper.Utils.cameraPermissionDescription;
import static com.geek.protogenesis.imageHelper.Utils.createFile;
import static com.geek.protogenesis.imageHelper.Utils.createUri;
import static com.geek.protogenesis.imageHelper.Utils.deleteFile;
import static com.geek.protogenesis.imageHelper.Utils.errCameraUnavailable;
import static com.geek.protogenesis.imageHelper.Utils.errOthers;
import static com.geek.protogenesis.imageHelper.Utils.errPermission;
import static com.geek.protogenesis.imageHelper.Utils.getAppSpecificStorageUri;
import static com.geek.protogenesis.imageHelper.Utils.getCancelMap;
import static com.geek.protogenesis.imageHelper.Utils.getErrorMap;
import static com.geek.protogenesis.imageHelper.Utils.getResponseMap;
import static com.geek.protogenesis.imageHelper.Utils.getVideoResponseMap;
import static com.geek.protogenesis.imageHelper.Utils.hasPermission;
import static com.geek.protogenesis.imageHelper.Utils.isCameraAvailable;
import static com.geek.protogenesis.imageHelper.Utils.isCameraPermissionFulfilled;
import static com.geek.protogenesis.imageHelper.Utils.isImageType;
import static com.geek.protogenesis.imageHelper.Utils.isValidRequestCode;
import static com.geek.protogenesis.imageHelper.Utils.isVideoType;
import static com.geek.protogenesis.imageHelper.Utils.mediaTypePhoto;
import static com.geek.protogenesis.imageHelper.Utils.mediaTypeVideo;
import static com.geek.protogenesis.imageHelper.Utils.resizeImage;
import static com.geek.protogenesis.imageHelper.Utils.saveToPublicDirectory;
import static com.geek.protogenesis.imageHelper.Utils.setFrontCamera;
public class RNProtogenesisModule extends ReactContextBaseJavaModule implements ActivityEventListener {
private final ReactApplicationContext reactContext;
private CosXmlService cosXmlService;
public static final int REQUEST_LAUNCH_IMAGE_CAPTURE = 13001;
public static final int REQUEST_LAUNCH_VIDEO_CAPTURE = 13002;
public static final int REQUEST_LAUNCH_LIBRARY = 13003;
private Uri fileUri;
Callback imageCallback;
Options options;
Uri cameraCaptureURI;
public RNProtogenesisModule(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
this.reactContext.addActivityEventListener(this);
}
@Override
public String getName() {
return "RNProtogenesis";
}
/**
* @param eventName 事件名
* @param params 传递参数
*/
private void sendEvent(String eventName, @Nullable String params) {
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit(eventName, params);
}
/**
* 横竖屏切换
*
* @param oritention protrait/landscape
*/
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@SuppressLint("SourceLockedOrientationActivity")
@ReactMethod
public void changeOritention(String oritention) {
try {
switch (oritention) {
case "protrait":
Objects.requireNonNull(getCurrentActivity()).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
break;
case "landscape":
Objects.requireNonNull(getCurrentActivity()).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
break;
}
} catch (Exception e) {
Log.e("main", e.toString());
}
}
/**
* 拍照
*
* @param options
* @param callback
*/
@ReactMethod
public void launchCamera(final ReadableMap options, final Callback callback) {
if (!isCameraAvailable(reactContext)) {
callback.invoke(getErrorMap(errCameraUnavailable, null));
return;
}
final Activity currentActivity = getCurrentActivity();
if (currentActivity == null) {
callback.invoke(getErrorMap(errOthers, "Activity error"));
return;
}
if (!isCameraPermissionFulfilled(reactContext, currentActivity)) {
callback.invoke(getErrorMap(errOthers, cameraPermissionDescription));
return;
}
this.imageCallback = callback;
this.options = new Options(options);
if (this.options.saveToPhotos && Build.VERSION.SDK_INT <= Build.VERSION_CODES.P && !hasPermission(currentActivity)) {
callback.invoke(getErrorMap(errPermission, null));
return;
}
int requestCode;
File file;
Intent cameraIntent;
if (this.options.mediaType.equals(mediaTypeVideo)) {
requestCode = REQUEST_LAUNCH_VIDEO_CAPTURE;
cameraIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, this.options.videoQuality);
if (this.options.durationLimit > 0) {
cameraIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, this.options.durationLimit);
}
file = createFile(reactContext, "mp4");
cameraCaptureURI = createUri(file, reactContext);
} else {
requestCode = REQUEST_LAUNCH_IMAGE_CAPTURE;
cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
file = createFile(reactContext, "jpg");
cameraCaptureURI = createUri(file, reactContext);
}
if (this.options.useFrontCamera) {
setFrontCamera(cameraIntent);
}
fileUri = Uri.fromFile(file);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, cameraCaptureURI);
cameraIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
try {
currentActivity.startActivityForResult(cameraIntent, requestCode);
} catch (ActivityNotFoundException e) {
callback.invoke(getErrorMap(errOthers, e.getMessage()));
this.imageCallback = null;
}
}
/**
* 文件选择
*
* @param options
* @param callback
*/
@ReactMethod
public void launchImageLibrary(final ReadableMap options, final Callback callback) {
final Activity currentActivity = getCurrentActivity();
if (currentActivity == null) {
callback.invoke(getErrorMap(errOthers, "Activity error"));
return;
}
this.imageCallback = callback;
this.options = new Options(options);
int requestCode;
Intent libraryIntent;
requestCode = REQUEST_LAUNCH_LIBRARY;
if (this.options.mediaType.equals(mediaTypeVideo)) {
libraryIntent = new Intent(Intent.ACTION_PICK);
libraryIntent.setType("video/*");
} else if (this.options.mediaType.equals(mediaTypePhoto)) {
libraryIntent = new Intent(Intent.ACTION_PICK);
libraryIntent.setType("image/*");
} else {
libraryIntent = new Intent(Intent.ACTION_GET_CONTENT);
libraryIntent.setType("*/*");
libraryIntent.putExtra(Intent.EXTRA_MIME_TYPES, new String[]{"image/*", "video/*"});
libraryIntent.addCategory(Intent.CATEGORY_OPENABLE);
}
try {
currentActivity.startActivityForResult(Intent.createChooser(libraryIntent, null), requestCode);
} catch (ActivityNotFoundException e) {
callback.invoke(getErrorMap(errOthers, e.getMessage()));
this.imageCallback = null;
}
}
/**
* 腾讯云上传配置
*
* @param tmpSecretId
* @param tmpSecretKey
* @param sessionToken
* @param startTime
* @param expiredTime
* @param regionName
*/
@ReactMethod
public void config(String tmpSecretId, String tmpSecretKey, String sessionToken, int startTime, int expiredTime, String regionName) {
QCloudCredentialProvider myCredentialProvider = new fileUploadUtils.MySessionCredentialProvider(tmpSecretId, tmpSecretKey,
sessionToken, Long.valueOf(expiredTime), Long.valueOf(startTime));
// 创建 CosXmlServiceConfig 对象,根据需要修改默认的配置参数
CosXmlServiceConfig serviceConfig = new CosXmlServiceConfig.Builder()
.setRegion(regionName)
.isHttps(true) // 使用 HTTPS 请求, 默认为 HTTP 请求
.builder();
// 初始化 COS Service,获取实例
cosXmlService = new CosXmlService(reactContext,
serviceConfig, myCredentialProvider);
}
/**
* 腾讯云上传文件
*
* @param file
* @param name
* @param bucketName
* @param callback
*/
@ReactMethod
public void uploadFile(String file, String name, String bucketName, final Callback callback) {
Uri localUri = Uri.parse(file);
String fileName = getFileName(localUri);
File rootDataDir = reactContext.getExternalFilesDir(null);
final File copyFile = new File(rootDataDir + File.separator + fileName);
copyFile(reactContext, localUri, copyFile);
// String srcPath = new File(reactContext.getCacheDir(), "exampleobject")
// ; .toString()
String abSolutePath = copyFile.getAbsolutePath();//本地文件的绝对路径
TransferConfig transferConfig = new TransferConfig.Builder().build();
// 初始化 TransferManager
TransferManager transferManager = new TransferManager(cosXmlService,
transferConfig);
String bucket = bucketName; //存储桶,格式:BucketName-APPID
String cosPath = name; //对象在存储桶中的位置标识符,即称对象键
//若存在初始化分块上传的 UploadId,则赋值对应的 uploadId 值用于续传;否则,赋值 null
String uploadId = null;
// 上传文件
COSXMLUploadTask cosxmlUploadTask = transferManager.upload(bucket, cosPath,
abSolutePath, uploadId);
//设置上传进度回调
cosxmlUploadTask.setCosXmlProgressListener(new CosXmlProgressListener() {
@Override
public void onProgress(long complete, long target) {
// todo Do something to update progress...
Log.e("main", "onProgress" + complete + "===" + target);
String progressData = "{" +
"\"totalBytesExpectedToSend\":" + complete +
",\"totalBytesSent\":" + target +
'}';
sendEvent("uploadProgress", progressData);
}
});
//设置返回结果回调
cosxmlUploadTask.setCosXmlResultListener(new CosXmlResultListener() {
@Override
public void onSuccess(CosXmlRequest request, CosXmlResult result) {
COSXMLUploadTask.COSXMLUploadTaskResult cOSXMLUploadTaskResult =
(COSXMLUploadTask.COSXMLUploadTaskResult) result;
Log.e("main", "accessUrl:" + cOSXMLUploadTaskResult.accessUrl);
callback.invoke(cOSXMLUploadTaskResult.accessUrl);
deleteSaveFile(copyFile);
}
@Override
public void onFail(CosXmlRequest request,
CosXmlClientException clientException,
CosXmlServiceException serviceException) {
deleteSaveFile(copyFile);
if (clientException != null) {
clientException.printStackTrace();
} else {
serviceException.printStackTrace();
}
}
});
//设置任务状态回调, 可以查看任务过程
cosxmlUploadTask.setTransferStateListener(new TransferStateListener() {
@Override
public void onStateChanged(TransferState state) {
// todo notify transfer state
Log.e("main", "----------------state" + state.toString());
}
});
}
void onImageObtained(Uri uri) {
Uri newUri = resizeImage(uri, reactContext, options);
imageCallback.invoke(getResponseMap(newUri, options, reactContext));
}
void onVideoObtained(Uri uri) {
imageCallback.invoke(getVideoResponseMap(uri, reactContext));
}
@Override
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
// onActivityResult is called even when ActivityNotFoundException occurs
if (!isValidRequestCode(requestCode) || (this.imageCallback == null)) {
return;
}
if (resultCode != Activity.RESULT_OK) {
if (requestCode == REQUEST_LAUNCH_IMAGE_CAPTURE) {
deleteFile(fileUri);
}
imageCallback.invoke(getCancelMap());
return;
}
switch (requestCode) {
case REQUEST_LAUNCH_IMAGE_CAPTURE:
if (options.saveToPhotos) {
saveToPublicDirectory(cameraCaptureURI, reactContext, "photo");
}
onImageObtained(fileUri);
break;
case REQUEST_LAUNCH_LIBRARY:
Uri uri = data.getData();
if (isImageType(uri, reactContext)) {
onImageObtained(getAppSpecificStorageUri(uri, reactContext));
} else if (isVideoType(uri, reactContext)) {
onVideoObtained(uri);
} else {
imageCallback.invoke(getErrorMap(errOthers, "Unsupported file type"));
}
break;
case REQUEST_LAUNCH_VIDEO_CAPTURE:
if (options.saveToPhotos) {
saveToPublicDirectory(cameraCaptureURI, reactContext, "video");
}
onVideoObtained(fileUri);
break;
}
}
@Override
public void onNewIntent(Intent intent) {
}
}
\ No newline at end of file
package com.geek.protogenesis;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import com.facebook.react.bridge.JavaScriptModule;
public class RNProtogenesisPackage implements ReactPackage {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
return Arrays.<NativeModule>asList(new RNProtogenesisModule(reactContext));
}
// Deprecated from RN 0.47
public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
}
\ No newline at end of file
package com.geek.protogenesis.fileHelper;
import android.net.Uri;
import com.facebook.react.bridge.ReactApplicationContext;
import com.tencent.qcloud.core.auth.BasicLifecycleCredentialProvider;
import com.tencent.qcloud.core.auth.QCloudCredentialProvider;
import com.tencent.qcloud.core.auth.QCloudLifecycleCredentials;
import com.tencent.qcloud.core.auth.SessionQCloudCredentials;
import com.tencent.qcloud.core.common.QCloudClientException;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class fileUploadUtils {
public static boolean deleteSaveFile(File file) {
if (file.exists() && file.isFile()) {
if (file.delete()) {
System.out.println("删除成功!");
return true;
} else {
System.out.println("删除失败!");
return false;
}
} else {
System.out.println("文件不存在!");
return false;
}
}
public static void copyFile(ReactApplicationContext reactContext, Uri srcUri, File dstFile) {
try {
InputStream inputStream = reactContext.getContentResolver().openInputStream(srcUri);
if (inputStream == null) return;
OutputStream outputStream = new FileOutputStream(dstFile);
copyStream(inputStream, outputStream);
inputStream.close();
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static int copyStream(InputStream input, OutputStream output) throws IOException {
final int BUFFER_SIZE = 1024 * 2;
byte[] buffer = new byte[BUFFER_SIZE];
BufferedInputStream in = new BufferedInputStream(input, BUFFER_SIZE);
BufferedOutputStream out = new BufferedOutputStream(output, BUFFER_SIZE);
int count = 0, n = 0;
try {
while ((n = in.read(buffer, 0, BUFFER_SIZE)) != -1) {
out.write(buffer, 0, n);
count += n;
}
out.flush();
} finally {
try {
out.close();
} catch (IOException e) {
}
try {
in.close();
} catch (IOException e) {
}
}
return count;
}
public static String getFileName(Uri uri) {
if (uri == null) return null;
String fileName = null;
String path = uri.getPath();
int cut = path.lastIndexOf('/');
if (cut != -1) {
fileName = path.substring(cut + 1);
}
return fileName;
}
public static class MySessionCredentialProvider
extends BasicLifecycleCredentialProvider {
String tmpSecretId = "COS_SECRETID"; // 临时密钥 SecretId
String tmpSecretKey = "COS_SECRETKEY"; // 临时密钥 SecretKey
String sessionToken = "COS_SESSIONTOKEN"; // 临时密钥 Token
long expiredTime = 1556183496L;//临时密钥有效截止时间戳,单位是秒
//建议返回服务器时间作为签名的开始时间,避免由于用户手机本地时间偏差过大导致请求过期
// 返回服务器时间作为签名的起始时间
long startTime = 1556182000L; //临时密钥有效起始时间,单位是秒
public MySessionCredentialProvider(String tmpSecretId, String tmpSecretKey, String sessionToken, long expiredTime, long startTime) {
this.tmpSecretId = tmpSecretId;
this.tmpSecretKey = tmpSecretKey;
this.sessionToken = sessionToken;
this.expiredTime = expiredTime;
this.startTime = startTime;
}
@Override
protected QCloudLifecycleCredentials fetchNewCredentials()
throws QCloudClientException {
// 最后返回临时密钥信息对象
return new SessionQCloudCredentials(tmpSecretId, tmpSecretKey,
sessionToken, startTime, expiredTime);
}
}
}
package com.geek.protogenesis.imageHelper;
import androidx.core.content.FileProvider;
// Two FileProvider class with same name will conflict during manifest merger, so we create a class which inherits from FileProvider with different name.
// This prevents conflict if library users already have used the default FileProvider class.
public class ImagePickerProvider extends FileProvider {
}
package com.geek.protogenesis.imageHelper;
import android.text.TextUtils;
import com.facebook.react.bridge.ReadableMap;
public class Options {
Boolean includeBase64;
public int videoQuality = 1;
int quality;
int maxWidth;
int maxHeight;
public Boolean saveToPhotos;
public int durationLimit;
public Boolean useFrontCamera = false;
public String mediaType;
public Options(ReadableMap options) {
mediaType = options.getString("mediaType");
includeBase64 = options.getBoolean("includeBase64");
String videoQualityString = options.getString("videoQuality");
if(!TextUtils.isEmpty(videoQualityString) && !videoQualityString.toLowerCase().equals("high")) {
videoQuality = 0;
}
if (options.getString("cameraType").equals("front")) {
useFrontCamera = true;
}
quality = (int) (options.getDouble("quality") * 100);
maxHeight = options.getInt("maxHeight");
maxWidth = options.getInt("maxWidth");
saveToPhotos = options.getBoolean("saveToPhotos");
durationLimit = options.getInt("durationLimit");
}
}
package com.geek.protogenesis.imageHelper;
import android.Manifest;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.hardware.camera2.CameraCharacteristics;
import android.media.MediaMetadataRetriever;
import android.net.Uri;
import android.os.Build;
import android.os.ParcelFileDescriptor;
import android.provider.MediaStore;
import android.util.Base64;
import android.webkit.MimeTypeMap;
import androidx.core.app.ActivityCompat;
import androidx.core.content.FileProvider;
import androidx.exifinterface.media.ExifInterface;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.UUID;
import static com.geek.protogenesis.RNProtogenesisModule.REQUEST_LAUNCH_IMAGE_CAPTURE;
import static com.geek.protogenesis.RNProtogenesisModule.REQUEST_LAUNCH_LIBRARY;
import static com.geek.protogenesis.RNProtogenesisModule.REQUEST_LAUNCH_VIDEO_CAPTURE;
public class Utils {
public static String fileNamePrefix = "rn_image_picker_lib_temp_";
public static String errCameraUnavailable = "camera_unavailable";
public static String errPermission = "permission";
public static String errOthers = "others";
public static String mediaTypePhoto = "photo";
public static String mediaTypeVideo = "video";
public static String cameraPermissionDescription = "This library does not require Manifest.permission.CAMERA, if you add this permission in manifest then you have to obtain the same.";
public static File createFile(Context reactContext, String fileType) {
try {
String filename = fileNamePrefix + UUID.randomUUID() + "." + fileType;
// getCacheDir will auto-clean according to android docs
File fileDir = reactContext.getCacheDir();
File file = new File(fileDir, filename);
file.createNewFile();
return file;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static Uri createUri(File file, Context reactContext) {
String authority = reactContext.getApplicationContext().getPackageName() + ".imagepickerprovider";
return FileProvider.getUriForFile(reactContext, authority, file);
}
public static void saveToPublicDirectory(Uri uri, Context context, String mediaType) {
ContentResolver resolver = context.getContentResolver();
Uri mediaStoreUri;
ContentValues fileDetails = new ContentValues();
if (mediaType.equals("video")) {
fileDetails.put(MediaStore.Video.Media.DISPLAY_NAME, UUID.randomUUID().toString());
fileDetails.put(MediaStore.Video.Media.MIME_TYPE, resolver.getType(uri));
mediaStoreUri = resolver.insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, fileDetails);
} else {
fileDetails.put(MediaStore.Images.Media.DISPLAY_NAME, UUID.randomUUID().toString());
fileDetails.put(MediaStore.Images.Media.MIME_TYPE, resolver.getType(uri));
mediaStoreUri = resolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, fileDetails);
}
copyUri(uri, mediaStoreUri, resolver);
}
public static void copyUri(Uri fromUri, Uri toUri, ContentResolver resolver) {
try {
OutputStream os = resolver.openOutputStream(toUri);
InputStream is = resolver.openInputStream(fromUri);
byte[] buffer = new byte[8192];
int bytesRead;
while ((bytesRead = is.read(buffer)) != -1) {
os.write(buffer, 0, bytesRead);
}
} catch (IOException e) {
e.printStackTrace();
}
}
// Make a copy of shared storage files inside app specific storage so that users can access it later.
public static Uri getAppSpecificStorageUri(Uri sharedStorageUri, Context context) {
if (sharedStorageUri == null) {
return null;
}
ContentResolver contentResolver = context.getContentResolver();
String fileType = getFileTypeFromMime(contentResolver.getType(sharedStorageUri));
Uri toUri = Uri.fromFile(createFile(context, fileType));
copyUri(sharedStorageUri, toUri, contentResolver);
return toUri;
}
public static boolean isCameraAvailable(Context reactContext) {
return reactContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)
|| reactContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY);
}
// Opening front camera is not officially supported in android, the below hack is obtained from various online sources
public static void setFrontCamera(Intent intent) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
intent.putExtra("android.intent.extras.CAMERA_FACING", CameraCharacteristics.LENS_FACING_FRONT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
intent.putExtra("android.intent.extra.USE_FRONT_CAMERA", true);
}
} else {
intent.putExtra("android.intent.extras.CAMERA_FACING", 1);
}
}
public static int[] getImageDimensions(Uri uri, Context reactContext) {
InputStream inputStream;
try {
inputStream = reactContext.getContentResolver().openInputStream(uri);
} catch (FileNotFoundException e) {
e.printStackTrace();
return new int[]{0, 0};
}
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeStream(inputStream, null, options);
return new int[]{options.outWidth, options.outHeight};
}
public static boolean hasPermission(final Activity activity) {
final int writePermission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
return writePermission == PackageManager.PERMISSION_GRANTED ? true : false;
}
static String getBase64String(Uri uri, Context reactContext) {
InputStream inputStream;
try {
inputStream = reactContext.getContentResolver().openInputStream(uri);
} catch (FileNotFoundException e) {
e.printStackTrace();
return null;
}
byte[] bytes;
byte[] buffer = new byte[8192];
int bytesRead;
ByteArrayOutputStream output = new ByteArrayOutputStream();
try {
while ((bytesRead = inputStream.read(buffer)) != -1) {
output.write(buffer, 0, bytesRead);
}
} catch (IOException e) {
e.printStackTrace();
}
bytes = output.toByteArray();
return Base64.encodeToString(bytes, Base64.NO_WRAP);
}
// Resize image
// When decoding a jpg to bitmap all exif meta data will be lost, so make sure to copy orientation exif to new file else image might have wrong orientations
public static Uri resizeImage(Uri uri, Context context, Options options) {
try {
int[] origDimens = getImageDimensions(uri, context);
if (!shouldResizeImage(origDimens[0], origDimens[1], options)) {
return uri;
}
int[] newDimens = getImageDimensBasedOnConstraints(origDimens[0], origDimens[1], options);
InputStream imageStream = context.getContentResolver().openInputStream(uri);
String mimeType = getMimeTypeFromFileUri(uri);
Bitmap b = BitmapFactory.decodeStream(imageStream);
b = Bitmap.createScaledBitmap(b, newDimens[0], newDimens[1], true);
String originalOrientation = getOrientation(uri, context);
File file = createFile(context, getFileTypeFromMime(mimeType));
OutputStream os = context.getContentResolver().openOutputStream(Uri.fromFile(file));
b.compress(getBitmapCompressFormat(mimeType), options.quality, os);
setOrientation(file, originalOrientation, context);
return Uri.fromFile(file);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
static String getOrientation(Uri uri, Context context) throws IOException {
ExifInterface exifInterface = new ExifInterface(context.getContentResolver().openInputStream(uri));
return exifInterface.getAttribute(ExifInterface.TAG_ORIENTATION);
}
// ExifInterface.saveAttributes is costly operation so don't set exif for unnecessary orientations
static void setOrientation(File file, String orientation, Context context) throws IOException {
if (orientation.equals(String.valueOf(ExifInterface.ORIENTATION_NORMAL)) || orientation.equals(String.valueOf(ExifInterface.ORIENTATION_UNDEFINED))) {
return;
}
ExifInterface exifInterface = new ExifInterface(file);
exifInterface.setAttribute(ExifInterface.TAG_ORIENTATION, orientation);
exifInterface.saveAttributes();
}
static int[] getImageDimensBasedOnConstraints(int origWidth, int origHeight, Options options) {
int width = origWidth;
int height = origHeight;
if (options.maxWidth == 0 || options.maxHeight == 0) {
return new int[]{width, height};
}
if (options.maxWidth < width) {
height = (int) (((float) options.maxWidth / width) * height);
width = options.maxWidth;
}
if (options.maxHeight < height) {
width = (int) (((float) options.maxHeight / height) * width);
height = options.maxHeight;
}
return new int[]{width, height};
}
static double getFileSize(Uri uri, Context context) {
try {
ParcelFileDescriptor f = context.getContentResolver().openFileDescriptor(uri, "r");
return f.getStatSize();
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
static int getDuration(Uri uri, Context context) {
MediaMetadataRetriever m = new MediaMetadataRetriever();
m.setDataSource(context, uri);
int duration = Math.round(Float.parseFloat(m.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION))) / 1000;
m.release();
return duration;
}
static boolean shouldResizeImage(int origWidth, int origHeight, Options options) {
if ((options.maxWidth == 0 || options.maxHeight == 0) && options.quality == 100) {
return false;
}
if (options.maxWidth >= origWidth && options.maxHeight >= origHeight && options.quality == 100) {
return false;
}
return true;
}
static Bitmap.CompressFormat getBitmapCompressFormat(String mimeType) {
switch (mimeType) {
case "image/jpeg":
return Bitmap.CompressFormat.JPEG;
case "image/png":
return Bitmap.CompressFormat.PNG;
}
return Bitmap.CompressFormat.JPEG;
}
static String getFileTypeFromMime(String mimeType) {
if (mimeType == null) {
return "jpg";
}
switch (mimeType) {
case "image/jpeg":
return "jpg";
case "image/png":
return "png";
}
return "jpg";
}
public static void deleteFile(Uri uri) {
new File(uri.getPath()).delete();
}
static String getMimeTypeFromFileUri(Uri uri) {
return MimeTypeMap.getSingleton().getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(uri.toString()));
}
// Since library users can have many modules in their project, we should respond to onActivityResult only for our request.
public static boolean isValidRequestCode(int requestCode) {
switch (requestCode) {
case REQUEST_LAUNCH_IMAGE_CAPTURE:
case REQUEST_LAUNCH_VIDEO_CAPTURE:
case REQUEST_LAUNCH_LIBRARY:
return true;
default:
return false;
}
}
// This library does not require Manifest.permission.CAMERA permission, but if user app declares as using this permission which is not granted, then attempting to use ACTION_IMAGE_CAPTURE|ACTION_VIDEO_CAPTURE will result in a SecurityException.
// https://issuetracker.google.com/issues/37063818
public static boolean isCameraPermissionFulfilled(Context context, Activity activity) {
try {
String[] declaredPermissions = context.getPackageManager()
.getPackageInfo(context.getPackageName(), PackageManager.GET_PERMISSIONS)
.requestedPermissions;
if (declaredPermissions == null) {
return true;
}
if (Arrays.asList(declaredPermissions).contains(Manifest.permission.CAMERA)
&& ActivityCompat.checkSelfPermission(activity, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
return false;
}
return true;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return true;
}
}
public static boolean isImageType(Uri uri, Context context) {
ContentResolver contentResolver = context.getContentResolver();
return contentResolver.getType(uri).contains("image/");
}
public static boolean isVideoType(Uri uri, Context context) {
ContentResolver contentResolver = context.getContentResolver();
return contentResolver.getType(uri).contains("video/");
}
public static ReadableMap getResponseMap(Uri uri, Options options, Context context) {
String fileName = uri.getLastPathSegment();
int[] dimensions = getImageDimensions(uri, context);
WritableMap map = Arguments.createMap();
map.putString("uri", uri.toString());
map.putDouble("fileSize", getFileSize(uri, context));
map.putString("fileName", fileName);
map.putString("type", getMimeTypeFromFileUri(uri));
map.putInt("width", dimensions[0]);
map.putInt("height", dimensions[1]);
if (options.includeBase64) {
map.putString("base64", getBase64String(uri, context));
}
return map;
}
public static ReadableMap getVideoResponseMap(Uri uri, Context context) {
String fileName = uri.getLastPathSegment();
WritableMap map = Arguments.createMap();
map.putString("uri", uri.toString());
map.putDouble("fileSize", getFileSize(uri, context));
map.putInt("duration", getDuration(uri, context));
map.putString("fileName", fileName);
return map;
}
public static ReadableMap getErrorMap(String errCode, String errMsg) {
WritableMap map = Arguments.createMap();
map.putString("errorCode", errCode);
if (errMsg != null) {
map.putString("errorMessage", errMsg);
}
return map;
}
public static ReadableMap getCancelMap() {
WritableMap map = Arguments.createMap();
map.putBoolean("didCancel", true);
return map;
}
}
<?xml version="1.0" encoding="utf-8"?>
<paths>
<cache-path name="cacheDir" path="." />
</paths>
\ No newline at end of file
import { NativeModules } from 'react-native';
import { httpUtil, Toast } from 'geekbase';
const { RNProtogenesis } = NativeModules;
// 屏幕方向
let currentOritention = ''
// 拍照默认参数
const DEFAULT_OPTIONS = {
mediaType: 'photo',
videoQuality: 'high',
quality: 1,
maxWidth: 0,
maxHeight: 0,
includeBase64: false,
saveToPhotos: false,
durationLimit: 0,
cameraType: 'back'
};
/**
* 横竖屏切换
* @param {*} oritentation
* @returns
*/
export const changeOritention = (oritentation) => {
currentOritention = oritentation
RNProtogenesis.changeOritention(oritentation)
return currentOritention
}
/**
* 自动切换横竖屏
* @returns
*/
export const useLandscapeOritention = () => {
useEffect(() => {
changeOritention('landscape')
currentOritention = 'landscape'
return () => {
changeOritention('protrait')
currentOritention = 'protrait'
}
}, [])
return currentOritention
}
/**
* 拍照
* @param {*} options
* @param {*} callback
* @returns
*/
export const launchCamera = (options, callback) => {
if (typeof callback !== 'function') {
console.error("Send proper callback function, check API");
return;
}
RNProtogenesis.launchCamera(
{ ...DEFAULT_OPTIONS, ...options },
callback,
);
}
/**
* 选择图片
* @param {*} options
* @param {*} callback
* @returns
*/
export const launchImageLibrary = (
options,
callback
) => {
if (typeof callback !== 'function') {
console.error("Send proper callback function, check API");
return;
}
RNProtogenesis.launchImageLibrary(
{ ...DEFAULT_OPTIONS, ...options },
callback,
);
}
/**
*
* @param {*} file 文件uri
* @param {*} name 文件名
* @param {*} credent 临时签名
* @param {*} bucketName 存储桶名称
* @param {*} regionName 地区
* @param {*} processCb 进度回调
* @param {*} resultCb 上传结果回调
*/
export const uploadFile = async (file, name, credent, bucketName, regionName, progressCb, resultCb) => {
const { GeekUploadEmitter } = NativeModules
try {
const emitter = new NativeEventEmitter(GeekUploadEmitter)
emitter.addListener('uploadProgress', (progressData) => {
const progress = Platform.OS === 'ios' ? progressData : JSON.parse(progressData)
progressCb && progressCb({
progress
})
})
const { credentials, startTime, expiredTime, dir } = credent || {}
const { tmpSecretId, tmpSecretKey, sessionToken } = credentials || {}
let dirName = name
if (Platform.OS === 'ios') {
const config = {
tmpSecretId,
tmpSecretKey,
sessionToken,
startTime,
expiredTime,
bucketName: bucketName,
dir,
regionName: regionName
}
dirName = name
RNProtogenesis.config(config)
RNProtogenesis.uploadFile(file, dirName, (res, err) => {
if (resultCb) {
resultCb({
res,
error: err
})
}
})
} else {
dirName = dir + name
RNProtogenesis.config(tmpSecretId, tmpSecretKey, sessionToken, startTime, expiredTime, regionName)
RNProtogenesis.uploadFile(file, dirName, bucketName, (res, err) => {
if (resultCb) {
resultCb({
res,
error: err
})
}
})
}
} catch (error) {
console.log(error)
resultCb && resultCb({
error
})
}
}
// 获取签名数据
export const getCredential = async () => {
if (httpUtil) {
const [credent, error] = await httpUtil.get('/service-public/cos/getCredential', {
params: {
code: 'HOMEWORK_IMAGE'
}
});
if (error) {
throw new Error('获取签名失败')
}
return JSON.parse(credent)
}
}
/**
*
* @param {*} file 文件uri
* @param {*} name 文件名
* @param {*} processCb 进度回调
* @param {*} resultCb 上传结果
*/
export const uploadFileWithoutCredent = async (file, name, processCb, resultCb) => {
const credent = await getCredential()
console.log('uploadFileWithoutCredent')
const { bucket, regionName } = credent
if (bucket) {
const localRegionName = regionName || 'ap-chengdu'
uploadFile(file, name, credent, bucket, localRegionName, processCb, resultCb)
} else {
resultCb(null)
Toast.msg('获取签名失败!')
}
}
export default RNProtogenesis;
#if __has_include("RCTBridgeModule.h")
#import "RCTBridgeModule.h"
#else
#import <React/RCTBridgeModule.h>
#endif
@interface RNProtogenesis : NSObject <RCTBridgeModule>
@end
\ No newline at end of file
#import "RNProtogenesis.h"
@implementation RNProtogenesis
- (dispatch_queue_t)methodQueue
{
return dispatch_get_main_queue();
}
RCT_EXPORT_MODULE()
@end
\ No newline at end of file
Pod::Spec.new do |s|
s.name = "RNProtogenesis"
s.version = "1.0.0"
s.summary = "RNProtogenesis"
s.description = <<-DESC
RNProtogenesis
DESC
s.homepage = ""
s.license = "MIT"
# s.license = { :type => "MIT", :file => "FILE_LICENSE" }
s.author = { "author" => "author@domain.cn" }
s.platform = :ios, "7.0"
s.source = { :git => "https://github.com/author/RNProtogenesis.git", :tag => "master" }
s.source_files = "RNProtogenesis/**/*.{h,m}"
s.requires_arc = true
s.dependency "React"
#s.dependency "others"
end
\ No newline at end of file
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
B3E7B58A1CC2AC0600A0062D /* RNProtogenesis.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNProtogenesis.m */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
58B511D91A9E6C8500147676 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "include/$(PRODUCT_NAME)";
dstSubfolderSpec = 16;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
134814201AA4EA6300B7C361 /* libRNProtogenesis.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNProtogenesis.a; sourceTree = BUILT_PRODUCTS_DIR; };
B3E7B5881CC2AC0600A0062D /* RNProtogenesis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNProtogenesis.h; sourceTree = "<group>"; };
B3E7B5891CC2AC0600A0062D /* RNProtogenesis.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNProtogenesis.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
58B511D81A9E6C8500147676 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
134814211AA4EA7D00B7C361 /* Products */ = {
isa = PBXGroup;
children = (
134814201AA4EA6300B7C361 /* libRNProtogenesis.a */,
);
name = Products;
sourceTree = "<group>";
};
58B511D21A9E6C8500147676 = {
isa = PBXGroup;
children = (
B3E7B5881CC2AC0600A0062D /* RNProtogenesis.h */,
B3E7B5891CC2AC0600A0062D /* RNProtogenesis.m */,
134814211AA4EA7D00B7C361 /* Products */,
);
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
58B511DA1A9E6C8500147676 /* RNProtogenesis */ = {
isa = PBXNativeTarget;
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNProtogenesis" */;
buildPhases = (
58B511D71A9E6C8500147676 /* Sources */,
58B511D81A9E6C8500147676 /* Frameworks */,
58B511D91A9E6C8500147676 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = RNProtogenesis;
productName = RCTDataManager;
productReference = 134814201AA4EA6300B7C361 /* libRNProtogenesis.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
58B511D31A9E6C8500147676 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0830;
ORGANIZATIONNAME = Facebook;
TargetAttributes = {
58B511DA1A9E6C8500147676 = {
CreatedOnToolsVersion = 6.1.1;
};
};
};
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNProtogenesis" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 58B511D21A9E6C8500147676;
productRefGroup = 58B511D21A9E6C8500147676;
projectDirPath = "";
projectRoot = "";
targets = (
58B511DA1A9E6C8500147676 /* RNProtogenesis */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
58B511D71A9E6C8500147676 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B3E7B58A1CC2AC0600A0062D /* RNProtogenesis.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
58B511ED1A9E6C8500147676 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
58B511EE1A9E6C8500147676 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
58B511F01A9E6C8500147676 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../../React/**",
"$(SRCROOT)/../../react-native/React/**",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RNProtogenesis;
SKIP_INSTALL = YES;
};
name = Debug;
};
58B511F11A9E6C8500147676 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../../React/**",
"$(SRCROOT)/../../react-native/React/**",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RNProtogenesis;
SKIP_INSTALL = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNProtogenesis" */ = {
isa = XCConfigurationList;
buildConfigurations = (
58B511ED1A9E6C8500147676 /* Debug */,
58B511EE1A9E6C8500147676 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNProtogenesis" */ = {
isa = XCConfigurationList;
buildConfigurations = (
58B511F01A9E6C8500147676 /* Debug */,
58B511F11A9E6C8500147676 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 58B511D31A9E6C8500147676 /* Project object */;
}
// !$*UTF8*$!
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:RNProtogenesis.xcodeproj">
</FileRef>
</Workspace>
\ No newline at end of file
{
"name": "react-native-protogenesis",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"react-native"
],
"author": "",
"license": "",
"peerDependencies": {
"react-native": "^0.41.2",
"react-native-windows": "0.41.0-rc.1"
}
}
*AppPackages*
*BundleArtifacts*
*ReactAssets*
#OS junk files
[Tt]humbs.db
*.DS_Store
#Visual Studio files
*.[Oo]bj
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.[Cc]ache
*.ilk
*.log
*.lib
*.sbr
*.sdf
*.opensdf
*.opendb
*.unsuccessfulbuild
ipch/
[Oo]bj/
[Bb]in
[Dd]ebug*/
[Rr]elease*/
Ankh.NoLoad
#MonoDevelop
*.pidb
*.userprefs
#Tooling
_ReSharper*/
*.resharper
[Tt]est[Rr]esult*
*.sass-cache
#Project files
[Bb]uild/
#Subversion files
.svn
# Office Temp Files
~$*
# vim Temp Files
*~
#NuGet
packages/
*.nupkg
#ncrunch
*ncrunch*
*crunch*.local.xml
# visual studio database projects
*.dbmdl
#Test files
*.testsettings
#Other files
*.DotSettings
.vs/
*project.lock.json
# Make sure we don't publish build artifacts to NPM
ARM/
Debug/
x64/
x86/
bin/
obj/
.vs/
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RNProtogenesis", "RNProtogenesis\RNProtogenesis.csproj", "{64C20860-D580-11EB-B721-01DF429A4FDF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactNative", "..\node_modules\react-native-windows\ReactWindows\ReactNative\ReactNative.csproj", "{C7673AD5-E3AA-468C-A5FD-FA38154E205C}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ReactNative.Shared", "..\node_modules\react-native-windows\ReactWindows\ReactNative.Shared\ReactNative.Shared.shproj", "{EEA8B852-4D07-48E1-8294-A21AB5909FE5}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChakraBridge", "..\node_modules\react-native-windows\ReactWindows\ChakraBridge\ChakraBridge.vcxproj", "{4B72C796-16D5-4E3A-81C0-3E36F531E578}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\node_modules\react-native-windows\ReactWindows\ReactNative.Shared\ReactNative.Shared.projitems*{c7673ad5-e3aa-468c-a5fd-fa38154e205c}*SharedItemsImports = 4
..\node_modules\react-native-windows\ReactWindows\ReactNative.Shared\ReactNative.Shared.projitems*{eea8b852-4d07-48e1-8294-a21ab5909fe5}*SharedItemsImports = 13
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Development|ARM = Development|ARM
Development|x64 = Development|x64
Development|x86 = Development|x86
Release|ARM = Release|ARM
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{64C20860-D580-11EB-B721-01DF429A4FDF}.Debug|ARM.ActiveCfg = Debug|ARM
{64C20860-D580-11EB-B721-01DF429A4FDF}.Debug|ARM.Build.0 = Debug|ARM
{64C20860-D580-11EB-B721-01DF429A4FDF}.Debug|x64.ActiveCfg = Debug|x64
{64C20860-D580-11EB-B721-01DF429A4FDF}.Debug|x64.Build.0 = Debug|x64
{64C20860-D580-11EB-B721-01DF429A4FDF}.Debug|x86.ActiveCfg = Debug|x86
{64C20860-D580-11EB-B721-01DF429A4FDF}.Debug|x86.Build.0 = Debug|x86
{64C20860-D580-11EB-B721-01DF429A4FDF}.Development|ARM.ActiveCfg = Development|ARM
{64C20860-D580-11EB-B721-01DF429A4FDF}.Development|ARM.Build.0 = Development|ARM
{64C20860-D580-11EB-B721-01DF429A4FDF}.Development|x64.ActiveCfg = Development|x64
{64C20860-D580-11EB-B721-01DF429A4FDF}.Development|x64.Build.0 = Development|x64
{64C20860-D580-11EB-B721-01DF429A4FDF}.Development|x86.ActiveCfg = Development|x86
{64C20860-D580-11EB-B721-01DF429A4FDF}.Development|x86.Build.0 = Development|x86
{64C20860-D580-11EB-B721-01DF429A4FDF}.Release|ARM.ActiveCfg = Release|ARM
{64C20860-D580-11EB-B721-01DF429A4FDF}.Release|ARM.Build.0 = Release|ARM
{64C20860-D580-11EB-B721-01DF429A4FDF}.Release|x64.ActiveCfg = Release|x64
{64C20860-D580-11EB-B721-01DF429A4FDF}.Release|x64.Build.0 = Release|x64
{64C20860-D580-11EB-B721-01DF429A4FDF}.Release|x86.ActiveCfg = Release|x86
{64C20860-D580-11EB-B721-01DF429A4FDF}.Release|x86.Build.0 = Release|x86
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|ARM.ActiveCfg = Debug|ARM
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|ARM.Build.0 = Debug|ARM
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x64.ActiveCfg = Debug|x64
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x64.Build.0 = Debug|x64
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x86.ActiveCfg = Debug|x86
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x86.Build.0 = Debug|x86
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|ARM.ActiveCfg = Debug|ARM
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|ARM.Build.0 = Debug|ARM
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x64.ActiveCfg = Debug|x64
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x64.Build.0 = Debug|x64
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x86.ActiveCfg = Debug|x86
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x86.Build.0 = Debug|x86
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|ARM.ActiveCfg = Release|ARM
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|ARM.Build.0 = Release|ARM
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x64.ActiveCfg = Release|x64
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x64.Build.0 = Release|x64
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x86.ActiveCfg = Release|x86
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x86.Build.0 = Release|x86
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|ARM.ActiveCfg = Debug|ARM
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|ARM.Build.0 = Debug|ARM
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x64.ActiveCfg = Debug|x64
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x64.Build.0 = Debug|x64
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x86.ActiveCfg = Debug|Win32
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x86.Build.0 = Debug|Win32
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|ARM.ActiveCfg = Debug|ARM
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|ARM.Build.0 = Debug|ARM
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|x64.ActiveCfg = Debug|x64
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|x64.Build.0 = Debug|x64
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|x86.ActiveCfg = Debug|Win32
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|x86.Build.0 = Debug|Win32
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|ARM.ActiveCfg = Release|ARM
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|ARM.Build.0 = Release|ARM
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x64.ActiveCfg = Release|x64
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x64.Build.0 = Release|x64
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x86.ActiveCfg = Release|Win32
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RNProtogenesis")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RNProtogenesis")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains Runtime Directives, specifications about types your application accesses
through reflection and other dynamic code patterns. Runtime Directives are used to control the
.NET Native optimizer and ensure that it does not remove code accessed by your library. If your
library does not do any reflection, then you generally do not need to edit this file. However,
if your library reflects over types, especially types passed to it or derived from its types,
then you should write Runtime Directives.
The most common use of reflection in libraries is to discover information about types passed
to the library. Runtime Directives have three ways to express requirements on types passed to
your library.
1. Parameter, GenericParameter, TypeParameter, TypeEnumerableParameter
Use these directives to reflect over types passed as a parameter.
2. SubTypes
Use a SubTypes directive to reflect over types derived from another type.
3. AttributeImplies
Use an AttributeImplies directive to indicate that your library needs to reflect over
types or methods decorated with an attribute.
For more information on writing Runtime Directives for libraries, please visit
http://go.microsoft.com/fwlink/?LinkID=391919
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Library Name="RNProtogenesis">
<!-- add directives for your library here -->
</Library>
</Directives>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{64C20860-D580-11EB-B721-01DF429A4FDF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Protogenesis</RootNamespace>
<AssemblyName>Protogenesis</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.10586.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ReactWindowsRoot>..\..\node_modules</ReactWindowsRoot>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' != 'Development'">
<ReactWindowsRoot>..\..</ReactWindowsRoot>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<PlatformTarget>x86</PlatformTarget>
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<PlatformTarget>ARM</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<PlatformTarget>ARM</PlatformTarget>
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Development|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Development\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<NoStdLib>true</NoStdLib>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Development|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Development\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<NoStdLib>true</NoStdLib>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Development|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Development\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<NoStdLib>true</NoStdLib>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RNProtogenesisModule.cs" />
<Compile Include="RNProtogenesisPackage.cs" />
<EmbeddedResource Include="Properties\RNProtogenesis.rd.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(ReactWindowsRoot)\react-native-windows\ReactWindows\ReactNative\ReactNative.csproj">
<Project>{c7673ad5-e3aa-468c-a5fd-fa38154e205c}</Project>
<Name>ReactNative</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
using ReactNative.Bridge;
using System;
using System.Collections.Generic;
using Windows.ApplicationModel.Core;
using Windows.UI.Core;
namespace Protogenesis.RNProtogenesis
{
/// <summary>
/// A module that allows JS to share data.
/// </summary>
class RNProtogenesisModule : NativeModuleBase
{
/// <summary>
/// Instantiates the <see cref="RNProtogenesisModule"/>.
/// </summary>
internal RNProtogenesisModule()
{
}
/// <summary>
/// The name of the native module.
/// </summary>
public override string Name
{
get
{
return "RNProtogenesis";
}
}
}
}
using ReactNative.Bridge;
using ReactNative.Modules.Core;
using ReactNative.UIManager;
using System;
using System.Collections.Generic;
namespace Protogenesis.RNProtogenesis
{
/// <summary>
/// Package defining core framework modules (e.g., <see cref="UIManagerModule"/>).
/// It should be used for modules that require special integration with
/// other framework parts (e.g., with the list of packages to load view
/// managers from).
/// </summary>
public class RNProtogenesisPackage : IReactPackage
{
/// <summary>
/// Creates the list of native modules to register with the react
/// instance.
/// </summary>
/// <param name="reactContext">The react application context.</param>
/// <returns>The list of native modules.</returns>
public IReadOnlyList<INativeModule> CreateNativeModules(ReactContext reactContext)
{
return new List<INativeModule>
{
new RNProtogenesisModule(),
};
}
/// <summary>
/// Creates the list of JavaScript modules to register with the
/// react instance.
/// </summary>
/// <returns>The list of JavaScript modules.</returns>
public IReadOnlyList<Type> CreateJavaScriptModulesConfig()
{
return new List<Type>(0);
}
/// <summary>
/// Creates the list of view managers that should be registered with
/// the <see cref="UIManagerModule"/>.
/// </summary>
/// <param name="reactContext">The react application context.</param>
/// <returns>The list of view managers.</returns>
public IReadOnlyList<IViewManager> CreateViewManagers(
ReactContext reactContext)
{
return new List<IViewManager>(0);
}
}
}
{
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2"
},
"frameworks": {
"uap10.0": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {},
"win10-x86": {},
"win10-x86-aot": {},
"win10-x64": {},
"win10-x64-aot": {}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment