This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RNApp/app/loggedIn.js | |
import React, { | |
View, | |
Text | |
} from 'react-native'; | |
import Button from './button'; | |
import ddpClient from './ddp'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RNApp/app/index.js | |
import React, { | |
View, | |
StyleSheet | |
} from 'react-native'; | |
import ddpClient from './ddp'; | |
import LoggedIn from './loggedIn'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RNApp/app/loggedOut.js | |
import React, { | |
View, | |
Text, | |
TextInput, | |
StyleSheet | |
} from 'react-native'; | |
import Button from './button'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RNApp/app/index.js | |
/* | |
* Removed from snippet for brevity | |
*/ | |
import LoggedOut from './loggedOut'; | |
export default React.createClass({ | |
getInitialState() { | |
return { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RNApp/app/loggedIn.js | |
/* | |
* Removed from snippet for brevity | |
*/ | |
export default React.createClass({ | |
/* | |
* Removed from snippet for brevity | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RNApp/app/loggedOut.js | |
import React, { | |
View, | |
Text, | |
TextInput, | |
StyleSheet, | |
AsyncStorage // Import AsyncStorage | |
} from 'react-native'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// meteor-app/both/posts.js | |
'addPost': function() { | |
Posts.insert({ | |
title: 'Post ' + Random.id(), | |
userId: this.userId | |
}); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- In /meteor-app/client/home.html --> | |
<template name="home"> | |
{{> loginButtons}} | |
<h1>Post Count: {{count}}</h1> | |
<button id="increment">Increment</button> | |
<button id="decrement">Decrement</button> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In RNApp/app/ddp.js | |
import DDPClient from 'ddp-client'; | |
import hash from 'hash.js'; | |
import { AsyncStorage } from 'react-native'; | |
let ddpClient = new DDPClient({ | |
host: 'localhost', | |
port: '3000', | |
// url: <your websocket url> | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In RNApp/app/ddp.js | |
/* | |
* Removed from snippet for brevity | |
*/ | |
ddpClient.sha256 = (password) => { | |
return { | |
digest: hash.sha256().update(password).digest('hex'), | |
algorithm: "sha-256" |