Fixes : #4273 Add link to user guide in About (#4882)

* user guide added in about

* test added

* unit test added
This commit is contained in:
RISHAV GUPTA 2022-03-20 07:50:25 +05:30 committed by GitHub
parent 1078c70525
commit 6ea3198d65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 0 deletions

View file

@ -104,6 +104,15 @@ class AboutActivityTest {
IntentMatchers.hasData(Urls.CREDITS_URL)))
}
@Test
@Ignore("Fix Failing Test")
fun testLaunchUserGuide() {
Espresso.onView(ViewMatchers.withId(R.id.about_user_guide)).perform(ViewActions.click())
Intents.intended(CoreMatchers.allOf(IntentMatchers.hasAction(Intent.ACTION_VIEW),
IntentMatchers.hasData(Urls.USER_GUIDE_URL)))
}
@Test
@Ignore("Fix Failing Test")
fun testLaunchAboutFaq() {

View file

@ -64,6 +64,7 @@ public class AboutActivity extends BaseActivity {
Utils.setUnderlinedText(binding.aboutFaq, R.string.about_faq, getApplicationContext());
Utils.setUnderlinedText(binding.aboutRateUs, R.string.about_rate_us, getApplicationContext());
Utils.setUnderlinedText(binding.aboutUserGuide, R.string.user_guide, getApplicationContext());
Utils.setUnderlinedText(binding.aboutPrivacyPolicy, R.string.about_privacy_policy, getApplicationContext());
Utils.setUnderlinedText(binding.aboutTranslate, R.string.about_translate, getApplicationContext());
Utils.setUnderlinedText(binding.aboutCredits, R.string.about_credits, getApplicationContext());
@ -77,6 +78,7 @@ public class AboutActivity extends BaseActivity {
binding.aboutRateUs.setOnClickListener(this::launchRatings);
binding.aboutCredits.setOnClickListener(this::launchCredits);
binding.aboutPrivacyPolicy.setOnClickListener(this::launchPrivacyPolicy);
binding.aboutUserGuide.setOnClickListener(this::launchUserGuide);
binding.aboutFaq.setOnClickListener(this::launchFrequentlyAskedQuesions);
binding.aboutTranslate.setOnClickListener(this::launchTranslate);
}
@ -114,6 +116,10 @@ public class AboutActivity extends BaseActivity {
Utils.handleWebUrl(this, Uri.parse(Urls.CREDITS_URL));
}
public void launchUserGuide(View view) {
Utils.handleWebUrl(this, Uri.parse(Urls.USER_GUIDE_URL));
}
public void launchPrivacyPolicy(View view) {
Utils.handleWebUrl(this, Uri.parse(BuildConfig.PRIVACY_POLICY_URL));
}

View file

@ -5,6 +5,7 @@ internal object Urls {
const val GITHUB_REPO_URL = "https://github.com/commons-app/apps-android-commons"
const val WEBSITE_URL = "https://commons-app.github.io"
const val CREDITS_URL = "https://github.com/commons-app/apps-android-commons/blob/master/CREDITS"
const val USER_GUIDE_URL = "https://commons-app.github.io/docs.html"
const val FAQ_URL = "https://github.com/commons-app/commons-app-documentation/blob/master/android/Frequently-Asked-Questions.md"
const val PLAY_STORE_PREFIX = "market://details?id="
const val PLAY_STORE_URL_PREFIX = "https://play.google.com/store/apps/details?id="

View file

@ -120,6 +120,15 @@
android:textColor="?attr/colorAccent"
/>
<TextView
android:id="@+id/about_user_guide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/standard_gap"
android:gravity="center"
android:textColor="?attr/colorAccent"
/>
<TextView
android:id="@+id/about_privacy_policy"
style="?android:textAppearanceSmall"

View file

@ -262,6 +262,7 @@
<string name="nearby_commons">Commons</string>
<string name="about_rate_us">Rate us</string>
<string name="about_faq">FAQ</string>
<string name="user_guide">User Guide</string>
<string name="welcome_skip_button">Skip Tutorial</string>
<string name="no_internet">Internet unavailable</string>
<string name="error_notifications">Error fetching notifications</string>

View file

@ -83,6 +83,12 @@ class AboutActivityUnitTests {
activity.launchPrivacyPolicy(null)
}
@Test
@Throws(Exception::class)
fun testLaunchUserGuide() {
activity.launchUserGuide(null)
}
@Test
@Throws(Exception::class)
fun testLaunchFrequentlyAskedQuestions() {