Show operation hours for selected country's support phone

Bug: 28827790
Change-Id: Idddaefa33cf1a128b70c517b1acb61a2b7bab288
This commit is contained in:
Fan Zhang
2016-06-24 15:17:09 -07:00
parent 3737fabda4
commit 2736ace057
3 changed files with 20 additions and 15 deletions

View File

@@ -7514,7 +7514,7 @@
<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>
<!-- Summary text for connecting to 24/7 customer support [CHAR LIMIT=NONE]--> <!-- Summary text for connecting to 24/7 customer support [CHAR LIMIT=NONE]-->
<string name="support_escalation_24_7_summary">Our support team is here all day, every day</string> <string name="support_escalation_24_7_summary">Our support team is available all day, every day</string>
<!-- 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>
@@ -7535,11 +7535,8 @@
<xliff:g id="language" example="English">%s</xliff:g> (<xliff:g id="phone" example="800-000-0000">%s</xliff:g>) <xliff:g id="language" example="English">%s</xliff:g> (<xliff:g id="phone" example="800-000-0000">%s</xliff:g>)
</string> </string>
<!-- Title text that indicates there is not internet connection. [CHAR LIMIT=80]--> <!-- Title text for support options when there is no internet access. [CHAR LIMIT=80]-->
<string name="support_offline_title">You\'re offline</string> <string name="support_offline_title">Call us toll-free</string>
<!-- Summary text telling user to connect to Internet in order to request customer support. [CHAR LIMIT=NONE]-->
<string name="support_offline_summary">To reach support, first connect to Wi-Fi or data.</string>
<!-- Title text for a list of international support phone numbers. [CHAR LIMIT=60]--> <!-- Title text for a list of international support phone numbers. [CHAR LIMIT=60]-->
<string name="support_international_phone_title">Traveling aboard?</string> <string name="support_international_phone_title">Traveling aboard?</string>

View File

@@ -168,8 +168,8 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
} }
private void addEscalationCards() { private void addEscalationCards() {
if (mSupportFeatureProvider.isAlwaysOperating(PHONE) if (mSupportFeatureProvider.isAlwaysOperating(PHONE, null /* countryCode */)
|| mSupportFeatureProvider.isAlwaysOperating(CHAT)) { || mSupportFeatureProvider.isAlwaysOperating(CHAT, null /* countryCode */)) {
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))
@@ -183,7 +183,7 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
} else { } else {
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_closed_title)
.setText2(mSupportFeatureProvider.getOperationHours(mActivity, PHONE)) .setText2(mSupportFeatureProvider.getOperationHours(mActivity, PHONE, null))
.build()); .build());
} }
final SupportData.Builder builder = final SupportData.Builder builder =
@@ -202,9 +202,16 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
} }
private void addOfflineEscalationCards() { private void addOfflineEscalationCards() {
final CharSequence operatingHours;
if (mSupportFeatureProvider.isAlwaysOperating(PHONE, mSelectedCountry)) {
operatingHours = mActivity.getString(R.string.support_escalation_24_7_summary);
} else {
operatingHours = mSupportFeatureProvider.getOperationHours(mActivity,
PHONE, mSelectedCountry);
}
mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE) mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
.setText1(R.string.support_offline_title) .setText1(R.string.support_offline_title)
.setText2(R.string.support_offline_summary) .setText2(operatingHours)
.build()); .build());
final OfflineSupportData.Builder builder = new OfflineSupportData.Builder(mActivity); final OfflineSupportData.Builder builder = new OfflineSupportData.Builder(mActivity);
builder.setCountries(mSupportFeatureProvider.getPhoneSupportCountries()) builder.setCountries(mSupportFeatureProvider.getPhoneSupportCountries())

View File

@@ -52,9 +52,10 @@ public interface SupportFeatureProvider {
boolean isSupportTypeEnabled(Context context, @SupportType int type); boolean isSupportTypeEnabled(Context context, @SupportType int type);
/** /**
* Whether or not a support type is in operation 24/7. * Whether or not a support type is in operation 24/7. If country is null, use
* current country.
*/ */
boolean isAlwaysOperating(@SupportType int type); boolean isAlwaysOperating(@SupportType int type, String countryCode);
/** /**
* Whether or not a support type is operating now. * Whether or not a support type is operating now.
@@ -62,16 +63,16 @@ public interface SupportFeatureProvider {
boolean isOperatingNow(@SupportType int type); boolean isOperatingNow(@SupportType int type);
/** /**
* Returns localized string for operation hours. * Returns localized string for operation hours in specified country. If country is null, use
* current country to figure out operation hours.
*/ */
CharSequence getOperationHours(Context context, @SupportType int type); CharSequence getOperationHours(Context context, @SupportType int type, String countryCode);
/** /**
* Returns a localized string indicating estimated wait time for a support time. * Returns a localized string indicating estimated wait time for a support time.
*/ */
String getEstimatedWaitTime(Context context, @SupportType int type); String getEstimatedWaitTime(Context context, @SupportType int type);
/** /**
* Returns a list of country codes that have phone support. * Returns a list of country codes that have phone support.
*/ */