Change in the request package

Put the File Service logic only for bin files
This commit is contained in:
henry 2018-03-27 21:44:41 -04:00
parent 71c1df2306
commit 6999ad58a1
38 changed files with 331 additions and 174 deletions

View file

@ -5,27 +5,16 @@ import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders; import android.arch.lifecycle.ViewModelProviders;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import butterknife.OnTextChanged;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateCreateBitsharesAccountRequest;
import cy.agorise.crystalwallet.models.AccountSeed; import cy.agorise.crystalwallet.models.AccountSeed;
import cy.agorise.crystalwallet.viewmodels.AccountSeedViewModel; import cy.agorise.crystalwallet.viewmodels.AccountSeedViewModel;
import cy.agorise.crystalwallet.viewmodels.validators.CreateSeedValidator;
import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField;
public class BackupSeedActivity extends AppCompatActivity { public class BackupSeedActivity extends AppCompatActivity {

View file

@ -3,17 +3,13 @@ package cy.agorise.crystalwallet.activities;
import android.arch.lifecycle.LiveData; import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer; import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders; import android.arch.lifecycle.ViewModelProviders;
import android.content.Intent;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.Editable; import android.text.Editable;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
@ -26,21 +22,14 @@ import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import butterknife.OnTextChanged; import butterknife.OnTextChanged;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateCreateBitsharesAccountRequest;
import cy.agorise.crystalwallet.models.Contact; import cy.agorise.crystalwallet.models.Contact;
import cy.agorise.crystalwallet.models.ContactAddress; import cy.agorise.crystalwallet.models.ContactAddress;
import cy.agorise.crystalwallet.models.GrapheneAccount;
import cy.agorise.crystalwallet.viewmodels.ContactListViewModel;
import cy.agorise.crystalwallet.viewmodels.ContactViewModel; import cy.agorise.crystalwallet.viewmodels.ContactViewModel;
import cy.agorise.crystalwallet.viewmodels.validators.CreateContactValidator; import cy.agorise.crystalwallet.viewmodels.validators.CreateContactValidator;
import cy.agorise.crystalwallet.viewmodels.validators.CreateSeedValidator;
import cy.agorise.crystalwallet.viewmodels.validators.ModifyContactValidator; import cy.agorise.crystalwallet.viewmodels.validators.ModifyContactValidator;
import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener; import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField; import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField;
import cy.agorise.crystalwallet.views.ContactAddressListAdapter; import cy.agorise.crystalwallet.views.ContactAddressListAdapter;
import cy.agorise.crystalwallet.views.ContactViewHolder;
public class CreateContactActivity extends AppCompatActivity implements UIValidatorListener { public class CreateContactActivity extends AppCompatActivity implements UIValidatorListener {

View file

@ -10,32 +10,21 @@ import android.support.v7.app.AppCompatActivity;
import android.text.Editable; import android.text.Editable;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import butterknife.OnTextChanged; import butterknife.OnTextChanged;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateCreateBitsharesAccountRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateCreateBitsharesAccountRequest;
import cy.agorise.crystalwallet.enums.SeedType;
import cy.agorise.crystalwallet.models.AccountSeed;
import cy.agorise.crystalwallet.models.CryptoNetAccount;
import cy.agorise.crystalwallet.models.GrapheneAccount; import cy.agorise.crystalwallet.models.GrapheneAccount;
import cy.agorise.crystalwallet.models.GrapheneAccountInfo;
import cy.agorise.crystalwallet.viewmodels.AccountSeedViewModel; import cy.agorise.crystalwallet.viewmodels.AccountSeedViewModel;
import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountViewModel;
import cy.agorise.crystalwallet.viewmodels.GrapheneAccountInfoViewModel;
import cy.agorise.crystalwallet.viewmodels.validators.CreateSeedValidator; import cy.agorise.crystalwallet.viewmodels.validators.CreateSeedValidator;
import cy.agorise.crystalwallet.viewmodels.validators.ImportSeedValidator;
import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener; import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField; import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField;
import static cy.agorise.crystalwallet.enums.SeedType.BIP39;
public class CreateSeedActivity extends AppCompatActivity implements UIValidatorListener { public class CreateSeedActivity extends AppCompatActivity implements UIValidatorListener {
AccountSeedViewModel accountSeedViewModel; AccountSeedViewModel accountSeedViewModel;

View file

@ -5,30 +5,18 @@ import android.arch.lifecycle.Observer;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnItemSelected;
import butterknife.OnTextChanged;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateBitsharesSendRequest;
import cy.agorise.crystalwallet.dao.CrystalDatabase; import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.models.CryptoCoinBalance; import cy.agorise.crystalwallet.models.CryptoCoinBalance;
import cy.agorise.crystalwallet.models.CryptoCurrency; import cy.agorise.crystalwallet.models.CryptoCurrency;
import cy.agorise.crystalwallet.models.CryptoNetAccount; import cy.agorise.crystalwallet.models.CryptoNetAccount;
import cy.agorise.crystalwallet.models.GrapheneAccount; import cy.agorise.crystalwallet.models.GrapheneAccount;
import cy.agorise.crystalwallet.viewmodels.validators.SendTransactionValidator;
import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField;
import cy.agorise.crystalwallet.views.CryptoCurrencyAdapter; import cy.agorise.crystalwallet.views.CryptoCurrencyAdapter;
public class ReceiveTransactionActivity extends AppCompatActivity { public class ReceiveTransactionActivity extends AppCompatActivity {

View file

@ -2,15 +2,12 @@ package cy.agorise.crystalwallet.activities;
import android.arch.lifecycle.LiveData; import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer; import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.text.Editable; import android.text.Editable;
import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.SimpleAdapter;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
@ -23,18 +20,12 @@ import butterknife.OnClick;
import butterknife.OnItemSelected; import butterknife.OnItemSelected;
import butterknife.OnTextChanged; import butterknife.OnTextChanged;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateBitsharesSendRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateBitsharesSendRequest;
import cy.agorise.crystalwallet.dao.CrystalDatabase; import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.enums.CryptoNet;
import cy.agorise.crystalwallet.enums.SeedType;
import cy.agorise.crystalwallet.models.AccountSeed;
import cy.agorise.crystalwallet.models.CryptoCoinBalance; import cy.agorise.crystalwallet.models.CryptoCoinBalance;
import cy.agorise.crystalwallet.models.CryptoCurrency; import cy.agorise.crystalwallet.models.CryptoCurrency;
import cy.agorise.crystalwallet.models.CryptoNetAccount; import cy.agorise.crystalwallet.models.CryptoNetAccount;
import cy.agorise.crystalwallet.models.GrapheneAccount; import cy.agorise.crystalwallet.models.GrapheneAccount;
import cy.agorise.crystalwallet.models.GrapheneAccountInfo;
import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountViewModel;
import cy.agorise.crystalwallet.viewmodels.GrapheneAccountInfoViewModel;
import cy.agorise.crystalwallet.viewmodels.validators.SendTransactionValidator; import cy.agorise.crystalwallet.viewmodels.validators.SendTransactionValidator;
import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener; import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField; import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField;

View file

@ -26,6 +26,9 @@ public interface CryptoNetAccountDao {
@Query("SELECT cna.* FROM crypto_net_account cna") @Query("SELECT cna.* FROM crypto_net_account cna")
List<CryptoNetAccount> getAllCryptoNetAccount(); List<CryptoNetAccount> getAllCryptoNetAccount();
@Query("SELECT cna.* FROM crypto_net_account cna WHERE seed_id = :seedId")
List<CryptoNetAccount> getAllCryptoNetAccountBySeed( long seedId);
@Query("SELECT * FROM crypto_net_account WHERE id = :accountId") @Query("SELECT * FROM crypto_net_account WHERE id = :accountId")
LiveData<CryptoNetAccount> getByIdLiveData( long accountId); LiveData<CryptoNetAccount> getByIdLiveData( long accountId);

View file

@ -5,59 +5,25 @@ import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer; import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders; import android.arch.lifecycle.ViewModelProviders;
import android.arch.paging.PagedList; import android.arch.paging.PagedList;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
import com.google.zxing.Result;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnItemSelected;
import butterknife.OnTextChanged;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateBitsharesSendRequest;
import cy.agorise.crystalwallet.dao.CrystalDatabase; import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.enums.CryptoNet; import cy.agorise.crystalwallet.enums.CryptoNet;
import cy.agorise.crystalwallet.models.Contact; import cy.agorise.crystalwallet.models.Contact;
import cy.agorise.crystalwallet.models.CryptoCoinBalance;
import cy.agorise.crystalwallet.models.CryptoCurrency;
import cy.agorise.crystalwallet.models.CryptoNetAccount;
import cy.agorise.crystalwallet.models.GrapheneAccount;
import cy.agorise.crystalwallet.viewmodels.ContactListViewModel; import cy.agorise.crystalwallet.viewmodels.ContactListViewModel;
import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountListViewModel;
import cy.agorise.crystalwallet.viewmodels.validators.SendTransactionValidator;
import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField;
import cy.agorise.crystalwallet.views.ContactSelectionListAdapter; import cy.agorise.crystalwallet.views.ContactSelectionListAdapter;
import cy.agorise.crystalwallet.views.CryptoCurrencyAdapter;
import cy.agorise.crystalwallet.views.CryptoNetAccountAdapter;
import me.dm7.barcodescanner.zxing.ZXingScannerView;
public class ContactSelectionFragment extends DialogFragment implements ContactSelectionListAdapter.ContactSelectionListAdapterListener{ public class ContactSelectionFragment extends DialogFragment implements ContactSelectionListAdapter.ContactSelectionListAdapterListener{

View file

@ -1,7 +1,6 @@
package cy.agorise.crystalwallet.fragments; package cy.agorise.crystalwallet.fragments;
import android.app.Dialog; import android.app.Dialog;
import android.app.LauncherActivity;
import android.arch.lifecycle.LiveData; import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer; import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders; import android.arch.lifecycle.ViewModelProviders;
@ -43,14 +42,12 @@ import butterknife.ButterKnife;
import butterknife.OnItemSelected; import butterknife.OnItemSelected;
import butterknife.OnTextChanged; import butterknife.OnTextChanged;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateBitsharesSendRequest;
import cy.agorise.crystalwallet.dao.CrystalDatabase; import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.models.CryptoCoinBalance; import cy.agorise.crystalwallet.models.CryptoCoinBalance;
import cy.agorise.crystalwallet.models.CryptoCurrency; import cy.agorise.crystalwallet.models.CryptoCurrency;
import cy.agorise.crystalwallet.models.CryptoNetAccount; import cy.agorise.crystalwallet.models.CryptoNetAccount;
import cy.agorise.crystalwallet.models.GrapheneAccount; import cy.agorise.crystalwallet.models.GrapheneAccount;
import cy.agorise.crystalwallet.viewmodels.validators.ReceiveTransactionValidator; import cy.agorise.crystalwallet.viewmodels.validators.ReceiveTransactionValidator;
import cy.agorise.crystalwallet.viewmodels.validators.SendTransactionValidator;
import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener; import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField; import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField;
import cy.agorise.crystalwallet.views.CryptoCurrencyAdapter; import cy.agorise.crystalwallet.views.CryptoCurrencyAdapter;

View file

@ -15,20 +15,17 @@ import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable; import android.text.Editable;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
import android.view.animation.LinearInterpolator;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import com.google.zxing.Result; import com.google.zxing.Result;
@ -45,11 +42,10 @@ import butterknife.OnClick;
import butterknife.OnItemSelected; import butterknife.OnItemSelected;
import butterknife.OnTextChanged; import butterknife.OnTextChanged;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateBitsharesSendRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateBitsharesSendRequest;
import cy.agorise.crystalwallet.dao.CrystalDatabase; import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.models.Contact;
import cy.agorise.crystalwallet.models.ContactAddress; import cy.agorise.crystalwallet.models.ContactAddress;
import cy.agorise.crystalwallet.models.CryptoCoinBalance; import cy.agorise.crystalwallet.models.CryptoCoinBalance;
import cy.agorise.crystalwallet.models.CryptoCurrency; import cy.agorise.crystalwallet.models.CryptoCurrency;
@ -57,7 +53,6 @@ import cy.agorise.crystalwallet.models.CryptoNetAccount;
import cy.agorise.crystalwallet.models.GrapheneAccount; import cy.agorise.crystalwallet.models.GrapheneAccount;
import cy.agorise.crystalwallet.viewmodels.ContactViewModel; import cy.agorise.crystalwallet.viewmodels.ContactViewModel;
import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountListViewModel; import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountListViewModel;
import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountViewModel;
import cy.agorise.crystalwallet.viewmodels.validators.SendTransactionValidator; import cy.agorise.crystalwallet.viewmodels.validators.SendTransactionValidator;
import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener; import cy.agorise.crystalwallet.viewmodels.validators.UIValidatorListener;
import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField; import cy.agorise.crystalwallet.viewmodels.validators.validationfields.ValidationField;

View file

@ -18,13 +18,13 @@ import cy.agorise.crystalwallet.apigenerator.ApiRequestListener;
import cy.agorise.crystalwallet.apigenerator.BitsharesFaucetApiGenerator; import cy.agorise.crystalwallet.apigenerator.BitsharesFaucetApiGenerator;
import cy.agorise.crystalwallet.apigenerator.GrapheneApiGenerator; import cy.agorise.crystalwallet.apigenerator.GrapheneApiGenerator;
import cy.agorise.crystalwallet.application.constant.BitsharesConstant; import cy.agorise.crystalwallet.application.constant.BitsharesConstant;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetEquivalentRequest; import cy.agorise.crystalwallet.requestmanagers.CryptoNetEquivalentRequest;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequest; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequest;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestsListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestsListener;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateBitsharesSendRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateBitsharesSendRequest;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateCreateBitsharesAccountRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateCreateBitsharesAccountRequest;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateExistBitsharesAccountRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountRequest;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateImportBitsharesAccountRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateImportBitsharesAccountRequest;
import cy.agorise.crystalwallet.dao.CrystalDatabase; import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.dao.TransactionDao; import cy.agorise.crystalwallet.dao.TransactionDao;
import cy.agorise.crystalwallet.enums.CryptoNet; import cy.agorise.crystalwallet.enums.CryptoNet;

View file

@ -0,0 +1,127 @@
package cy.agorise.crystalwallet.manager;
import android.app.Activity;
import android.os.Environment;
import android.util.Log;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
import cy.agorise.crystalwallet.application.CrystalApplication;
import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.requestmanagers.CreateBackupRequest;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequest;
import cy.agorise.crystalwallet.requestmanagers.FileServiceRequest;
import cy.agorise.crystalwallet.requestmanagers.FileServiceRequestsListener;
import cy.agorise.graphenej.BrainKey;
import cy.agorise.graphenej.Chains;
import cy.agorise.graphenej.FileBin;
import cy.agorise.graphenej.models.backup.LinkedAccount;
import cy.agorise.graphenej.models.backup.PrivateKeyBackup;
import cy.agorise.graphenej.models.backup.Wallet;
import cy.agorise.graphenej.models.backup.WalletBackup;
/**
* Created by henry on 21/3/2018.
*/
public class FileBackupManager implements FileServiceRequestsListener {
@Override
public void onNewRequest(FileServiceRequest request) {
if(request instanceof CreateBackupRequest){
createBackupBinFile((CreateBackupRequest) request);
}
}
public void createBackupBinFile(CreateBackupRequest request)
{
CrystalDatabase db = CrystalDatabase.getAppDatabase(request.getContext());
db.cryptoNetAccountDao().getAllCryptoNetAccountBySeed(request.getSeed().getId());
/*TinyDB tinyDB = new TinyDB(myActivity);
ArrayList<AccountDetails> accountDetails = tinyDB.getListObject(myActivity.getResources().getString(R.string.pref_wallet_accounts), AccountDetails.class);
String _brnKey = getBrainKey(accountDetails);
String _accountName = getAccountName(accountDetails);
String _pinCode = getPin(accountDetails);
getBinBytesFromBrainkey(_pinCode, _brnKey, _accountName);*/
}
public void getBinBytesFromBrainkey(String pin, String brnKey, String accountName, CreateBackupRequest request) {
BrainKey brainKey = new BrainKey(brnKey, 0);
try {
ArrayList<Wallet> wallets = new ArrayList<>();
ArrayList<LinkedAccount> accounts = new ArrayList<>();
ArrayList<PrivateKeyBackup> keys = new ArrayList<>();
Wallet wallet = new Wallet(accountName, brainKey.getBrainKey(), brainKey.getSequenceNumber(), Chains.BITSHARES.CHAIN_ID, pin);
wallets.add(wallet);
PrivateKeyBackup keyBackup = new PrivateKeyBackup(brainKey.getPrivateKey().getPrivKeyBytes(),
brainKey.getSequenceNumber(), brainKey.getSequenceNumber(), wallet.getEncryptionKey(pin));
keys.add(keyBackup);
LinkedAccount linkedAccount = new LinkedAccount(accountName, Chains.BITSHARES.CHAIN_ID);
accounts.add(linkedAccount);
WalletBackup backup = new WalletBackup(wallets, keys, accounts);
byte[] results = FileBin.serializeWalletBackup(backup, pin);
List<Integer> resultFile = new ArrayList<>();
for(byte result: results){
resultFile.add(result & 0xff);
}
saveBinContentToFile(resultFile, accountName, request);
}
catch (Exception e) {
//TODO error exception
}
}
static void saveBinContentToFile(List<Integer> content, String _accountName, CreateBackupRequest request )
{
String folder = Environment.getExternalStorageDirectory() + File.separator + "Crystal"; //TODO make constant
String path = folder + File.separator + _accountName + ".bin";
boolean success = saveBinFile(path,content,request);
//TODO handle sucess
}
private static boolean saveBinFile (String filePath , List<Integer> content, CreateBackupRequest request)
{
boolean success = false;
try
{
//TODO permissions
// PermissionManager Manager = new PermissionManager();
// Manager.verifyStoragePermissions(_activity);
File file = new File(filePath);
byte[] fileData = new byte[content.size()];
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file));
for ( int i = 0 ; i < content.size() ; i++ )
{
fileData[i] = content.get(i).byteValue();
}
bos.write(fileData);
bos.flush();
bos.close();
success = true;
}
catch (Exception e)
{
//TODO handle error
}
return success;
}
}

View file

@ -0,0 +1,32 @@
package cy.agorise.crystalwallet.requestmanagers;
import android.app.Activity;
import android.content.Context;
import cy.agorise.crystalwallet.models.AccountSeed;
/**
* Created by henry on 26/3/2018.
*/
public class CreateBackupRequest extends FileServiceRequest {
private AccountSeed seed;
enum StatusCode{
}
public CreateBackupRequest(Context context, Activity activity, AccountSeed seed) {
super(context, activity);
this.seed = seed;
}
public AccountSeed getSeed() {
return seed;
}
}

View file

@ -1,4 +1,4 @@
package cy.agorise.crystalwallet.cryptonetinforequests; package cy.agorise.crystalwallet.requestmanagers;
import android.content.Context; import android.content.Context;

View file

@ -1,4 +1,4 @@
package cy.agorise.crystalwallet.cryptonetinforequests; package cy.agorise.crystalwallet.requestmanagers;
import cy.agorise.crystalwallet.enums.CryptoCoin; import cy.agorise.crystalwallet.enums.CryptoCoin;
@ -19,7 +19,7 @@ public abstract class CryptoNetInfoRequest {
*/ */
protected CryptoNetInfoRequestListener listener; protected CryptoNetInfoRequestListener listener;
public CryptoNetInfoRequest(CryptoCoin coin){ protected CryptoNetInfoRequest(CryptoCoin coin){
this.coin = coin; this.coin = coin;
} }

View file

@ -1,4 +1,4 @@
package cy.agorise.crystalwallet.cryptonetinforequests; package cy.agorise.crystalwallet.requestmanagers;
/** /**
* Listener for manager request * Listener for manager request

View file

@ -1,4 +1,4 @@
package cy.agorise.crystalwallet.cryptonetinforequests; package cy.agorise.crystalwallet.requestmanagers;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View file

@ -1,4 +1,4 @@
package cy.agorise.crystalwallet.cryptonetinforequests; package cy.agorise.crystalwallet.requestmanagers;
/** /**
* Listener extends for the manager classes * Listener extends for the manager classes

View file

@ -0,0 +1,37 @@
package cy.agorise.crystalwallet.requestmanagers;
import android.app.Activity;
import android.content.Context;
/**
* Created by henry on 26/3/2018.
*/
public abstract class FileServiceRequest {
protected Context context;
protected Activity activity;
protected FileServiceRequest(Context context, Activity activity) {
this.context = context;
this.activity = activity;
}
protected FileServiceRequestListener listener;
public void setListener(FileServiceRequestListener listener){
this.listener = listener;
}
public Context getContext() {
return context;
}
public Activity getActivity() {
return activity;
}
protected void _fireOnCarryOutEvent(){
listener.onCarryOut();
}
}

View file

@ -0,0 +1,10 @@
package cy.agorise.crystalwallet.requestmanagers;
/**
* Created by henry on 26/3/2018.
*/
public interface FileServiceRequestListener {
public void onCarryOut();
}

View file

@ -0,0 +1,56 @@
package cy.agorise.crystalwallet.requestmanagers;
import java.util.ArrayList;
import java.util.List;
/**
* Created by henry on 26/3/2018.
*/
public class FileServiceRequests {
private List<FileServiceRequest> requests;
private List<FileServiceRequestsListener> listeners;
private static FileServiceRequests instance;
/**
* Private constructor for singleton pattern
*/
private FileServiceRequests() {
}
/**
* Gets an instance of this manager
* @return the instance to manage the cryptonetinforequest
*/
public static FileServiceRequests getInstance(){
if (FileServiceRequests.instance == null){
FileServiceRequests.instance = new FileServiceRequests();
FileServiceRequests.instance.requests = new ArrayList<>();
FileServiceRequests.instance.listeners = new ArrayList<>();
}
return FileServiceRequests.instance;
}
public void addRequest(FileServiceRequest request){
this.requests.add(request);
this._fireNewRequestEvent(request);
}
public void removeRequest(FileServiceRequest request){
this.requests.remove(request);
}
public void addListener(FileServiceRequestsListener listener){
this.listeners.add(listener);
}
private void _fireNewRequestEvent(FileServiceRequest request){
for (int i=0;i<this.listeners.size();i++){
this.listeners.get(i).onNewRequest(request);
}
}
}

View file

@ -0,0 +1,10 @@
package cy.agorise.crystalwallet.requestmanagers;
/**
* Created by henry on 26/3/2018.
*/
public interface FileServiceRequestsListener {
public void onNewRequest(FileServiceRequest request);
}

View file

@ -0,0 +1,15 @@
package cy.agorise.crystalwallet.requestmanagers;
import android.app.Activity;
import android.content.Context;
/**
* Created by henry on 26/3/2018.
*/
public class ImportBackupRequest extends FileServiceRequest {
public ImportBackupRequest(Context context, Activity activity) {
super(context, activity);
}
}

View file

@ -1,4 +1,4 @@
package cy.agorise.crystalwallet.cryptonetinforequests; package cy.agorise.crystalwallet.requestmanagers;
import android.content.Context; import android.content.Context;

View file

@ -1,4 +1,4 @@
package cy.agorise.crystalwallet.cryptonetinforequests; package cy.agorise.crystalwallet.requestmanagers;
import android.content.Context; import android.content.Context;

View file

@ -1,4 +1,4 @@
package cy.agorise.crystalwallet.cryptonetinforequests; package cy.agorise.crystalwallet.requestmanagers;
import cy.agorise.crystalwallet.enums.CryptoCoin; import cy.agorise.crystalwallet.enums.CryptoCoin;

View file

@ -1,4 +1,4 @@
package cy.agorise.crystalwallet.cryptonetinforequests; package cy.agorise.crystalwallet.requestmanagers;
import cy.agorise.crystalwallet.enums.CryptoCoin; import cy.agorise.crystalwallet.enums.CryptoCoin;

View file

@ -1,7 +1,6 @@
package cy.agorise.crystalwallet.service; package cy.agorise.crystalwallet.service;
import android.app.Service;
import android.arch.lifecycle.LifecycleService; import android.arch.lifecycle.LifecycleService;
import android.arch.lifecycle.LiveData; import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer; import android.arch.lifecycle.Observer;
@ -16,14 +15,12 @@ import android.util.Log;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import cy.agorise.crystalwallet.apigenerator.GrapheneApiGenerator; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.dao.CrystalDatabase; import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.enums.CryptoNet; import cy.agorise.crystalwallet.enums.CryptoNet;
import cy.agorise.crystalwallet.manager.BitsharesAccountManager; import cy.agorise.crystalwallet.manager.BitsharesAccountManager;
import cy.agorise.crystalwallet.models.BitsharesAsset; import cy.agorise.crystalwallet.models.BitsharesAsset;
import cy.agorise.crystalwallet.models.BitsharesAssetInfo; import cy.agorise.crystalwallet.models.BitsharesAssetInfo;
import cy.agorise.crystalwallet.models.CryptoCoinBalance;
import cy.agorise.crystalwallet.models.CryptoCurrency; import cy.agorise.crystalwallet.models.CryptoCurrency;
import cy.agorise.crystalwallet.models.CryptoNetAccount; import cy.agorise.crystalwallet.models.CryptoNetAccount;
import cy.agorise.crystalwallet.models.GeneralSetting; import cy.agorise.crystalwallet.models.GeneralSetting;

View file

@ -32,7 +32,7 @@ public class EquivalencesThread extends Thread{
try { try {
GrapheneApiGenerator.getEquivalenValue(fromAsset, bitsharesAssets, this.service); GrapheneApiGenerator.getEquivalenValue(fromAsset, bitsharesAssets, this.service);
Log.i("Equivalences Thread", "In loop"); Log.i("Equivalences Thread", "In loop");
Thread.sleep(60000); Thread.sleep(300000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }

View file

@ -3,15 +3,9 @@ package cy.agorise.crystalwallet.viewmodels;
import android.app.Application; import android.app.Application;
import android.arch.lifecycle.AndroidViewModel; import android.arch.lifecycle.AndroidViewModel;
import android.arch.lifecycle.LiveData; import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.MutableLiveData;
import java.util.List;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.dao.CrystalDatabase; import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.models.AccountSeed; import cy.agorise.crystalwallet.models.AccountSeed;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateImportBitsharesAccountRequest;
import cy.agorise.crystalwallet.viewmodels.validators.ImportSeedValidator;
/** /**
* Created by Henry Varona on 27/9/2017. * Created by Henry Varona on 27/9/2017.

View file

@ -1,13 +1,9 @@
package cy.agorise.crystalwallet.viewmodels.validators.validationfields; package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.view.View;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Spinner; import android.widget.Spinner;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateExistBitsharesAccountRequest;
import cy.agorise.crystalwallet.dao.CrystalDatabase; import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.models.CryptoCoinBalance; import cy.agorise.crystalwallet.models.CryptoCoinBalance;
import cy.agorise.crystalwallet.models.CryptoCurrency; import cy.agorise.crystalwallet.models.CryptoCurrency;

View file

@ -1,12 +1,7 @@
package cy.agorise.crystalwallet.viewmodels.validators.validationfields; package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.widget.EditText;
import android.widget.Spinner; import android.widget.Spinner;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateExistBitsharesAccountRequest;
import cy.agorise.crystalwallet.models.CryptoCurrency; import cy.agorise.crystalwallet.models.CryptoCurrency;
/** /**

View file

@ -3,9 +3,9 @@ package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.widget.EditText; import android.widget.EditText;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateImportBitsharesAccountRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateImportBitsharesAccountRequest;
/** /**
* Created by Henry Varona on 7/10/2017. * Created by Henry Varona on 7/10/2017.

View file

@ -3,9 +3,9 @@ package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.widget.EditText; import android.widget.EditText;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateExistBitsharesAccountRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountRequest;
/** /**
* Created by Henry Varona on 7/10/2017. * Created by Henry Varona on 7/10/2017.

View file

@ -3,9 +3,9 @@ package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.widget.EditText; import android.widget.EditText;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateExistBitsharesAccountRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountRequest;
/** /**
* Created by Henry Varona on 7/10/2017. * Created by Henry Varona on 7/10/2017.

View file

@ -1,24 +1,11 @@
package cy.agorise.crystalwallet.viewmodels.validators.validationfields; package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.arch.lifecycle.LifecycleOwner;
import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders; import android.arch.lifecycle.ViewModelProviders;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Spinner;
import java.util.List;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateExistBitsharesAccountRequest;
import cy.agorise.crystalwallet.models.Contact; import cy.agorise.crystalwallet.models.Contact;
import cy.agorise.crystalwallet.models.GeneralSetting;
import cy.agorise.crystalwallet.viewmodels.ContactListViewModel; import cy.agorise.crystalwallet.viewmodels.ContactListViewModel;
import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel;
/** /**
* Created by Henry Varona on 2/03/2017. * Created by Henry Varona on 2/03/2017.

View file

@ -1,12 +1,11 @@
package cy.agorise.crystalwallet.viewmodels.validators.validationfields; package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.widget.EditText;
import android.widget.Spinner; import android.widget.Spinner;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateExistBitsharesAccountRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountRequest;
/** /**
* Created by Henry Varona on 7/10/2017. * Created by Henry Varona on 7/10/2017.

View file

@ -2,11 +2,6 @@ package cy.agorise.crystalwallet.viewmodels.validators.validationfields;
import android.widget.EditText; import android.widget.EditText;
import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateExistBitsharesAccountRequest;
/** /**
* Created by Henry Varona on 7/10/2017. * Created by Henry Varona on 7/10/2017.
*/ */

View file

@ -4,9 +4,9 @@ import android.widget.EditText;
import android.widget.Spinner; import android.widget.Spinner;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateExistBitsharesAccountRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountRequest;
/** /**
* Created by Henry Varona on 7/10/2017. * Created by Henry Varona on 7/10/2017.