-
Notifications
You must be signed in to change notification settings - Fork 871
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tokens that fail to redeem due to network errors should be added to a…
… queue and retried fixes brave/brave-browser#3662
- Loading branch information
Showing
19 changed files
with
808 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* 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/. */ | ||
|
||
#include "bat/ads/confirmation_type.h" | ||
|
||
namespace ads { | ||
|
||
static const char kConfirmationTypeClick[] = "click"; | ||
static const char kConfirmationTypeDismiss[] = "dismiss"; | ||
static const char kConfirmationTypeView[] = "view"; | ||
static const char kConfirmationTypeLanded[] = "landed"; | ||
|
||
ConfirmationType::ConfirmationType(const std::string& value) { | ||
if (value == kConfirmationTypeClick) { | ||
value_ = CLICK; | ||
} else if (value == kConfirmationTypeDismiss) { | ||
value_ = DISMISS; | ||
} else if (value == kConfirmationTypeView) { | ||
value_ = VIEW; | ||
} else if (value == kConfirmationTypeLanded) { | ||
value_ = LANDED; | ||
} else { | ||
value_ = UNKNOWN; | ||
} | ||
} | ||
|
||
bool ConfirmationType::IsSupported() const { | ||
return value_ != UNKNOWN; | ||
} | ||
|
||
int ConfirmationType::value() const { | ||
return value_; | ||
} | ||
|
||
ConfirmationType::operator std::string() const { | ||
switch (value_) { | ||
case UNKNOWN: { | ||
return ""; | ||
} | ||
|
||
case CLICK: { | ||
return kConfirmationTypeClick; | ||
} | ||
|
||
case DISMISS: { | ||
return kConfirmationTypeDismiss; | ||
} | ||
|
||
case VIEW: { | ||
return kConfirmationTypeView; | ||
} | ||
|
||
case LANDED: { | ||
return kConfirmationTypeLanded; | ||
} | ||
} | ||
} | ||
|
||
bool ConfirmationType::operator==(ConfirmationType type) const { | ||
return value_ == type.value_; | ||
} | ||
|
||
bool ConfirmationType::operator!=(ConfirmationType type) const { | ||
return value_ != type.value_; | ||
} | ||
|
||
} // namespace ads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
vendor/bat-native-confirmations/src/bat/confirmations/confirmation_type.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* 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/. */ | ||
|
||
#include "bat/confirmations/confirmation_type.h" | ||
|
||
namespace confirmations { | ||
|
||
static const char kConfirmationTypeClick[] = "click"; | ||
static const char kConfirmationTypeDismiss[] = "dismiss"; | ||
static const char kConfirmationTypeView[] = "view"; | ||
static const char kConfirmationTypeLanded[] = "landed"; | ||
|
||
ConfirmationType::ConfirmationType(const std::string& value) { | ||
if (value == kConfirmationTypeClick) { | ||
value_ = CLICK; | ||
} else if (value == kConfirmationTypeDismiss) { | ||
value_ = DISMISS; | ||
} else if (value == kConfirmationTypeView) { | ||
value_ = VIEW; | ||
} else if (value == kConfirmationTypeLanded) { | ||
value_ = LANDED; | ||
} else { | ||
value_ = UNKNOWN; | ||
} | ||
} | ||
|
||
bool ConfirmationType::IsSupported() const { | ||
return value_ != UNKNOWN; | ||
} | ||
|
||
int ConfirmationType::value() const { | ||
return value_; | ||
} | ||
|
||
ConfirmationType::operator std::string() const { | ||
switch (value_) { | ||
case UNKNOWN: { | ||
return ""; | ||
} | ||
|
||
case CLICK: { | ||
return kConfirmationTypeClick; | ||
} | ||
|
||
case DISMISS: { | ||
return kConfirmationTypeDismiss; | ||
} | ||
|
||
case VIEW: { | ||
return kConfirmationTypeView; | ||
} | ||
|
||
case LANDED: { | ||
return kConfirmationTypeLanded; | ||
} | ||
} | ||
} | ||
|
||
bool ConfirmationType::operator==(ConfirmationType type) const { | ||
return value_ == type.value_; | ||
} | ||
|
||
bool ConfirmationType::operator!=(ConfirmationType type) const { | ||
return value_ != type.value_; | ||
} | ||
|
||
} // namespace confirmations |
30 changes: 30 additions & 0 deletions
30
vendor/bat-native-confirmations/src/bat/confirmations/internal/confirmation_info.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* 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/. */ | ||
|
||
#include "bat/confirmations/internal/confirmation_info.h" | ||
|
||
namespace confirmations { | ||
|
||
ConfirmationInfo::ConfirmationInfo() : | ||
id(""), | ||
creative_instance_id(""), | ||
type(ConfirmationType::UNKNOWN), | ||
token_info(TokenInfo()), | ||
payment_token(nullptr), | ||
blinded_payment_token(nullptr), | ||
credential("") {} | ||
|
||
ConfirmationInfo::ConfirmationInfo(const ConfirmationInfo& info) : | ||
id(info.id), | ||
creative_instance_id(info.creative_instance_id), | ||
type(info.type), | ||
token_info(info.token_info), | ||
payment_token(info.payment_token), | ||
blinded_payment_token(info.blinded_payment_token), | ||
credential(info.credential) {} | ||
|
||
ConfirmationInfo::~ConfirmationInfo() {} | ||
|
||
} // namespace confirmations |
Oops, something went wrong.