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