Merge changes from topics 'offline_operation_hours_part5', 'offline_operation_hours_part4' into nyc-mr1-dev

* changes:
  Show a static title/summary if country doesn't have support
  By default select current country in support phone list.
This commit is contained in:
TreeHugger Robot
2016-06-28 19:20:02 +00:00
committed by Android (Google) Code Review
3 changed files with 26 additions and 7 deletions

View File

@@ -7507,9 +7507,6 @@
<!-- Title text for connecting to 24/7 available customer support [CHAR LIMIT=80]--> <!-- Title text for connecting to 24/7 available customer support [CHAR LIMIT=80]-->
<string name="support_escalation_24_7_title">We\'re here for you 24/7</string> <string name="support_escalation_24_7_title">We\'re here for you 24/7</string>
<!-- Title text when customer support is closed [CHAR LIMIT=80]-->
<string name="support_escalation_closed_title">Support closed</string>
<!-- Summary text for connecting to customer support [CHAR LIMIT=NONE]--> <!-- Summary text for connecting to customer support [CHAR LIMIT=NONE]-->
<string name="support_escalation_summary">Our support team is here to address any issues</string> <string name="support_escalation_summary">Our support team is here to address any issues</string>
@@ -7519,6 +7516,9 @@
<!-- Summary text when customer support is closed. [CHAR LIMIT=NONE]--> <!-- Summary text when customer support is closed. [CHAR LIMIT=NONE]-->
<string name="support_escalation_closed_summary">Call us during support hours (local time)&lt;br&gt;&lt;b&gt;<xliff:g id="operation_hours">%s</xliff:g>&lt;/b&gt;</string> <string name="support_escalation_closed_summary">Call us during support hours (local time)&lt;br&gt;&lt;b&gt;<xliff:g id="operation_hours">%s</xliff:g>&lt;/b&gt;</string>
<!-- Summary text when customer support is unavailble in the region. [CHAR LIMIT=NONE]-->
<string name="support_escalation_unavailable_summary">Search help or explore tips &amp; tricks</string>
<!-- Template for formatting support hours eg Mon - Fri, 8:00 AM - 19:30 PM. [CHAR LIMIT=NONE]--> <!-- Template for formatting support hours eg Mon - Fri, 8:00 AM - 19:30 PM. [CHAR LIMIT=NONE]-->
<string name="support_hour_format" translatable="false"> <string name="support_hour_format" translatable="false">
<xliff:g id="start_day">%s</xliff:g> - <xliff:g id="end_day">%s</xliff:g>, <xliff:g id="start_time">%s</xliff:g> - <xliff:g id="end_time">%s</xliff:g>&lt;br&gt; <xliff:g id="start_day">%s</xliff:g> - <xliff:g id="end_day">%s</xliff:g>, <xliff:g id="start_time">%s</xliff:g> - <xliff:g id="end_time">%s</xliff:g>&lt;br&gt;

View File

@@ -88,6 +88,7 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
mSelectedCountry = savedInstanceState.getString(STATE_SELECTED_COUNTRY); mSelectedCountry = savedInstanceState.getString(STATE_SELECTED_COUNTRY);
} }
setAccount(mSupportFeatureProvider.getSupportEligibleAccount(mActivity)); setAccount(mSupportFeatureProvider.getSupportEligibleAccount(mActivity));
mSelectedCountry = mSupportFeatureProvider.getCurrentCountryCodeIfHasConfig(PHONE);
refreshData(); refreshData();
} }
@@ -177,32 +178,45 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
} }
private void addEscalationCards() { private void addEscalationCards() {
if (mSupportFeatureProvider.isAlwaysOperating(PHONE, null /* countryCode */) final boolean hasPhoneOperation =
mSupportFeatureProvider.isSupportTypeEnabled(mActivity, PHONE);
final boolean hasChatOperation =
mSupportFeatureProvider.isSupportTypeEnabled(mActivity, CHAT);
if (!hasPhoneOperation && !hasChatOperation) {
// No support at all.
mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
.setText1(R.string.support_escalation_title)
.setText2(mActivity.getString(R.string.support_escalation_unavailable_summary))
.build());
} else if (mSupportFeatureProvider.isAlwaysOperating(PHONE, null /* countryCode */)
|| mSupportFeatureProvider.isAlwaysOperating(CHAT, null /* countryCode */)) { || mSupportFeatureProvider.isAlwaysOperating(CHAT, null /* countryCode */)) {
// Support is available.
mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE) mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
.setText1(R.string.support_escalation_24_7_title) .setText1(R.string.support_escalation_24_7_title)
.setText2(mActivity.getString(R.string.support_escalation_24_7_summary)) .setText2(mActivity.getString(R.string.support_escalation_24_7_summary))
.build()); .build());
} else if (mSupportFeatureProvider.isOperatingNow(PHONE) } else if (mSupportFeatureProvider.isOperatingNow(PHONE)
|| mSupportFeatureProvider.isOperatingNow(CHAT)) { || mSupportFeatureProvider.isOperatingNow(CHAT)) {
// Support is available now.
mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE) mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
.setText1(R.string.support_escalation_title) .setText1(R.string.support_escalation_title)
.setText2(R.string.support_escalation_summary) .setText2(R.string.support_escalation_summary)
.build()); .build());
} else { } else {
// Support is not temporarily unavailable.
mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE) mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
.setText1(R.string.support_escalation_closed_title) .setText1(R.string.support_escalation_title)
.setText2(mSupportFeatureProvider.getOperationHours(mActivity, PHONE, null)) .setText2(mSupportFeatureProvider.getOperationHours(mActivity, PHONE, null))
.build()); .build());
} }
final SupportData.Builder builder = final SupportData.Builder builder =
new SupportData.Builder(mActivity, TYPE_ESCALATION_OPTIONS); new SupportData.Builder(mActivity, TYPE_ESCALATION_OPTIONS);
if (mSupportFeatureProvider.isSupportTypeEnabled(mActivity, PHONE)) { if (hasPhoneOperation) {
builder.setText1(R.string.support_escalation_by_phone); builder.setText1(R.string.support_escalation_by_phone);
builder.setSummary1(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, PHONE)); builder.setSummary1(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, PHONE));
builder.setEnabled1(mSupportFeatureProvider.isOperatingNow(PHONE)); builder.setEnabled1(mSupportFeatureProvider.isOperatingNow(PHONE));
} }
if (mSupportFeatureProvider.isSupportTypeEnabled(mActivity, CHAT)) { if (hasChatOperation) {
builder.setText2(R.string.support_escalation_by_chat); builder.setText2(R.string.support_escalation_by_chat);
builder.setSummary2(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, CHAT)); builder.setSummary2(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, CHAT));
builder.setEnabled2(mSupportFeatureProvider.isOperatingNow(CHAT)); builder.setEnabled2(mSupportFeatureProvider.isOperatingNow(CHAT));

View File

@@ -62,6 +62,11 @@ public interface SupportFeatureProvider {
*/ */
boolean isOperatingNow(@SupportType int type); boolean isOperatingNow(@SupportType int type);
/**
* Returns the current country code if it has a operation config, otherwise returns null.
*/
String getCurrentCountryCodeIfHasConfig(@SupportType int type);
/** /**
* Returns localized string for operation hours in specified country. If country is null, use * Returns localized string for operation hours in specified country. If country is null, use
* current country to figure out operation hours. * current country to figure out operation hours.