diff --git a/CHANGES.md b/CHANGES.md index 5e09a67c5f..3c37763248 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -16,6 +16,7 @@ Improvements 🙌: Other changes: - Change the way RiotX identifies a session to allow the SDK to support several sessions with the same user (#800) + - Exclude play-services-oss-licenses library from F-Droid build (#814) Bugfix 🐛: - Fix crash when opening room creation screen from the room filtering screen diff --git a/vector/build.gradle b/vector/build.gradle index c8d474088f..513449db51 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -186,6 +186,7 @@ android { gplay { dimension "store" + resValue "bool", "isGplay", "true" buildConfigField "boolean", "ALLOW_FCM_USE", "true" buildConfigField "String", "SHORT_FLAVOR_DESCRIPTION", "\"G\"" buildConfigField "String", "FLAVOR_DESCRIPTION", "\"GooglePlay\"" @@ -194,6 +195,7 @@ android { fdroid { dimension "store" + resValue "bool", "isGplay", "false" buildConfigField "boolean", "ALLOW_FCM_USE", "false" buildConfigField "String", "SHORT_FLAVOR_DESCRIPTION", "\"F\"" buildConfigField "String", "FLAVOR_DESCRIPTION", "\"FDroid\"" @@ -249,9 +251,6 @@ dependencies { implementation "com.squareup.moshi:moshi-adapters:$moshi_version" kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version" - // OSS License - implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0' - // Log implementation 'com.jakewharton.timber:timber:4.7.1' @@ -343,6 +342,9 @@ dependencies { exclude group: 'com.google.firebase', module: 'firebase-measurement-connector' } + // OSS License, gplay flavor only + gplayImplementation 'com.google.android.gms:play-services-oss-licenses:17.0.0' + implementation "androidx.emoji:emoji-appcompat:1.0.0" // TESTS diff --git a/vector/src/fdroid/java/im/vector/riotx/FlavorCode.kt b/vector/src/fdroid/java/im/vector/riotx/FlavorCode.kt new file mode 100644 index 0000000000..de1ee2290b --- /dev/null +++ b/vector/src/fdroid/java/im/vector/riotx/FlavorCode.kt @@ -0,0 +1,22 @@ +/* + * Copyright 2020 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.riotx + +import android.content.Context + +// No op +fun openOssLicensesMenuActivity(@Suppress("UNUSED_PARAMETER") context: Context) = Unit diff --git a/vector/src/gplay/java/im/vector/riotx/FlavorCode.kt b/vector/src/gplay/java/im/vector/riotx/FlavorCode.kt new file mode 100644 index 0000000000..109e9bc978 --- /dev/null +++ b/vector/src/gplay/java/im/vector/riotx/FlavorCode.kt @@ -0,0 +1,23 @@ +/* + * Copyright 2020 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.riotx + +import android.content.Context +import android.content.Intent +import com.google.android.gms.oss.licenses.OssLicensesMenuActivity + +fun openOssLicensesMenuActivity(context: Context) = context.startActivity(Intent(context, OssLicensesMenuActivity::class.java)) diff --git a/vector/src/main/java/im/vector/riotx/features/settings/VectorSettingsHelpAboutFragment.kt b/vector/src/main/java/im/vector/riotx/features/settings/VectorSettingsHelpAboutFragment.kt index 6ce928c05d..6c10b8695d 100644 --- a/vector/src/main/java/im/vector/riotx/features/settings/VectorSettingsHelpAboutFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/settings/VectorSettingsHelpAboutFragment.kt @@ -20,13 +20,13 @@ import android.content.Intent import android.net.Uri import android.provider.Settings import androidx.preference.Preference -import com.google.android.gms.oss.licenses.OssLicensesMenuActivity import im.vector.matrix.android.api.Matrix import im.vector.riotx.R import im.vector.riotx.core.preference.VectorPreference import im.vector.riotx.core.utils.copyToClipboard import im.vector.riotx.core.utils.displayInWebView import im.vector.riotx.features.version.VersionProvider +import im.vector.riotx.openOssLicensesMenuActivity import javax.inject.Inject class VectorSettingsHelpAboutFragment @Inject constructor( @@ -107,10 +107,11 @@ class VectorSettingsHelpAboutFragment @Inject constructor( false } + // Note: preference is not visible on F-Droid build findPreference(VectorPreferences.SETTINGS_OTHER_THIRD_PARTY_NOTICES_PREFERENCE_KEY)!! .onPreferenceClickListener = Preference.OnPreferenceClickListener { // See https://developers.google.com/android/guides/opensource - startActivity(Intent(requireActivity(), OssLicensesMenuActivity::class.java)) + openOssLicensesMenuActivity(requireActivity()) false } } diff --git a/vector/src/main/res/xml/vector_settings_help_about.xml b/vector/src/main/res/xml/vector_settings_help_about.xml index 4aec87c123..2720a19533 100644 --- a/vector/src/main/res/xml/vector_settings_help_about.xml +++ b/vector/src/main/res/xml/vector_settings_help_about.xml @@ -1,5 +1,6 @@ + android:title="@string/settings_other_third_party_notices" + app:isPreferenceVisible="@bool/isGplay" /> \ No newline at end of file