-
Notifications
You must be signed in to change notification settings - Fork 900
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
Improve brave rating dialog #16425
Improve brave rating dialog #16425
Conversation
41cdfa4
to
3ce8562
Compare
|
0517b8a
to
1f31885
Compare
private void showBraveNewsRatingUI( | ||
LinearLayout linearLayout, RecyclerView.LayoutParams linearLayoutParams) { | ||
/* | ||
Image Title |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder what this comment helps with? To me it is rather confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
|
||
private void showBraveRateDialog() { | ||
BraveRateDialogFragment mRateDialogFragment = new BraveRateDialogFragment(); | ||
mRateDialogFragment.show(((ChromeActivity) mActivity).getSupportFragmentManager(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check if mActivity
is actually ChromeActivity
as we may get null pointer here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
transaction.add(this, tag); | ||
transaction.commitAllowingStateLoss(); | ||
} catch (IllegalStateException e) { | ||
Log.e("BraveRateDialogFragment", e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use TAG variable with logs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
android/java/org/chromium/chrome/browser/rate/BraveAskPlayStoreRatingDialog.java
Show resolved
Hide resolved
transaction.add(this, tag); | ||
transaction.commitAllowingStateLoss(); | ||
} catch (IllegalStateException e) { | ||
Log.e("BraveRateDialogFragment", e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use TAG variable with logs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
|
||
public class BraveRateThanksFeedbackDialog extends BottomSheetDialogFragment { | ||
final public static String TAG_FRAGMENT = "brave_rate_thanks_feedback_dialog_tag"; | ||
private static final String TAG = "ask_play_store"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't see where it is used, we should probably use it with logs, but name of the TAG should be different then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
transaction.add(this, tag); | ||
transaction.commitAllowingStateLoss(); | ||
} catch (IllegalStateException e) { | ||
Log.e("BraveRateDialogFragment", e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use TAG variable with logs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
android/java/org/chromium/chrome/browser/rate/BraveAskPlayStoreRatingDialog.java
Outdated
Show resolved
Hide resolved
android/java/org/chromium/chrome/browser/rate/BraveAskPlayStoreRatingDialog.java
Outdated
Show resolved
Hide resolved
android/java/org/chromium/chrome/browser/rate/BraveRateDialogFragment.java
Outdated
Show resolved
Hide resolved
android/java/org/chromium/chrome/browser/rate/BraveRateDialogFragment.java
Outdated
Show resolved
Hide resolved
android/java/org/chromium/chrome/browser/rate/BraveRateThanksFeedbackDialog.java
Outdated
Show resolved
Hide resolved
android/java/org/chromium/chrome/browser/rate/BraveRateThanksFeedbackDialog.java
Outdated
Show resolved
Hide resolved
182c711
to
5ac426a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@@ -639,6 +647,7 @@ public void onClick(View v) { | |||
|
|||
*/ | |||
mLinearLayout.setOrientation(LinearLayout.HORIZONTAL); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit : remove new line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
View view = LayoutInflater.from(ContextUtils.getApplicationContext()) | ||
.inflate(R.layout.brave_rating_news_layout, null); | ||
view.setOnClickListener((v) -> { showBraveRateDialog(); }); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit : remove new line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@Override | ||
public void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setStyle(STYLE_NORMAL, R.style.AppBottomSheetDialogTheme); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sujitacharya2005 have you verified the change on android 6 ? i want to make sure for style on android 6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same style is already used in BraveStatsBottomSheetDialogFragment.java.
I will re-verify it.
|
||
private static final String PREF_LAST_SESSION_SHOWN = "last_session_shown"; | ||
|
||
private static final String PREF_LAST_TIME_APP_USED_DATE1 = "last_time_app_used_date1"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of using 4 different pref, can we use last open timestamp and compare with the current timestamp and determine if it's consecutive days ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here current timeStamp need to check last 3 timeStamp, if all are less than 7 means , 4 days used in last seven days.
For that need to keep 4 different timestamp in pref.
sharedPreferencesEditor.apply(); | ||
} | ||
|
||
public boolean shouldShowRateDialog() { | ||
int appOpenCount = SharedPreferencesManager.getInstance().readInt(BravePreferenceKeys.BRAVE_APP_OPEN_COUNT); | ||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's amazing to see the comments like this for the conditions.
@@ -0,0 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sujitacharya2005 you can run npm run presubmit
to see if we have license header related issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would complain about few missing license headers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved all presubmit error
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="@drawable/rating_bottomsheet_background"> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit : extra new line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
a1680f2
to
617bef0
Compare
617bef0
to
83a29d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM. Let's make sure the change in android 6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Resolves brave/brave-browser#25777
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run lint
,npm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
Show dialog in launch time OR show ui in news screen based on following condition.
Any one
User has added at least 5 bookmarks.
User has set Brave as default.
User has paid for the VPN subscription.
Then show the dialog every 30 days.