1. 日记本封面上传

This commit is contained in:
xuwenyang 2019-05-24 15:43:06 +08:00
parent 0a7175a277
commit a58a1dee69
12 changed files with 335 additions and 20 deletions

View file

@ -109,6 +109,7 @@ android {
missingDimensionStrategy "RNN.reactNativeVersion", "reactNative57_5"
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
splits {
abi {
@ -141,6 +142,8 @@ android {
dependencies {
implementation project(':react-native-image-crop-picker')
implementation project(':react-native-image-resizer')
implementation project(':react-native-device-info')
implementation project(':react-native-vector-icons')

View file

@ -3,6 +3,8 @@ package com.timepill;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.reactnative.ivpusic.imagepicker.PickerPackage;
import fr.bamlab.rnimageresizer.ImageResizerPackage;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.oblador.vectoricons.VectorIconsPackage;
import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
@ -43,7 +45,8 @@ public class MainApplication extends NavigationApplication {
// eg. new VectorIconsPackage()
new RNDeviceInfo(),
new VectorIconsPackage(),
new AsyncStoragePackage()
new AsyncStoragePackage(),
new PickerPackage()
);
}

View file

@ -1,4 +1,8 @@
rootProject.name = 'Timepill'
include ':react-native-image-crop-picker'
project(':react-native-image-crop-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-crop-picker/android')
include ':react-native-image-resizer'
project(':react-native-image-resizer').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-resizer/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':@react-native-community_async-storage'

View file

@ -38,14 +38,20 @@
2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D16E6891FA4F8E400B85C8A /* libReact.a */; };
2DCD954D1E0B4F2C00145EB5 /* TimepillTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* TimepillTests.m */; };
2DF0FFEE2056DD460020B375 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact.a */; };
4156314B2297CFA5009EB583 /* RSKImageCropper.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4156314A2297CFA5009EB583 /* RSKImageCropper.framework */; };
4156314C2297CFA5009EB583 /* RSKImageCropper.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4156314A2297CFA5009EB583 /* RSKImageCropper.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4156314F2297CFBE009EB583 /* QBImagePicker.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4156314E2297CFBE009EB583 /* QBImagePicker.framework */; };
415631502297CFBE009EB583 /* QBImagePicker.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4156314E2297CFBE009EB583 /* QBImagePicker.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4166A0E722895B5C0086277D /* libReactNativeNavigation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4166A0E422895B4C0086277D /* libReactNativeNavigation.a */; };
444B74B0B45F447FA6D25561 /* libRNVectorIcons.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A333F2A12D224289B26028D1 /* libRNVectorIcons.a */; };
47AE5EA4A39F43CFA279144B /* libRNDeviceInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B6943EF54DC4C0E8C860C48 /* libRNDeviceInfo.a */; };
505DDEF9B17C4B93A7D4C4B0 /* libRCTImageResizer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C988095E6478452AAAF73E23 /* libRCTImageResizer.a */; };
6CA03C7B6F034CF5B2ECC3E5 /* libRNVectorIcons-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7FC4807EA1FA42A4A55BDAE5 /* libRNVectorIcons-tvOS.a */; };
6CAEBF678D2F4D3A8D88B88A /* EvilIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = CC35BDC2C50846E0A4F98D35 /* EvilIcons.ttf */; };
71E72460768C4C9EB73C5050 /* MaterialCommunityIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 0D4DF9EF3F764CD0BF997FD6 /* MaterialCommunityIcons.ttf */; };
7CDD27C257FA4106B76D549E /* FontAwesome.ttf in Resources */ = {isa = PBXBuildFile; fileRef = C558ABC6E5C94D939958E5F9 /* FontAwesome.ttf */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
9678DE108DEC4C5A9D92EA1D /* libimageCropPicker.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 996469B8096342559A8F98D6 /* libimageCropPicker.a */; };
9D7603B23A7F4822A211DDAE /* Feather.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6D8788EB66CB42AAAE311EF6 /* Feather.ttf */; };
9DF5D161F69E45E7B193AF29 /* Ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 126191B2E4AC47DC918127F9 /* Ionicons.ttf */; };
9ED46B2FDF3A4DB9A9DE64DD /* libRNCAsyncStorage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 02F6E40D13C4416C92D5A67C /* libRNCAsyncStorage.a */; };
@ -270,6 +276,20 @@
remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4;
remoteInfo = "cxxreact-tvOS";
};
415631022297C79D009EB583 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = DE970E03BCC84CE8A281A103 /* RCTImageResizer.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 5D72D2E81C16249000E22EC1;
remoteInfo = RCTImageResizer;
};
415631482297C85D009EB583 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BDBA91D5680B4ACA83A7844B /* imageCropPicker.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3400A8081CEB54A6008A0BC7;
remoteInfo = imageCropPicker;
};
4166A0E322895B4C0086277D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4166A0DE22895B4B0086277D /* ReactNativeNavigation.xcodeproj */;
@ -377,6 +397,21 @@
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
4156314D2297CFA6009EB583 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
4156314C2297CFA5009EB583 /* RSKImageCropper.framework in Embed Frameworks */,
415631502297CFBE009EB583 /* QBImagePicker.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
000EDE6A5D7D497FB251CC09 /* RNVectorIcons.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNVectorIcons.xcodeproj; path = "../node_modules/react-native-vector-icons/RNVectorIcons.xcodeproj"; sourceTree = "<group>"; };
008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = "<group>"; };
@ -406,6 +441,8 @@
2D02E4901E0B4A5D006451C7 /* Timepill-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Timepill-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; };
39A6CC5AA01844FCA6BAD7CE /* MaterialIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf"; sourceTree = "<group>"; };
4156314A2297CFA5009EB583 /* RSKImageCropper.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = RSKImageCropper.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4156314E2297CFBE009EB583 /* QBImagePicker.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = QBImagePicker.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4166A0DE22895B4B0086277D /* ReactNativeNavigation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeNavigation.xcodeproj; path = "../node_modules/react-native-navigation/lib/ios/ReactNativeNavigation.xcodeproj"; sourceTree = "<group>"; };
4B6943EF54DC4C0E8C860C48 /* libRNDeviceInfo.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNDeviceInfo.a; sourceTree = "<group>"; };
4DC49BDD3EFD4FA997BEEF58 /* Zocial.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Zocial.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Zocial.ttf"; sourceTree = "<group>"; };
@ -416,12 +453,16 @@
7FC4807EA1FA42A4A55BDAE5 /* libRNVectorIcons-tvOS.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = "libRNVectorIcons-tvOS.a"; sourceTree = "<group>"; };
81F0243DD71F467A964CAD89 /* Entypo.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Entypo.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Entypo.ttf"; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
996469B8096342559A8F98D6 /* libimageCropPicker.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libimageCropPicker.a; sourceTree = "<group>"; };
A333F2A12D224289B26028D1 /* libRNVectorIcons.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNVectorIcons.a; sourceTree = "<group>"; };
ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = "<group>"; };
ADDB7A9FC7044DF48E9BA080 /* Octicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Octicons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Octicons.ttf"; sourceTree = "<group>"; };
BDBA91D5680B4ACA83A7844B /* imageCropPicker.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = imageCropPicker.xcodeproj; path = "../node_modules/react-native-image-crop-picker/ios/imageCropPicker.xcodeproj"; sourceTree = "<group>"; };
C558ABC6E5C94D939958E5F9 /* FontAwesome.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = FontAwesome.ttf; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf"; sourceTree = "<group>"; };
C988095E6478452AAAF73E23 /* libRCTImageResizer.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRCTImageResizer.a; sourceTree = "<group>"; };
CC35BDC2C50846E0A4F98D35 /* EvilIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = EvilIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf"; sourceTree = "<group>"; };
D16AA0DE1A4348A8B86F08A1 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNDeviceInfo.xcodeproj; path = "../node_modules/react-native-device-info/ios/RNDeviceInfo.xcodeproj"; sourceTree = "<group>"; };
DE970E03BCC84CE8A281A103 /* RCTImageResizer.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RCTImageResizer.xcodeproj; path = "../node_modules/react-native-image-resizer/ios/RCTImageResizer.xcodeproj"; sourceTree = "<group>"; };
E259D54DE3C4445E8CCCEE25 /* SimpleLineIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = SimpleLineIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf"; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; };
@ -452,12 +493,16 @@
133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */,
00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */,
139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */,
4156314B2297CFA5009EB583 /* RSKImageCropper.framework in Frameworks */,
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
9ED46B2FDF3A4DB9A9DE64DD /* libRNCAsyncStorage.a in Frameworks */,
444B74B0B45F447FA6D25561 /* libRNVectorIcons.a in Frameworks */,
47AE5EA4A39F43CFA279144B /* libRNDeviceInfo.a in Frameworks */,
505DDEF9B17C4B93A7D4C4B0 /* libRCTImageResizer.a in Frameworks */,
9678DE108DEC4C5A9D92EA1D /* libimageCropPicker.a in Frameworks */,
4156314F2297CFBE009EB583 /* QBImagePicker.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -616,6 +661,22 @@
name = Frameworks;
sourceTree = "<group>";
};
415630FF2297C79C009EB583 /* Products */ = {
isa = PBXGroup;
children = (
415631032297C79D009EB583 /* libRCTImageResizer.a */,
);
name = Products;
sourceTree = "<group>";
};
415631452297C85D009EB583 /* Products */ = {
isa = PBXGroup;
children = (
415631492297C85D009EB583 /* libimageCropPicker.a */,
);
name = Products;
sourceTree = "<group>";
};
4166A0DF22895B4B0086277D /* Products */ = {
isa = PBXGroup;
children = (
@ -633,6 +694,8 @@
7FC4807EA1FA42A4A55BDAE5 /* libRNVectorIcons-tvOS.a */,
4B6943EF54DC4C0E8C860C48 /* libRNDeviceInfo.a */,
784C7C58E2B04EECBD71EF5E /* libRNDeviceInfo-tvOS.a */,
C988095E6478452AAAF73E23 /* libRCTImageResizer.a */,
996469B8096342559A8F98D6 /* libimageCropPicker.a */,
);
name = "Recovered References";
sourceTree = "<group>";
@ -699,6 +762,8 @@
FE0D7FAFEDE44E168687B4B2 /* RNCAsyncStorage.xcodeproj */,
000EDE6A5D7D497FB251CC09 /* RNVectorIcons.xcodeproj */,
D16AA0DE1A4348A8B86F08A1 /* RNDeviceInfo.xcodeproj */,
DE970E03BCC84CE8A281A103 /* RCTImageResizer.xcodeproj */,
BDBA91D5680B4ACA83A7844B /* imageCropPicker.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
@ -715,6 +780,8 @@
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
4156314E2297CFBE009EB583 /* QBImagePicker.framework */,
4156314A2297CFA5009EB583 /* RSKImageCropper.framework */,
13B07FAE1A68108700A75B9A /* Timepill */,
832341AE1AAA6A7D00B99B32 /* Libraries */,
00E356EF1AD99517003FC87E /* TimepillTests */,
@ -795,6 +862,7 @@
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
4156314D2297CFA6009EB583 /* Embed Frameworks */,
);
buildRules = (
);
@ -878,6 +946,10 @@
productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 415631452297C85D009EB583 /* Products */;
ProjectRef = BDBA91D5680B4ACA83A7844B /* imageCropPicker.xcodeproj */;
},
{
ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */;
ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
@ -898,6 +970,10 @@
ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */;
ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
},
{
ProductGroup = 415630FF2297C79C009EB583 /* Products */;
ProjectRef = DE970E03BCC84CE8A281A103 /* RCTImageResizer.xcodeproj */;
},
{
ProductGroup = 78C398B11ACF4ADC00677621 /* Products */;
ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
@ -1150,6 +1226,20 @@
remoteRef = 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
415631032297C79D009EB583 /* libRCTImageResizer.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTImageResizer.a;
remoteRef = 415631022297C79D009EB583 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
415631492297C85D009EB583 /* libimageCropPicker.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libimageCropPicker.a;
remoteRef = 415631482297C85D009EB583 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
4166A0E422895B4C0086277D /* libReactNativeNavigation.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@ -1409,6 +1499,8 @@
"$(SRCROOT)/../node_modules/@react-native-community/async-storage/ios",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo",
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
"$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**",
);
INFOPLIST_FILE = TimepillTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
@ -1420,6 +1512,8 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@ -1441,6 +1535,8 @@
"$(SRCROOT)/../node_modules/@react-native-community/async-storage/ios",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo",
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
"$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**",
);
INFOPLIST_FILE = TimepillTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
@ -1452,6 +1548,8 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@ -1474,6 +1572,8 @@
"$(SRCROOT)/../node_modules/@react-native-community/async-storage/ios",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo",
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
"$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**",
);
INFOPLIST_FILE = Timepill/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@ -1498,6 +1598,8 @@
"$(SRCROOT)/../node_modules/@react-native-community/async-storage/ios",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo",
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
"$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**",
);
INFOPLIST_FILE = Timepill/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@ -1529,6 +1631,8 @@
"$(SRCROOT)/../node_modules/@react-native-community/async-storage/ios",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo",
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
"$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**",
);
INFOPLIST_FILE = "Timepill-tvOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@ -1539,6 +1643,8 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@ -1569,6 +1675,8 @@
"$(SRCROOT)/../node_modules/@react-native-community/async-storage/ios",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo",
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
"$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**",
);
INFOPLIST_FILE = "Timepill-tvOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@ -1579,6 +1687,8 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@ -1608,6 +1718,8 @@
"$(SRCROOT)/../node_modules/@react-native-community/async-storage/ios",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo",
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
"$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**",
);
INFOPLIST_FILE = "Timepill-tvOSTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@ -1618,6 +1730,8 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@ -1647,6 +1761,8 @@
"$(SRCROOT)/../node_modules/@react-native-community/async-storage/ios",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo",
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
"$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**",
);
INFOPLIST_FILE = "Timepill-tvOSTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@ -1657,6 +1773,8 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",

View file

@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSCameraUsageDescription</key>
<string></string>
<key>NSPhotoLibraryUsageDescription</key>
<string></string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
@ -25,7 +29,7 @@
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<string/>
<string></string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>

10
package-lock.json generated
View file

@ -10845,6 +10845,16 @@
"prop-types": "^15.5.8"
}
},
"react-native-image-crop-picker": {
"version": "0.24.0",
"resolved": "https://registry.npm.taobao.org/react-native-image-crop-picker/download/react-native-image-crop-picker-0.24.0.tgz",
"integrity": "sha1-3xAVSPcpUb9m5WCIevc7EfMovdA="
},
"react-native-image-resizer": {
"version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/react-native-image-resizer/download/react-native-image-resizer-1.0.0.tgz",
"integrity": "sha1-1H4UlDw3k44of71jnk23zrf9iRc="
},
"react-native-iphone-x-helper": {
"version": "1.0.2",
"resolved": "http://registry.npm.taobao.org/react-native-iphone-x-helper/download/react-native-iphone-x-helper-1.0.2.tgz",

View file

@ -16,6 +16,8 @@
"react-native-datepicker": "^1.7.2",
"react-native-device-info": "^1.6.1",
"react-native-elements": "^0.19.0",
"react-native-image-crop-picker": "^0.24.0",
"react-native-image-resizer": "^1.0.0",
"react-native-iphone-x-helper": "^1.0.2",
"react-native-keyboard-spacer": "^0.4.1",
"react-native-navigation": "^2.18.5",

View file

View file

@ -63,7 +63,7 @@ export default class NotebookList extends Component {
_onAddPress() {
Navigation.push(this.props.componentId, {
component: {
name: 'NotebookAdd',
name: 'NotebookEdit',
passProps: {
}

View file

@ -1,15 +1,20 @@
import React, {Component} from 'react';
import {StyleSheet, Text, View, ScrollView, Switch, TextInput, TouchableOpacity} from 'react-native';
import {Navigation} from 'react-native-navigation';
import ActionSheet from 'react-native-actionsheet-api';
import ImagePicker from 'react-native-image-crop-picker'
import ImageResizer from 'react-native-image-resizer'
import Color from '../style/color';
import {Icon} from '../style/icon';
import Msg from '../util/msg';
import Api from '../util/api';
import Loading from '../component/loading'
import DateInput from '../component/dateInput'
export default class NotebookAddPage extends Component {
export default class NotebookEditPage extends Component {
constructor(props) {
super(props);
@ -20,7 +25,9 @@ export default class NotebookAddPage extends Component {
subject: '',
isPublic: false,
dateString: ''
dateString: '',
uploading: false
}
}
@ -49,9 +56,97 @@ export default class NotebookAddPage extends Component {
console.log('date string:', this.dateInput.getDate());
}
async resizePhoto(uri, oWidth, oHeight) {
let width = 0;
let height = 0;
let maxPixel = 640 * 640;
let oPixel = oWidth * oHeight;
if(oPixel > maxPixel) {
width = Math.sqrt(oWidth * maxPixel / oHeight);
height = Math.sqrt(oHeight * maxPixel / oWidth);
} else {
width = oWidth;
height = oHeight;
}
const newUri = await ImageResizer.createResizedImage(uri, width, height, 'JPEG', 75);
return 'file://' + newUri.uri;
}
async _uploadCover(uri, width, height) {
const newUri = await this.resizePhoto(uri, width, height);
try {
this.setState({uploading: true});
let result = await Api.updateNotebookCover(this.props.notebook.id, newUri);
if(result) {
Msg.showMsg('封面保存成功');
} else {
throw {
message: 'upload notebook cover failed'
}
}
} catch (e) {
Msg.showMsg('封面保存失败');
}
this.setState({uploading: false});
}
_onEditCover() {
ActionSheet.showActionSheetWithOptions({
options: ['拍照', '从相册选择', '取消'],
cancelButtonIndex: 2,
title: '设置封面'
}, (index) => {
if (index != 2) {
let imageOption = {
width: 640,
height: 480,
cropping: true
};
let imageSelect = index == 0
? ImagePicker.openCamera(imageOption) : ImagePicker.openPicker(imageOption);
imageSelect.then(image => {
this._uploadCover(image.path, image.width, image.height);
})
}
});
}
_onDelete() {
Navigation.popToRoot(this.props.componentId);
/*
let notebookId = this.state.notebook ? this.state.notebook.id;
if(!notebookId) {
return;
}
Api.deleteNotebook(notebookId)
.then(() => {
Alert.alert('提示', '日记本已删除', [{text: '好', onPress: () => {
Navigation.popToRoot();
}}]);
})
.catch((err) => {
Alert.alert('删除失败', err.message)
});
*/
}
render() {
return (
<View style={localStyle.wrap}>
<Loading visible={this.state.uploading}></Loading>
<View style={localStyle.group}>
<View style={localStyle.item}>
@ -89,6 +184,24 @@ export default class NotebookAddPage extends Component {
</View>
<View style={localStyle.group}>
<TouchableOpacity style={localStyle.item}
onPress={this._onEditCover.bind(this)}>
<Text style={localStyle.editCover}>设置封面</Text>
</TouchableOpacity>
</View>
<View>
<View style={localStyle.group}>
<TouchableOpacity style={localStyle.item}
onPress={this._onDelete.bind(this)}>
<Text style={localStyle.delete}>删除</Text>
</TouchableOpacity>
</View>
<Text style={localStyle.tip}>提示写过的日记本不能被删除</Text>
</View>
</View>
);
}
@ -133,6 +246,24 @@ const localStyle = StyleSheet.create({
padding: 0,
height: '100%',
justifyContent: 'center'
},
editCover: {
flex: 1,
textAlign: 'center',
color: Color.light,
fontSize: 16
},
delete: {
flex: 1,
textAlign: 'center',
color: '#d9534f',
fontSize: 16
},
tip: {
fontSize: 12,
padding: 10,
paddingTop: 8,
color: Color.inactiveText
}
});

