Skip to content

Commit cee25dd

Browse files
committed
commit after amtlis
0 parents  commit cee25dd

File tree

100 files changed

+21788
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+21788
-0
lines changed

.buckconfig

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
[android]
3+
target = Google Inc.:Google APIs:23
4+
5+
[maven_repositories]
6+
central = https://repo1.maven.org/maven2

.eslintrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native-community',
4+
};

.flowconfig

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
[ignore]
2+
; We fork some components by platform
3+
.*/*[.]android.js
4+
5+
; Ignore "BUCK" generated dirs
6+
<PROJECT_ROOT>/\.buckd/
7+
8+
; Ignore unexpected extra "@providesModule"
9+
.*/node_modules/.*/node_modules/fbjs/.*
10+
11+
; Ignore duplicate module providers
12+
; For RN Apps installed via npm, "Libraries" folder is inside
13+
; "node_modules/react-native" but in the source repo it is in the root
14+
node_modules/react-native/Libraries/react-native/React.js
15+
16+
; Ignore polyfills
17+
node_modules/react-native/Libraries/polyfills/.*
18+
19+
; These should not be required directly
20+
; require from fbjs/lib instead: require('fbjs/lib/warning')
21+
node_modules/warning/.*
22+
23+
; Flow doesn't support platforms
24+
.*/Libraries/Utilities/HMRLoadingView.js
25+
26+
[untyped]
27+
.*/node_modules/@react-native-community/cli/.*/.*
28+
29+
[include]
30+
31+
[libs]
32+
node_modules/react-native/Libraries/react-native/react-native-interface.js
33+
node_modules/react-native/flow/
34+
35+
[options]
36+
emoji=true
37+
38+
esproposal.optional_chaining=enable
39+
esproposal.nullish_coalescing=enable
40+
41+
module.file_ext=.js
42+
module.file_ext=.json
43+
module.file_ext=.ios.js
44+
45+
module.system=haste
46+
module.system.haste.use_name_reducers=true
47+
# get basename
48+
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
49+
# strip .js or .js.flow suffix
50+
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
51+
# strip .ios suffix
52+
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
53+
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
54+
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
55+
module.system.haste.paths.blacklist=.*/__tests__/.*
56+
module.system.haste.paths.blacklist=.*/__mocks__/.*
57+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
58+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/RNTester/.*
59+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/IntegrationTests/.*
60+
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation.js
61+
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
62+
63+
munge_underscores=true
64+
65+
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
66+
67+
suppress_type=$FlowIssue
68+
suppress_type=$FlowFixMe
69+
suppress_type=$FlowFixMeProps
70+
suppress_type=$FlowFixMeState
71+
72+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
73+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
74+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
75+
76+
[lints]
77+
sketchy-null-number=warn
78+
sketchy-null-mixed=warn
79+
sketchy-number=warn
80+
untyped-type-import=warn
81+
nonstrict-import=warn
82+
deprecated-type=warn
83+
unsafe-getters-setters=warn
84+
inexact-spread=warn
85+
unnecessary-invariant=warn
86+
signature-verification-failure=warn
87+
deprecated-utility=error
88+
89+
[strict]
90+
deprecated-type
91+
nonstrict-import
92+
sketchy-null
93+
unclear-type
94+
unsafe-getters-setters
95+
untyped-import
96+
untyped-type-import
97+
98+
[version]
99+
^0.98.0

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pbxproj -text

.gitignore

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
project.xcworkspace
24+
25+
# Android/IntelliJ
26+
#
27+
build/
28+
.idea
29+
.gradle
30+
local.properties
31+
*.iml
32+
33+
# node.js
34+
#
35+
node_modules/
36+
npm-debug.log
37+
yarn-error.log
38+
39+
# BUCK
40+
buck-out/
41+
\.buckd/
42+
*.keystore
43+
44+
# fastlane
45+
#
46+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47+
# screenshots whenever they are needed.
48+
# For more information about the recommended setup visit:
49+
# https://docs.fastlane.tools/best-practices/source-control/
50+
51+
*/fastlane/report.xml
52+
*/fastlane/Preview.html
53+
*/fastlane/screenshots
54+
55+
# Bundle artifact
56+
*.jsbundle
57+
58+
# CocoaPods
59+
/ios/Pods/

.prettierrc.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
bracketSpacing: false,
3+
jsxBracketSameLine: true,
4+
singleQuote: true,
5+
trailingComma: 'all',
6+
};

.watchmanconfig

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

App.js

