Merge pull request #101 from esteemapp/configuration

Configuration Structure closed #87
This commit is contained in:
Feruz M 2018-11-15 18:22:37 +02:00 committed by GitHub
commit 000fc1a624
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 124 additions and 2 deletions

1
.env.example Normal file
View File

@ -0,0 +1 @@
BACKEND_URL = https://myapi.com

1
.gitignore vendored
View File

@ -58,3 +58,4 @@ buck-out/
config.js
!src/screens/steem-connect/config.js
keystore/
.env

View File

@ -1,4 +1,5 @@
apply plugin: "com.android.application"
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
import com.android.build.OutputFile
@ -137,6 +138,7 @@ android {
}
dependencies {
compile project(':react-native-config')
compile project(':react-native-vector-icons')
compile project(':react-native-fast-image')
compile project(':realm')

View File

@ -3,6 +3,7 @@ package com.esteem;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.lugg.ReactNativeConfig.ReactNativeConfigPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.dylanvann.fastimage.FastImageViewPackage;
import io.realm.react.RealmReactPackage;
@ -28,6 +29,7 @@ public class MainApplication extends Application implements ReactApplication {
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new ReactNativeConfigPackage(),
new VectorIconsPackage(),
new FastImageViewPackage(),
new RealmReactPackage(),

View File

@ -1,4 +1,6 @@
rootProject.name = 'esteem'
include ':react-native-config'
project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/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-fast-image'

View File

@ -45,6 +45,7 @@
3D18392E6B3D4AAAB054A206 /* EvilIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = CDA19DB138184C9BB67FFA73 /* EvilIcons.ttf */; };
4314A99BA5C94BCD9E527873 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D4E083B771D4AF2AF62E4D2 /* libz.tbd */; };
548C6A754DAD401A8235DF14 /* Sansation_Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 224245E1366F46F98214C9B8 /* Sansation_Regular.ttf */; };
562E0C9042E0460E986E5415 /* libReactNativeConfig.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B9E70136F0D4FD8A55F8031 /* libReactNativeConfig.a */; };
6C00FDC7B4B54ACBABA6F462 /* Ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 388EA3B93FD64F479AA9977E /* Ionicons.ttf */; };
7918030CDF7C4D2A98040422 /* Sansation_Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E434A344B09D49AD966063AD /* Sansation_Bold.ttf */; };
7B80523EC6D64C05BF3B069B /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 454696104228474690AC269D /* libc++.tbd */; };
@ -308,6 +309,13 @@
remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4;
remoteInfo = "jschelpers-tvOS";
};
583D5B48219C7F2900C5006F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 062A4D4B07614C30BF03D907 /* ReactNativeConfig.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = EB2648DF1C7BE17A00B8F155;
remoteInfo = ReactNativeConfig;
};
58712346219B601100354CBE /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = AAAB371C708C493896DF647D /* RCTRestart.xcodeproj */;
@ -404,6 +412,7 @@
00E356EE1AD99517003FC87E /* esteemTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = esteemTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
00E356F21AD99517003FC87E /* esteemTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = esteemTests.m; sourceTree = "<group>"; };
062A4D4B07614C30BF03D907 /* ReactNativeConfig.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeConfig.xcodeproj; path = "../node_modules/react-native-config/ios/ReactNativeConfig.xcodeproj"; sourceTree = "<group>"; };
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = "<group>"; };
13B07F961A680F5B00A75B9A /* esteem.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = esteem.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -431,6 +440,7 @@
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
62AB655DC50F43FEA43A0DB5 /* Roboto.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Roboto.ttf; path = "../node_modules/native-base/Fonts/Roboto.ttf"; sourceTree = "<group>"; };
66AD4642077143E393F52059 /* MaterialIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialIcons.ttf; path = ../src/assets/Fonts/MaterialIcons.ttf; sourceTree = "<group>"; };
6B9E70136F0D4FD8A55F8031 /* libReactNativeConfig.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libReactNativeConfig.a; sourceTree = "<group>"; };
6E13BF49AA984CC7A97DBF2A /* MaterialCommunityIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialCommunityIcons.ttf; path = ../src/assets/Fonts/MaterialCommunityIcons.ttf; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
7BCF48F9914F4B659820D0F8 /* libRCTRestart.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRCTRestart.a; sourceTree = "<group>"; };
@ -489,6 +499,7 @@
F2A4ABA54EB8471B90554653 /* libRealmReact.a in Frameworks */,
7B80523EC6D64C05BF3B069B /* libc++.tbd in Frameworks */,
4314A99BA5C94BCD9E527873 /* libz.tbd in Frameworks */,
562E0C9042E0460E986E5415 /* libReactNativeConfig.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -645,6 +656,14 @@
name = Frameworks;
sourceTree = "<group>";
};
583D5B45219C7F2800C5006F /* Products */ = {
isa = PBXGroup;
children = (
583D5B49219C7F2900C5006F /* libReactNativeConfig.a */,
);
name = Products;
sourceTree = "<group>";
};
5871231D219B600900354CBE /* Recovered References */ = {
isa = PBXGroup;
children = (
@ -654,6 +673,7 @@
A3F54D7123BF487B9E36857D /* libRNVectorIcons.a */,
9C88393A6064468CBBC856BA /* libRealmReact.a */,
57A2D4F43661441EB7931F73 /* libRNVectorIcons-tvOS.a */,
6B9E70136F0D4FD8A55F8031 /* libReactNativeConfig.a */,
);
name = "Recovered References";
sourceTree = "<group>";
@ -738,6 +758,7 @@
AAAB371C708C493896DF647D /* RCTRestart.xcodeproj */,
CECE249991544C198CBC7498 /* RNVectorIcons.xcodeproj */,
2E516DDCFE2646AA87414D17 /* RealmReact.xcodeproj */,
062A4D4B07614C30BF03D907 /* ReactNativeConfig.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
@ -986,6 +1007,10 @@
ProductGroup = 146834001AC3E56700842450 /* Products */;
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
},
{
ProductGroup = 583D5B45219C7F2800C5006F /* Products */;
ProjectRef = 062A4D4B07614C30BF03D907 /* ReactNativeConfig.xcodeproj */;
},
{
ProductGroup = 58712351219B601200354CBE /* Products */;
ProjectRef = 2E516DDCFE2646AA87414D17 /* RealmReact.xcodeproj */;
@ -1230,6 +1255,13 @@
remoteRef = 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
583D5B49219C7F2900C5006F /* libReactNativeConfig.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libReactNativeConfig.a;
remoteRef = 583D5B48219C7F2900C5006F /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
58712347219B601100354CBE /* libRCTRestart.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@ -1480,6 +1512,7 @@
"$(SRCROOT)/../node_modules/react-native-restart/ios/RCTRestart/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-config/ios/ReactNativeConfig",
);
INFOPLIST_FILE = esteemTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
@ -1492,6 +1525,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@ -1515,6 +1549,7 @@
"$(SRCROOT)/../node_modules/react-native-restart/ios/RCTRestart/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-config/ios/ReactNativeConfig",
);
INFOPLIST_FILE = esteemTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
@ -1527,6 +1562,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@ -1551,6 +1587,7 @@
"$(SRCROOT)/../node_modules/react-native-restart/ios/RCTRestart/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-config/ios/ReactNativeConfig",
);
INFOPLIST_FILE = esteem/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@ -1577,6 +1614,7 @@
"$(SRCROOT)/../node_modules/react-native-restart/ios/RCTRestart/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-config/ios/ReactNativeConfig",
);
INFOPLIST_FILE = esteem/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@ -1610,6 +1648,7 @@
"$(SRCROOT)/../node_modules/react-native-restart/ios/RCTRestart/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-config/ios/ReactNativeConfig",
);
INFOPLIST_FILE = "esteem-tvOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@ -1621,6 +1660,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@ -1653,6 +1693,7 @@
"$(SRCROOT)/../node_modules/react-native-restart/ios/RCTRestart/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-config/ios/ReactNativeConfig",
);
INFOPLIST_FILE = "esteem-tvOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@ -1664,6 +1705,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@ -1695,6 +1737,7 @@
"$(SRCROOT)/../node_modules/react-native-restart/ios/RCTRestart/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-config/ios/ReactNativeConfig",
);
INFOPLIST_FILE = "esteem-tvOSTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@ -1706,6 +1749,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@ -1737,6 +1781,7 @@
"$(SRCROOT)/../node_modules/react-native-restart/ios/RCTRestart/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/realm/src/**",
"$(SRCROOT)/../node_modules/react-native-config/ios/ReactNativeConfig",
);
INFOPLIST_FILE = "esteem-tvOSTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@ -1748,6 +1793,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@ -1807,6 +1853,9 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional";
INFOPLIST_PREFIX_HEADER = "${BUILD_DIR}/GeneratedInfoPlistDotEnv.h";
INFOPLIST_PREPROCESS = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@ -1853,6 +1902,9 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional";
INFOPLIST_PREFIX_HEADER = "${BUILD_DIR}/GeneratedInfoPlistDotEnv.h";
INFOPLIST_PREPROCESS = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;

9
package-lock.json generated
View File

@ -8297,7 +8297,7 @@
},
"fs-extra": {
"version": "1.0.0",
"resolved": "http://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz",
"integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=",
"requires": {
"graceful-fs": "^4.1.2",
@ -10066,7 +10066,7 @@
},
"fs-extra": {
"version": "1.0.0",
"resolved": "http://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz",
"integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=",
"requires": {
"graceful-fs": "^4.1.2",
@ -10114,6 +10114,11 @@
"prop-types": "^15.5.10"
}
},
"react-native-config": {
"version": "0.11.5",
"resolved": "https://registry.npmjs.org/react-native-config/-/react-native-config-0.11.5.tgz",
"integrity": "sha512-u1ScTyJXsCZM8Kt8eVEZZw4vtbWOffwAv1HpMwGRRuerqQC99hTBOhFKGCvxPr6APHqYJO3vQYoad/Cjb5VGWw=="
},
"react-native-dismiss-keyboard": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/react-native-dismiss-keyboard/-/react-native-dismiss-keyboard-1.0.0.tgz",

View File

@ -32,6 +32,7 @@
"react": "^16.6.0-alpha.8af6728",
"react-intl": "^2.7.2",
"react-native": "^0.57.5",
"react-native-config": "^0.11.5",
"react-native-extended-stylesheet": "^0.10.0",
"react-native-fast-image": "^4.0.14",
"react-native-html-renderer": "^1.0.0",

11
src/config/api.js Normal file
View File

@ -0,0 +1,11 @@
import axios from 'axios';
import Config from 'react-native-config';
const api = axios.create({
baseURL: Config.BACKEND_URL,
headers: {
'Content-Type': 'application/json',
},
});
export default api;

View File

@ -0,0 +1,45 @@
import api from '../../config/api';
export const getDrafts = data => new Promise((resolve, reject) => {
api
.get(`/drafts/${data.user}`)
.then((res) => {
resolve(res.data);
})
.catch((error) => {
reject(error);
});
});
export const removeDraft = data => new Promise((resolve, reject) => {
api
.delete(`/drafts/${data.user}/${data.draftId}`)
.then((res) => {
resolve(res.data);
})
.catch((error) => {
reject(error);
});
});
export const addDraft = data => new Promise((resolve, reject) => {
api
.post('/draft', data)
.then((res) => {
resolve(res.data);
})
.catch((error) => {
reject(error);
});
});
export const updateDraft = data => new Promise((resolve, reject) => {
api
.put(`/drafts/${data.user}/${data.draftId}`, data)
.then((res) => {
resolve(res.data);
})
.catch((error) => {
reject(error);
});
});