Skip to content

Commit

Permalink
Issue #256: Disable Git feature completely in Play Store build
Browse files Browse the repository at this point in the history
  • Loading branch information
amberin committed May 16, 2024
1 parent 1c08c23 commit d11fe49
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -51,4 +54,4 @@ class SshKeyCreationTest(private val param: Parameter) : OrgzlyTest() {
.check(matches(isDisplayed()))
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit d11fe49

Please sign in to comment.