+159
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
import React, {Component} from 'react';
2+
import {AsyncStorage} from 'react-native';
3+
import {createAppContainer, createSwitchNavigator} from 'react-navigation';
4+
import {createStackNavigator} from 'react-navigation-stack';
5+
import {createBottomTabNavigator} from 'react-navigation-tabs';
6+
import LoginScreen from './src/screens/LoginScreen';
7+
import HomeScreen from './src/screens/HomeScreen';
8+
import AuthLoadingScreen from './src/screens/AuthLoadingScreen';
9+
import ChatScreen from './src/screens/ChatScreen';
10+
import SplashScreen from './src/screens/SplashScreen';
11+
import SignUpScreen from './src/screens/SignUpScreen';
12+
import ProfileScreen from './src/screens/ProfileScreen';
13+
import ListChatScreen from './src/screens/ListChatsScreen';
14+
import FriendScreen from './src/screens/FriendProfile';
15+
import OneSignal from 'react-native-onesignal';
16+
import {Icon} from 'native-base';
17+
import audio from 'react-native-sound';
18+
import DeviceId from './src/Publics/store/deviceId';
19+
const AppStack = createStackNavigator({
20+
Home: HomeScreen,
21+
Chat: ChatScreen,
22+
});
23+
24+
const ChatStack = createStackNavigator({
25+
ListChat: ListChatScreen,
26+
Chat: ChatScreen,
27+
Friend: FriendScreen,
28+
});
29+
const HomeBottom = createBottomTabNavigator(
30+
{
31+
Home: {
32+
screen: AppStack,
33+
navigationOptions: {
34+
tabBarLabel: 'Home',
35+
tabBarIcon: ({tintColor}) => (
36+
<Icon
37+
type="MaterialCommunityIcons"
38+
name="google-maps"
39+
style={{fontSize: 20, color: tintColor}}
40+
/>
41+
),
42+
},
43+
},
44+
ListChat: {
45+
screen: ChatStack,
46+
navigationOptions: {
47+
tabBarLabel: 'Chat',
48+
tabBarIcon: ({tintColor}) => (
49+
<Icon
50+
type="FontAwesome"
51+
name="wechat"
52+
style={{fontSize: 20, color: tintColor}}
53+
/>
54+
),
55+
},
56+
},
57+
Profile: {
58+
screen: ProfileScreen,
59+
navigationOptions: {
60+
tabBarLabel: 'Profile',
61+
tabBarIcon: ({tintColor}) => (
62+
<Icon
63+
type="EvilIcons"
64+
name="user"
65+
style={{fontSize: 20, color: tintColor}}
66+
/>
67+
),
68+
},
69+
},
70+
},
71+
{
72+
tabBarOptions: {
73+
activeTintColor: '#5ba4e5',
74+
inactiveTintColor: 'grey',
75+
style: {
76+
backgroundColor: 'white',
77+
borderTopWidth: 0,
78+
shadowOffset: {width: 5, height: 3},
79+
shadowColor: 'black',
80+
shadowOpacity: 0.5,
81+
elevation: 5,
82+
},
83+
},
84+
},
85+
);
86+
const AuthStack = createStackNavigator({
87+
SignIn: {
88+
screen: LoginScreen,
89+
navigationOptions: ({navigation}) => ({header: null}),
90+
},
91+
Register: {
92+
screen: SignUpScreen,
93+
navigationOptions: ({navigation}) => ({header: null}),
94+
},
95+
Home: {
96+
screen: HomeBottom,
97+
},
98+
});
99+
100+
const AppRoot = createAppContainer(
101+
createSwitchNavigator(
102+
{
103+
SplashScreen: SplashScreen,
104+
AuthLoading: AuthLoadingScreen,
105+
App: HomeBottom,
106+
Auth: AuthStack,
107+
},
108+
{
109+
initialRouteName: 'SplashScreen',
110+
headerMode: 'none',
111+
},
112+
),
113+
);
114+
export default class App extends Component {
115+
constructor(properties) {
116+
super(properties);
117+
OneSignal.init('d78bd285-678f-429b-9b7e-1a8588d4a279');
118+
119+
OneSignal.addEventListener('received', this.onReceived);
120+
OneSignal.addEventListener('opened', this.onOpened);
121+
OneSignal.addEventListener('ids', this.onIds);
122+
OneSignal.enableSound(false);
123+
OneSignal.inFocusDisplaying(2);
124+
OneSignal.enableVibrate(true);
125+
}
126+
127+
componentWillUnmount() {
128+
OneSignal.removeEventListener('received', this.onReceived);
129+
OneSignal.removeEventListener('opened', this.onOpened);
130+
OneSignal.removeEventListener('ids', this.onIds);
131+
}
132+
133+
onReceived(notification) {
134+
console.log('Notification received: ', notification);
135+
const notif = new audio('onichan.mp3', audio.MAIN_BUNDLE, err => {
136+
if (err) {
137+
return;
138+
}
139+
notif.play();
140+
});
141+
}
142+
143+
onOpened(openResult) {
144+
console.log('Message: ', openResult.notification.payload.body);
145+
console.log('Data: ', openResult.notification.payload.additionalData);
146+
console.log('isActive: ', openResult.notification.isAppInFocus);
147+
console.log('openResult: ', openResult);
148+
}
149+
150+
onIds(device) {
151+
console.log('Device info: ', device);
152+
DeviceId.IDPonsel = device.userId;
153+
AsyncStorage.setItem('idponsel', device.userId);
154+
console.warn(DeviceId.IDPonsel);
155+
}
156+
render() {
157+
return <AppRoot />;
158+
}
159+
}

0 commit comments

Comments
 (0)