Skip to content
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
7 changes: 5 additions & 2 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,26 @@ import {createStackNavigator} from 'react-navigation';
import rootReducer from './src/main/js/reducers';
import WelcomePage from './src/main/js/components/pages/welcomePage/WelcomePage';
import LoginPage from './src/main/js/components/pages/loginPage/LoginPage';
import RegisterPage from './src/main/js/components/pages/registerPage/RegisterPage';
import DonatrixPage from './src/main/js/components/pages/donatrixPage/DonatrixPage';


const store = createStore(rootReducer);

const RootStack = createStackNavigator(
{
Welcome: WelcomePage,
Login: LoginPage,
Donatrix: DonatrixPage
Register: RegisterPage,
Donatrix: DonatrixPage,
},
{
initialRouteName: 'Welcome',
headerMode: 'none'
}
);

const App = (page) => (
const App = () => (
<Provider store = {store}>
<RootStack />
</Provider>
Expand Down
187 changes: 48 additions & 139 deletions android/.idea/workspace.xml

Large diffs are not rendered by default.

12 changes: 1 addition & 11 deletions android/app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -87,27 +87,17 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-apk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-main-apk-res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/splits-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
Expand Down
1 change: 0 additions & 1 deletion android/app/src/main/java/com/donatrix/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.facebook.react.ReactActivity;

public class MainActivity extends ReactActivity {

/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
Expand Down
5 changes: 4 additions & 1 deletion android/app/src/main/java/com/donatrix/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;

import com.donatrix.RNJavaLinkPackage;

import java.util.Arrays;
import java.util.List;

Expand All @@ -22,7 +24,8 @@ public boolean getUseDeveloperSupport() {
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
new MainReactPackage(),
new RNJavaLinkPackage()
);
}

Expand Down
50 changes: 46 additions & 4 deletions android/app/src/main/java/com/donatrix/MysqlCon.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,37 @@ public MysqlCon() {

}

private void startConnection(String sql) {
private ResultSet startConnectionForData(String sql) {
ResultSet rs = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection con = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/Donatrix", "root",
"password");
// System.out.println("Connected to database");
// System.out.println(sql);
Statement stmt = con.createStatement();
// stmt.executeUpdate(sql);
rs = stmt.executeQuery(sql);
// ResultSetMetaData rsmd = rs.getMetaData();
// int columnNumer = rsmd.getColumnCount();
// while (rs.next()) {
// for (int i = 1; i <= columnNumer; i++ ) {
// if (i > 1) System.out.print(", ");
// String columnValue = rs.getString(i);
// System.out.print(columnValue + " " + rsmd.getColumnName(i));
// }
// System.out.println("");
// }
// System.out.println(rs);
} catch(Exception e) {
rs = null;
System.out.println(e);
}
return rs;
}

private void startConnectionForUpdate(String sql) {
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection con = DriverManager.getConnection(
Expand All @@ -32,12 +62,24 @@ private void startConnection(String sql) {
public void registerUser(String username, String password, String locked, String name) {
String sql = String.format("insert into donatrix.users values('%s'," +
"'%s','%s','%s')", username, password, locked, name);
startConnection(sql);
startConnectionForUpdate(sql);
}

public boolean checkRegisteredUser(String username) throws SQLException {
String sql = String.format("select * from donatrix.users where email = '%s';", username);

if (startConnectionForData(sql).next()) {
System.out.println("true");
return true;
}
System.out.println("False");
return false;
}

public static void main(String[] args) {
public static void main(String[] args) throws SQLException {
MysqlCon me = new MysqlCon();
me.registerUser("dpoole@gatech.edu", "password", "0", "Davidson Poole");
// me.registerUser("dpoole@gatech.edu", "password", "0", "Davidson Poole");
me.checkRegisteredUser("dpoole@gatech.edu");

// try {
// Class.forName("com.mysql.jdbc.Driver");
Expand Down
48 changes: 48 additions & 0 deletions android/app/src/main/java/com/donatrix/RNJavaLink.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

package com.donatrix;

import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.Callback;

public class RNJavaLink extends ReactContextBaseJavaModule {

private final ReactApplicationContext reactContext;

public RNJavaLink(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
}

@Override
public String getName() {
return "RNJavaLink";
}

@ReactMethod
public void addUser(String email, String fname, String lname, String pass, String confPass, Callback callback) {
boolean success = true;
//do database stuff and update the value of 'success' if necessary

//finally call the correct callback based off the updated value of 'success'
if (success) {
callback.invoke("added user");
} else {
callback.invoke("nice try buddy");
}
}

@ReactMethod
public void tryLogin(String email, String pass, Callback callback) {
boolean valid = true;
//do database stuff and update the value of 'valid' if necessary

//finally call the correct callback based off the updated value of 'valid'
if (valid) {
callback.invoke("valid");
} else {
callback.invoke("not valid");
}
}
}
28 changes: 28 additions & 0 deletions android/app/src/main/java/com/donatrix/RNJavaLinkPackage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.donatrix;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import com.facebook.react.bridge.JavaScriptModule;

public class RNJavaLinkPackage implements ReactPackage {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
return Arrays.<NativeModule>asList(new RNJavaLink(reactContext));
}

// Deprecated from RN 0.47
public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}

@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
}
30 changes: 30 additions & 0 deletions android/app/src/main/java/com/donatrix/User.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
package com.donatrix;

public class User {

private String email;
private String password;
private String name;
private boolean accountState;

public void setEmail(String email) {
this.email = email;
}
public String getEmail() {
return this.email;
}
public void setPassword(String password) {
this.password = password;
}
public String getPassword() {
return this.password;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
public void setAccountState(boolean accountState) {
this.accountState = accountState;
}
public boolean getAccountState() {
return this.accountState;
}
}
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Welcome to the Donatrix</h1>
Loading