diff --git a/README.md b/README.md index 5bcb4a7..9ac9d9e 100644 --- a/README.md +++ b/README.md @@ -48,22 +48,22 @@ Redirecting outgoing calls to E2EE apps. # Features -- Material You design -- Popup with cancel option +- Material You design +- Popup with cancel option - Extensive settings panel: - - Toggle per-service support - - Redirection only on Wi-Fi/Data - - Allowlist specific contacts - - Change per-service priority - - Customize popup position, animation, and duration + - Toggle per-service support + - Redirection only on Wi-Fi/Data + - Allowlist specific contacts + - Change per-service priority + - Customize popup position, animation, and duration - ... # Supports -- Signal -- Telegram -- Threema -- WhatsApp +- Signal +- Telegram +- Threema +- WhatsApp # How to Install @@ -73,7 +73,7 @@ Redirecting outgoing calls to E2EE apps. In the app, search for "Pulse" and install it. -_Pulse uses the IzzyOnDroid repo. Some F-Droid clients, such as F-Droid itself, do not include it by default. Please add the IzzyOnDroid repo: https://apt.izzysoft.de/fdroid/repo_ +*Pulse uses the IzzyOnDroid repo. Some F-Droid clients, such as F-Droid itself, do not include it by default. Please add the IzzyOnDroid repo: https://apt.izzysoft.de/fdroid/repo* ## Using Obtainium @@ -81,8 +81,8 @@ _Pulse uses the IzzyOnDroid repo. Some F-Droid clients, such as F-Droid itself, In the “Add App” screen: -1. Add the following URL: https://weforge.xyz/partisan/Pulse -2. In **Override Source**, select **Forgejo (Codeberg)** +1. Add the following URL: https://weforge.xyz/partisan/Pulse +2. In **Override Source**, select **Forgejo (Codeberg)** 3. Tap the “Add” button at the very top, and you’re done! ## Install directly @@ -91,16 +91,16 @@ Go to the [Releases page](https://weforge.xyz/partisan/Pulse/releases) and downl Install it, and you’re done! -_Please note that when installing directly, the app will not receive automatic updates._ +*Please note that when installing directly, the app will not receive automatic updates.* # Permissions -- `ACCESS_NETWORK_STATE` – check connectivity -- `CALL_PHONE` – make a call via messenger -- `READ_CONTACTS` – check if contact has a messenger -- `READ_PHONE_NUMBERS` – detect outgoing call -- `SYSTEM_ALERT_WINDOW` – show redirecting popup and launch from background -- `INTERNET` – check connectivity and verify donates +- `ACCESS_NETWORK_STATE` – check connectivity +- `CALL_PHONE` – make a call via messenger +- `READ_CONTACTS` – check if contact has a messenger +- `READ_PHONE_NUMBERS` – detect outgoing call +- `SYSTEM_ALERT_WINDOW` – show redirecting popup and launch from background +- `INTERNET` – check connectivity and verify donates Currently all of the permissions are required. @@ -120,4 +120,4 @@ Licensed under the [Public Domain](https://www.svgrepo.com/page/licensing/#PD). ## Original Author -[This software](https://github.com/x13a/Red) was originally developed by [x13a](https://github.com/x13a), but it has been archived by the owner on Jun 22, 2022. +[This software](https://github.com/x13a/Red) was originally developed by [x13a](https://github.com/x13a), but it has been archived by the owner on Jun 22, 2022. \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 7b72933..f9bf50f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,8 +11,8 @@ android { applicationId = "partisan.weforge.xyz.pulse" minSdk = 29 targetSdk = 34 - versionCode = 16 - versionName = "2.0.2" + versionCode = 15 + versionName = "2.0.1" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/partisan/weforge/xyz/pulse/ContactsFragment.kt b/app/src/main/java/partisan/weforge/xyz/pulse/ContactsFragment.kt index 39d236a..370281d 100644 --- a/app/src/main/java/partisan/weforge/xyz/pulse/ContactsFragment.kt +++ b/app/src/main/java/partisan/weforge/xyz/pulse/ContactsFragment.kt @@ -89,9 +89,7 @@ class ContactsFragment : Fragment() { } private fun getContacts(): List { - val results = mutableListOf() val resolver: ContentResolver = requireContext().contentResolver - val projection = arrayOf( ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER @@ -105,16 +103,16 @@ class ContactsFragment : Fragment() { "${ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME} ASC" ) + val results = mutableListOf() + cursor?.use { - val nameIndex = it.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME) - val numberIndex = it.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Phone.NUMBER) + val nameIndex = it.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME) + val numberIndex = it.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER) while (it.moveToNext()) { - val name = it.getString(nameIndex) - val number = it.getString(numberIndex) - if (!name.isNullOrBlank() && !number.isNullOrBlank()) { - results.add(ContactEntry(name, number)) - } + val name = it.getString(nameIndex) ?: continue + val number = it.getString(numberIndex) ?: continue + results.add(ContactEntry(name, number)) } } diff --git a/app/src/main/java/partisan/weforge/xyz/pulse/MainFragment.kt b/app/src/main/java/partisan/weforge/xyz/pulse/MainFragment.kt index 72cc529..9e8c3b4 100644 --- a/app/src/main/java/partisan/weforge/xyz/pulse/MainFragment.kt +++ b/app/src/main/java/partisan/weforge/xyz/pulse/MainFragment.kt @@ -1,20 +1,17 @@ package partisan.weforge.xyz.pulse -import android.net.ConnectivityManager -import android.net.NetworkCapabilities import android.os.Bundle import android.os.SystemClock import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.TextView import androidx.fragment.app.Fragment import com.google.android.material.button.MaterialButton -import java.util.concurrent.TimeUnit import nl.dionsegijn.konfetti.core.Party import nl.dionsegijn.konfetti.core.Position import nl.dionsegijn.konfetti.core.emitter.Emitter import nl.dionsegijn.konfetti.xml.KonfettiView +import java.util.concurrent.TimeUnit class MainFragment : Fragment() { @@ -27,9 +24,9 @@ class MainFragment : Fragment() { } override fun onCreateView( - inflater: LayoutInflater, - container: ViewGroup?, - savedInstanceState: Bundle? + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? ): View { val view = inflater.inflate(R.layout.fragment_main, container, false) prefs = Preferences(requireContext()) @@ -47,16 +44,14 @@ class MainFragment : Fragment() { if (isNowChecked && SystemClock.elapsedRealtime() - lastConfettiTime > 500) { konfetti.start( - Party( - emitter = - Emitter(duration = 100, TimeUnit.MILLISECONDS) - .perSecond(100), - speed = 30f, - maxSpeed = 40f, - damping = 0.85f, - spread = 360, - position = Position.Relative(0.5, 0.5) - ) + Party( + emitter = Emitter(duration = 100, TimeUnit.MILLISECONDS).perSecond(100), + speed = 30f, + maxSpeed = 40f, + damping = 0.85f, + spread = 360, + position = Position.Relative(0.5, 0.5) + ) ) lastConfettiTime = SystemClock.elapsedRealtime() } @@ -67,49 +62,6 @@ class MainFragment : Fragment() { } } - val warningText = view.findViewById(R.id.warningText) - val warnings = mutableListOf() - - // 1. Check if contacts are available - val contactCursor = - requireContext() - .contentResolver - .query( - android.provider.ContactsContract.CommonDataKinds.Phone.CONTENT_URI, - null, - null, - null, - null - ) - - if (contactCursor != null) { - contactCursor.use { - if (!it.moveToFirst()) { - warnings.add(getString(R.string.warn_no_contacts)) - } - } - } else { - warnings.add(getString(R.string.warn_no_contacts)) - } - - // 2. Check internet connectivity - if (!hasInternet()) { - warnings.add(getString(R.string.warn_no_internet)) - } - - // Show warning if needed - if (warnings.isNotEmpty()) { - warningText.text = warnings.joinToString("\n") - warningText.visibility = View.VISIBLE - } - return view } - - private fun hasInternet(): Boolean { - val cm = requireContext().getSystemService(ConnectivityManager::class.java) - val capabilities = cm?.getNetworkCapabilities(cm.activeNetwork) ?: return false - return capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) && - capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED) - } } diff --git a/app/src/main/java/partisan/weforge/xyz/pulse/SecretView.kt b/app/src/main/java/partisan/weforge/xyz/pulse/SecretView.kt index 759e8aa..64efcce 100644 --- a/app/src/main/java/partisan/weforge/xyz/pulse/SecretView.kt +++ b/app/src/main/java/partisan/weforge/xyz/pulse/SecretView.kt @@ -127,13 +127,10 @@ class SecretView @JvmOverloads constructor( com.google.android.material.R.attr.colorPrimaryVariant, com.google.android.material.R.attr.colorSecondary ) - val ta = context.obtainStyledAttributes(colorAttrs) - try { - playerPaint.color = ta.getColor(0, Color.CYAN) - enemyPaint.color = ta.getColor(0, Color.CYAN) - colorSecondary = ta.getColor(1, Color.GREEN) - } finally { - ta.recycle() + context.obtainStyledAttributes(colorAttrs).use { + playerPaint.color = it.getColor(0, Color.CYAN) + enemyPaint.color = it.getColor(0, Color.CYAN) + colorSecondary = it.getColor(1, Color.GREEN) } Choreographer.getInstance().postFrameCallback(this) diff --git a/app/src/main/res/layout/fragment_main.xml b/app/src/main/res/layout/fragment_main.xml index 741fc5e..86b4dee 100644 --- a/app/src/main/res/layout/fragment_main.xml +++ b/app/src/main/res/layout/fragment_main.xml @@ -34,17 +34,4 @@ app:iconGravity="textTop" app:iconPadding="0dp" app:cornerRadius="48dp" /> - - - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 19b99a3..2ebeab5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -47,10 +47,6 @@ Random - - Unable to access contacts. - No internet connection. - Support Pulse Development 💖 Pulse is free and open-source. You can support future development through Ko-fi. As a thank-you, donors get special popup animation effects! diff --git a/fastlane/metadata/android/en-US/changelogs/17.txt b/fastlane/metadata/android/en-US/changelogs/17.txt deleted file mode 100644 index d18ecdb..0000000 --- a/fastlane/metadata/android/en-US/changelogs/17.txt +++ /dev/null @@ -1,3 +0,0 @@ -v2.0.2 -- Added warning text in case the app does not have sufficient permissions -- Fixed a bug related to tapping the Pulse logo in the About section, specific to MIUI \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/full_description.txt b/fastlane/metadata/android/en-US/full_description.txt index e63bda7..09bf845 100644 --- a/fastlane/metadata/android/en-US/full_description.txt +++ b/fastlane/metadata/android/en-US/full_description.txt @@ -3,7 +3,6 @@ Redirect calls to Signal, Telegram, Threema, or WhatsApp. --- **Features:** - - Material You design - Popup with cancel option - Extensive settings panel: @@ -12,17 +11,15 @@ Redirect calls to Signal, Telegram, Threema, or WhatsApp. - Allowlist specific contacts - Change per-service priority - Customize popup position, animation, and duration - - etc + ... **Supports:** - - Signal - Telegram - Threema - WhatsApp **Permissions required:** - - `CALL_PHONE` - initiate calls via messenger - `READ_CONTACTS` - check contact compatibility - `READ_PHONE_NUMBERS` - detect outgoing call @@ -32,8 +29,5 @@ Redirect calls to Signal, Telegram, Threema, or WhatsApp. Currently all of the permissions are required. ---- - **License:** GPL-3.0 - Free and open source