Skip to content

Commit

Permalink
Merge pull request #222 from metabrainz/ref-release
Browse files Browse the repository at this point in the history
Remove Listens Service and Bump Dependencies
  • Loading branch information
akshaaatt authored Apr 27, 2023
2 parents 8a540f0 + 7d13042 commit 6fce405
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 146 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/android-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: set up JDK
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11
cache: gradle
java-version: '17'
distribution: 'adopt'

- run: chmod +x gradlew
- run: ./gradlew lint
- uses: yutailang0119/action-android-lint@v3
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down
82 changes: 44 additions & 38 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ def keystorePropertiesFile = rootProject.file("keystore.properties")

android {
namespace 'org.metabrainz.android'

compileSdk 33
signingConfigs {
release {
Expand All @@ -28,7 +27,7 @@ android {
minSdk 21
targetSdk 33
versionCode 55
versionName "6.1.1"
versionName "7.0.0"

multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -72,49 +71,56 @@ android {
disable 'MissingTranslation'
}
composeOptions {
kotlinCompilerExtensionVersion '1.3.0'
kotlinCompilerExtensionVersion '1.4.6'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
}

dependencies {
//AndroidX
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.core:core-ktx:1.10.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.browser:browser:1.4.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.browser:browser:1.5.0'
implementation 'androidx.recyclerview:recyclerview:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'androidx.core:core-splashscreen:1.0.0'
implementation 'androidx.core:core-splashscreen:1.0.1'

//Web Service Setup
implementation 'com.google.code.gson:gson:2.10'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.11'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.11'
implementation 'androidx.paging:paging-runtime-ktx:3.1.1'

//Image downloading and Caching library
implementation 'com.github.bumptech.glide:glide:4.14.2'
kapt 'com.github.bumptech.glide:compiler:4.14.2'
implementation 'com.github.bumptech.glide:glide:4.15.1'
kapt 'com.github.bumptech.glide:compiler:4.15.1'

//Fragment Setup For Kotlin
implementation "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
implementation "androidx.navigation:navigation-ui-ktx:$navigationVersion"
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1'

//Tagger & Metadata Setup
implementation 'info.debatty:java-string-similarity:2.0.0'

//Design Setup
implementation 'com.google.android.material:material:1.8.0-beta01'
implementation 'com.airbnb.android:lottie:5.2.0'
implementation 'com.github.akshaaatt:Onboarding:1.0.4'
implementation 'com.google.android.material:material:1.8.0'
implementation 'com.airbnb.android:lottie:6.0.0'
implementation 'com.github.akshaaatt:Onboarding:1.0.5'
implementation 'com.github.akshaaatt:Share-Android:1.0.0'

//Barcode Scan
Expand All @@ -123,47 +129,47 @@ dependencies {
//Dagger-Hilt
implementation("com.google.dagger:hilt-android:$hilt_version")
kapt("com.google.dagger:hilt-android-compiler:$hilt_version")
implementation group: 'androidx.lifecycle', name: 'lifecycle-viewmodel-ktx', version: '2.5.1'
implementation group: 'androidx.lifecycle', name: 'lifecycle-viewmodel-ktx', version: '2.6.1'
kapt("androidx.hilt:hilt-compiler:1.0.0")

//Jetpack Compose
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation "androidx.compose.ui:ui-util:$compose_version"
implementation "androidx.compose.material:material:1.3.1"
implementation "androidx.compose.material:material-icons-extended:1.3.1"
implementation 'androidx.compose.material3:material3:1.1.0-alpha03'
implementation 'androidx.compose.material3:material3-window-size-class:1.1.0-alpha03'
implementation 'androidx.compose.material:material:1.4.2'
implementation 'androidx.compose.material:material-icons-extended:1.4.2'
implementation 'androidx.compose.material3:material3:1.1.0-rc01'
implementation 'androidx.compose.material3:material3-window-size-class:1.1.0-rc01'
implementation "androidx.compose.animation:animation:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.constraintlayout:constraintlayout-compose:1.0.1'
implementation 'androidx.navigation:navigation-compose:2.6.0-alpha04'
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1'
implementation 'androidx.navigation:navigation-compose:2.6.0-beta01'
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1'
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0'
implementation 'io.coil-kt:coil-compose:2.2.2'
implementation 'com.airbnb.android:lottie-compose:5.2.0'
implementation 'androidx.navigation:navigation-compose:2.6.0-alpha04'
implementation 'io.coil-kt:coil-compose:2.3.0'
implementation 'com.airbnb.android:lottie-compose:6.0.0'
implementation 'androidx.navigation:navigation-compose:2.6.0-beta01'

//Test Setup
testImplementation 'junit:junit:4.13.2'
testImplementation 'com.squareup.okhttp3:mockwebserver:5.0.0-alpha.7'
testImplementation 'androidx.arch.core:core-testing:2.1.0'
testImplementation 'androidx.arch.core:core-testing:2.2.0'
testImplementation 'org.hamcrest:hamcrest-all:1.3'
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4'
testImplementation "androidx.room:room-testing:2.4.3"
testImplementation 'androidx.room:room-testing:2.5.1'

androidTestImplementation 'androidx.test:runner:1.5.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.arch.core:core-testing:2.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.5.0'
androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.arch.core:core-testing:2.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.5.1'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"

//Room db
implementation "androidx.room:room-runtime:2.4.3"
kapt "androidx.room:room-compiler:2.4.3"
implementation "androidx.room:room-ktx:2.4.3"
implementation 'androidx.room:room-runtime:2.5.1'
kapt 'androidx.room:room-compiler:2.5.1'
implementation 'androidx.room:room-ktx:2.5.1'

// Jetpack Compose accompanists (https://github.com/google/accompanist)
implementation 'com.google.accompanist:accompanist-systemuicontroller:0.28.0'
implementation 'com.google.accompanist:accompanist-systemuicontroller:0.30.0'
}
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
android:name="android.hardware.camera"
android:required="false" />

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/java/org/metabrainz/android/application/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import android.graphics.Typeface
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.os.Build
import android.provider.Settings
import dagger.hilt.android.HiltAndroidApp
import org.metabrainz.android.util.Configuration

Expand All @@ -24,11 +23,6 @@ class App : Application() {
robotoLight = Typeface.createFromAsset(context!!.assets, "Roboto-Light.ttf")
}

val isNotificationServiceAllowed: Boolean
get() {
val listeners = Settings.Secure.getString(contentResolver, "enabled_notification_listeners")
return listeners != null && listeners.contains(packageName)
}
val isOnline: Boolean
get() {
val connectivityManager = applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import android.os.Bundle
import androidx.appcompat.app.AlertDialog
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import com.aemerse.onboard.OnboardAdvanced
import com.aemerse.onboard.OnboardFragment
import com.aemerse.onboard.OnboardPageTransformerType
import com.aemerse.onboard.model.SliderPage
import com.limurse.onboard.OnboardAdvanced
import com.limurse.onboard.OnboardFragment
import com.limurse.onboard.OnboardPageTransformerType
import com.limurse.onboard.model.SliderPage
import org.metabrainz.android.R
import org.metabrainz.android.ui.screens.dashboard.DashboardActivity
import org.metabrainz.android.util.UserPreferences
Expand All @@ -19,7 +19,8 @@ class FeaturesActivity : OnboardAdvanced() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

addSlide(OnboardFragment.newInstance(
addSlide(
OnboardFragment.newInstance(
SliderPage(
"Search",
"Explore MusicBrainz Data",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
package org.metabrainz.android.ui.screens.settings

import android.content.DialogInterface
import android.content.Intent
import android.graphics.drawable.ColorDrawable
import android.os.Build
import android.os.Bundle
import android.provider.Settings
import android.view.MenuItem
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.preference.Preference
import androidx.preference.SwitchPreference
import org.metabrainz.android.application.App
import org.metabrainz.android.R
import org.metabrainz.android.databinding.ActivityPreferencesBinding
import org.metabrainz.android.util.UserPreferences.PREFERENCE_LISTENING_ENABLED
import org.metabrainz.android.util.UserPreferences.PREFERENCE_SYSTEM_THEME
import org.metabrainz.android.util.UserPreferences.preferenceListeningEnabled
import org.metabrainz.android.ui.theme.isUiModeIsDark
import org.metabrainz.android.util.UserPreferences.PREFERENCE_SYSTEM_THEME

class SettingsActivity : AppCompatActivity() {

Expand Down Expand Up @@ -48,24 +41,6 @@ class SettingsActivity : AppCompatActivity() {
}

preferenceChangeListener = Preference.OnPreferenceChangeListener { preference: Preference, newValue: Any ->
if (preference.key == PREFERENCE_LISTENING_ENABLED) {
val enabled = newValue as Boolean
if (enabled && !App.context!!.isNotificationServiceAllowed) {
val builder = AlertDialog.Builder(this)
builder.setTitle("Grant Media Control Permissions")
builder.setMessage("The listen service requires the special Notification " +
"Listener Service Permission to run. Please grant this permission to" +
" MusicBrainz for Android if you want to use the service.")
builder.setPositiveButton("Proceed") { dialog: DialogInterface?, which: Int -> startActivity(Intent(ACTION_NOTIFICATION_LISTENER_SETTINGS)) }
builder.setNegativeButton("Cancel") { dialog: DialogInterface?, which: Int ->
preferenceListeningEnabled = false
(preference as SwitchPreference).isChecked = false
}
builder.create().show()
}
return@OnPreferenceChangeListener true
}

// Explicit Ui Mode functionality.
if (preference.key == PREFERENCE_SYSTEM_THEME){
when (newValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ import android.view.MenuItem
import android.widget.Toast
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreference
import org.metabrainz.android.application.App
import org.metabrainz.android.R
import org.metabrainz.android.ui.screens.dashboard.DashboardActivity
import org.metabrainz.android.ui.screens.suggestion.SuggestionProvider
import org.metabrainz.android.util.UserPreferences.PREFERENCE_CLEAR_SUGGESTIONS
import org.metabrainz.android.util.UserPreferences.PREFERENCE_LISTENING_ENABLED
import org.metabrainz.android.util.UserPreferences.PREFERENCE_SYSTEM_THEME
import org.metabrainz.android.util.UserPreferences.preferenceListeningEnabled
import org.metabrainz.android.ui.screens.suggestion.SuggestionProvider
import org.metabrainz.android.ui.screens.dashboard.DashboardActivity

class SettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceClickListener {
private var preferenceChangeListener: Preference.OnPreferenceChangeListener? = null
Expand All @@ -28,19 +24,6 @@ class SettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceClic
setPreferencesFromResource(R.xml.preferences, rootKey)
findPreference<Preference>(PREFERENCE_CLEAR_SUGGESTIONS)!!.onPreferenceClickListener = this
findPreference<Preference>(PREFERENCE_SYSTEM_THEME)!!.onPreferenceChangeListener = preferenceChangeListener
if (!App.context!!.isNotificationServiceAllowed) {
(findPreference<Preference>(PREFERENCE_LISTENING_ENABLED) as SwitchPreference?)!!.isChecked = false
preferenceListeningEnabled = false
}
findPreference<Preference>(PREFERENCE_LISTENING_ENABLED)!!.onPreferenceChangeListener = preferenceChangeListener
}

override fun onResume() {
super.onResume()
if (!App.context!!.isNotificationServiceAllowed) {
(findPreference<Preference>(PREFERENCE_LISTENING_ENABLED) as SwitchPreference?)!!.isChecked = false
preferenceListeningEnabled = false
}
}

override fun onPreferenceClick(preference: Preference): Boolean {
Expand Down
13 changes: 0 additions & 13 deletions app/src/main/java/org/metabrainz/android/util/UserPreferences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ import org.metabrainz.android.application.App
object UserPreferences {

const val PREFERENCE_CLEAR_SUGGESTIONS = "clear_suggestions"
const val PREFERENCE_LISTENBRAINZ_TOKEN = "listenbrainz_user_token"
const val PREFERENCE_PICARD_PORT = "picard_port"
const val PREFERENCE_IP_ADDRESS = "ip_address"
const val PREFERENCE_LISTENING_ENABLED = "listening_enabled"
private const val PREFERENCE_LISTENING_SPOTIFY = "listening_spotify_enabled"
private const val PREFERENCE_GET_PRIVATE_COLLECTIONS = "private_collections"
private const val PREFERENCE_RATINGS_TAGS = "ratings_tags"
private const val PREFERENCE_SYSTEM_LANGUAGE = "use_english"
Expand All @@ -33,14 +30,4 @@ object UserPreferences {
get() = preferences.getString(PREFERENCE_PICARD_PORT, "8000")!!
val preferenceIpAddress: String?
get() = preferences.getString(PREFERENCE_IP_ADDRESS, null)

val preferenceListenBrainzToken = preferences.getString(PREFERENCE_LISTENBRAINZ_TOKEN, null)
var preferenceListeningEnabled: Boolean
get() = preferences.getBoolean(PREFERENCE_LISTENING_ENABLED, false)
set(value) {
val editor = preferences.edit()
editor.putBoolean(PREFERENCE_LISTENING_ENABLED, value)
editor.apply()
}
val preferenceListeningSpotifyEnabled = preferences.getBoolean(PREFERENCE_LISTENING_SPOTIFY, false)
}
23 changes: 0 additions & 23 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,29 +44,6 @@
android:title="@string/settings_use_language" />
</PreferenceCategory>

<PreferenceCategory
android:key="listen_settings"
android:title="@string/settings_listens">

<EditTextPreference
android:key="listenbrainz_user_token"
android:selectAllOnFocus="true"
android:singleLine="true"
android:summary="@string/settings_listenbrainz_token_summary"
android:title="@string/settings_listenbrainz_token" />

<SwitchPreference
android:defaultValue="false"
android:key="listening_enabled"
android:title="@string/settings_listenbrainz_enabled" />

<SwitchPreference
android:defaultValue="false"
android:key="listening_spotify_enabled"
android:title="@string/settings_listenbrainz_spotify"
android:summary="@string/settings_listenbrainz_spotify_summary" />

</PreferenceCategory>
<PreferenceCategory
android:key="picard_settings"
android:title="Picard">
Expand Down
Loading

0 comments on commit 6fce405

Please sign in to comment.