Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/config #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion app/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Messaging, { Routes as MessagingRoutes } from './views/Messaging';
import Presence, { Routes as PresenceRoutes } from './views/Presence'
import Analytics, { Routes as AnalyticsRoutes } from './views/Analytics';
import Storage, { Routes as StorageRoutes } from './views/Storage';
import RemoteConfig, { Routes as RemoteConfigRoutes } from './views/RemoteConfig';

export type Route = {
key: String,
Expand Down Expand Up @@ -62,6 +63,13 @@ export const exampleRoutes = {
Component: Storage
},
children: StorageRoutes
},
'remoteConfig': {
route: {
title: 'Remote Config',
Component: RemoteConfig
},
children: RemoteConfigRoutes
}
}

Expand All @@ -77,4 +85,4 @@ export const routes = toList({
},
});

export default routes;
export default routes;
62 changes: 62 additions & 0 deletions app/views/RemoteConfig/Demos/GetRemote.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React from 'react'

import {
View,
Text,
NativeModules,
Alert
} from 'react-native'

import env from '../../../../config/environment';
import { Container, Header, Title, Content, Button } from 'native-base';
import appStyles from '../../../styles/app';

export class GetConfig extends React.Component {

constructor(props){
super(props);

this.state = {
welcome_message: null
}
}

componentWillMount() {
const {firestack} = this.props;

firestack.remoteConfig.fetchWithExpiration(0)
.then(cfg => console.log(cfg))
.catch(err => config.error(err))
}

getConfig() {
let { firestack } = this.props;
firestack.remoteConfig.config('welcome_message')
.then(value => this.setState({welcome_message: value}))
.catch(error => console.error(error));
}

componentWillUnmount() {
const {firestack} = this.props;
}

render() {
let { welcome_message } = this.state;

return (
<Container>
<Content>
<Button
block
onPress={this.getConfig.bind(this)}>
Get Remote Config - welcome_message
</Button>
<Text>{welcome_message}</Text>
</Content>
</Container>
)
}

}

export default GetConfig
62 changes: 62 additions & 0 deletions app/views/RemoteConfig/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React from 'react';
import {connect} from 'react-redux'

import {
View,
Text
} from 'react-native'

import appStyles from '../../styles/app';
import List from '../../components/List/List'

import GetRemote from './Demos/GetRemote';

export const Routes = {
'get_config': {
route: {
title: 'Get remote config',
Component: GetRemote
}
}
}

console.log(GetRemote)

export class RemoteConfig extends React.Component {
render() {
const initialRows = Object.keys(Routes).map(key => {
const routeCfg = Routes[key];
return { title: routeCfg.route.title, key: `remoteConfig.${key}` }
})
return (
<View style={appStyles.container}>
<List
initialRows={initialRows}
renderRow={this._renderRow.bind(this)}
onRowPress={this._onRowPress.bind(this)}
/>
</View>
)
}

_renderRow(rowData, sectionID, rowID, highlightRow) {
console.log(rowData)
return (
<View style={[appStyles.row]}>
<Text>{rowData.title}</Text>
</View>
)
}

_onRowPress(rowData) {
const rowKey = rowData.key;
const {actions} = this.props;
const {navigation} = actions;
navigation.push(rowKey, this.props);
}
}

