Skip to content

Commit

Permalink
Release React SDK version 0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
briancaw committed Feb 26, 2016
1 parent f56c84e commit ab5954e
Show file tree
Hide file tree
Showing 60 changed files with 3,725 additions and 2 deletions.
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Xcode
!**/*.xcsettings
!**/*.xcscheme
*.pbxuser
!default.pbxuser
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Xcode, Gradle
build/

# Android
.idea
.gradle
local.properties
*.iml

# Node
node_modules
*.log
.nvm

# OS X
.DS_Store

# CocoaPods
Pods

# Emacs
*~
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AppboyProject
65 changes: 65 additions & 0 deletions AppboyProject/.flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[ignore]

# We fork some components by platform.
.*/*.web.js
.*/*.android.js

# Some modules have their own node_modules with overlap
.*/node_modules/node-haste/.*

# Ugh
.*/node_modules/babel.*
.*/node_modules/babylon.*
.*/node_modules/invariant.*

# Ignore react and fbjs where there are overlaps, but don't ignore
# anything that react-native relies on
.*/node_modules/fbjs/lib/Map.js
.*/node_modules/fbjs/lib/Promise.js
.*/node_modules/fbjs/lib/fetch.js
.*/node_modules/fbjs/lib/ExecutionEnvironment.js
.*/node_modules/fbjs/lib/isEmpty.js
.*/node_modules/fbjs/lib/crc32.js
.*/node_modules/fbjs/lib/ErrorUtils.js

# Flow has a built-in definition for the 'react' module which we prefer to use
# over the currently-untyped source
.*/node_modules/react/react.js
.*/node_modules/react/lib/React.js
.*/node_modules/react/lib/ReactDOM.js

# Ignore commoner tests
.*/node_modules/commoner/test/.*

# See https://github.com/facebook/flow/issues/442
.*/react-tools/node_modules/commoner/lib/reader.js

# Ignore jest
.*/node_modules/jest-cli/.*

# Ignore Website
.*/website/.*

[include]

[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js

[options]
module.system=haste

munge_underscores=true

module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
module.name_mapper='^[./a-zA-Z0-9$_-]+\.png$' -> 'RelativeImageStub'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-0]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-0]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy

[version]
0.20.1
34 changes: 34 additions & 0 deletions AppboyProject/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# OSX
#
.DS_Store

# 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/IJ
#
.idea
.gradle
local.properties

# node.js
#
node_modules/
npm-debug.log
1 change: 1 addition & 0 deletions AppboyProject/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
135 changes: 135 additions & 0 deletions AppboyProject/AppboyProject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View
} from 'react-native';

var Button = require('react-native-button');

const ReactAppboy = require('react-native-appboy-sdk');

class AppboyProject extends Component {
render() {
return (
<View style={styles.container}>
<Button
onPress={this._changeUserPress}>
Change User
</Button>
<Button
onPress={this._logCustomEventPress}>
Log Custom Event
</Button>
<Button
onPress={this._logPurchasePress}>
Log Purchase
</Button>
<Button
onPress={this._submitFeedbackPress}>
Submit Feedback
</Button>
<Button
onPress={this._logCustomAttributePress}>
Set Custom User Attributes
</Button>
<Button
onPress={this._logUserPropertiesPress}>
Set User Properties
</Button>
<Button
onPress={this._launchNewsFeedPress}>
Launch News Feed
</Button>
<Button
onPress={this._launchFeedbackPress}>
Launch Feedback
</Button>
<Button
onPress={this._unsetCustomUserAttributePress}>
Unset Custom User Attributes
</Button>
<Button
onPress={this._addToCustomAttributeArrayPress}>
Add to custom attribute array
</Button>
<Button
onPress={this._removeFromCustomAttributeArrayPress}>
Remove From Custom Attribute Array
</Button>
</View>
);
}
_changeUserPress(event) {
ReactAppboy.changeUser("theAppboyTestUser");
}
_logCustomEventPress(event) {
ReactAppboy.logCustomEvent("reactCustomEvent", {"p1" : "p2"});
}
_logPurchasePress(event) {
ReactAppboy.logPurchase("reactProductIdentifier", "1.2", "USD", 2, {"pp1" : "pp2"});
}
_submitFeedbackPress(event) {
ReactAppboy.submitFeedback("[email protected]", "great app asdf", true);
}
_logCustomAttributePress(event) {
ReactAppboy.setCustomUserAttribute("sk", "sv");
ReactAppboy.setCustomUserAttribute("doubleattr", 4.5);
ReactAppboy.setCustomUserAttribute("intattr", 88);
ReactAppboy.setCustomUserAttribute("booleanattr", true);
ReactAppboy.setCustomUserAttribute("dateattr", new Date());
ReactAppboy.setCustomUserAttribute("arrayattr", ["a", "b"]);
}
_logUserPropertiesPress(event) {
ReactAppboy.setFirstName("Brian");
ReactAppboy.setLastName("Wheeler");
ReactAppboy.setEmail("[email protected]");
ReactAppboy.setDateOfBirth(1987, 9, 21);
ReactAppboy.setCountry("USA");
ReactAppboy.setHomeCity("New York");
ReactAppboy.setGender(ReactAppboy.Genders.MALE);
ReactAppboy.setPhoneNumber("9085555555");
ReactAppboy.setAvatarImageUrl("https://raw.githubusercontent.com/Appboy/appboy-android-sdk/master/Appboy_Logo_400x100.png");
ReactAppboy.setEmailNotificationSubscriptionType(ReactAppboy.NotificationSubscriptionTypes.UNSUBSCRIBED);
ReactAppboy.setPushNotificationSubscriptionType(ReactAppboy.NotificationSubscriptionTypes.SUBSCRIBED);
}
_launchNewsFeedPress(event) {
ReactAppboy.launchNewsFeed();
}
_launchFeedbackPress(event) {
ReactAppboy.launchFeedback();
}
_unsetCustomUserAttributePress(event) {
ReactAppboy.unsetCustomUserAttribute("sk");
}
_addToCustomAttributeArrayPress(event) {
ReactAppboy.addToCustomUserAttributeArray("myArray", "arrayValue1");
ReactAppboy.addToCustomUserAttributeArray("myArray", "arrayValue2");
}
_removeFromCustomAttributeArrayPress(event) {
ReactAppboy.removeFromCustomUserAttributeArray("myArray", "arrayValue1");
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

export default AppboyProject;
Loading

0 comments on commit ab5954e

Please sign in to comment.