Skip to content

Commit 6379fb9

Browse files
authored
initial load of cloudbankmobile ui (#446)
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
1 parent d67fa9f commit 6379fb9

File tree

86 files changed

+33087
-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.

86 files changed

+33087
-0
lines changed
Lines changed: 6 additions & 0 deletions
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
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUNDLE_PATH: "vendor/bundle"
2+
BUNDLE_FORCE_RUBY_PLATFORM: 1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native-community',
4+
};
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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 polyfills
9+
node_modules/react-native/Libraries/polyfills/.*
10+
11+
; Flow doesn't support platforms
12+
.*/Libraries/Utilities/LoadingView.js
13+
14+
.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$
15+
16+
[untyped]
17+
.*/node_modules/@react-native-community/cli/.*/.*
18+
19+
[include]
20+
21+
[libs]
22+
node_modules/react-native/interface.js
23+
node_modules/react-native/flow/
24+
25+
[options]
26+
emoji=true
27+
28+
exact_by_default=true
29+
30+
format.bracket_spacing=false
31+
32+
module.file_ext=.js
33+
module.file_ext=.json
34+
module.file_ext=.ios.js
35+
36+
munge_underscores=true
37+
38+
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
39+
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\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
40+
41+
suppress_type=$FlowIssue
42+
suppress_type=$FlowFixMe
43+
suppress_type=$FlowFixMeProps
44+
suppress_type=$FlowFixMeState
45+
46+
[lints]
47+
sketchy-null-number=warn
48+
sketchy-null-mixed=warn
49+
sketchy-number=warn
50+
untyped-type-import=warn
51+
nonstrict-import=warn
52+
deprecated-type=warn
53+
unsafe-getters-setters=warn
54+
unnecessary-invariant=warn
55+
signature-verification-failure=warn
56+
57+
[strict]
58+
deprecated-type
59+
nonstrict-import
60+
sketchy-null
61+
unclear-type
62+
unsafe-getters-setters
63+
untyped-import
64+
untyped-type-import
65+
66+
[version]
67+
^0.170.0
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
24+
# Android/IntelliJ
25+
#
26+
build/
27+
.idea
28+
.gradle
29+
local.properties
30+
*.iml
31+
*.hprof
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+
!debug.keystore
44+
45+
# fastlane
46+
#
47+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
48+
# screenshots whenever they are needed.
49+
# For more information about the recommended setup visit:
50+
# https://docs.fastlane.tools/best-practices/source-control/
51+
52+
*/fastlane/report.xml
53+
*/fastlane/Preview.html
54+
*/fastlane/screenshots
55+
56+
# Bundle artifact
57+
*.jsbundle
58+
59+
# Ruby / CocoaPods
60+
/ios/Pods/
61+
/vendor/bundle/
62+
63+
docker-compose.yaml
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
arrowParens: 'avoid',
3+
bracketSameLine: true,
4+
bracketSpacing: false,
5+
singleQuote: true,
6+
trailingComma: 'all',
7+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.7.4
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// Copyright (c) 2022, Oracle and/or its affiliates.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+
import React, {useState} from 'react';
5+
import AsyncStorage from '@react-native-async-storage/async-storage';
6+
import LoginForm from './components/Login/LoginForm';
7+
import Home from './components/Home';
8+
import AccountDetail from './components/Accounts/AccountDetail';
9+
import {NavigationContainer} from '@react-navigation/native';
10+
import {createNativeStackNavigator} from '@react-navigation/native-stack';
11+
import CloudBankMasthead from './components/UI/CloudBankMasthead';
12+
import Transfer from './components/Transfer/Transfer';
13+
import Deposit from './components/Deposit/Deposit';
14+
import Payment from './components/Payment/Payment';
15+
import {Alert} from 'react-native';
16+
17+
const Stack = createNativeStackNavigator();
18+
19+
const App = () => {
20+
// isLoggedIn is used to control whether to show the login screen or the main app ui
21+
const [isLoggedIn, setIsLoggedIn] = useState(false);
22+
// user stores the username of the logged in user
23+
const [user, setUser] = useState('');
24+
25+
// called when the user logs out
26+
const logoutHandler = () => {
27+
AsyncStorage.removeItem('isLoggedIn');
28+
setIsLoggedIn(false);
29+
};
30+
31+
// called when the user logs in
32+
const loginHandler = (username, password, serverAddress) => {
33+
// do some very basic form validation
34+
if (username.length < 1) {
35+
Alert.alert('You must enter your username');
36+
return;
37+
}
38+
if (password.length < 1) {
39+
Alert.alert('You must enter your password');
40+
return;
41+
}
42+
// TODO call API to validate user exists, etc.
43+
44+
// store the logged in state and the server address that the user entered
45+
AsyncStorage.setItem('isLoggedIn', '1');
46+
AsyncStorage.setItem('serverAddress', serverAddress);
47+
setUser(username);
48+
setIsLoggedIn(true);
49+
};
50+
51+
return (
52+
<NavigationContainer>
53+
<Stack.Navigator
54+
screenOptions={{
55+
headerTitle: props => <CloudBankMasthead />,
56+
}}>
57+
{isLoggedIn ? (
58+
<>
59+
<Stack.Screen name="Home">
60+
{props => (
61+
<Home {...props} onLogout={logoutHandler} user={user} />
62+
)}
63+
</Stack.Screen>
64+
<Stack.Screen name="AccountDetail">
65+
{props => <AccountDetail {...props} />}
66+
</Stack.Screen>
67+
<Stack.Screen name="Transfer">
68+
{props => <Transfer {...props} user={user} />}
69+
</Stack.Screen>
70+
<Stack.Screen name="Payment">
71+
{props => <Payment {...props} user={user} />}
72+
</Stack.Screen>
73+
<Stack.Screen name="Deposit">
74+
{props => <Deposit {...props} user={user} />}
75+
</Stack.Screen>
76+
</>
77+
) : (
78+
<>
79+
<Stack.Screen name="Login">
80+
{props => <LoginForm {...props} onLogin={loginHandler} />}
81+
</Stack.Screen>
82+
</>
83+
)}
84+
</Stack.Navigator>
85+
</NavigationContainer>
86+
);
87+
};
88+
89+
export default App;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source 'https://rubygems.org'
2+
3+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4+
ruby '2.7.4'
5+
6+
gem 'cocoapods', '~> 1.11', '>= 1.11.2'

0 commit comments

Comments
 (0)