const mapStateToProps = (state) => ({
firestack: state.firestack
})
export default connect(mapStateToProps)(RemoteConfig)
3 changes: 3 additions & 0 deletions config/development.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
module.exports = {
firestack: {
debug: '*',
defaultConfig: {
'welcome_message': 'Welcome to the app. Local'
}
},
auth: {}
}
54 changes: 31 additions & 23 deletions ios/FirestackApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,30 @@
objects = {

/* Begin PBXBuildFile section */
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
00C302E51ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
00C302E71ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
00C302E81ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
00C302E91ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
00C302EA1ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
00E356F31AD99517003FC87E /* FirestackAppTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* FirestackAppTests.m */; };
0B01EE779F9042E9B93FCB78 /* MaterialIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 60D4DC9214BF416BB25A04F5 /* MaterialIcons.ttf */; };
0F87A14A55B94CA79AA8234E /* libRNVectorIcons.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 43A9680A7D7B4D12ADED1B46 /* libRNVectorIcons.a */; };
133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; };
133E29F31AD74F7200F7D852 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
139105C61AF99C1200B5F7CC /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
139FDEF61B0652A700C62182 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; };
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
140ED2AC1D01E1AD002B40FF /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
146834051AC3E58100842450 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
4F2EB34B0265421E9DC9F64D /* FontAwesome.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 03F453DB070844839A1D0615 /* FontAwesome.ttf */; };
544B46F31DDE5DD00057E78B /* libDCTAuth.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 544B46F21DDE5DD00057E78B /* libDCTAuth.a */; };
59577E629AC04BC782808B39 /* libRNFS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A6B1B7E628934FC0B6BBFE08 /* libRNFS.a */; };
5A23F9EA4D9B4B3E9DC07A5D /* Entypo.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B14D251F8788439EBDFC19D6 /* Entypo.ttf */; };
732154BF250AC131CEEECE4B /* libPods-FirestackApp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B96D879A35F8CCE9DDE1AF3 /* libPods-FirestackApp.a */; };
77979D8511B14C88B2EF35BB /* EvilIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = F0F6BD6002274B96B0321DBF /* EvilIcons.ttf */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
832341BD1AAA6AB300B99B32 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
88FE28F66975415F9FA689C1 /* Ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 3988AE0934704FD0ADAC9CE5 /* Ionicons.ttf */; };
8E1FEFA56A3C48EB835E0EC3 /* Zocial.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 621F832D582B499B8F88D567 /* Zocial.ttf */; };
9D3926C57AE14398ABB13FA6 /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = CB14CE3DFE5744D4A678C73E /* Octicons.ttf */; };
Expand Down Expand Up @@ -189,6 +190,7 @@
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
3988AE0934704FD0ADAC9CE5 /* Ionicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 0; includeInIndex = 0; lastKnownFileType = unknown; name = Ionicons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Ionicons.ttf"; sourceTree = "<group>"; };
43A9680A7D7B4D12ADED1B46 /* libRNVectorIcons.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 0; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNVectorIcons.a; sourceTree = "<group>"; };
544B46F21DDE5DD00057E78B /* libDCTAuth.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libDCTAuth.a; path = "Pods/../build/Debug-iphoneos/libDCTAuth.a"; sourceTree = "<group>"; };
5D4DBCF5A4BA4854BBD023F0 /* RNVectorIcons.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 0; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNVectorIcons.xcodeproj; path = "../node_modules/react-native-vector-icons/RNVectorIcons.xcodeproj"; sourceTree = "<group>"; };
60D4DC9214BF416BB25A04F5 /* MaterialIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 0; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf"; sourceTree = "<group>"; };
621F832D582B499B8F88D567 /* Zocial.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 0; includeInIndex = 0; lastKnownFileType = unknown; name = Zocial.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Zocial.ttf"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -218,28 +220,29 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */,
140ED2AC1D01E1AD002B40FF /* ReferenceProxy in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
544B46F31DDE5DD00057E78B /* libDCTAuth.a in Frameworks */,
D90AE2BE1DA86511001FE176 /* CFNetwork.framework in Frameworks */,
D99D24561DA7AB98004C9CF4 /* libresolv.tbd in Frameworks */,
D99D24541DA7AB91004C9CF4 /* Security.framework in Frameworks */,
732154BF250AC131CEEECE4B /* libPods-FirestackApp.a in Frameworks */,
146834051AC3E58100842450 /* libReact.a in Frameworks */,
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */,
00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */,
133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */,
00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */,
139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */,
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
146834051AC3E58100842450 /* ReferenceProxy in Frameworks */,
00C302E51ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */,
00C302E71ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */,
00C302E81ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */,
133E29F31AD74F7200F7D852 /* ReferenceProxy in Frameworks */,
00C302E91ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */,
139105C61AF99C1200B5F7CC /* ReferenceProxy in Frameworks */,
832341BD1AAA6AB300B99B32 /* ReferenceProxy in Frameworks */,
00C302EA1ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */,
139FDEF61B0652A700C62182 /* ReferenceProxy in Frameworks */,
0F87A14A55B94CA79AA8234E /* libRNVectorIcons.a in Frameworks */,
B914148F5A434E5A9680EC2C /* libFirestack.a in Frameworks */,
AAE721A98E364AC2A301BE95 /* StoreKit.framework in Frameworks */,
Expand Down Expand Up @@ -435,6 +438,7 @@
C5F76D1C98048D4704EBBA19 /* Frameworks */ = {
isa = PBXGroup;
children = (
544B46F21DDE5DD00057E78B /* libDCTAuth.a */,
D90AE2BD1DA86511001FE176 /* CFNetwork.framework */,
D99D24551DA7AB98004C9CF4 /* libresolv.tbd */,
D99D24531DA7AB91004C9CF4 /* Security.framework */,
Expand Down Expand Up @@ -801,7 +805,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down Expand Up @@ -897,6 +901,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 76;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = DEB2RAY5A4;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -919,6 +924,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/build/Debug-iphoneos/DCTAuth",
"$(PROJECT_DIR)/build/Debug-iphoneos",
);
OTHER_LDFLAGS = (
"$(inherited)",
Expand All @@ -942,6 +948,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 76;
DEVELOPMENT_TEAM = DEB2RAY5A4;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -964,6 +971,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/build/Debug-iphoneos/DCTAuth",
"$(PROJECT_DIR)/build/Debug-iphoneos",
);
OTHER_LDFLAGS = (
"$(inherited)",
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 70422e9e2b45cf788d75fa1c925bae7d8422d819

COCOAPODS: 1.0.1
COCOAPODS: 1.1.1
2 changes: 1 addition & 1 deletion ios/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading