Skip to content

Commit 08ec61b

Browse files
committed
feat: Clear checkin info in remove all registered apps option
1 parent 0d2aaa9 commit 08ec61b

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

play-services-core/src/main/kotlin/org/microg/gms/ui/PushNotificationAdvancedFragment.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ package org.microg.gms.ui
77

88
import android.annotation.SuppressLint
99
import android.content.Intent
10-
import android.net.Uri
1110
import android.os.Bundle
1211
import android.provider.Settings
1312
import android.view.View
@@ -24,9 +23,12 @@ import com.google.android.material.color.MaterialColors
2423
import com.google.android.material.transition.MaterialSharedAxis
2524
import kotlinx.coroutines.Dispatchers
2625
import kotlinx.coroutines.delay
26+
import android.widget.Toast
2727
import kotlinx.coroutines.launch
2828
import kotlinx.coroutines.withContext
29+
import org.microg.gms.checkin.LastCheckinInfo
2930
import org.microg.gms.gcm.*
31+
import androidx.core.net.toUri
3032

3133
class PushNotificationAdvancedFragment : PreferenceFragmentCompat() {
3234
private lateinit var confirmNewApps: TwoStatePreference
@@ -133,7 +135,7 @@ class PushNotificationAdvancedFragment : PreferenceFragmentCompat() {
133135
true
134136
}
135137

136-
findPreference<Preference>("pref_push_notification_reset")
138+
findPreference<Preference>("pref_remove_all_registers")
137139
?.setOnPreferenceClickListener {
138140
showRemoveRegistersDialog()
139141
true
@@ -188,11 +190,12 @@ class PushNotificationAdvancedFragment : PreferenceFragmentCompat() {
188190
private fun openOverlayPermissionSettings() {
189191
val context = requireContext()
190192
val intent = Intent(
191-
Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:${context.packageName}")
193+
Settings.ACTION_MANAGE_OVERLAY_PERMISSION, "package:${context.packageName}".toUri()
192194
)
193195
startActivity(intent)
194196
}
195197

198+
@SuppressLint("SetTextI18n")
196199
private fun showRemoveRegistersDialog() {
197200
val dialog = AlertDialog.Builder(requireContext()).setIcon(R.drawable.ic_unregister)
198201
.setTitle(R.string.gcm_remove_registers_dialog_title)
@@ -221,8 +224,10 @@ class PushNotificationAdvancedFragment : PreferenceFragmentCompat() {
221224
positiveButton.setOnClickListener {
222225
lifecycleScope.launch {
223226
withContext(Dispatchers.IO) {
227+
LastCheckinInfo.clear(requireContext())
224228
database.resetDatabase()
225229
}
230+
Toast.makeText(requireContext(), R.string.gcm_remove_registers_toast_message, Toast.LENGTH_SHORT).show()
226231
}
227232
dialog.dismiss()
228233
}

play-services-core/src/main/res/values/strings.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,14 @@ Your data will not be lost"</string>
7474
<string name="gcm_remove_registers_dialog_title">Remove all registers?</string>
7575
<!-- %1$s is an app name, such as "YouTube"? -->
7676
<string name="gcm_unregister_confirm_title">Unregister %1$s?</string>
77-
<string name="gcm_remove_registers_dialog_message">"This will remove all applications registered for push notifications at once
77+
<string name="gcm_remove_registers_dialog_message">"This will remove all registered apps from receiving push notifications at once
7878

79-
You will need to open the applications to re-register on cloud messaging
79+
You will need a new securityToken and AndroidID to register apps. Check the device registration status
8080

81-
Some apps may be unable to register again after this action"</string>
81+
Some apps may not be able to register again after this action. You may need to clear the data for these apps before they can request registration again"</string>
8282
<string name="gcm_unregister_confirm_message">"Some apps do not automatically re-register and/or do not provide an option to do so manually. These apps might not work correctly after unregistering.
8383
Continue?"</string>
84+
<string name="gcm_remove_registers_toast_message">All apps removed from push notification</string>
8485
<string name="gcm_unregister_after_deny_message">"You denied an app to register for push notifications that is already registered.
8586
Do you want to unregister it now so it does not receive push messages in the future?"</string>
8687
<!--gcm: register messages infos-->

play-services-core/src/main/res/xml/preferences_push_notification_settings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
app:iconSpaceReserved="false" />
3333

3434
<Preference
35-
android:key="pref_push_notification_reset"
35+
android:key="pref_remove_all_registers"
3636
android:layout="@layout/preference_material_bottom"
3737
android:summary="@string/pref_gcm_remove_registers_summary"
3838
android:title="@string/pref_gcm_remove_registers"

0 commit comments

Comments
 (0)