Skip to content

Commit

Permalink
Merge pull request #1697 from brave/fix_payments_import
Browse files Browse the repository at this point in the history
Fix payments import
  • Loading branch information
yrliou authored Feb 17, 2019
2 parents 3515226 + b71b382 commit 7689d49
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 5 additions & 5 deletions browser/importer/brave_profile_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ void BraveProfileWriter::SetBridge(BraveInProcessImporterBridge* bridge) {
bridge_ptr_ = bridge;
}

void BraveProfileWriter::OnWalletInitialized(brave_rewards::RewardsService*
rewards_service, int error_code) {
if (error_code) {
void BraveProfileWriter::OnWalletInitialized(
brave_rewards::RewardsService* rewards_service, int result) {
if (result != 0 && result != 12) { // 12: ledger::Result::WALLET_CREATED
// Cancel the import if wallet creation failed
std::ostringstream msg;
msg << "An error occurred while trying to create a "
<< "wallet to restore into (error_code=" << error_code << ")";
<< "wallet to restore into (result=" << result << ")";
CancelWalletImport(msg.str());
return;
}
Expand All @@ -125,7 +125,7 @@ void BraveProfileWriter::BackupWallet() {
const base::FilePath profile_default_directory = profile_->GetPath();
std::ostringstream backup_filename;
backup_filename << "ledger_import_backup_"
<< base::NumberToString(static_cast<unsigned long long>(
<< base::NumberToString(static_cast<uint64_t>(
base::Time::Now().ToJsTime()));

LOG(INFO) << "Making backup of current \"ledger_state\" as "
Expand Down
7 changes: 5 additions & 2 deletions browser/importer/brave_profile_writer.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
/* Copyright (c) 2019 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef BRAVE_BROWSER_IMPORTER_BRAVE_PROFILE_WRITER_H_
#define BRAVE_BROWSER_IMPORTER_BRAVE_PROFILE_WRITER_H_

#include <memory>
#include <string>
#include <vector>

#include "base/macros.h"
Expand Down Expand Up @@ -38,7 +41,7 @@ class BraveProfileWriter : public ProfileWriter,

// brave_rewards::RewardsServiceObserver:
void OnWalletInitialized(brave_rewards::RewardsService* rewards_service,
int error_code) override;
int result) override;
void OnRecoverWallet(brave_rewards::RewardsService* rewards_service,
unsigned int result,
double balance,
Expand Down

0 comments on commit 7689d49

Please sign in to comment.