Skip to content

Commit

Permalink
Merge branch 'wallet_api_merge' into 'development'
Browse files Browse the repository at this point in the history
Merge Wallet API

See merge request qt-team/graft-mobile-client!372
  • Loading branch information
vitalius-parubochyi-vakoms committed Nov 15, 2018
2 parents bdb55f0 + c4a2c64 commit ee3e334
Show file tree
Hide file tree
Showing 50 changed files with 2,629 additions and 282 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "GraftMobileClient/qrcodegenerator"]
path = GraftMobileClient/qrcodegenerator
url = https://github.com/EDDragonWolf/QR-Code-generator.git
[submodule "GraftMobileClient/libwallet"]
path = GraftMobileClient/libwallet
url = https://gitlab.com/EDDragonWolf/explibwallet.git
27 changes: 19 additions & 8 deletions GraftMobileClient/GraftMobileClient.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ QT += qml quick network widgets
CONFIG += c++11

DEFINES += MAJOR_VERSION=1
DEFINES += MINOR_VERSION=11
DEFINES += BUILD_VERSION=1
DEFINES += MINOR_VERSION=13
DEFINES += BUILD_VERSION=0

win32|macx|unix {
DEFINES += RES_IOS
Expand All @@ -29,29 +29,39 @@ include(android/android.pri)

include(qzxing/QZXing.pri)
include(QRCodeGenerator.pri)
include(libwallet/libwallet.pri)
ios|macx {
include(core/api/v2/graftapiv2.pri)
}

contains(DEFINES, POS_BUILD) {
ios|android {
include(imagepicker/ImagePickerLibrary.pri)
}

SOURCES += \
core/api/graftposapi.cpp \
core/api/v1/graftposapiv1.cpp \
core/api/v1/graftposhandlerv1.cpp \
core/graftposclient.cpp

HEADERS += \
core/api/graftposapi.h \
core/api/v1/graftposapiv1.h \
core/api/v1/graftposhandlerv1.h \
core/api/graftposhandler.h \
core/graftposclient.h \
core/defines.h
}

contains(DEFINES, WALLET_BUILD) {
SOURCES += \
core/api/graftwalletapi.cpp \
core/api/v1/graftwalletapiv1.cpp \
core/api/v1/graftwallethandlerv1.cpp \
core/graftwalletclient.cpp

HEADERS += \
core/api/graftwalletapi.h \
core/api/v1/graftwalletapiv1.h \
core/api/v1/graftwallethandlerv1.h \
core/api/graftwallethandler.h \
core/graftwalletclient.h
}

Expand All @@ -64,7 +74,7 @@ include(mac/mac.pri)
}

SOURCES += main.cpp \
core/api/graftgenericapi.cpp \
core/api/v1/graftgenericapiv1.cpp \
core/productmodel.cpp \
core/productitem.cpp \
core/productmodelserializator.cpp \
Expand All @@ -88,7 +98,8 @@ SOURCES += main.cpp \

HEADERS += \
core/config.h \
core/api/graftgenericapi.h \
core/api/v1/graftgenericapiv1.h \
core/api/graftbasehandler.h \
core/productmodel.h \
core/productitem.h \
core/productmodelserializator.h \
Expand Down
2 changes: 1 addition & 1 deletion GraftMobileClient/android/pos/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="org.graft.pos" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.11.1" android:versionCode="11101" android:installLocation="auto">
<manifest package="org.graft.pos" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.13.0" android:versionCode="11300" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Graft Point-of-Sale" android:icon="@drawable/icon">
<activity android:theme="@style/SplashTheme" android:label="Graft Point-of-Sale" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:screenOrientation="portrait" android:launchMode="singleTask">
<intent-filter>
Expand Down
2 changes: 1 addition & 1 deletion GraftMobileClient/android/wallet/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="org.graft.wallet" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.11.1" android:versionCode="11101" android:installLocation="auto">
<manifest package="org.graft.wallet" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.13.0" android:versionCode="11300" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Graft Wallet" android:icon="@drawable/icon">
<activity android:theme="@style/SplashTheme" android:label="Graft Wallet" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:screenOrientation="portrait" android:launchMode="singleTask">
<intent-filter>
Expand Down
40 changes: 40 additions & 0 deletions GraftMobileClient/core/api/graftbasehandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#ifndef GRAFTBASEHANDLER_H
#define GRAFTBASEHANDLER_H

#include <QObject>

class GraftBaseHandler : public QObject
{
Q_OBJECT
public:
explicit GraftBaseHandler(QObject *parent = nullptr) : QObject(parent) {}

virtual void changeAddresses(const QStringList &addresses,
const QStringList &internalAddresses = QStringList()) = 0;

virtual void setAccountData(const QByteArray &accountData, const QString &password) = 0;
virtual QByteArray accountData() const = 0;
virtual QString password() const = 0;

virtual void resetData() = 0;

public slots:
virtual void createAccount(const QString &password) = 0;
virtual void restoreAccount(const QString &seed, const QString &password) = 0;
virtual void updateBalance() = 0;
virtual void transferFee(const QString &address, const QString &amount) = 0;
virtual void transfer(const QString &address, const QString &amount) = 0;

signals:
void errorReceived(const QString &message);
void createAccountReceived(const QByteArray &accountData, const QString &password,
const QString &address, const QString &viewKey, const QString &seed);
void restoreAccountReceived(const QByteArray &accountData, const QString &password,
const QString &address, const QString &viewKey,
const QString &seed);
void balanceReceived(double balance, double unlockedBalance);
void transferFeeReceived(int result, double fee);
void transferReceived(int result);
};

#endif // GRAFTBASEHANDLER_H
24 changes: 24 additions & 0 deletions GraftMobileClient/core/api/graftposhandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef GRAFTPOSHANDLER_H
#define GRAFTPOSHANDLER_H

#include "graftbasehandler.h"

class GraftPOSHandler : public GraftBaseHandler
{
Q_OBJECT
public:
explicit GraftPOSHandler(QObject *parent = nullptr) : GraftBaseHandler(parent) {}

public slots:
virtual void sale(const QString &address, const QString &viewKey, double amount,
const QString &saleDetails = QString()) = 0;
virtual void rejectSale(const QString &pid) = 0;
virtual void saleStatus(const QString &pid, int blockNumber) = 0;

signals:
void saleReceived(int result, const QString &pid, int blockNumber);
void rejectSaleReceived(bool result);
void saleStatusReceived(bool result);
};

#endif // GRAFTPOSHANDLER_H
26 changes: 26 additions & 0 deletions GraftMobileClient/core/api/graftwallethandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ifndef GRAFTWALLETHANDLER_H
#define GRAFTWALLETHANDLER_H

#include "graftbasehandler.h"

class GraftWalletHandler : public GraftBaseHandler
{
Q_OBJECT
public:
explicit GraftWalletHandler(QObject *parent = nullptr) : GraftBaseHandler(parent) {}

public slots:
virtual void saleDetails(const QString &pid, int blockNumber) = 0;
virtual void rejectPay(const QString &pid, int blockNumber) = 0;
virtual void pay(const QString &pid, const QString &address,
double amount, int blockNumber) = 0;
virtual void payStatus(const QString &pid, int blockNumber) = 0;

signals:
void saleDetailsReceived(int result, const QString &details);
void rejectPayReceived(int result);
void payReceived(int result);
void payStatusReceived(int result, int status);
};

#endif // GRAFTWALLETHANDLER_H
Loading

0 comments on commit ee3e334

Please sign in to comment.