Skip to content

Rewards bitflyer android integration #11587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Dec 16, 2021

Conversation

deeppandya
Copy link
Contributor

Resolves brave/brave-browser#18471

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

@deeppandya deeppandya added this to the 1.35.x - Nightly milestone Dec 14, 2021
@deeppandya deeppandya requested a review from a team as a code owner December 14, 2021 01:15
@deeppandya deeppandya self-assigned this Dec 14, 2021
@deeppandya deeppandya force-pushed the rewards-bitflyer-android-integration branch from 0fb2072 to e989f67 Compare December 14, 2021 01:16
@@ -69,7 +69,7 @@ void LoadRewardsURL(
const std::string bitflyer_staging_host = bitflyer_staging_url.host();
const std::string gemini_staging_host = gemini_oauth_staging_url.host();
const char* kAllowedDomains[] = {
"bitflyer.com", // bitFlyer production
"dummy.com", // bitFlyer production
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it a real domain?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the bitFlyer production domain is stubbed out for now per request from @Miyayes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will we be changing this to before merging?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zenparsing rightly pointed out that this won't work as-is, so we're reverting it and will rely on stubbing the production client id in our builds instead.

@SergeyZhukovsky
Copy link
Member

@deeppandya I think we need to check it on Android 6, as the PR contains new vector images.

@deeppandya
Copy link
Contributor Author

@deeppandya I think we need to check it on Android 6, as the PR contains new vector images.

@SergeyZhukovsky I have checked. If we use support components, it's fine.

Copy link
Member

@SergeyZhukovsky SergeyZhukovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Comment on lines +100 to +101
intent.putExtra(
BraveActivity.OPEN_URL, BraveWalletProvider.UPHOLD_ORIGIN_URL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deeppandya If this function is Uphold-specific, do we need a bitFlyer-specific function. If it's not Uphold-specific, then it seems like we need to be smarter here (and probably should rename the function, etc.)

redirect_url = jsonObj.getString(REDIRECT_URL_KEY);
}
} catch (JSONException e) {
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we log something here?

SharedPreferences.Editor editor = sharedPref.edit();
int rightDrawable = 0;
int leftDrawable = 0;
int text = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Maybe textId is a better name here?

@@ -170,6 +170,8 @@
public static final String ADD_FUNDS_URL = "chrome://rewards/#add-funds";
public static final String REWARDS_SETTINGS_URL = "chrome://rewards/";
public static final String BRAVE_REWARDS_SETTINGS_URL = "brave://rewards/";
public static final String BRAVE_REWARDS_SETTINGS_WALLET_PROVIDER_URL =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I would name this BRAVE_REWARDS_SETTINGS_WALLET_VERIFICATION_URL just to be a little more specific.

view.getLocationOnScreen(location);
int x = location[0];
int y = location[1];
loginPopupWindow.showAtLocation(view, Gravity.NO_GRAVITY, 0, y);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking that we don't want to use x here?

}
} else if (errorCode == BraveRewardsNativeWorker.LEDGER_ERROR) { // No Internet connection
String args[] = {};
Log.e(TAG, "LEDGER_ERROR");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could say something like Failed to fetch rewards parameters from server (or something like that) here?

@@ -69,7 +69,7 @@ void LoadRewardsURL(
const std::string bitflyer_staging_host = bitflyer_staging_url.host();
const std::string gemini_staging_host = gemini_oauth_staging_url.host();
const char* kAllowedDomains[] = {
"bitflyer.com", // bitFlyer production
"dummy.com", // bitFlyer production
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will we be changing this to before merging?

@@ -312,6 +312,8 @@ class RewardsService : public KeyedService {

virtual void GetExternalWallet(GetExternalWalletCallback callback) = 0;

virtual std::string GetExternalWalletType() const = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code that relies on this method may need to be rewritten when we improve how we handle external wallets internally.

Currently, SetExternalWalletType is used to set a pref, which mostly serves to control which wallet type will be returned from GetExternalWallet. This was a hack to work around the fact that the front-end design expects to be able to retrieve a populated mojom::ExternalWallet structure, even when the user is not connected to any wallet provider.

Ideally, this pref would not be necessary: the engine would know which wallet is currently connected (if any), and the front-end would not expect to get "login" URLs from the ExternalWallet structure. In that case we'd remove the SetExternalWalletType method.

Code that relies on GetExternalWalletType (a sync method), may have to be rewritten in the future, and I would prefer that we not have more implementations using the SetExternalWalletType hack going forward.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zenparsing mentioned in our meeting that this is good for now, but let's not use GetExternalWalletType beyond this going forward.

@deeppandya deeppandya merged commit b048108 into master Dec 16, 2021
@deeppandya deeppandya deleted the rewards-bitflyer-android-integration branch December 16, 2021 14:55
@emerick emerick restored the rewards-bitflyer-android-integration branch February 4, 2022 22:37
@emerick emerick deleted the rewards-bitflyer-android-integration branch March 28, 2022 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android] Implement Rewards dropdown panel 2.0
4 participants