class ImportKeystorePresenter extends BasePresenter<ImportKeystoreContract.View> implements ImportKeystoreContract.Presenter {

    @Override
    public void importKeystore(String keystore, String name, String password) {

        if (isExists(name)) {
            return;
        }

        showLoadingDialog();
        new Thread() {
            @Override
            public void run() {
                int code = WalletManager.getInstance().importKeystore(keystore, name, password);
                switch (code) {
                    case WalletManager.CODE_OK:
                        mHandler.sendEmptyMessage(MSG_OK);
                        break;
                    case WalletManager.CODE_ERROR_KEYSTORE:
                        mHandler.sendEmptyMessage(MSG_KEYSTORE_ERROR);
                        break;
                    case WalletManager.CODE_ERROR_NAME:
                        break;
                    case WalletManager.CODE_ERROR_PASSWORD:
                        mHandler.sendEmptyMessage(MSG_PASSWORD_FAILED);
                        break;
                    case WalletManager.CODE_ERROR_WALLET_EXISTS:
                        mHandler.sendEmptyMessage(MSG_WALLET_EXISTS);
                        break;
                    case WalletManager.CODE_ERROR_UNKNOW:
                        mHandler.sendEmptyMessage(MSG_PASSWORD_FAILED);
                        break;
                    default:
                        break;
                }
            }
        }.start();
    }

}