View file

@ -3,8 +3,8 @@ DiaryDetail: require("./DiaryDetailPage.js").default,
Follow: require("./FollowPage.js").default,
FollowUser: require("./FollowUserPage.js").default,
Home: require("./HomePage.js").default,
NotebookAdd: require("./NotebookAddPage.js").default,
NotebookDetail: require("./NotebookDetailPage.js").default,
NotebookEdit: require("./NotebookEditPage.js").default,
NotificationHistory: require("./NotificationHistoryPage.js").default,
Notification: require("./NotificationPage.js").default,
User: require("./UserPage.js").default,

View file

@ -125,6 +125,45 @@ async function deleteDiary(id) {
}
async function updateNotebookCover(bookId, photoUri) {
return upload('POST', `/notebooks/${bookId}/cover`, {
cover: {
uri: photoUri,
name: 'image.jpg',
type: 'image/jpg'
}
})
}
async function upload(method, api, body) {
let token = await TokenManager.getToken();
let formData = new FormData();
for(let prop of Object.keys(body)) {
formData.append(prop, body[prop]);
}
return timeout(
fetch(baseUrl + api, {
method: method,
headers: {
'Authorization': token,
'Accept': 'application/json',
'Content-Type': 'multipart/form-data',
'X-TP-OS': OS,
'X-TP-OS-Version': OS_VERSION,
'X-TP-Version': VERSION,
'X-TP-Device-ID': DEVICE_ID,
},
body: formData
})
.then(checkStatus)
.then(parseJSON)
.catch(handleCatch)
, 60000);
}
async function call(method, api, body, _timeout = 10000) {
let token = await TokenManager.getUserToken();
@ -219,6 +258,7 @@ export default {
getFollowDiaries,
getNotebookDiaries,
getUserTodayDiaries,
deleteDiary,
getDiaryComments,
@ -232,5 +272,5 @@ export default {
getMessagesHistory,
deleteDiary
updateNotebookCover
}