diff options
author | Thomas <tschneider.ac@gmail.com> | 2023-01-24 18:08:58 +0100 |
---|---|---|
committer | Thomas <tschneider.ac@gmail.com> | 2023-01-24 18:08:58 +0100 |
commit | e87a347354b05141a1b1fff29776fa2b06e60be4 (patch) | |
tree | 7ae5f1e94992bfab7d20ed156f944e9f9495f187 | |
parent | 7b071eb9eb7bcb5e773010451f75e7b6dc93bc26 (diff) |
working
29 files changed, 367 insertions, 175 deletions
diff --git a/app/build.gradle b/app/build.gradle index d5e61613e..5aa4eeedc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -68,6 +68,7 @@ android { 'src/main/res/layouts/mastodon', 'src/main/res/layouts/peertube', 'src/main/res/layouts', + 'src/main/layout', 'src/main/res/drawables/mastodon', 'src/main/res/drawables/peertube', 'src/main/res/drawables', diff --git a/app/src/fdroid/java/app/fedilab/android/activities/PeertubeBaseMainActivity.java b/app/src/fdroid/java/app/fedilab/android/activities/PeertubeBaseMainActivity.java index c1a4dbe67..aef21de7e 100644 --- a/app/src/fdroid/java/app/fedilab/android/activities/PeertubeBaseMainActivity.java +++ b/app/src/fdroid/java/app/fedilab/android/activities/PeertubeBaseMainActivity.java @@ -107,7 +107,7 @@ public abstract class PeertubeBaseMainActivity extends AppCompatActivity impleme assert b != null; int state = b.getInt("state_asked", -1); int displayed = b.getInt("displayed", -1); - castedTube = b.getParcelable("castedTube"); + castedTube = (VideoData.Video) b.getSerializable("castedTube"); if (state == 1) { discoverCast(); diff --git a/app/src/main/assets/categories.json b/app/src/main/assets/categories.json new file mode 100644 index 000000000..bab347916 --- /dev/null +++ b/app/src/main/assets/categories.json @@ -0,0 +1,20 @@ +{ + "1": "Music", + "2": "Films", + "3": "Vehicles", + "4": "Art", + "5": "Sports", + "6": "Travels", + "7": "Gaming", + "8": "People", + "9": "Comedy", + "10": "Entertainment", + "11": "News & Politics", + "12": "How To", + "13": "Education", + "14": "Activism", + "15": "Science & Technology", + "16": "Animals", + "17": "Kids", + "18": "Food" +}
\ No newline at end of file diff --git a/app/src/main/assets/languages.json b/app/src/main/assets/languages.json new file mode 100644 index 000000000..347c4e6e9 --- /dev/null +++ b/app/src/main/assets/languages.json @@ -0,0 +1,199 @@ +{ + "aa": "Afar", + "ab": "Abkhazian", + "af": "Afrikaans", + "ak": "Akan", + "am": "Amharic", + "ar": "Arabic", + "an": "Aragonese", + "ase": "American Sign Language", + "as": "Assamese", + "av": "Avaric", + "avk": "Kotava", + "ay": "Aymara", + "az": "Azerbaijani", + "ba": "Bashkir", + "bm": "Bambara", + "be": "Belarusian", + "bn": "Bengali", + "bfi": "British Sign Language", + "bi": "Bislama", + "bo": "Tibetan", + "bs": "Bosnian", + "br": "Breton", + "bg": "Bulgarian", + "bzs": "Brazilian Sign Language", + "ca": "Catalan", + "cs": "Czech", + "ch": "Chamorro", + "ce": "Chechen", + "cv": "Chuvash", + "kw": "Cornish", + "co": "Corsican", + "cr": "Cree", + "cse": "Czech Sign Language", + "csl": "Chinese Sign Language", + "cy": "Welsh", + "da": "Danish", + "de": "German", + "dv": "Dhivehi", + "dsl": "Danish Sign Language", + "dz": "Dzongkha", + "el": "Greek", + "en": "English", + "eo": "Esperanto", + "et": "Estonian", + "eu": "Basque", + "ee": "Ewe", + "fo": "Faroese", + "fa": "Persian", + "fj": "Fijian", + "fi": "Finnish", + "fr": "French", + "fy": "Western Frisian", + "fsl": "French Sign Language", + "ff": "Fulah", + "gd": "Scottish Gaelic", + "ga": "Irish", + "gl": "Galician", + "gv": "Manx", + "gn": "Guarani", + "gsg": "German Sign Language", + "gu": "Gujarati", + "ht": "Haitian", + "ha": "Hausa", + "sh": "Serbo-Croatian", + "he": "Hebrew", + "hz": "Herero", + "hi": "Hindi", + "ho": "Hiri Motu", + "hr": "Croatian", + "hu": "Hungarian", + "hy": "Armenian", + "ig": "Igbo", + "ii": "Sichuan Yi", + "iu": "Inuktitut", + "id": "Indonesian", + "ik": "Inupiaq", + "is": "Icelandic", + "it": "Italian", + "jv": "Javanese", + "jbo": "Lojban", + "ja": "Japanese", + "jsl": "Japanese Sign Language", + "kab": "Kabyle", + "kl": "Kalaallisut", + "kn": "Kannada", + "ks": "Kashmiri", + "ka": "Georgian", + "kr": "Kanuri", + "kk": "Kazakh", + "km": "Khmer", + "ki": "Kikuyu", + "rw": "Kinyarwanda", + "ky": "Kirghiz", + "kv": "Komi", + "kg": "Kongo", + "ko": "Korean", + "kj": "Kuanyama", + "ku": "Kurdish", + "lo": "Lao", + "la": "Latin", + "lv": "Latvian", + "li": "Limburgan", + "ln": "Lingala", + "lt": "Lithuanian", + "lb": "Luxembourgish", + "lu": "Luba-Katanga", + "lg": "Ganda", + "mh": "Marshallese", + "ml": "Malayalam", + "mr": "Marathi", + "mk": "Macedonian", + "mg": "Malagasy", + "mt": "Maltese", + "mn": "Mongolian", + "mi": "Maori", + "ms": "Malay (macrolanguage)", + "my": "Burmese", + "na": "Nauru", + "nv": "Navajo", + "nr": "South Ndebele", + "nd": "North Ndebele", + "ng": "Ndonga", + "ne": "Nepali (macrolanguage)", + "nl": "Dutch", + "nn": "Norwegian Nynorsk", + "nb": "Norwegian Bokmål", + "no": "Norwegian", + "ny": "Nyanja", + "oc": "Occitan", + "oj": "Ojibwa", + "or": "Oriya (macrolanguage)", + "om": "Oromo", + "os": "Ossetian", + "pa": "Panjabi", + "pks": "Pakistan Sign Language", + "pl": "Polish", + "pt": "Portuguese", + "ps": "Pushto", + "qu": "Quechua", + "rm": "Romansh", + "ro": "Romanian", + "rsl": "Russian Sign Language", + "rn": "Rundi", + "ru": "Russian", + "sg": "Sango", + "sdl": "Saudi Arabian Sign Language", + "sfs": "South African Sign Language", + "si": "Sinhala", + "sk": "Slovak", + "sl": "Slovenian", + "se": "Northern Sami", + "sm": "Samoan", + "sn": "Shona", + "sd": "Sindhi", + "so": "Somali", + "st": "Southern Sotho", + "es": "Spanish", + "sq": "Albanian", + "sc": "Sardinian", + "sr": "Serbian", + "ss": "Swati", + "su": "Sundanese", + "sw": "Swahili (macrolanguage)", + "sv": "Swedish", + "swl": "Swedish Sign Language", + "ty": "Tahitian", + "ta": "Tamil", + "tt": "Tatar", + "te": "Telugu", + "tg": "Tajik", + "tl": "Tagalog", + "th": "Thai", + "ti": "Tigrinya", + "tlh": "Klingon", + "to": "Tonga (Tonga Islands)", + "tn": "Tswana", + "ts": "Tsonga", + "tk": "Turkmen", + "tr": "Turkish", + "tw": "Twi", + "ug": "Uighur", + "uk": "Ukrainian", + "ur": "Urdu", + "uz": "Uzbek", + "ve": "Venda", + "vi": "Vietnamese", + "wa": "Walloon", + "wo": "Wolof", + "xh": "Xhosa", + "yi": "Yiddish", + "yo": "Yoruba", + "za": "Zhuang", + "zh": "Chinese", + "zu": "Zulu", + "zxx": "No linguistic content", + "zh-Hans": "Simplified Chinese", + "zh-Hant": "Traditional Chinese" +}
\ No newline at end of file diff --git a/app/src/main/java/app/fedilab/android/BaseMainActivity.java b/app/src/main/java/app/fedilab/android/BaseMainActivity.java index 57be860ba..a86f778ed 100644 --- a/app/src/main/java/app/fedilab/android/BaseMainActivity.java +++ b/app/src/main/java/app/fedilab/android/BaseMainActivity.java @@ -17,9 +17,10 @@ package app.fedilab.android; import static app.fedilab.android.BaseMainActivity.status.DISCONNECTED; import static app.fedilab.android.BaseMainActivity.status.UNKNOWN; import static app.fedilab.android.mastodon.helper.CacheHelper.deleteDir; +import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_ID; +import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE; import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_SOFTWARE; import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_TOKEN; -import static app.fedilab.android.mastodon.helper.Helper.TAG; import static app.fedilab.android.mastodon.helper.Helper.displayReleaseNotesIfNeeded; import static app.fedilab.android.mastodon.ui.drawer.StatusAdapter.sendAction; @@ -43,7 +44,6 @@ import android.provider.BaseColumns; import android.text.Editable; import android.text.Html; import android.text.TextWatcher; -import android.util.Log; import android.util.Patterns; import android.util.TypedValue; import android.view.Gravity; @@ -330,7 +330,6 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt BaseMainActivity.currentToken = sharedpreferences.getString(Helper.PREF_USER_TOKEN, null); } String software = sharedpreferences.getString(PREF_USER_SOFTWARE, null); - Log.v(TAG, "software: " + software); if (software != null && software.equalsIgnoreCase("peertube")) { startActivity(new Intent(this, PeertubeMainActivity.class)); finish(); @@ -725,14 +724,22 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt item.setOnMenuItemClickListener(item1 -> { if (!this.isFinishing()) { headerMenuOpen = false; - Toasty.info(BaseMainActivity.this, getString(R.string.toast_account_changed, "@" + account.mastodon_account.acct + "@" + account.instance), Toasty.LENGTH_LONG).show(); + String acctForAccount = ""; + if (account.mastodon_account != null) { + acctForAccount = "@" + account.mastodon_account.username + "@" + account.instance; + } else if (account.peertube_account != null) { + acctForAccount = "@" + account.peertube_account.getUsername() + "@" + account.instance; + } + Toasty.info(BaseMainActivity.this, getString(R.string.toast_account_changed, acctForAccount), Toasty.LENGTH_LONG).show(); BaseMainActivity.currentToken = account.token; BaseMainActivity.currentUserID = account.user_id; + BaseMainActivity.currentInstance = account.instance; api = account.api; SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putString(PREF_USER_TOKEN, account.token); editor.putString(PREF_USER_SOFTWARE, account.software); - Log.v(TAG, "put 2: " + account.software); + editor.putString(PREF_USER_INSTANCE, account.instance); + editor.putString(PREF_USER_ID, account.user_id); editor.commit(); //The user is now aut //The user is now authenticated, it will be redirected to MainActivity @@ -968,9 +975,12 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt Toasty.info(BaseMainActivity.this, getString(R.string.toast_account_changed, account), Toasty.LENGTH_LONG).show(); BaseMainActivity.currentToken = accounts.get(0).token; BaseMainActivity.currentUserID = accounts.get(0).user_id; + BaseMainActivity.currentInstance = accounts.get(0).instance; api = accounts.get(0).api; SharedPreferences.Editor editor = sharedpreferences.edit(); + editor.putString(PREF_USER_ID, accounts.get(0).user_id); editor.putString(PREF_USER_TOKEN, accounts.get(0).token); + editor.putString(PREF_USER_INSTANCE, accounts.get(0).instance); editor.putString(PREF_USER_SOFTWARE, accounts.get(0).software); editor.commit(); //The user is now aut @@ -993,10 +1003,13 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt Toasty.info(BaseMainActivity.this, getString(R.string.toast_account_changed, account), Toasty.LENGTH_LONG).show(); BaseMainActivity.currentToken = accounts.get(1).token; BaseMainActivity.currentUserID = accounts.get(1).user_id; + BaseMainActivity.currentInstance = accounts.get(1).instance; api = accounts.get(1).api; SharedPreferences.Editor editor = sharedpreferences.edit(); + editor.putString(PREF_USER_ID, accounts.get(1).user_id); editor.putString(PREF_USER_TOKEN, accounts.get(1).token); editor.putString(PREF_USER_SOFTWARE, accounts.get(1).software); + editor.putString(PREF_USER_INSTANCE, accounts.get(1).instance); editor.commit(); //The user is now aut //The user is now authenticated, it will be redirected to MainActivity @@ -1061,7 +1074,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt String userIdIntent, instanceIntent, urlOfMessage; if (extras != null && extras.containsKey(Helper.INTENT_ACTION)) { userIdIntent = extras.getString(Helper.PREF_USER_ID); //Id of the account in the intent - instanceIntent = extras.getString(Helper.PREF_INSTANCE); + instanceIntent = extras.getString(Helper.PREF_USER_INSTANCE); urlOfMessage = extras.getString(Helper.PREF_MESSAGE_URL); if (extras.getInt(Helper.INTENT_ACTION) == Helper.NOTIFICATION_INTENT) { if (userIdIntent != null && instanceIntent != null && userIdIntent.equals(currentUserID) && instanceIntent.equals(currentInstance)) { @@ -1078,7 +1091,6 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putString(PREF_USER_TOKEN, account.token); editor.putString(PREF_USER_SOFTWARE, account.software); - Log.v(TAG, "put 3: " + account.software); editor.commit(); Intent mainActivity = new Intent(this, MainActivity.class); mainActivity.putExtra(Helper.INTENT_ACTION, Helper.OPEN_NOTIFICATION); diff --git a/app/src/main/java/app/fedilab/android/mastodon/helper/Helper.java b/app/src/main/java/app/fedilab/android/mastodon/helper/Helper.java index 284be1648..4c56d7a5b 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/helper/Helper.java +++ b/app/src/main/java/app/fedilab/android/mastodon/helper/Helper.java @@ -58,7 +58,6 @@ import android.provider.MediaStore; import android.provider.OpenableColumns; import android.text.TextUtils; import android.util.DisplayMetrics; -import android.util.Log; import android.util.TypedValue; import android.view.Menu; import android.view.MenuItem; @@ -303,7 +302,6 @@ public class Helper { public static final String PREF_IS_MODERATOR = "PREF_IS_MODERATOR"; public static final String PREF_IS_ADMINISTRATOR = "PREF_IS_ADMINISTRATOR"; public static final String PREF_MESSAGE_URL = "PREF_MESSAGE_URL"; - public static final String PREF_INSTANCE = "PREF_INSTANCE"; public static final String SET_SECURITY_PROVIDER = "SET_SECURITY_PROVIDER"; @@ -915,10 +913,12 @@ public class Helper { OauthVM oauthVM = new ViewModelProvider((ViewModelStoreOwner) activity).get(OauthVM.class); - //Revoke the token - oauthVM.revokeToken(currentAccount.instance, currentAccount.token, currentAccount.client_id, currentAccount.client_secret); - //Log out the current user - accountDB.removeUser(currentAccount); + if (currentAccount != null) { + //Revoke the token + oauthVM.revokeToken(currentAccount.instance, currentAccount.token, currentAccount.client_id, currentAccount.client_secret); + //Log out the current user + accountDB.removeUser(currentAccount); + } BaseAccount newAccount = accountDB.getLastUsedAccount(); SharedPreferences.Editor editor = sharedpreferences.edit(); if (newAccount == null) { @@ -934,7 +934,6 @@ public class Helper { currentAccount = newAccount; editor.putString(PREF_USER_TOKEN, newAccount.token); editor.putString(PREF_USER_SOFTWARE, newAccount.software); - Log.v(TAG, "put 4: " + newAccount.software); editor.putString(PREF_USER_INSTANCE, newAccount.instance); editor.putString(PREF_USER_ID, newAccount.user_id); BaseMainActivity.currentUserID = newAccount.user_id; diff --git a/app/src/main/java/app/fedilab/android/mastodon/helper/NotificationsHelper.java b/app/src/main/java/app/fedilab/android/mastodon/helper/NotificationsHelper.java index c7922f48b..4fb6fcbe8 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/helper/NotificationsHelper.java +++ b/app/src/main/java/app/fedilab/android/mastodon/helper/NotificationsHelper.java @@ -372,7 +372,7 @@ public class NotificationsHelper { intent.putExtra(Helper.PREF_USER_ID, account.user_id); if (targeted_account != null) intent.putExtra(Helper.INTENT_TARGETED_ACCOUNT, targeted_account); - intent.putExtra(Helper.PREF_INSTANCE, account.instance); + intent.putExtra(Helper.PREF_USER_INSTANCE, account.instance); notificationUrl = notification.account.avatar; Handler mainHandler = new Handler(Looper.getMainLooper()); final String finalNotificationUrl = notificationUrl; diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java index 54e7aef99..108634f67 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java @@ -30,7 +30,6 @@ import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_ID; import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE; import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_SOFTWARE; import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_TOKEN; -import static app.fedilab.android.mastodon.helper.Helper.TAG; import android.annotation.SuppressLint; import android.app.Activity; @@ -51,7 +50,6 @@ import android.os.Looper; import android.text.Html; import android.text.SpannableString; import android.text.TextUtils; -import android.util.Log; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -1999,7 +1997,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putString(PREF_USER_TOKEN, account.token); editor.putString(PREF_USER_SOFTWARE, account.software); - Log.v(TAG, "put 5: " + account.software); editor.putString(PREF_USER_INSTANCE, account.instance); editor.putString(PREF_USER_ID, account.user_id); editor.commit(); @@ -2026,7 +2023,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putString(PREF_USER_TOKEN, account.token); editor.putString(PREF_USER_SOFTWARE, account.software); - Log.v(TAG, "put 6: " + account.software); editor.putString(PREF_USER_INSTANCE, account.instance); editor.putString(PREF_USER_ID, account.user_id); editor.commit(); diff --git a/app/src/main/java/app/fedilab/android/peertube/activities/AccountActivity.java b/app/src/main/java/app/fedilab/android/peertube/activities/AccountActivity.java index 49e4ab829..72c7d7274 100644 --- a/app/src/main/java/app/fedilab/android/peertube/activities/AccountActivity.java +++ b/app/src/main/java/app/fedilab/android/peertube/activities/AccountActivity.java @@ -124,7 +124,7 @@ public class AccountActivity extends BaseBarActivity { TabLayout.Tab notificationTab = binding.accountTabLayout.newTab(); - if (Helper.isLoggedIn(AccountActivity.this)) { + if (Helper.isLoggedIn()) { if (badgeCount > 0) { binding.accountTabLayout.addTab(notificationTab.setText(getString(R.string.title_notifications) + " (" + badgeCount + ")")); } else { diff --git a/app/src/main/java/app/fedilab/android/peertube/activities/PeertubeActivity.java b/app/src/main/java/app/fedilab/android/peertube/activities/PeertubeActivity.java index b4e5d623f..ff3bf331a 100644 --- a/app/src/main/java/app/fedilab/android/peertube/activities/PeertubeActivity.java +++ b/app/src/main/java/app/fedilab/android/peertube/activities/PeertubeActivity.java @@ -21,7 +21,6 @@ import static app.fedilab.android.peertube.client.RetrofitPeertubeAPI.ActionType import static app.fedilab.android.peertube.client.RetrofitPeertubeAPI.ActionType.REPLY; import static app.fedilab.android.peertube.client.RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT; import static app.fedilab.android.peertube.client.RetrofitPeertubeAPI.ActionType.REPORT_VIDEO; -import static app.fedilab.android.peertube.helper.Helper.canMakeAction; import static app.fedilab.android.peertube.helper.Helper.getAttColor; import static app.fedilab.android.peertube.helper.Helper.isLoggedIn; import static app.fedilab.android.peertube.helper.Helper.loadAvatar; @@ -216,7 +215,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis max_id = "0"; SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(PeertubeActivity.this); String token = sharedpreferences.getString(PREF_USER_TOKEN, null); - if (Helper.canMakeAction(PeertubeActivity.this) && !sepiaSearch) { + if (Helper.isLoggedIn() && !sepiaSearch) { BaseAccount account = null; try { account = new app.fedilab.android.mastodon.client.entities.app.Account(PeertubeActivity.this).getAccountByToken(token); @@ -264,17 +263,13 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis videoUuid = b.getString("video_uuid", null); isMyVideo = b.getBoolean("isMyVideo", false); sepiaSearch = b.getBoolean("sepia_search", false); - peertube = b.getParcelable("video"); + peertube = (VideoData.Video) b.getSerializable("video"); } willPlayFromIntent = manageIntentUrl(intent); - if (Helper.isLoggedInType(PeertubeActivity.this) == PeertubeMainActivity.TypeOfConnection.REMOTE_ACCOUNT) { - binding.peertubeLikeCount.setVisibility(View.GONE); - binding.peertubeDislikeCount.setVisibility(View.GONE); - binding.peertubePlaylist.setVisibility(View.GONE); - } else { + if (Helper.isLoggedIn()) { binding.peertubePlaylist.setVisibility(View.VISIBLE); } @@ -289,7 +284,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis } } }); - if (!Helper.canMakeAction(PeertubeActivity.this) || sepiaSearch) { + if (!Helper.isLoggedIn() || sepiaSearch) { binding.writeCommentContainer.setVisibility(View.GONE); } playInMinimized = sharedpreferences.getBoolean(getString(R.string.set_video_minimize_choice), true); @@ -385,7 +380,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis } } }); - if (!willPlayFromIntent && peertube != null && sepiaSearch && peertube.getEmbedUrl() != null && Helper.isLoggedIn(PeertubeActivity.this)) { + if (!willPlayFromIntent && peertube != null && sepiaSearch && peertube.getEmbedUrl() != null && Helper.isLoggedIn()) { SearchVM viewModelSearch = new ViewModelProvider(PeertubeActivity.this).get(SearchVM.class); viewModelSearch.getVideos("0", peertube.getUuid()).observe(PeertubeActivity.this, this::manageVIewVideos); } else { @@ -397,7 +392,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis openFullscreenDialog(); } binding.postCommentButton.setOnClickListener(v -> { - if (canMakeAction(PeertubeActivity.this) && !sepiaSearch) { + if (Helper.isLoggedIn() && !sepiaSearch) { openPostComment(null, 0); } else { if (sepiaSearch) { @@ -862,7 +857,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis PlaylistsVM viewModel = new ViewModelProvider(this).get(PlaylistsVM.class); viewModel.videoExists(videoIds).observe(this, this::manageVIewPlaylist); - if (!Helper.canMakeAction(PeertubeActivity.this) || sepiaSearch) { + if (!Helper.isLoggedIn() || sepiaSearch) { binding.writeCommentContainer.setVisibility(View.GONE); } @@ -985,7 +980,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis binding.peertubeLikeCount.setOnClickListener(v -> { - if (isLoggedIn(PeertubeActivity.this) && !sepiaSearch) { + if (isLoggedIn() && !sepiaSearch) { String newState = peertube.getMyRating().equals("like") ? "none" : "like"; PostActionsVM viewModelLike = new ViewModelProvider(PeertubeActivity.this).get(PostActionsVM.class); viewModelLike.post(RATEVIDEO, peertube.getId(), newState).observe(PeertubeActivity.this, apiResponse1 -> manageVIewPostActions(RATEVIDEO, 0, apiResponse1)); @@ -1010,7 +1005,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis } }); binding.peertubeDislikeCount.setOnClickListener(v -> { - if (isLoggedIn(PeertubeActivity.this) && !sepiaSearch) { + if (isLoggedIn() && !sepiaSearch) { String newState = peertube.getMyRating().equals("dislike") ? "none" : "dislike"; PostActionsVM viewModelLike = new ViewModelProvider(PeertubeActivity.this).get(PostActionsVM.class); viewModelLike.post(RATEVIDEO, peertube.getId(), newState).observe(PeertubeActivity.this, apiResponse1 -> manageVIewPostActions(RATEVIDEO, 0, apiResponse1)); @@ -1210,14 +1205,14 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis private void fetchComments() { if (peertube.isCommentsEnabled()) { - if (Helper.canMakeAction(PeertubeActivity.this)) { + if (Helper.isLoggedIn()) { binding.postCommentButton.setVisibility(View.VISIBLE); } else { binding.postCommentButton.setVisibility(View.GONE); } CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class); commentViewModel.getThread(sepiaSearch ? peertubeInstance : null, videoUuid, max_id).observe(PeertubeActivity.this, this::manageVIewComment); - if (Helper.canMakeAction(PeertubeActivity.this) && !sepiaSearch) { + if (Helper.isLoggedIn() && !sepiaSearch) { |