mirror of
https://github.com/YTVanced/Integrations
synced 2024-11-27 13:43:01 +00:00
Merge remote-tracking branch 'upstream/master' into segment-length-improvements
This commit is contained in:
commit
0c27da8b3a
3 changed files with 23 additions and 13 deletions
|
@ -448,7 +448,8 @@ public abstract class SponsorBlockUtils {
|
|||
preference.setSummary(str("stats_username_change"));
|
||||
preference.setText(userName);
|
||||
preference.setOnPreferenceChangeListener((preference1, newUsername) -> {
|
||||
Requester.setUsername((String) newUsername);
|
||||
appContext = new WeakReference<>(context.getApplicationContext());
|
||||
Requester.setUsername((String) newUsername, toastRunnable);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -134,9 +134,6 @@ public class Requester {
|
|||
case 403:
|
||||
SponsorBlockUtils.messageToToast = str("vote_failed_forbidden");
|
||||
break;
|
||||
case 429:
|
||||
SponsorBlockUtils.messageToToast = str("vote_failed_rate_limit");
|
||||
break;
|
||||
default:
|
||||
SponsorBlockUtils.messageToToast = str("vote_failed_unknown_error", responseCode, connection.getResponseMessage());
|
||||
break;
|
||||
|
@ -170,9 +167,18 @@ public class Requester {
|
|||
}).start();
|
||||
}
|
||||
|
||||
public static void setUsername(String username) {
|
||||
public static void setUsername(String username, Runnable toastRunnable) {
|
||||
try {
|
||||
HttpURLConnection connection = getConnectionFromRoute(Route.CHANGE_USERNAME, SponsorBlockSettings.uuid, username);
|
||||
int responseCode = connection.getResponseCode();
|
||||
|
||||
if (responseCode == 200) {
|
||||
SponsorBlockUtils.messageToToast = str("stats_username_changed");
|
||||
}
|
||||
else {
|
||||
SponsorBlockUtils.messageToToast = str("stats_username_change_unknown_error", responseCode, connection.getResponseMessage());
|
||||
}
|
||||
new Handler(Looper.getMainLooper()).post(toastRunnable);
|
||||
connection.disconnect();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
|
|
@ -182,18 +182,22 @@
|
|||
<string name="skip_automatically">Skip automatically</string>
|
||||
<string name="skip_showbutton">Show a skip button</string>
|
||||
<string name="skip_ignore">Don\'t do anything</string>
|
||||
|
||||
<string name="stats">Stats</string>
|
||||
<string name="stats_loading">Loading..</string>
|
||||
<string name="stats_sb_disabled">SponsorBlock is disabled</string>
|
||||
<string name="stats_username">Your username: <b>%s</b></string>
|
||||
<string name="stats_username" formatted="false">Your username: <b>%s</b></string>
|
||||
<string name="stats_username_change">Click to change your username</string>
|
||||
<string name="stats_submissions">Submissions: <b>%s</b></string>
|
||||
<string name="stats_saved">You\'ve saved people from <b>%s</b> segments.</string>
|
||||
<string name="stats_saved_sum">That\'s <b>%s</b> of their lives. Click to see the leaderboard</string>
|
||||
<string name="stats_self_saved">You\'ve skipped <b>%s</b> segments.</string>
|
||||
<string name="stats_self_saved_sum">That\'s <b>%s</b>.</string>
|
||||
<string name="stats_username_change_unknown_error" formatted="false">Unable to change username: Status: %d %s</string>
|
||||
<string name="stats_username_changed">Username changed successfully</string>
|
||||
<string name="stats_submissions" formatted="false">Submissions: <b>%s</b></string>
|
||||
<string name="stats_saved" formatted="false">You\'ve saved people from <b>%s</b> segments.</string>
|
||||
<string name="stats_saved_sum" formatted="false">That\'s <b>%s</b> of their lives. Click to see the leaderboard</string>
|
||||
<string name="stats_self_saved" formatted="false">You\'ve skipped <b>%s</b> segments.</string>
|
||||
<string name="stats_self_saved_sum" formatted="false">That\'s <b>%s</b>.</string>
|
||||
|
||||
<string name="about">About</string>
|
||||
<string name="about_api">This app uses the API from Sponsor Block</string>
|
||||
<string name="about_api">This app uses the API from SponsorBlock</string>
|
||||
<string name="about_api_sum">Tap to learn more, and see downloads for other platforms at: sponsor.ajay.app</string>
|
||||
<string name="about_madeby">Integration made by JakubWeg</string>
|
||||
<string name="tap_skip">Tap to skip</string>
|
||||
|
@ -206,7 +210,6 @@
|
|||
<string name="submit_started">Submitting segment…</string>
|
||||
|
||||
<string name="vote_failed_unknown_error" formatted="false">Unable to vote for segment: Status: %d %s</string>
|
||||
<string name="vote_failed_rate_limit">Can\'t vote for segment.\nRate Limited (Too many from the same user or IP)</string>
|
||||
<string name="vote_failed_forbidden">Can\'t vote for segment.\nA moderator has decided that this segment is correct</string>
|
||||
<string name="vote_succeeded">Voted successfully</string>
|
||||
<string name="vote_started">Voting for segment…</string>
|
||||
|
|
Loading…
Reference in a new issue