mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 13:50:30 +05:30
commit
8519648e87
@ -3,6 +3,7 @@ package com.github.libretube.dialogs
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.widget.Button
|
||||
import android.widget.EditText
|
||||
@ -62,7 +63,8 @@ class DeleteAccountDialog : DialogFragment() {
|
||||
val response = try {
|
||||
RetrofitInstance.api.deleteAccount(token, DeleteUserRequest(password))
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
Log.e(TAG, e.toString())
|
||||
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
|
||||
return@launchWhenCreated
|
||||
}
|
||||
Toast.makeText(context, R.string.success, Toast.LENGTH_SHORT).show()
|
||||
|
@ -114,9 +114,6 @@ class InstanceSettings : PreferenceFragmentCompat() {
|
||||
val topBarTextView = activity?.findViewById<TextView>(R.id.topBar_textView)
|
||||
topBarTextView?.text = getString(R.string.instance)
|
||||
|
||||
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
|
||||
val token = sharedPref?.getString("token", "")
|
||||
|
||||
val instance = findPreference<ListPreference>("selectInstance")
|
||||
// fetchInstance()
|
||||
initCustomInstances()
|
||||
@ -155,8 +152,9 @@ class InstanceSettings : PreferenceFragmentCompat() {
|
||||
}
|
||||
|
||||
val deleteAccount = findPreference<Preference>("delete_account")
|
||||
deleteAccount?.parent?.removePreference(deleteAccount)
|
||||
deleteAccount?.setOnPreferenceClickListener {
|
||||
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
|
||||
val token = sharedPref?.getString("token", "")
|
||||
if (token != "") {
|
||||
val newFragment = DeleteAccountDialog()
|
||||
newFragment.show(childFragmentManager, "DeleteAccountDialog")
|
||||
@ -168,6 +166,8 @@ class InstanceSettings : PreferenceFragmentCompat() {
|
||||
|
||||
val importFromYt = findPreference<Preference>("import_from_yt")
|
||||
importFromYt?.setOnPreferenceClickListener {
|
||||
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
|
||||
val token = sharedPref?.getString("token", "")
|
||||
// check StorageAccess
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
Log.d("myz", "" + Build.VERSION.SDK_INT)
|
||||
|
@ -91,7 +91,7 @@ interface PipedApi {
|
||||
suspend fun deleteAccount(
|
||||
@Header("Authorization") token: String,
|
||||
@Body password: DeleteUserRequest
|
||||
): Message
|
||||
)
|
||||
|
||||
@GET("feed")
|
||||
suspend fun getFeed(@Query("authToken") token: String?): List<StreamItem>
|
||||
|
Loading…
Reference in New Issue
Block a user