Compare commits
27 commits
master
...
stableclea
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e547852d79 | ||
![]() |
e806c990ff | ||
![]() |
39fd145cdd | ||
![]() |
f16ec4c8fc | ||
![]() |
cc8918c8ed | ||
![]() |
adbfddf834 | ||
![]() |
7a4e7bf549 | ||
![]() |
4bd2b8d0da | ||
![]() |
82a75648a1 | ||
![]() |
57cd29ad6f | ||
![]() |
62f8b0a8df | ||
![]() |
07d3f94a40 | ||
![]() |
73132974db | ||
![]() |
53f65d9609 | ||
![]() |
81d4d33d3d | ||
![]() |
1d2bdf0808 | ||
![]() |
110e7794fd | ||
![]() |
b617aadbba | ||
![]() |
ef981aee4b | ||
![]() |
edbeb5bb0c | ||
![]() |
7f3e0fa6a7 | ||
![]() |
0e3f52c91c | ||
![]() |
8a78eda50d | ||
![]() |
4d1ff7da1f | ||
![]() |
d74218fb29 | ||
![]() |
2d9ed1d1f8 | ||
![]() |
1fcf0686d5 |
Binary file not shown.
|
@ -5,22 +5,26 @@
|
||||||
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||||
<option name="myNullables">
|
<option name="myNullables">
|
||||||
<value>
|
<value>
|
||||||
<list size="5">
|
<list size="7">
|
||||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||||
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
|
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
|
||||||
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||||
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||||
|
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
|
||||||
|
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
<option name="myNotNulls">
|
<option name="myNotNulls">
|
||||||
<value>
|
<value>
|
||||||
<list size="4">
|
<list size="6">
|
||||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||||
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
|
||||||
|
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
<mapping directory="" vcs="Git" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -1,32 +1,43 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 26
|
compileSdkVersion 27
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.example.monnthic.monnthicmobile"
|
applicationId 'com.monnethic.appmobile'
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
minSdkVersion 19
|
minSdkVersion 19
|
||||||
targetSdkVersion 26
|
targetSdkVersion 27
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
buildToolsVersion '28.0.3'
|
||||||
|
productFlavors {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
implementation 'com.android.support:appcompat-v7:26.1.0'
|
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||||
implementation 'com.android.support:design:26.1.0'
|
|
||||||
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
|
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
androidTestImplementation 'com.android.support.test:runner:1.0.1'
|
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
|
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||||
compile ('org.web3j:core:3.3.1-android')
|
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||||
compile ('com.j256.ormlite:ormlite-android:4.48')
|
implementation 'com.google.code.gson:gson:2.8.5'
|
||||||
|
implementation 'com.google.zxing:core:3.2.1'
|
||||||
|
implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
|
||||||
|
implementation 'com.google.android.gms:play-services-vision:17.0.2'
|
||||||
|
implementation 'com.j256.ormlite:ormlite-core:5.1'
|
||||||
|
implementation 'com.j256.ormlite:ormlite-jdbc:5.1'
|
||||||
|
implementation 'org.postgresql:postgresql:42.2.5'
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.monnthic.monnthicmobile;
|
package monnethic.mobile.test;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.test.InstrumentationRegistry;
|
import android.support.test.InstrumentationRegistry;
|
|
@ -0,0 +1,54 @@
|
||||||
|
package monnethic.mobile.test;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.support.test.InstrumentationRegistry;
|
||||||
|
import com.example.monnthic.monnethicmobile.R;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class LearningTest {
|
||||||
|
@Test
|
||||||
|
public void useAppContext() throws Exception {
|
||||||
|
// Context of the app under test.
|
||||||
|
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||||
|
|
||||||
|
System.out.println(appContext.getFilesDir());
|
||||||
|
|
||||||
|
System.out.println(appContext.getPackageName());
|
||||||
|
|
||||||
|
InputStream is = appContext.getResources().openRawResource(R.raw.config);
|
||||||
|
/*
|
||||||
|
try (JsonReader reader = Json.createReader(is)) {
|
||||||
|
JsonObject jsonConfig = (JsonObject) reader.read();
|
||||||
|
System.out.println(jsonConfig);
|
||||||
|
System.out.println(jsonConfig.getClass());
|
||||||
|
NetworkConfig config;
|
||||||
|
config = NetworkConfig.fromJsonObject(jsonConfig);
|
||||||
|
//System.out.println(config!=null);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Writer writer = new StringWriter();
|
||||||
|
char[] buffer = new char[1024];
|
||||||
|
try {
|
||||||
|
Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
||||||
|
int n;
|
||||||
|
while ((n = reader.read(buffer)) != -1) {
|
||||||
|
writer.write(buffer, 0, n);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
is.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
String jsonString = writer.toString();
|
||||||
|
JSONObject jsonObject = new JSONObject(jsonString);
|
||||||
|
System.out.println(jsonObject.getString("name"));
|
||||||
|
System.out.println(jsonObject.getJSONObject("organizations"));
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.monnthic.monnthicmobile">
|
package="com.example.monnthic.monnethicmobile">
|
||||||
|
|
||||||
<!-- To auto-complete the email text field in the login form with Useruser's emails -->
|
<!-- To auto-complete the email text field in the login form with Useruser's emails -->
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||||
<uses-permission android:name="android.permission.READ_PROFILE" />
|
<uses-permission android:name="android.permission.READ_PROFILE" />
|
||||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
@ -17,20 +17,29 @@
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity android:name=".HomepageActivity">
|
<meta-data
|
||||||
|
android:name="com.google.android.gms.vision.DEPENDENCIES"
|
||||||
|
android:value="barcode" />
|
||||||
|
|
||||||
|
<activity android:name="monnethic.mobile.homepage.HomepageActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".SignupActivity" />
|
<activity android:name="monnethic.mobile.homepage.RegisterActivity" />
|
||||||
<activity android:name=".LoginActivity" />
|
<activity android:name="monnethic.mobile.homepage.LoginActivity" />
|
||||||
<activity android:name=".WalletActivity" />
|
<activity android:name="monnethic.mobile.wallet.WalletActivity" />
|
||||||
<activity android:name=".UserAccountActivity" />
|
<activity android:name="monnethic.mobile.user.UserAccountActivity" />
|
||||||
<activity android:name=".DemoActivity" />
|
<activity android:name="monnethic.mobile.demo.DemoActivity" />
|
||||||
<activity android:name=".WalletPresenterActivity" />
|
<activity android:name="monnethic.mobile.wallet.WalletPresenterActivity" />
|
||||||
<activity android:name=".TransactionActivity"></activity>
|
<activity android:name="monnethic.mobile.transaction.TransactionActivity" />
|
||||||
|
<activity android:name="monnethic.mobile.qrcode.QrCodeActivity" />
|
||||||
|
<activity android:name="monnethic.mobile.transaction.ReceivePayementActivity" />
|
||||||
|
<activity android:name="monnethic.mobile.transaction.MakePayementActivity" />
|
||||||
|
<activity android:name="monnethic.mobile.qrcode.QrCodeScannerActivity" />
|
||||||
|
<activity android:name="monnethic.mobile.transaction.ApprovePayementActivity"></activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
|
@ -1,161 +0,0 @@
|
||||||
package com.example.monnthic.monnthicmobile;
|
|
||||||
|
|
||||||
import org.web3j.crypto.RawTransaction;
|
|
||||||
import org.web3j.protocol.Web3j;
|
|
||||||
import org.web3j.protocol.Web3jFactory;
|
|
||||||
import org.web3j.protocol.core.methods.response.EthGetBalance;
|
|
||||||
import org.web3j.protocol.core.methods.response.EthGetTransactionCount;
|
|
||||||
import org.web3j.protocol.core.methods.request.Transaction;
|
|
||||||
import org.web3j.protocol.core.methods.response.EthSendTransaction;
|
|
||||||
import org.web3j.protocol.core.methods.response.TransactionReceipt;
|
|
||||||
import org.web3j.protocol.http.HttpService;
|
|
||||||
import org.web3j.protocol.core.DefaultBlockParameterName;
|
|
||||||
import org.web3j.utils.Convert;
|
|
||||||
|
|
||||||
import java.math.BigInteger;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Guillaume on 28/05/2018.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class AccessBlockchain {
|
|
||||||
private static final String node3 = "http://5.51.59.70:1403";
|
|
||||||
private static final String node2 = "http://93.30.148.59:1402";
|
|
||||||
private static final String node1 = "http://93.30.148.59:1401";
|
|
||||||
//private static String address_test = "0x5421c79d465a288c28e10aa43f9b7dff1b313c8e";
|
|
||||||
private static String address_node3 = "0x869abc2dadd7e23c8b38f054276813a67d8131a7";
|
|
||||||
//Web3j web3jNode2 = Web3jFactory.build(new HttpService(node2));
|
|
||||||
|
|
||||||
public static void main(String [ ] args)
|
|
||||||
{
|
|
||||||
try{
|
|
||||||
//USED FOR TEST
|
|
||||||
|
|
||||||
/*
|
|
||||||
Web3j web3jNode1 = Web3jFactory.build(new HttpService(node1));
|
|
||||||
System.out.println(web3jNode1.ethCoinbase().sendAsync().get().getResult());
|
|
||||||
|
|
||||||
EthGetTransactionCount transactionCount = web3jNode1.ethGetTransactionCount(address_test, DefaultBlockParameterName.LATEST).sendAsync().get();
|
|
||||||
System.out.println(transactionCount);
|
|
||||||
BigInteger nonce = transactionCount.getTransactionCount();
|
|
||||||
System.out.println(nonce);
|
|
||||||
*/
|
|
||||||
Web3j web3jNode1 = Web3jFactory.build(new HttpService(node1));
|
|
||||||
System.out.println("Node 1 : ethAccounts : "+web3jNode1.ethAccounts().send().getAccounts());
|
|
||||||
EthGetBalance ethGetBalance1 = web3jNode1.ethGetBalance("0x5421c79d465a288c28e10aa43f9b7dff1b313c8e", DefaultBlockParameterName.LATEST).sendAsync().get();
|
|
||||||
|
|
||||||
|
|
||||||
Web3j web3jNode2 = Web3jFactory.build(new HttpService(node2));
|
|
||||||
System.out.println("Noded 2 ethAccounts : "+web3jNode2.ethAccounts().send().getAccounts());
|
|
||||||
EthGetBalance ethGetBalance2 = web3jNode2.ethGetBalance("0xef816528949bda3b87e19b86848fb28767156232", DefaultBlockParameterName.LATEST).sendAsync().get();
|
|
||||||
|
|
||||||
System.out.println("Node 1 ethMining : "+web3jNode1.ethMining().send().getResult());
|
|
||||||
|
|
||||||
System.out.println("Node 1 sync : "+web3jNode1.ethSyncing().send().getResult().toString());
|
|
||||||
|
|
||||||
|
|
||||||
BigInteger wei1 = ethGetBalance1.getBalance();
|
|
||||||
System.out.println("Node 1 balance is : "+wei1);
|
|
||||||
|
|
||||||
BigInteger wei2 = ethGetBalance2.getBalance();
|
|
||||||
System.out.println("Node 2 balance is : "+wei2);
|
|
||||||
|
|
||||||
System.out.println("ethBlockNumber Node 1 : "+web3jNode1.ethBlockNumber().send().getResult());
|
|
||||||
System.out.println("ethGetWork Node 1 : "+web3jNode1.ethGetWork().send().getResult());
|
|
||||||
|
|
||||||
|
|
||||||
Web3j web3jNode3 = Web3jFactory.build(new HttpService(node3));
|
|
||||||
System.out.println("Node 3 : ethAccounts : "+web3jNode3.ethAccounts().send().getAccounts());
|
|
||||||
|
|
||||||
EthGetBalance ethGetBalance_n3 = web3jNode1.ethGetBalance(address_node3, DefaultBlockParameterName.LATEST).sendAsync().get();
|
|
||||||
System.out.println("TEST node 1 wallet 3 : "+ethGetBalance_n3);
|
|
||||||
|
|
||||||
//BigInteger test = getTheBalanceOfWallet(address);
|
|
||||||
//System.out.println(test);
|
|
||||||
|
|
||||||
//Web3j web3jNode1 = Web3jFactory.build(new HttpService(node1));
|
|
||||||
//Web3j web3jNode2 = Web3jFactory.build(new HttpService(node2));
|
|
||||||
//System.out.println("ethAccounts : "+web3jNode1.ethAccounts().send().getAccounts());
|
|
||||||
//System.out.println("ethGasPrice : "+web3jNode1.ethGasPrice().send().getGasPrice());
|
|
||||||
//System.out.println("ethGetWork : "+web3jNode1.ethGetWork().send().getResult());
|
|
||||||
//System.out.println("ethBlockNumber : "+web3jNode1.ethBlockNumber().send().getResult());
|
|
||||||
//EthGetBalance ethGetBalance = web3jNode1.ethGetBalance("0x5421c79d465a288c28e10aa43f9b7dff1b313c8e", DefaultBlockParameterName.LATEST).sendAsync().get();
|
|
||||||
// BigInteger wei = ethGetBalance.getBalance();
|
|
||||||
//System.out.println("wei is : "+wei);
|
|
||||||
|
|
||||||
//System.out.println("*************************************************");
|
|
||||||
//Web3j web3jNode1 = Web3jFactory.build(new HttpService(node1));
|
|
||||||
//Web3j web3jNode2 = Web3jFactory.build(new HttpService(node2));
|
|
||||||
//System.out.println("ethAccounts : "+web3jNode1.ethAccounts().send().getAccounts());
|
|
||||||
//System.out.println("ethAccounts : "+web3jNode2.ethAccounts().send().getAccounts());
|
|
||||||
//System.out.println("ethGasPrice : "+web3jNode2.ethGasPrice().send().getGasPrice());
|
|
||||||
//System.out.println("ethGetWork : "+web3jNode2.ethGetWork().send().getResult());
|
|
||||||
//System.out.println("ethBlockNumber : "+web3jNode2.ethBlockNumber().send().getResult());
|
|
||||||
//EthGetBalance ethGetBalance2 = web3jNode2.ethGetBalance("0x0278467c617c13604b3d88b95c2257a3a8a7bc01", DefaultBlockParameterName.LATEST).sendAsync().get();
|
|
||||||
//BigInteger wei2 = ethGetBalance2.getBalance();
|
|
||||||
//System.out.println("wei is : "+wei2);
|
|
||||||
}catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Get Balance function
|
|
||||||
public BigInteger getTheBalanceOfWallet(String walletAddress){
|
|
||||||
Web3j web3jNode1 = Web3jFactory.build(new HttpService(node1));
|
|
||||||
try{
|
|
||||||
EthGetBalance ethGetBalance = web3jNode1.ethGetBalance(walletAddress, DefaultBlockParameterName.LATEST).sendAsync().get();
|
|
||||||
BigInteger wei = ethGetBalance.getBalance();
|
|
||||||
return wei;
|
|
||||||
}catch (Exception e){
|
|
||||||
e.getMessage();
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Send DbTransaction demo function
|
|
||||||
public static boolean sendTransationTo(String addressSource, String addressDestination, BigInteger amountToSend){
|
|
||||||
Web3j n1 = Web3jFactory.build(new HttpService(node1));
|
|
||||||
try{
|
|
||||||
EthGetTransactionCount transactionCount = n1.ethGetTransactionCount(addressSource, DefaultBlockParameterName.LATEST).sendAsync().get();
|
|
||||||
String coinbase = n1.ethCoinbase().sendAsync().get().getResult();
|
|
||||||
BigInteger nonce = transactionCount.getTransactionCount();
|
|
||||||
BigInteger gasPrice = n1.ethGasPrice().send().getGasPrice();
|
|
||||||
BigInteger gasLimit = gasPrice.multiply(BigInteger.valueOf(2));
|
|
||||||
|
|
||||||
BigInteger amountEther = Convert.toWei(amountToSend.toString(), Convert.Unit.ETHER).toBigInteger();
|
|
||||||
Transaction transaction = Transaction.createEtherTransaction(coinbase, nonce, gasPrice, gasLimit, addressDestination, amountEther);
|
|
||||||
String txUnit = "ETHER";
|
|
||||||
|
|
||||||
System.out.println("source : "+coinbase+"\nnonce : "+nonce+"\ngasPrice : "+gasPrice);
|
|
||||||
System.out.println("gasLimit : "+gasLimit+"\ndestination : "+addressDestination+"\namount : "+amountEther);
|
|
||||||
|
|
||||||
/*
|
|
||||||
Send the transaction
|
|
||||||
*/
|
|
||||||
//EthSendTransaction ethSendTransaction = n1.ethSendTransaction(transaction).sendAsync().get();
|
|
||||||
//String txHash = ethSendTransaction.getTransactionHash();
|
|
||||||
//TransactionReceipt txR = n1.ethGetTransactionReceipt(txHash).send().getResult();
|
|
||||||
//txR.getBlockNumber();
|
|
||||||
//insertTransaction(addressSource, addressDestination, amountToSend, txHash, txR.getBlockNumber().toString(), txUnit);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
|
|
||||||
}catch (Exception e){
|
|
||||||
e.getMessage();
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void insertTransaction(String adS, String adD, BigInteger amTs, String txH, String blN, String txUnit){
|
|
||||||
|
|
||||||
DbTransaction dbTrs = new DbTransaction();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
package com.example.monnthic.monnthicmobile;
|
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
|
|
||||||
import com.j256.ormlite.dao.Dao;
|
|
||||||
import com.j256.ormlite.support.ConnectionSource;
|
|
||||||
import com.j256.ormlite.table.TableUtils;
|
|
||||||
|
|
||||||
public class DatabaseManager extends OrmLiteSqliteOpenHelper{
|
|
||||||
private static final String DATABASE_NAME = "WalletTransaction.db";
|
|
||||||
private static final int DATABASE_VERSION = 1;
|
|
||||||
|
|
||||||
public DatabaseManager(Context context){
|
|
||||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(SQLiteDatabase database, ConnectionSource connectionSource) {
|
|
||||||
try{
|
|
||||||
TableUtils.clearTable(connectionSource, DbTransaction.class);
|
|
||||||
Log.i("DATABASE","onCreate invoked");
|
|
||||||
}catch(Exception exception){
|
|
||||||
Log.e("DATABASE","Can't create Database", exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpgrade(SQLiteDatabase database, ConnectionSource connectionSource, int oldVersion, int newVersion) {
|
|
||||||
try{
|
|
||||||
TableUtils.dropTable(connectionSource, DbTransaction.class, true);
|
|
||||||
onCreate(database, connectionSource);
|
|
||||||
Log.i("DATABASE","onUpdate invoked");
|
|
||||||
}catch(Exception exception){
|
|
||||||
Log.e("DATABASE","Can't update Database", exception);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void insertTransaction(DbTransaction tx){
|
|
||||||
try{
|
|
||||||
Dao<DbTransaction, Integer> dao = getDao(DbTransaction.class);
|
|
||||||
dao.create(tx);
|
|
||||||
} catch(Exception exception){
|
|
||||||
Log.e("DATABASE","Can't insert DbTransaction into Database", exception);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
package com.example.monnthic.monnthicmobile;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Guillaume on 15/04/2018.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class User {
|
|
||||||
private String name;
|
|
||||||
private String firstname;
|
|
||||||
private String email;
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
public User(String name, String firstname, String email, String password) {
|
|
||||||
this.name = name;
|
|
||||||
this.firstname = firstname;
|
|
||||||
this.email = email;
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFirstname() {
|
|
||||||
return firstname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFirstname(String firstname) {
|
|
||||||
this.firstname = firstname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEmail() {
|
|
||||||
return email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEmail(String email) {
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
package com.example.monnthic.monnthicmobile;
|
|
||||||
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
public class UserAccountActivity extends AppCompatActivity {
|
|
||||||
private TextView solde;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_user_account);
|
|
||||||
|
|
||||||
solde = findViewById(R.id.viewSolde);
|
|
||||||
Button buttonPayement = findViewById(R.id.buttonPayement);
|
|
||||||
Button buttonReceive = findViewById(R.id.buttonReceive);
|
|
||||||
Button buttonSettings = findViewById(R.id.buttonSettings);
|
|
||||||
|
|
||||||
//refreshSolde();
|
|
||||||
|
|
||||||
buttonPayement.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
sendPayement();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
buttonReceive.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
receivePayement();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
buttonSettings.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
settings();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
public void sendPayement(){
|
|
||||||
Toast.makeText(this, "Coming soon", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
public void receivePayement(){
|
|
||||||
Toast.makeText(this, "Coming soon", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
public void settings(){
|
|
||||||
Toast.makeText(this, "Coming soon", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
public void refreshSolde(){
|
|
||||||
solde.setText("0.00");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package monnethic.mobile.blockchainApi;
|
||||||
|
|
||||||
|
public class UrlApi {
|
||||||
|
static public String URL_BALANCE = "http://10.0.2.2:8083/balance?name=";
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package monnethic.mobile.database;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import monnethic.mobile.transaction.Transaction;
|
||||||
|
import monnethic.mobile.user.User;
|
||||||
|
|
||||||
|
import com.j256.ormlite.dao.Dao;
|
||||||
|
import com.j256.ormlite.dao.DaoManager;
|
||||||
|
import com.j256.ormlite.jdbc.JdbcConnectionSource;
|
||||||
|
import com.j256.ormlite.support.ConnectionSource;
|
||||||
|
|
||||||
|
public class DatabaseHelper {
|
||||||
|
private static final String DATABASE_NAME = "monnethic";
|
||||||
|
private static final String DATABASE_USER = "";
|
||||||
|
private static final String DATABASE_PWD = "";
|
||||||
|
private final static String DATABASE_URL = "jdbc:postgresql:///"+DATABASE_NAME;
|
||||||
|
|
||||||
|
|
||||||
|
public ConnectionSource setupDatabaseConnection(){
|
||||||
|
try{
|
||||||
|
return new JdbcConnectionSource(DATABASE_URL, DATABASE_USER, DATABASE_PWD);
|
||||||
|
}catch (Exception e){
|
||||||
|
System.out.print("\n"+e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public void insertTransaction(Transaction tx){
|
||||||
|
try{
|
||||||
|
//Dao<Transaction, Integer> dao = getDao(Transaction.class);
|
||||||
|
//dao.create(tx);
|
||||||
|
} catch(Exception exception){
|
||||||
|
Log.e("DATABASE","Can't insert Transaction into Database", exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package monnethic.mobile.database;
|
||||||
|
|
||||||
|
import com.j256.ormlite.field.DatabaseField;
|
||||||
|
import com.j256.ormlite.table.DatabaseTable;
|
||||||
|
|
||||||
|
@DatabaseTable(tableName = "T_TEST")
|
||||||
|
public class DatabaseTest {
|
||||||
|
private static final String NAME_FIELD_NAME = "name";
|
||||||
|
private static final String ID_FIELD_NAME = "id";
|
||||||
|
|
||||||
|
@DatabaseField(columnName = ID_FIELD_NAME, id = true)
|
||||||
|
private int id;
|
||||||
|
@DatabaseField(columnName = NAME_FIELD_NAME, canBeNull = false)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public DatabaseTest(int id, String name) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DatabaseTest() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.monnthic.monnthicmobile;
|
package monnethic.mobile.demo;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
@ -6,6 +6,10 @@ import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
|
||||||
|
import com.example.monnthic.monnethicmobile.R;
|
||||||
|
|
||||||
|
import monnethic.mobile.wallet.WalletPresenterActivity;
|
||||||
|
|
||||||
public class DemoActivity extends AppCompatActivity {
|
public class DemoActivity extends AppCompatActivity {
|
||||||
private static final String WALLET_A = "0x5421c79d465a288c28e10aa43f9b7dff1b313c8e";
|
private static final String WALLET_A = "0x5421c79d465a288c28e10aa43f9b7dff1b313c8e";
|
||||||
private static final String WALLET_B = "";
|
private static final String WALLET_B = "";
|
|
@ -1,11 +1,14 @@
|
||||||
package com.example.monnthic.monnthicmobile;
|
package monnethic.mobile.homepage;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
|
||||||
|
import com.example.monnthic.monnethicmobile.R;
|
||||||
|
|
||||||
|
import monnethic.mobile.demo.DemoActivity;
|
||||||
|
|
||||||
public class HomepageActivity extends AppCompatActivity {
|
public class HomepageActivity extends AppCompatActivity {
|
||||||
//TODO MOVE TO LOGIN ACTIVITY
|
//TODO MOVE TO LOGIN ACTIVITY
|
||||||
|
@ -19,7 +22,7 @@ public class HomepageActivity extends AppCompatActivity {
|
||||||
setContentView(R.layout.activity_homepage);
|
setContentView(R.layout.activity_homepage);
|
||||||
Button bRegister = findViewById(R.id.register);
|
Button bRegister = findViewById(R.id.register);
|
||||||
Button bLogin = findViewById(R.id.login);
|
Button bLogin = findViewById(R.id.login);
|
||||||
Button bDemo = findViewById(R.id.demo);
|
//Button bDemo = findViewById(R.id.demo);
|
||||||
|
|
||||||
bRegister.setOnClickListener(new View.OnClickListener() {
|
bRegister.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,23 +36,27 @@ public class HomepageActivity extends AppCompatActivity {
|
||||||
launchLoginActivity();
|
launchLoginActivity();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
/*
|
||||||
bDemo.setOnClickListener(new View.OnClickListener(){
|
bDemo.setOnClickListener(new View.OnClickListener(){
|
||||||
public void onClick(View view){
|
public void onClick(View view){
|
||||||
launchDemoActivity();
|
launchDemoActivity();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void launchRegisterActivity(){
|
public void launchRegisterActivity(){
|
||||||
Intent registerIntent = new Intent(HomepageActivity.this, SignupActivity.class);
|
Intent registerIntent = new Intent(HomepageActivity.this, RegisterActivity.class);
|
||||||
HomepageActivity.this.startActivity(registerIntent);
|
HomepageActivity.this.startActivity(registerIntent);
|
||||||
}
|
}
|
||||||
public void launchLoginActivity(){
|
public void launchLoginActivity(){
|
||||||
Intent loginIntent = new Intent(HomepageActivity.this, LoginActivity.class);
|
Intent loginIntent = new Intent(HomepageActivity.this, LoginActivity.class);
|
||||||
HomepageActivity.this.startActivity(loginIntent);
|
HomepageActivity.this.startActivity(loginIntent);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
public void launchDemoActivity(){
|
public void launchDemoActivity(){
|
||||||
Intent demoIntent = new Intent(HomepageActivity.this, DemoActivity.class);
|
Intent demoIntent = new Intent(HomepageActivity.this, DemoActivity.class);
|
||||||
HomepageActivity.this.startActivity(demoIntent);
|
HomepageActivity.this.startActivity(demoIntent);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package monnethic.mobile.homepage;
|
||||||
|
|
||||||
|
import android.widget.EditText;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class InputController {
|
||||||
|
private static Pattern pattern;
|
||||||
|
private static Matcher matcher;
|
||||||
|
private static final String PASSWORD_PATTERN = "((?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{6,20})";
|
||||||
|
private static final String NAME_PATTERN = "((?=.*[a-z]).{4,30})";
|
||||||
|
|
||||||
|
public static boolean isEmptyEdit(EditText etText) {
|
||||||
|
return etText.getText().toString().trim().length() == 0;
|
||||||
|
}
|
||||||
|
public static boolean validEmail(String email){
|
||||||
|
return android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches();
|
||||||
|
}
|
||||||
|
public static boolean passwordValidator(String password){
|
||||||
|
pattern = Pattern.compile(PASSWORD_PATTERN);
|
||||||
|
matcher = pattern.matcher(password);
|
||||||
|
return matcher.matches();
|
||||||
|
}
|
||||||
|
public static boolean nameValidator(String name){
|
||||||
|
pattern = Pattern.compile(NAME_PATTERN);
|
||||||
|
matcher = pattern.matcher(name);
|
||||||
|
return matcher.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO VERIFY IF INPUTED USER ALREADY EXIST IN LDAP
|
||||||
|
public static boolean checkUser(String mail){
|
||||||
|
//Statement stmt = null;
|
||||||
|
//String query = "SELECT userId FROM USER_TABLE WHERE email="+mail+";";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO CHECK USER AND SEND BACK ID
|
||||||
|
public static boolean checkUser(String mail, String password){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.monnthic.monnthicmobile;
|
package monnethic.mobile.homepage;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
@ -8,6 +8,11 @@ import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.example.monnthic.monnethicmobile.R;
|
||||||
|
|
||||||
|
import monnethic.mobile.user.UserAccountActivity;
|
||||||
|
import monnethic.mobile.wallet.WalletActivity;
|
||||||
|
|
||||||
public class LoginActivity extends AppCompatActivity {
|
public class LoginActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private EditText email;
|
private EditText email;
|
||||||
|
@ -43,31 +48,26 @@ public class LoginActivity extends AppCompatActivity {
|
||||||
public void onClickForgetEmail(View v){
|
public void onClickForgetEmail(View v){
|
||||||
Toast.makeText(this, "Forget email", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Forget email", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
public void validateInput(){
|
private void validateInput(){
|
||||||
if(isEmptyEdit(email)){
|
if(InputController.isEmptyEdit(email)){
|
||||||
Toast.makeText(this, "You did not enter your email", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "You did not enter your email", Toast.LENGTH_SHORT).show();
|
||||||
} else if(isEmptyEdit(password)) {
|
} else if(!InputController.validEmail(email.getText().toString())){
|
||||||
|
Toast.makeText(this, "Your email is invalid", Toast.LENGTH_SHORT).show();
|
||||||
|
} else if(InputController.isEmptyEdit(password)) {
|
||||||
Toast.makeText(this, "You did not enter your password", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "You did not enter your password", Toast.LENGTH_SHORT).show();
|
||||||
} else {
|
} else {
|
||||||
if(checkUser(email.getText().toString(),password.getText().toString())){
|
if(InputController.checkUser(email.getText().toString(),password.getText().toString())){
|
||||||
launchWalletActivity(1);
|
launchWalletActivity(1);
|
||||||
}else{
|
}else{
|
||||||
Toast.makeText(this, "Wrong authentification", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Wrong authentication", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private boolean isEmptyEdit(EditText etText) {
|
public void launchWalletActivity(int ldapId){
|
||||||
return etText.getText().toString().trim().length() == 0;
|
|
||||||
}
|
|
||||||
//TODO CHECK USER AND SEND BACK ID
|
|
||||||
private boolean checkUser(String m, String p){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public void launchWalletActivity(int ldapId){;
|
|
||||||
//LAUNCH APP WALLET WITH ID USER
|
//LAUNCH APP WALLET WITH ID USER
|
||||||
Intent walletIntent = new Intent(LoginActivity.this, WalletActivity.class);
|
Intent accountIntent = new Intent(LoginActivity.this, UserAccountActivity.class);
|
||||||
walletIntent.putExtra("idUser", ldapId);
|
accountIntent.putExtra("idUser", ldapId);
|
||||||
LoginActivity.this.startActivity(walletIntent);
|
LoginActivity.this.startActivity(accountIntent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.monnthic.monnthicmobile;
|
package monnethic.mobile.homepage;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
@ -8,7 +8,12 @@ import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class SignupActivity extends AppCompatActivity {
|
import com.example.monnthic.monnethicmobile.R;
|
||||||
|
|
||||||
|
import monnethic.mobile.user.User;
|
||||||
|
import monnethic.mobile.wallet.WalletActivity;
|
||||||
|
|
||||||
|
public class RegisterActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private EditText name;
|
private EditText name;
|
||||||
private EditText firstname;
|
private EditText firstname;
|
||||||
|
@ -48,24 +53,10 @@ public class SignupActivity extends AppCompatActivity {
|
||||||
|
|
||||||
//TODO VERIFY EACH EDIT TEXT
|
//TODO VERIFY EACH EDIT TEXT
|
||||||
public void validateInput(){
|
public void validateInput(){
|
||||||
if(isEmptyEdit(name)){
|
if(checkInputEmpty()){
|
||||||
Toast.makeText(this, "You did not enter your name", Toast.LENGTH_SHORT).show();
|
if(!InputController.passwordValidator(password.getText().toString())){
|
||||||
} else if(isEmptyEdit(firstname)){
|
Toast.makeText(this, "Password must contains 6 to 20 characters, one lowercase, one uppercase and one digit", Toast.LENGTH_LONG).show();
|
||||||
Toast.makeText(this, "You did not enter your firstname", Toast.LENGTH_SHORT).show();
|
}else if(InputController.validEmail(email.getText().toString())){
|
||||||
} else if(isEmptyEdit(email)){
|
|
||||||
Toast.makeText(this, "You did not enter your email", Toast.LENGTH_SHORT).show();
|
|
||||||
} else if(isEmptyEdit(confirmEmail)){
|
|
||||||
Toast.makeText(this, "You did not confirm your email", Toast.LENGTH_SHORT).show();
|
|
||||||
} else if(isEmptyEdit(password)){
|
|
||||||
Toast.makeText(this, "You did not enter your password", Toast.LENGTH_SHORT).show();
|
|
||||||
} else if(isEmptyEdit(confirmPassword)){
|
|
||||||
Toast.makeText(this, "You did not confirm your password", Toast.LENGTH_SHORT).show();
|
|
||||||
}else {
|
|
||||||
if(!(password.getText().toString().equals(confirmPassword.getText().toString()))){
|
|
||||||
Toast.makeText(this, "Password don't match confirmation password", Toast.LENGTH_SHORT).show();
|
|
||||||
}else if(!(email.getText().toString().equals(confirmEmail.getText().toString()))){
|
|
||||||
Toast.makeText(this, "Email don't match confirmation email", Toast.LENGTH_SHORT).show();
|
|
||||||
} else{
|
|
||||||
User inputUser = new User(name.getText().toString(),firstname.getText().toString(),email.getText().toString(),password.getText().toString());
|
User inputUser = new User(name.getText().toString(),firstname.getText().toString(),email.getText().toString(),password.getText().toString());
|
||||||
insertUserLdap(inputUser);
|
insertUserLdap(inputUser);
|
||||||
}
|
}
|
||||||
|
@ -73,7 +64,7 @@ public class SignupActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO INSERT VALIDE USER INTO LDAP
|
//TODO INSERT VALIDE USER INTO LDAP
|
||||||
public void insertUserLdap(User u){
|
private void insertUserLdap(User u){
|
||||||
//CHECK IF USER ALREADY EXIST
|
//CHECK IF USER ALREADY EXIST
|
||||||
|
|
||||||
//IF USER DOESN'T EXIST, INSERT USER INTO LDAP
|
//IF USER DOESN'T EXIST, INSERT USER INTO LDAP
|
||||||
|
@ -83,7 +74,7 @@ public class SignupActivity extends AppCompatActivity {
|
||||||
//IF SUCCESSFULLY INSERTED INTO LDAP CALL LAUNCHWALLET
|
//IF SUCCESSFULLY INSERTED INTO LDAP CALL LAUNCHWALLET
|
||||||
|
|
||||||
//TEMPORARY
|
//TEMPORARY
|
||||||
if(checkUser(u.getEmail())){
|
if(InputController.checkUser(u.getEmail())){
|
||||||
Toast.makeText(this, "User already have an account, please log in", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "User already have an account, please log in", Toast.LENGTH_SHORT).show();
|
||||||
}else {
|
}else {
|
||||||
Toast.makeText(this, "INSERT", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "INSERT", Toast.LENGTH_SHORT).show();
|
||||||
|
@ -92,21 +83,49 @@ public class SignupActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO LAUNCH WALLET ACTIVITY
|
//TODO LAUNCH WALLET ACTIVITY
|
||||||
public void launchWalletActivity(int ldapId){;
|
private void launchWalletActivity(int ldapId){
|
||||||
//LAUNCH APP WALLET WITH ID USER
|
//LAUNCH APP WALLET WITH ID USER
|
||||||
Intent walletIntent = new Intent(SignupActivity.this, WalletActivity.class);
|
Intent walletIntent = new Intent(RegisterActivity.this, WalletActivity.class);
|
||||||
walletIntent.putExtra("idUser", ldapId);
|
walletIntent.putExtra("idUser", ldapId);
|
||||||
SignupActivity.this.startActivity(walletIntent);
|
RegisterActivity.this.startActivity(walletIntent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isEmptyEdit(EditText etText) {
|
private boolean checkInputEmpty(){
|
||||||
return etText.getText().toString().trim().length() == 0;
|
if(InputController.isEmptyEdit(name)){
|
||||||
}
|
Toast.makeText(this, "You did not enter your name", Toast.LENGTH_SHORT).show();
|
||||||
//TODO VERIFY IF INPUTED USER ALREADY EXIST IN LDAP
|
|
||||||
private boolean checkUser(Object mail){
|
|
||||||
//Statement stmt = null;
|
|
||||||
//String query = "SELECT userId FROM USER_TABLE WHERE email="+mail;
|
|
||||||
return false;
|
return false;
|
||||||
|
} else if (!InputController.nameValidator(name.getText().toString())){
|
||||||
|
Toast.makeText(this, "Name must be 4 to 30 character long", Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
} else if(InputController.isEmptyEdit(firstname)){
|
||||||
|
Toast.makeText(this, "You did not enter your firstname", Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
} else if(InputController.isEmptyEdit(email)){
|
||||||
|
Toast.makeText(this, "You did not enter your email", Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
} else if(!InputController.validEmail(email.getText().toString())){
|
||||||
|
Toast.makeText(this, "Your email is invalid", Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
} else if(InputController.isEmptyEdit(confirmEmail)){
|
||||||
|
Toast.makeText(this, "You did not confirm your email", Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
} else if(InputController.isEmptyEdit(password)){
|
||||||
|
Toast.makeText(this, "You did not enter your password", Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
} else if(InputController.isEmptyEdit(confirmPassword)){
|
||||||
|
Toast.makeText(this, "You did not confirm your password", Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
}else {
|
||||||
|
if (!(password.getText().toString().equals(confirmPassword.getText().toString()))) {
|
||||||
|
Toast.makeText(this, "Password don't match confirmation password", Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
} else if (!(email.getText().toString().equals(confirmEmail.getText().toString()))) {
|
||||||
|
Toast.makeText(this, "Email don't match confirmation email", Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package monnethic.mobile.qrcode;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.example.monnthic.monnethicmobile.R;
|
||||||
|
import com.google.zxing.BarcodeFormat;
|
||||||
|
import com.google.zxing.MultiFormatWriter;
|
||||||
|
import com.google.zxing.WriterException;
|
||||||
|
import com.google.zxing.common.BitMatrix;
|
||||||
|
import com.journeyapps.barcodescanner.BarcodeEncoder;
|
||||||
|
|
||||||
|
public class QrCodeActivity extends AppCompatActivity {
|
||||||
|
ImageView qrCode;
|
||||||
|
Button closeButton;
|
||||||
|
TextView adresseView;
|
||||||
|
TextView amountView;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_qr_code);
|
||||||
|
qrCode=findViewById(R.id.qrCodeViewer);
|
||||||
|
closeButton=findViewById(R.id.buttonClose);
|
||||||
|
adresseView=findViewById(R.id.textViewAdresseDisplay);
|
||||||
|
amountView=findViewById(R.id.textViewAmountDisplay);
|
||||||
|
|
||||||
|
Intent intent = getIntent();
|
||||||
|
String adresse = intent.getStringExtra("adresse");
|
||||||
|
String value = intent.getStringExtra("value");
|
||||||
|
try{
|
||||||
|
generateQrCode(adresse,value);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.getMessage();
|
||||||
|
}
|
||||||
|
closeButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void generateQrCode(String adresse, String value) throws WriterException {
|
||||||
|
BitMatrix bitMatrix;
|
||||||
|
String valueToEncode = adresse+";"+value;
|
||||||
|
try{
|
||||||
|
bitMatrix = new MultiFormatWriter().encode(valueToEncode, BarcodeFormat.QR_CODE,450,450);
|
||||||
|
BarcodeEncoder barcodeEncoder = new BarcodeEncoder();
|
||||||
|
Bitmap bitmap = barcodeEncoder.createBitmap(bitMatrix);
|
||||||
|
qrCode.setImageBitmap(bitmap);
|
||||||
|
adresseView.setText(adresse);
|
||||||
|
amountView.setText(value);
|
||||||
|
}catch (Exception e){
|
||||||
|
e.getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
package monnethic.mobile.qrcode;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.support.v4.app.ActivityCompat;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.SparseArray;
|
||||||
|
import android.view.SurfaceHolder;
|
||||||
|
import android.view.SurfaceView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.example.monnthic.monnethicmobile.R;
|
||||||
|
import com.google.android.gms.vision.CameraSource;
|
||||||
|
import com.google.android.gms.vision.Detector;
|
||||||
|
import com.google.android.gms.vision.barcode.Barcode;
|
||||||
|
import com.google.android.gms.vision.barcode.BarcodeDetector;
|
||||||
|
|
||||||
|
import monnethic.mobile.transaction.ApprovePayementActivity;
|
||||||
|
|
||||||
|
public class QrCodeScannerActivity extends AppCompatActivity {
|
||||||
|
SurfaceView surfaceView;
|
||||||
|
private BarcodeDetector barcodeDector;
|
||||||
|
private CameraSource cameraSource;
|
||||||
|
private static final int REQUEST_CAMERA_PERMISSION = 201;
|
||||||
|
private String intentData = "";
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_qr_code_scanner);
|
||||||
|
initViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initViews(){
|
||||||
|
surfaceView = findViewById(R.id.surfaceView);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initialiseDetector(){
|
||||||
|
Toast.makeText(getApplicationContext(), "QR code scanner started", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
barcodeDector = new BarcodeDetector.Builder(this).setBarcodeFormats(Barcode.ALL_FORMATS).build();
|
||||||
|
cameraSource = new CameraSource.Builder(this, barcodeDector).setRequestedPreviewSize(1920,1080).setAutoFocusEnabled(true).build();
|
||||||
|
|
||||||
|
surfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
|
||||||
|
@Override
|
||||||
|
public void surfaceCreated(SurfaceHolder surfaceHolder) {
|
||||||
|
try{
|
||||||
|
if(ActivityCompat.checkSelfPermission(QrCodeScannerActivity.this, Manifest.permission.CAMERA)== PackageManager.PERMISSION_GRANTED){
|
||||||
|
cameraSource.start(surfaceView.getHolder());
|
||||||
|
}else{
|
||||||
|
ActivityCompat.requestPermissions(QrCodeScannerActivity.this, new String[]{Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSION);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i1, int i2) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
|
||||||
|
cameraSource.stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
barcodeDector.setProcessor(new Detector.Processor<Barcode>() {
|
||||||
|
@Override
|
||||||
|
public void release() {
|
||||||
|
Toast.makeText(getApplicationContext(),"Barcode scanner has been stopped",Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receiveDetections(Detector.Detections<Barcode> detections) {
|
||||||
|
final SparseArray<Barcode> barcodes = detections.getDetectedItems();
|
||||||
|
if(barcodes.size()!=0){
|
||||||
|
intentData = barcodes.valueAt(0).displayValue;
|
||||||
|
Intent scannedQrIntent = new Intent(QrCodeScannerActivity.this, ApprovePayementActivity.class);
|
||||||
|
scannedQrIntent.putExtra("valueScanned",intentData);
|
||||||
|
QrCodeScannerActivity.this.startActivity(scannedQrIntent);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause(){
|
||||||
|
super.onPause();
|
||||||
|
cameraSource.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume(){
|
||||||
|
super.onResume();
|
||||||
|
initialiseDetector();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package monnethic.mobile.transaction;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.example.monnthic.monnethicmobile.R;
|
||||||
|
|
||||||
|
public class ApprovePayementActivity extends AppCompatActivity {
|
||||||
|
TextView textDisplay;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_approve_payement);
|
||||||
|
|
||||||
|
Intent intent = getIntent();
|
||||||
|
String stringToDisplay = intent.getStringExtra("valueScanned");
|
||||||
|
|
||||||
|
initViews(stringToDisplay);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initViews(String stringToDisplay){
|
||||||
|
textDisplay = findViewById(R.id.textDisplay);
|
||||||
|
|
||||||
|
textDisplay.setText(stringToDisplay);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package monnethic.mobile.transaction;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
|
import com.example.monnthic.monnethicmobile.R;
|
||||||
|
|
||||||
|
import monnethic.mobile.qrcode.QrCodeScannerActivity;
|
||||||
|
|
||||||
|
public class MakePayementActivity extends AppCompatActivity {
|
||||||
|
Button btnScanQr;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_make_payement);
|
||||||
|
|
||||||
|
initViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initViews(){
|
||||||
|
btnScanQr = findViewById(R.id.buttonScanQr);
|
||||||
|
|
||||||
|
btnScanQr.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Intent payementIntent = new Intent(MakePayementActivity.this, QrCodeScannerActivity.class);
|
||||||
|
MakePayementActivity.this.startActivity(payementIntent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package monnethic.mobile.transaction;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
|
||||||
|
import com.example.monnthic.monnethicmobile.R;
|
||||||
|
|
||||||
|
import monnethic.mobile.qrcode.QrCodeActivity;
|
||||||
|
|
||||||
|
public class ReceivePayementActivity extends AppCompatActivity {
|
||||||
|
Button cancelButton;
|
||||||
|
Button validateButton;
|
||||||
|
EditText amountValueEdit;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_receive_payement);
|
||||||
|
cancelButton=findViewById(R.id.buttonCancel);
|
||||||
|
validateButton=findViewById(R.id.buttonValidate);
|
||||||
|
amountValueEdit=findViewById(R.id.amountValue);
|
||||||
|
|
||||||
|
cancelButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
validateButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
generateQrCodeWithValue(amountValueEdit.getText().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void generateQrCodeWithValue(String value){
|
||||||
|
Intent generateQrIntent = new Intent(ReceivePayementActivity.this, QrCodeActivity.class);
|
||||||
|
generateQrIntent.putExtra("adresse","addresseAAAA");
|
||||||
|
generateQrIntent.putExtra("value",value);
|
||||||
|
ReceivePayementActivity.this.startActivity(generateQrIntent);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.monnthic.monnthicmobile;
|
package monnethic.mobile.transaction;
|
||||||
|
|
||||||
import com.j256.ormlite.field.DatabaseField;
|
import com.j256.ormlite.field.DatabaseField;
|
||||||
import com.j256.ormlite.table.DatabaseTable;
|
import com.j256.ormlite.table.DatabaseTable;
|
||||||
|
@ -7,7 +7,7 @@ import java.math.BigInteger;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@DatabaseTable(tableName = "T_TRANSACTION")
|
@DatabaseTable(tableName = "T_TRANSACTION")
|
||||||
public class DbTransaction {
|
public class Transaction {
|
||||||
@DatabaseField(columnName = "transactionId", generatedId = true, unique = true)
|
@DatabaseField(columnName = "transactionId", generatedId = true, unique = true)
|
||||||
private int id;
|
private int id;
|
||||||
@DatabaseField(columnName = "transactionDate")
|
@DatabaseField(columnName = "transactionDate")
|
||||||
|
@ -25,11 +25,11 @@ public class DbTransaction {
|
||||||
@DatabaseField(columnName = "transactionUnit")
|
@DatabaseField(columnName = "transactionUnit")
|
||||||
private String unit;
|
private String unit;
|
||||||
|
|
||||||
public DbTransaction() {
|
public Transaction() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DbTransaction(Date transactionDate, String sourceAddress, String destAddress, String transactionHash, String blockNumber, BigInteger amount, String unit) {
|
public Transaction(Date transactionDate, String sourceAddress, String destAddress, String transactionHash, String blockNumber, BigInteger amount, String unit) {
|
||||||
super();
|
super();
|
||||||
this.transactionDate = transactionDate;
|
this.transactionDate = transactionDate;
|
||||||
this.sourceAddress = sourceAddress;
|
this.sourceAddress = sourceAddress;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.monnthic.monnthicmobile;
|
package monnethic.mobile.transaction;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
@ -8,6 +8,8 @@ import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.example.monnthic.monnethicmobile.R;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
public class TransactionActivity extends AppCompatActivity {
|
public class TransactionActivity extends AppCompatActivity {
|
||||||
|
@ -45,11 +47,13 @@ public class TransactionActivity extends AppCompatActivity {
|
||||||
public void sendTransaction(){
|
public void sendTransaction(){
|
||||||
String adD = addressDestination.getText().toString();
|
String adD = addressDestination.getText().toString();
|
||||||
BigInteger amt = new BigInteger(amount.getText().toString());
|
BigInteger amt = new BigInteger(amount.getText().toString());
|
||||||
|
/*
|
||||||
if(AccessBlockchain.sendTransationTo(address, adD, amt)){
|
if(AccessBlockchain.sendTransationTo(address, adD, amt)){
|
||||||
Toast.makeText(this, "OK.", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "OK.", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
//Toast.makeText(this, "Coming soon", Toast.LENGTH_SHORT).show();
|
*/
|
||||||
|
String message = "Comming soon, addressDestination "+adD+" Amount : "+amt.toString();
|
||||||
|
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
120
app/src/main/java/monnethic/mobile/user/User.java
Normal file
120
app/src/main/java/monnethic/mobile/user/User.java
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
package monnethic.mobile.user;
|
||||||
|
|
||||||
|
import com.j256.ormlite.field.DatabaseField;
|
||||||
|
import com.j256.ormlite.table.DatabaseTable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Guillaume on 15/04/2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//Class User which represent an User in the postgresDB
|
||||||
|
@DatabaseTable(tableName = "T_USER")
|
||||||
|
public class User {
|
||||||
|
@DatabaseField(canBeNull = false)
|
||||||
|
private String name;
|
||||||
|
@DatabaseField(canBeNull = false)
|
||||||
|
private String firstname;
|
||||||
|
@DatabaseField(id = true)
|
||||||
|
private String email;
|
||||||
|
@DatabaseField(canBeNull = false)
|
||||||
|
private String password;
|
||||||
|
@DatabaseField(canBeNull = false)
|
||||||
|
private long creation_date;
|
||||||
|
@DatabaseField(canBeNull = false)
|
||||||
|
private long modification_date;
|
||||||
|
@DatabaseField(canBeNull = false)
|
||||||
|
private boolean verified;
|
||||||
|
@DatabaseField(canBeNull = false)
|
||||||
|
private boolean approved;
|
||||||
|
|
||||||
|
//Constructors
|
||||||
|
//Default constructor for ORMLite
|
||||||
|
public User() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public User(String name, String firstname, String email, String password) {
|
||||||
|
this.name = name;
|
||||||
|
this.firstname = firstname;
|
||||||
|
this.email = email;
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User(String name, String firstname, String email, String password, long creation_date, long modification_date, boolean verified, boolean approved) {
|
||||||
|
this.name = name;
|
||||||
|
this.firstname = firstname;
|
||||||
|
this.email = email;
|
||||||
|
this.password = password;
|
||||||
|
this.creation_date = creation_date;
|
||||||
|
this.modification_date = modification_date;
|
||||||
|
this.verified = verified;
|
||||||
|
this.approved = approved;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Getters and Setters
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFirstname() {
|
||||||
|
return firstname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstname(String firstname) {
|
||||||
|
this.firstname = firstname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCreation_date() {
|
||||||
|
return creation_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreation_date(long creation_date) {
|
||||||
|
this.creation_date = creation_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getModification_date() {
|
||||||
|
return modification_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModification_date(long modification_date) {
|
||||||
|
this.modification_date = modification_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVerified() {
|
||||||
|
return verified;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVerified(boolean verified) {
|
||||||
|
this.verified = verified;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isApproved() {
|
||||||
|
return approved;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApproved(boolean approved) {
|
||||||
|
this.approved = approved;
|
||||||
|
}
|
||||||
|
}
|
144
app/src/main/java/monnethic/mobile/user/UserAccountActivity.java
Normal file
144
app/src/main/java/monnethic/mobile/user/UserAccountActivity.java
Normal file
|
@ -0,0 +1,144 @@
|
||||||
|
package monnethic.mobile.user;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.example.monnthic.monnethicmobile.R;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import monnethic.mobile.blockchainApi.UrlApi;
|
||||||
|
import monnethic.mobile.transaction.MakePayementActivity;
|
||||||
|
import monnethic.mobile.transaction.ReceivePayementActivity;
|
||||||
|
|
||||||
|
public class UserAccountActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private TextView balance;
|
||||||
|
private String strUrl = UrlApi.URL_BALANCE+"b";
|
||||||
|
private String result;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_user_account);
|
||||||
|
|
||||||
|
balance = findViewById(R.id.balanceView);
|
||||||
|
Button buttonPayement = findViewById(R.id.buttonPayement);
|
||||||
|
Button buttonReceive = findViewById(R.id.buttonReceive);
|
||||||
|
Button buttonSettings = findViewById(R.id.buttonSettings);
|
||||||
|
Button buttonRefresh = findViewById(R.id.buttonRefreshBalance);
|
||||||
|
|
||||||
|
|
||||||
|
buttonPayement.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
sendPayement();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
buttonReceive.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
receivePayement();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
buttonSettings.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
settings();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
buttonRefresh.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
refreshBalance("b");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
new GetUserBalanceTask().execute(strUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendPayement(){
|
||||||
|
Intent payementIntent = new Intent(UserAccountActivity.this, MakePayementActivity.class);
|
||||||
|
UserAccountActivity.this.startActivity(payementIntent);
|
||||||
|
}
|
||||||
|
public void receivePayement(){
|
||||||
|
Intent receivePayementIntent = new Intent(UserAccountActivity.this, ReceivePayementActivity.class);
|
||||||
|
UserAccountActivity.this.startActivity(receivePayementIntent);
|
||||||
|
}
|
||||||
|
public void settings(){
|
||||||
|
Toast.makeText(this, "Coming soon", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void refreshBalance(String userHash){
|
||||||
|
String url = UrlApi.URL_BALANCE+userHash;
|
||||||
|
new GetUserBalanceTask().execute(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBalance(String value){
|
||||||
|
balance.setText(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class GetUserBalanceTask extends AsyncTask<String,String,String>
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
super.onPreExecute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(String s) {
|
||||||
|
balance.setText(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String doInBackground(String... params) {
|
||||||
|
System.out.println(params[0]);
|
||||||
|
InputStream inputStream = null;
|
||||||
|
HttpURLConnection conn = null;
|
||||||
|
try{
|
||||||
|
URL url = new URL(params[0]);
|
||||||
|
conn = (HttpURLConnection) url.openConnection();
|
||||||
|
conn.setRequestMethod("GET");
|
||||||
|
conn.connect();
|
||||||
|
|
||||||
|
int response = conn.getResponseCode();
|
||||||
|
if(response != 200){
|
||||||
|
return "Error response";
|
||||||
|
}
|
||||||
|
|
||||||
|
inputStream = conn.getInputStream();
|
||||||
|
if(inputStream == null){
|
||||||
|
return "Error inputStream";
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
String line;
|
||||||
|
|
||||||
|
while ((line = reader.readLine())!=null){
|
||||||
|
buffer.append(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
String value = new String(buffer);
|
||||||
|
|
||||||
|
System.out.println("result is "+value);
|
||||||
|
result = value;
|
||||||
|
|
||||||
|
} catch (Exception e){
|
||||||
|
System.out.println("Exception : "+e);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
119
app/src/main/java/monnethic/mobile/user/UserDao.java
Normal file
119
app/src/main/java/monnethic/mobile/user/UserDao.java
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
package monnethic.mobile.user;
|
||||||
|
|
||||||
|
import com.j256.ormlite.dao.Dao;
|
||||||
|
import com.j256.ormlite.dao.DaoManager;
|
||||||
|
import com.j256.ormlite.stmt.PreparedQuery;
|
||||||
|
import com.j256.ormlite.stmt.QueryBuilder;
|
||||||
|
import com.j256.ormlite.stmt.UpdateBuilder;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import monnethic.mobile.database.DatabaseHelper;
|
||||||
|
|
||||||
|
//Class to communicate with database with ORMLite
|
||||||
|
public class UserDao {
|
||||||
|
private DatabaseHelper dbh = new DatabaseHelper();
|
||||||
|
private Dao<User, String> userDao;
|
||||||
|
|
||||||
|
public Dao createUserDaoConnection(){
|
||||||
|
try {
|
||||||
|
return DaoManager.createDao(dbh.setupDatabaseConnection(),User.class);
|
||||||
|
}catch (Exception e){
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addUser(User user)throws Exception {
|
||||||
|
userDao = createUserDaoConnection();
|
||||||
|
userDao.create(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean checkApprovedUser(String email) throws Exception {
|
||||||
|
userDao = createUserDaoConnection();
|
||||||
|
QueryBuilder<User, String> queryBuilder = userDao.queryBuilder();
|
||||||
|
queryBuilder.where().eq("email",email);
|
||||||
|
PreparedQuery<User> preparedQuery = queryBuilder.prepare();
|
||||||
|
User user = userDao.queryForFirst(preparedQuery);
|
||||||
|
return user.isApproved();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean checkVerifiedUser(String email) throws Exception {
|
||||||
|
userDao = createUserDaoConnection();
|
||||||
|
QueryBuilder<User, String> queryBuilder = userDao.queryBuilder();
|
||||||
|
queryBuilder.where().eq("email",email);
|
||||||
|
PreparedQuery<User> preparedQuery = queryBuilder.prepare();
|
||||||
|
User user = userDao.queryForFirst(preparedQuery);
|
||||||
|
return user.isVerified();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateUserPassword(String email, String password) throws Exception {
|
||||||
|
userDao = createUserDaoConnection();
|
||||||
|
UpdateBuilder<User, String> updateBuilder = userDao.updateBuilder();
|
||||||
|
updateBuilder.updateColumnValue("password",password);
|
||||||
|
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
||||||
|
updateBuilder.updateColumnValue("modification_date",timestamp.getTime());
|
||||||
|
updateBuilder.where().eq("email",email);
|
||||||
|
updateBuilder.update();
|
||||||
|
|
||||||
|
if(checkUserPassword(email, password)){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean verifyUserExist(String email) throws Exception {
|
||||||
|
userDao = createUserDaoConnection();
|
||||||
|
QueryBuilder<User, String> queryBuilder = userDao.queryBuilder();
|
||||||
|
queryBuilder.where().eq("email",email);
|
||||||
|
PreparedQuery<User> preparedQuery = queryBuilder.prepare();
|
||||||
|
User user = userDao.queryForFirst(preparedQuery);
|
||||||
|
|
||||||
|
if(user==null){
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean checkUserPassword(String email, String password) throws Exception {
|
||||||
|
User user = getUser(email);
|
||||||
|
if(password.equals(user.getPassword())){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getUser(String email) throws Exception {
|
||||||
|
if(!verifyUserExist(email)){
|
||||||
|
return null;
|
||||||
|
}else{
|
||||||
|
userDao = createUserDaoConnection();
|
||||||
|
QueryBuilder<User, String> queryBuilder = userDao.queryBuilder();
|
||||||
|
queryBuilder.where().eq("email",email);
|
||||||
|
PreparedQuery<User> preparedQuery = queryBuilder.prepare();
|
||||||
|
return userDao.queryForFirst(preparedQuery);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void approveUser (String email) throws Exception{
|
||||||
|
userDao = createUserDaoConnection();
|
||||||
|
UpdateBuilder<User, String> updateBuilder = userDao.updateBuilder();
|
||||||
|
updateBuilder.updateColumnValue("approved",true);
|
||||||
|
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
||||||
|
updateBuilder.updateColumnValue("modification_date",timestamp.getTime());
|
||||||
|
updateBuilder.where().eq("email",email);
|
||||||
|
updateBuilder.update();
|
||||||
|
}
|
||||||
|
public void verifyUser (String email) throws Exception{
|
||||||
|
userDao = createUserDaoConnection();
|
||||||
|
UpdateBuilder<User, String> updateBuilder = userDao.updateBuilder();
|
||||||
|
updateBuilder.updateColumnValue("verified",true);
|
||||||
|
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
||||||
|
updateBuilder.updateColumnValue("modification_date",timestamp.getTime());
|
||||||
|
updateBuilder.where().eq("email",email);
|
||||||
|
updateBuilder.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.monnthic.monnthicmobile;
|
package monnethic.mobile.wallet;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
@ -7,6 +7,10 @@ import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.example.monnthic.monnethicmobile.R;
|
||||||
|
|
||||||
|
import monnethic.mobile.user.UserAccountActivity;
|
||||||
|
|
||||||
public class WalletActivity extends AppCompatActivity {
|
public class WalletActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.monnthic.monnthicmobile;
|
package monnethic.mobile.wallet;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
@ -8,9 +8,10 @@ import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.web3j.utils.Convert;
|
import com.example.monnthic.monnethicmobile.R;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
|
||||||
|
import monnethic.mobile.transaction.TransactionActivity;
|
||||||
|
|
||||||
public class WalletPresenterActivity extends AppCompatActivity {
|
public class WalletPresenterActivity extends AppCompatActivity {
|
||||||
private EditText addressPublic;
|
private EditText addressPublic;
|
||||||
|
@ -31,9 +32,9 @@ public class WalletPresenterActivity extends AppCompatActivity {
|
||||||
addressPublic.setText(address);
|
addressPublic.setText(address);
|
||||||
|
|
||||||
if(initiateBalance(address)==null){
|
if(initiateBalance(address)==null){
|
||||||
balance.setText("Error");
|
balance.setText("IN DEV");
|
||||||
}else{
|
}else{
|
||||||
balance.setText(Convert.fromWei(initiateBalance(address).toString(), Convert.Unit.ETHER).toString());
|
balance.setText("IN DEV");
|
||||||
}
|
}
|
||||||
|
|
||||||
buttonSendTransaction.setOnClickListener(new View.OnClickListener() {
|
buttonSendTransaction.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -58,9 +59,6 @@ public class WalletPresenterActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String initiateBalance(String address){
|
public String initiateBalance(String address){
|
||||||
AccessBlockchain ab = new AccessBlockchain();
|
return "";
|
||||||
System.out.println("addresse "+ address);
|
|
||||||
String balanceIs = ab.getTheBalanceOfWallet(address).toString();
|
|
||||||
return balanceIs;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
20
app/src/main/res/layout/activity_approve_payement.xml
Normal file
20
app/src/main/res/layout/activity_approve_payement.xml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="monnethic.mobile.transaction.ApprovePayementActivity">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textDisplay"
|
||||||
|
android:layout_width="183dp"
|
||||||
|
android:layout_height="195dp"
|
||||||
|
android:layout_marginBottom="184dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.502"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
|
@ -2,7 +2,6 @@
|
||||||
<android.support.constraint.ConstraintLayout
|
<android.support.constraint.ConstraintLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:text="version v0.1"
|
android:text="version v0.1"
|
||||||
android:textAlignment="center" />
|
android:textAlignment="center" />
|
||||||
|
<!--
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/demo"
|
android:id="@+id/demo"
|
||||||
android:layout_width="200dp"
|
android:layout_width="200dp"
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
android:layout_below="@+id/register"
|
android:layout_below="@+id/register"
|
||||||
android:layout_marginTop="53dp"
|
android:layout_marginTop="53dp"
|
||||||
android:text="DEMO" />
|
android:text="DEMO" />
|
||||||
|
-->
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView"
|
android:id="@+id/imageView"
|
||||||
android:layout_width="230dp"
|
android:layout_width="230dp"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:orientation="vertical" android:layout_width="match_parent"
|
android:orientation="vertical" android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
@ -28,12 +27,12 @@
|
||||||
android:id="@+id/editTextPassword"
|
android:id="@+id/editTextPassword"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignStart="@+id/editTextEmail"
|
|
||||||
android:layout_below="@+id/editTextEmail"
|
android:layout_below="@+id/editTextEmail"
|
||||||
|
android:layout_alignStart="@+id/editTextEmail"
|
||||||
android:layout_marginTop="69dp"
|
android:layout_marginTop="69dp"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:hint="Password"
|
android:hint="Password"
|
||||||
android:inputType="textPersonName" />
|
android:inputType="textPassword" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/forgetPassword"
|
android:id="@+id/forgetPassword"
|
||||||
|
|
24
app/src/main/res/layout/activity_make_payement.xml
Normal file
24
app/src/main/res/layout/activity_make_payement.xml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="monnethic.mobile.transaction.MakePayementActivity">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonScanQr"
|
||||||
|
android:layout_width="141dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginBottom="160dp"
|
||||||
|
android:text="SCAN QR CODE"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.502"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.905" />
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
75
app/src/main/res/layout/activity_qr_code.xml
Normal file
75
app/src/main/res/layout/activity_qr_code.xml
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="monnethic.mobile.qrcode.QrCodeActivity">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/qrCodeViewer"
|
||||||
|
android:layout_width="320dp"
|
||||||
|
android:layout_height="307dp"
|
||||||
|
android:layout_marginBottom="204dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonClose"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="56dp"
|
||||||
|
android:layout_marginEnd="148dp"
|
||||||
|
android:text="CLOSE"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textViewAdresse"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginStart="48dp"
|
||||||
|
android:text="Adresse :"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/textViewAmount"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/textViewAdresseDisplay"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textViewAdresseDisplay"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
android:layout_marginEnd="96dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/textViewAmountDisplay"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textViewAmount"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
android:layout_marginBottom="140dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginStart="48dp"
|
||||||
|
android:text="Montant :"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/textViewAmountDisplay"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textViewAmountDisplay"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
android:layout_marginBottom="140dp"
|
||||||
|
android:layout_marginEnd="96dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
15
app/src/main/res/layout/activity_qr_code_scanner.xml
Normal file
15
app/src/main/res/layout/activity_qr_code_scanner.xml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="monnethic.mobile.qrcode.QrCodeScannerActivity">
|
||||||
|
|
||||||
|
<SurfaceView
|
||||||
|
android:id="@+id/surfaceView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_centerVertical="true" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
42
app/src/main/res/layout/activity_receive_payement.xml
Normal file
42
app/src/main/res/layout/activity_receive_payement.xml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="monnethic.mobile.transaction.ReceivePayementActivity">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/amountValue"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="184dp"
|
||||||
|
android:ems="10"
|
||||||
|
android:inputType="numberDecimal"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.568"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonValidate"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="176dp"
|
||||||
|
android:layout_marginEnd="72dp"
|
||||||
|
android:text="Validate"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonCancel"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="176dp"
|
||||||
|
android:layout_marginStart="92dp"
|
||||||
|
android:text="Cancel"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
|
@ -2,7 +2,6 @@
|
||||||
<android.support.constraint.ConstraintLayout
|
<android.support.constraint.ConstraintLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonSettings"
|
android:id="@+id/buttonSettings"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="100dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="45dp"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:text="Settings" />
|
android:text="Settings" />
|
||||||
|
@ -25,32 +25,61 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/buttonSettings"
|
android:layout_below="@+id/buttonSettings"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="13dp"
|
||||||
android:text="User account" />
|
android:text="User account" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/viewSolde"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/textView4"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_marginTop="48dp" />
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonPayement"
|
android:id="@+id/buttonPayement"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="150dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="45dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_centerVertical="true"
|
android:layout_marginBottom="202dp"
|
||||||
android:text="Payement" />
|
android:text="Payement" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonReceive"
|
android:id="@+id/buttonReceive"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="150dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="45dp"
|
||||||
android:layout_below="@+id/buttonPayement"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_marginTop="38dp"
|
android:layout_marginBottom="142dp"
|
||||||
android:text="Receive" />
|
android:text="Receive" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonRefreshBalance"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginBottom="82dp"
|
||||||
|
android:text="Refresh" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/balanceView"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_below="@+id/textView4"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_marginStart="119dp"
|
||||||
|
android:layout_marginTop="156dp"
|
||||||
|
android:layout_marginEnd="113dp"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="30sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView6"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="204dp"
|
||||||
|
android:text="BALANCE"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
61
app/src/main/res/raw/config.json
Normal file
61
app/src/main/res/raw/config.json
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
{
|
||||||
|
"name": "hlfv1",
|
||||||
|
"x-type": "hlfv1",
|
||||||
|
"x-commitTimeout": 300,
|
||||||
|
"version": "1.0.0",
|
||||||
|
"client": {
|
||||||
|
"organization": "Org1",
|
||||||
|
"connection": {
|
||||||
|
"timeout": {
|
||||||
|
"peer": {
|
||||||
|
"endorser": "300",
|
||||||
|
"eventHub": "300",
|
||||||
|
"eventReg": "300"
|
||||||
|
},
|
||||||
|
"orderer": "300"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"channels": {
|
||||||
|
"composerchannel": {
|
||||||
|
"orderers": [
|
||||||
|
"orderer.example.com"
|
||||||
|
],
|
||||||
|
"peers": {
|
||||||
|
"peer0.org1.example.com": {
|
||||||
|
"endorsingPeer": true,
|
||||||
|
"chaincodeQuery": true,
|
||||||
|
"ledgerQuery": true,
|
||||||
|
"eventSource": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"organizations": {
|
||||||
|
"Org1": {
|
||||||
|
"mspid": "Org1MSP",
|
||||||
|
"peers": [
|
||||||
|
"peer0.org1.example.com"
|
||||||
|
],
|
||||||
|
"certificateAuthorities": [
|
||||||
|
"ca.org1.example.com"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"orderers": {
|
||||||
|
"orderer.example.com": {
|
||||||
|
"url": "grpc://orderer.example.com:7050"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"peers": {
|
||||||
|
"peer0.org1.example.com": {
|
||||||
|
"url": "grpc://peer0.org1.example.com:7051"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"certificateAuthorities": {
|
||||||
|
"ca.org1.example.com": {
|
||||||
|
"url": "http://ca.org1.example.com:7054",
|
||||||
|
"caName": "ca.org1.example.com"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Monnéthic Mobile</string>
|
<string name="app_name">Monnethic Mobile</string>
|
||||||
<string name="title_activity_login">Sign in</string>
|
<string name="title_activity_login">Sign in</string>
|
||||||
|
|
||||||
<!-- Strings related to login -->
|
<!-- Strings related to login -->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.monnthic.monnthicmobile;
|
package monnethic.mobile.test;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package monnethic.mobile.test.database;
|
||||||
|
|
||||||
|
import com.j256.ormlite.dao.Dao;
|
||||||
|
import com.j256.ormlite.dao.DaoManager;
|
||||||
|
import org.junit.Test;
|
||||||
|
import monnethic.mobile.database.DatabaseHelper;
|
||||||
|
import monnethic.mobile.database.DatabaseTest;
|
||||||
|
|
||||||
|
|
||||||
|
//Testing class for postgresql connection
|
||||||
|
public class DatabaseHelperTest {
|
||||||
|
private DatabaseHelper dbh = new DatabaseHelper();
|
||||||
|
|
||||||
|
//Test connection by getting existing data in T_TEST
|
||||||
|
@Test
|
||||||
|
public void TestConnection(){
|
||||||
|
Dao<DatabaseTest, Integer> testDao;
|
||||||
|
try{
|
||||||
|
testDao = DaoManager.createDao(dbh.setupDatabaseConnection(),DatabaseTest.class);
|
||||||
|
DatabaseTest dbt = testDao.queryForId(1);
|
||||||
|
assert dbt != null;
|
||||||
|
assert "thomas".equals(dbt.getName());
|
||||||
|
}catch (Exception e){
|
||||||
|
System.out.println("\n"+e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
147
app/src/test/java/monnethic/mobile/test/user/UserDaoTest.java
Normal file
147
app/src/test/java/monnethic/mobile/test/user/UserDaoTest.java
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
package monnethic.mobile.test.user;
|
||||||
|
|
||||||
|
import com.j256.ormlite.dao.Dao;
|
||||||
|
import com.j256.ormlite.table.TableUtils;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import monnethic.mobile.user.User;
|
||||||
|
import monnethic.mobile.user.UserDao;
|
||||||
|
|
||||||
|
public class UserDaoTest {
|
||||||
|
private UserDao udao = new UserDao();
|
||||||
|
private final String USER_EMAIL = "thomas.marshal@gmail.com";
|
||||||
|
private final String USER_PASSWORD = "avcde";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void TestACreateTable(){
|
||||||
|
try{
|
||||||
|
Dao<User, String> userDao;
|
||||||
|
userDao = udao.createUserDaoConnection();
|
||||||
|
TableUtils.createTable(userDao);
|
||||||
|
}catch(Exception e){
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void TestBInsertUser(){
|
||||||
|
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
||||||
|
User user = new User("marshal","thomas",USER_EMAIL,USER_PASSWORD,timestamp.getTime(),timestamp.getTime(),false,false);
|
||||||
|
try{
|
||||||
|
udao.addUser(user);
|
||||||
|
}catch(Exception e){
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void TestCGetGeneratedUser(){
|
||||||
|
try{
|
||||||
|
User uTest = udao.getUser(USER_EMAIL);
|
||||||
|
if(uTest==null){
|
||||||
|
System.out.println("User don't Exist");
|
||||||
|
}else {
|
||||||
|
System.out.println(uTest.getEmail());
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void TestDCheckApprovedUser(){
|
||||||
|
try{
|
||||||
|
boolean response = udao.checkApprovedUser(USER_EMAIL);
|
||||||
|
if(response){
|
||||||
|
System.out.println("Approved");
|
||||||
|
}else{
|
||||||
|
System.out.println("Not Approved");
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void TestECheckVerifiedUser(){
|
||||||
|
try{
|
||||||
|
boolean response = udao.checkVerifiedUser(USER_EMAIL);
|
||||||
|
if(response){
|
||||||
|
System.out.println("Verified");
|
||||||
|
}else{
|
||||||
|
System.out.println("Not Verified");
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void TestFCheckUserPassword(){
|
||||||
|
try{
|
||||||
|
boolean response = udao.checkUserPassword(USER_EMAIL,USER_PASSWORD);
|
||||||
|
if(response){
|
||||||
|
System.out.println("Password OK");
|
||||||
|
}else{
|
||||||
|
System.out.println("Password Failed");
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void TestGUpdateUserPassword(){
|
||||||
|
String newPassword = "newPassword";
|
||||||
|
try{
|
||||||
|
boolean response = udao.updateUserPassword(USER_EMAIL,newPassword);
|
||||||
|
if(response){
|
||||||
|
System.out.println("Password Changed");
|
||||||
|
}else{
|
||||||
|
System.out.println("Password Update Failed");
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void TestHApproveVerifyUser(){
|
||||||
|
try{
|
||||||
|
udao.approveUser(USER_EMAIL);
|
||||||
|
udao.verifyUser(USER_EMAIL);
|
||||||
|
}catch(Exception e){
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void TestICheckApprovedUser(){
|
||||||
|
try{
|
||||||
|
boolean response = udao.checkApprovedUser(USER_EMAIL);
|
||||||
|
if(response){
|
||||||
|
System.out.println("Approved");
|
||||||
|
}else{
|
||||||
|
System.out.println("Not Approved");
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void TestJCheckVerifiedUser(){
|
||||||
|
try{
|
||||||
|
boolean response = udao.checkVerifiedUser(USER_EMAIL);
|
||||||
|
if(response){
|
||||||
|
System.out.println("Verified");
|
||||||
|
}else{
|
||||||
|
System.out.println("Not Verified");
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -7,7 +7,7 @@ buildscript {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.0.0'
|
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||||
|
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
||||||
#Wed Apr 04 16:52:57 CEST 2018
|
#Sun Oct 14 15:18:06 CEST 2018
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
||||||
|
|
Loading…
Reference in a new issue