Skip to content

Commit

Permalink
Add changes for handling creators
Browse files Browse the repository at this point in the history
Encode Url for creators
  • Loading branch information
deeppandya committed Jan 16, 2025
1 parent 749c81d commit dcc5aea
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.provider.Browser;
import android.view.Gravity;
Expand All @@ -22,6 +23,7 @@
import android.widget.ImageView;

import androidx.browser.customtabs.CustomTabsIntent;
import androidx.core.content.res.ResourcesCompat;

import org.chromium.base.IntentUtils;
import org.chromium.chrome.R;
Expand All @@ -32,7 +34,8 @@

/** New Rewards 3.0 custom tab activity */
public class RewardsPageActivity extends CustomTabActivity {
private static final int CLOSE_BUTTON_MARGIN = 32;
private static final int CLOSE_BUTTON_MARGIN = 16;
private static final int CLOSE_BUTTON_PADDING = 16;

@Override
public boolean supportsAppMenu() {
Expand All @@ -57,22 +60,22 @@ public void performPostInflationStartup() {

ViewGroup parentView = findViewById(android.R.id.content);
ImageView closeImg = new ImageView(RewardsPageActivity.this);
closeImg.setPadding(
CLOSE_BUTTON_PADDING,
CLOSE_BUTTON_PADDING,
CLOSE_BUTTON_PADDING,
CLOSE_BUTTON_PADDING);

Drawable drawable =
ResourcesCompat.getDrawable(
getResources(), R.drawable.blue_rounded_notification_bg, null);
closeImg.setBackground(drawable);
closeImg.setImageResource(R.drawable.ic_baseline_close_24);
closeImg.setOnClickListener(
button -> {
finish();
});
parentView.addView(closeImg, layoutParams);

// OnBackPressedCallback callback =
// new OnBackPressedCallback(true /* enabled by default */) {
// @Override
// public void handleOnBackPressed() {
// // Handle the back button event
// }
// };

// getOnBackPressedDispatcher().addCallback(RewardsPageActivity.this, callback);
}

public static void showPage(Context context, String url) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
import org.chromium.chrome.browser.util.BraveTouchUtils;
import org.chromium.chrome.browser.util.ConfigurationUtils;
import org.chromium.chrome.browser.util.PackageUtils;
import org.chromium.chrome.browser.util.TabUtils;
import org.chromium.components.embedder_support.util.UrlUtilities;
import org.chromium.components.feature_engagement.Tracker;
import org.chromium.content_public.browser.NavigationHandle;
Expand All @@ -134,6 +135,7 @@
import org.chromium.url.mojom.Url;

import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
Expand Down Expand Up @@ -516,6 +518,7 @@ public void onPageLoadStarted(Tab tab, GURL url) {
mBraveShieldsHandler.clearBraveShieldsCount(tab.getId());
dismissShieldsTooltip();
hidePlaylistButton();
mPublisherId = "";
}

@Override
Expand Down Expand Up @@ -1214,9 +1217,11 @@ public void onClickImpl(View v) {
public void showRewardsPage() {
String rewardsUrl = BraveActivity.BRAVE_REWARDS_SETTINGS_URL;
if (mPublisherId != null && !mPublisherId.isEmpty()) {
rewardsUrl += "?creator=" + mPublisherId;
rewardsUrl += "?creator=" + URLEncoder.encode(mPublisherId);
}
RewardsPageActivity.showPage(getContext(), rewardsUrl);
Log.e(TAG, "rewardsUrl: " + rewardsUrl);
TabUtils.openUrlInNewTab(false, rewardsUrl);
// RewardsPageActivity.showPage(getContext(), rewardsUrl);
}

private void maybeShowWalletPanel() {
Expand Down

0 comments on commit dcc5aea

Please sign in to comment.