diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1b7e76ebe..d1a0a2d9b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -22,6 +22,7 @@ jobs: matrix: # TODO: Run on lowest and highest supported API api-level: [29, 34] + flavor: [Fdroid, Premium] steps: - name: checkout uses: actions/checkout@v4 @@ -84,4 +85,4 @@ jobs: disable-spellchecker: true profile: Nexus 6 # Tests should use the build which includes Dropbox code. - script: ./gradlew connectedPremiumDebugAndroidTest --no-watch-fs --build-cache --info + script: ./gradlew connected${{matrix.flavor}}DebugAndroidTest --no-watch-fs --build-cache --info diff --git a/app/build.gradle b/app/build.gradle index 59f9614e9..90b2621fc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -67,6 +67,9 @@ android { premium { buildConfigField "boolean", "IS_DROPBOX_ENABLED", "true" + // Remove Git feature because of Play restrictions on external storage permissions + buildConfigField "boolean", "IS_GIT_REMOVED", "true" + buildConfigField "String", "VERSION_NAME_SUFFIX", '""' dimension "store" @@ -79,6 +82,8 @@ android { */ buildConfigField "boolean", "IS_DROPBOX_ENABLED", "false" + buildConfigField "boolean", "IS_GIT_REMOVED", "false" + buildConfigField "String", "VERSION_NAME_SUFFIX", '" (fdroid)"' dimension "store" diff --git a/app/src/androidTest/java/com/orgzly/android/espresso/ReposActivityTest.java b/app/src/androidTest/java/com/orgzly/android/espresso/ReposActivityTest.java index acf5c3f1a..6bed5034b 100644 --- a/app/src/androidTest/java/com/orgzly/android/espresso/ReposActivityTest.java +++ b/app/src/androidTest/java/com/orgzly/android/espresso/ReposActivityTest.java @@ -15,6 +15,8 @@ import androidx.test.core.app.ActivityScenario; +import android.os.SystemClock; + import com.orgzly.BuildConfig; import com.orgzly.R; import com.orgzly.android.OrgzlyTest; @@ -48,6 +50,7 @@ public void testDirectoryRepoWithPercentCharacter() { ActivityScenario.launch(ReposActivity.class); onView(withId(R.id.activity_repos_flipper)).check(matches(isDisplayed())); + SystemClock.sleep(100); onView(isRoot()).perform(waitId(R.id.activity_repos_directory, 5000)); onView(withId(R.id.activity_repos_directory)).perform(scroll(), click()); onView(withId(R.id.activity_repo_directory)).perform(replaceTextCloseKeyboard(repoUri)); @@ -88,6 +91,7 @@ public void testCreateRepoWithExistingUrl() { String url = "file:" + context.getExternalCacheDir().getAbsolutePath(); // file:/storage/emulated/0/Android/data/com.orgzly/cache + SystemClock.sleep(500); onView(withId(R.id.activity_repos_directory)).perform(scroll(), click()); onView(withId(R.id.activity_repo_directory)).perform(replaceTextCloseKeyboard(url)); onView(withId(R.id.fab)).perform(click()); // Repo done diff --git a/app/src/androidTest/java/com/orgzly/android/espresso/SshKeyCreationTest.kt b/app/src/androidTest/java/com/orgzly/android/espresso/SshKeyCreationTest.kt index 2dd91e48d..62cda5c23 100644 --- a/app/src/androidTest/java/com/orgzly/android/espresso/SshKeyCreationTest.kt +++ b/app/src/androidTest/java/com/orgzly/android/espresso/SshKeyCreationTest.kt @@ -10,12 +10,14 @@ import androidx.test.espresso.matcher.ViewMatchers.isDisplayed import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation import com.orgzly.R +import com.orgzly.BuildConfig import com.orgzly.android.OrgzlyTest import com.orgzly.android.espresso.util.EspressoUtils import com.orgzly.android.ui.main.MainActivity import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized +import org.junit.Assume @RunWith(value = Parameterized::class) @@ -35,6 +37,7 @@ class SshKeyCreationTest(private val param: Parameter) : OrgzlyTest() { @Test fun testCreateUnprotectedKey() { + Assume.assumeFalse(BuildConfig.IS_GIT_REMOVED); ActivityScenario.launch(MainActivity::class.java).use { EspressoUtils.onActionItemClick(R.id.activity_action_settings, R.string.settings) EspressoUtils.clickSetting(null, R.string.app) @@ -51,4 +54,4 @@ class SshKeyCreationTest(private val param: Parameter) : OrgzlyTest() { .check(matches(isDisplayed())) } } -} \ No newline at end of file +} diff --git a/app/src/fdroid/AndroidManifest.xml b/app/src/fdroid/AndroidManifest.xml new file mode 100644 index 000000000..ad7ab0235 --- /dev/null +++ b/app/src/fdroid/AndroidManifest.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 27112b767..4242e8453 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -16,8 +16,6 @@ - - diff --git a/app/src/main/java/com/orgzly/android/ui/settings/SettingsFragment.kt b/app/src/main/java/com/orgzly/android/ui/settings/SettingsFragment.kt index 00a5b61bc..57a1333ea 100644 --- a/app/src/main/java/com/orgzly/android/ui/settings/SettingsFragment.kt +++ b/app/src/main/java/com/orgzly/android/ui/settings/SettingsFragment.kt @@ -99,8 +99,8 @@ class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedP } } - // Disable Git repos completely on API < 23 - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { + // Disable Git repos completely on API < 23 and in the Play Store build + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N || BuildConfig.IS_GIT_REMOVED) { preference(R.string.pref_key_git_is_enabled)?.let { preferenceScreen.removePreference(it) }