Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

chore: Merge branch dev to main #704

Merged
merged 28 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
18dbf8b
chore: Adjust PR body
oSumAtrIX Sep 30, 2024
469a1a9
ci: Adjust release commit message
oSumAtrIX Sep 30, 2024
85e0cb9
build(Needs bump): Update dependencies
oSumAtrIX Sep 30, 2024
a06b7a3
ci: Use permissions and regular GitHub token instead of PAT
oSumAtrIX Sep 30, 2024
df2ebfb
chore: Release v1.15.1-dev.1 [skip ci]
semantic-release-bot Oct 1, 2024
16c3ef7
feat(YouTube - Hide Shorts components): Add option to hide like fount…
oSumAtrIX Oct 2, 2024
f82d293
chore: Release v1.16.0-dev.1 [skip ci]
semantic-release-bot Oct 2, 2024
ea4b073
fix(YouTube - Spoof video streams): Handle app left open for a long t…
LisoUseInAIKyrios Oct 3, 2024
c12b9a3
chore: Release v1.16.0-dev.2 [skip ci]
semantic-release-bot Oct 3, 2024
4b5f3de
feat(YouTube - Hide layout components): Add option to hide Yoodles (Y…
LisoUseInAIKyrios Oct 6, 2024
ca064a7
chore: Release v1.16.0-dev.3 [skip ci]
semantic-release-bot Oct 6, 2024
119c416
fix(YouTube - Hide layout components): Adjust settings text (#713)
LisoUseInAIKyrios Oct 6, 2024
5e802ed
chore: Release v1.16.0-dev.4 [skip ci]
semantic-release-bot Oct 6, 2024
af45ab5
chore(YouTube): Fix typo
LisoUseInAIKyrios Oct 7, 2024
faad754
feat(YouTube - Hide Shorts components): Add options to hide `Use temp…
MarcaDian Oct 14, 2024
142de1a
chore: Release v1.16.0-dev.5 [skip ci]
semantic-release-bot Oct 14, 2024
8ad3f78
fix(YouTube - Spoof video streams): Fix playback for Android VR by re…
oSumAtrIX Oct 17, 2024
7b260df
chore: Release v1.16.0-dev.6 [skip ci]
semantic-release-bot Oct 17, 2024
c673951
feat(Twitter): Add `Change link sharing domain` patch (#715)
FrozenAlex Oct 17, 2024
246ebc2
chore: Release v1.16.0-dev.7 [skip ci]
semantic-release-bot Oct 17, 2024
888de49
feat(Sync for Reddit): Add `Fix video downloads` patch (#710)
1fexd Oct 17, 2024
042addc
chore: Release v1.16.0-dev.8 [skip ci]
semantic-release-bot Oct 17, 2024
1a58a40
fix(YouTube - Hide layout components): Hide new type of Playable
LisoUseInAIKyrios Oct 19, 2024
99d17bf
chore: Release v1.16.0-dev.9 [skip ci]
semantic-release-bot Oct 19, 2024
61569ba
feat(YouTube): Support versions `19.25` and `19.34` (#689)
zainarbani Oct 19, 2024
b7b9dd2
chore: Release v1.16.0-dev.10 [skip ci]
semantic-release-bot Oct 19, 2024
1c9a966
feat(YouTube - Hide Shorts components): Hide `Hashtag` button (#717)
MarcaDian Oct 19, 2024
e3317e6
chore: Release v1.16.0-dev.11 [skip ci]
semantic-release-bot Oct 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/open_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
pr_body: |
This pull request will ${{ env.MESSAGE }}.

## Dependencies before merge
## Before merging this PR

- [ ] https://github.com/revanced/revanced-patches
- [ ] Remember about https://github.com/revanced/revanced-patches
pr_draft: true
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:
jobs:
release:
name: Release
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -49,5 +51,5 @@ jobs:

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm exec semantic-release
3 changes: 2 additions & 1 deletion .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"assets": [
"CHANGELOG.md",
"gradle.properties"
]
],
"message": "chore: Release v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
[
Expand Down
79 changes: 79 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,82 @@
# [1.16.0-dev.11](https://github.com/ReVanced/revanced-integrations/compare/v1.16.0-dev.10...v1.16.0-dev.11) (2024-10-19)


### Features

* **YouTube - Hide Shorts components:** Hide `Hashtag` button ([#717](https://github.com/ReVanced/revanced-integrations/issues/717)) ([1c9a966](https://github.com/ReVanced/revanced-integrations/commit/1c9a966354243dd1a106e1fc767227c1b025125e))

# [1.16.0-dev.10](https://github.com/ReVanced/revanced-integrations/compare/v1.16.0-dev.9...v1.16.0-dev.10) (2024-10-19)


### Features

* **YouTube:** Support versions `19.25` and `19.34` ([#689](https://github.com/ReVanced/revanced-integrations/issues/689)) ([61569ba](https://github.com/ReVanced/revanced-integrations/commit/61569ba111af82aaff60d11863bc57221a295fe8))

# [1.16.0-dev.9](https://github.com/ReVanced/revanced-integrations/compare/v1.16.0-dev.8...v1.16.0-dev.9) (2024-10-19)


### Bug Fixes

* **YouTube - Hide layout components:** Hide new type of Playable ([1a58a40](https://github.com/ReVanced/revanced-integrations/commit/1a58a406db76e4deaea070d077a31714f270e479))

# [1.16.0-dev.8](https://github.com/ReVanced/revanced-integrations/compare/v1.16.0-dev.7...v1.16.0-dev.8) (2024-10-17)


### Features

* **Sync for Reddit:** Add `Fix video downloads` patch ([#710](https://github.com/ReVanced/revanced-integrations/issues/710)) ([888de49](https://github.com/ReVanced/revanced-integrations/commit/888de49edd39913116028ac1d173f2b6e0feab09))

# [1.16.0-dev.7](https://github.com/ReVanced/revanced-integrations/compare/v1.16.0-dev.6...v1.16.0-dev.7) (2024-10-17)


### Features

* **Twitter:** Add `Change link sharing domain` patch ([#715](https://github.com/ReVanced/revanced-integrations/issues/715)) ([c673951](https://github.com/ReVanced/revanced-integrations/commit/c6739517f179bf8e811e869640a24f433d729f42))

# [1.16.0-dev.6](https://github.com/ReVanced/revanced-integrations/compare/v1.16.0-dev.5...v1.16.0-dev.6) (2024-10-17)


### Bug Fixes

* **YouTube - Spoof video streams:** Fix playback for Android VR by removing invalid body as well ([#716](https://github.com/ReVanced/revanced-integrations/issues/716)) ([8ad3f78](https://github.com/ReVanced/revanced-integrations/commit/8ad3f78865836fbe38a832ef6395c6eb8d0edbf2))

# [1.16.0-dev.5](https://github.com/ReVanced/revanced-integrations/compare/v1.16.0-dev.4...v1.16.0-dev.5) (2024-10-14)


### Features

* **YouTube - Hide Shorts components:** Add options to hide `Use template`, `Upcoming`, `Green screen` buttons ([#714](https://github.com/ReVanced/revanced-integrations/issues/714)) ([faad754](https://github.com/ReVanced/revanced-integrations/commit/faad7548df2091c24d41dad98a589745ce8a6b73))

# [1.16.0-dev.4](https://github.com/ReVanced/revanced-integrations/compare/v1.16.0-dev.3...v1.16.0-dev.4) (2024-10-06)


### Bug Fixes

* **YouTube - Hide layout components:** Adjust settings text ([#713](https://github.com/ReVanced/revanced-integrations/issues/713)) ([119c416](https://github.com/ReVanced/revanced-integrations/commit/119c416bc5c24f2455bfe70adccd51234b165d25))

# [1.16.0-dev.3](https://github.com/ReVanced/revanced-integrations/compare/v1.16.0-dev.2...v1.16.0-dev.3) (2024-10-06)


### Features

* **YouTube - Hide layout components:** Add option to hide Yoodles (YouTube Doodles) ([#712](https://github.com/ReVanced/revanced-integrations/issues/712)) ([4b5f3de](https://github.com/ReVanced/revanced-integrations/commit/4b5f3deef9c3a8c700e23a0f4d9ce999013ec9d4))

# [1.16.0-dev.2](https://github.com/ReVanced/revanced-integrations/compare/v1.16.0-dev.1...v1.16.0-dev.2) (2024-10-03)


### Bug Fixes

* **YouTube - Spoof video streams:** Handle app left open for a long time ([#709](https://github.com/ReVanced/revanced-integrations/issues/709)) ([ea4b073](https://github.com/ReVanced/revanced-integrations/commit/ea4b073f5c21b0fea4e3922488e8bbf69cfcb421))

# [1.16.0-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.15.1-dev.1...v1.16.0-dev.1) (2024-10-02)


### Features

* **YouTube - Hide Shorts components:** Add option to hide like fountain ([#708](https://github.com/ReVanced/revanced-integrations/issues/708)) ([16c3ef7](https://github.com/ReVanced/revanced-integrations/commit/16c3ef7ee5a32ec22db6da876dcf19fc02bc9aac))

## [1.15.1-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.15.0...v1.15.1-dev.1) (2024-10-01)

# [1.15.0](https://github.com/ReVanced/revanced-integrations/compare/v1.14.2...v1.15.0) (2024-09-30)


Expand Down
36 changes: 32 additions & 4 deletions app/src/main/java/app/revanced/integrations/shared/Utils.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package app.revanced.integrations.shared;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.*;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
Expand Down Expand Up @@ -268,6 +265,20 @@ public interface MatchFilter<T> {
boolean matches(T object);
}

/**
* Includes sub children.
*
* @noinspection unchecked
*/
public static <R extends View> R getChildViewByResourceName(@NonNull View view, @NonNull String str) {
var child = view.findViewById(Utils.getResourceIdentifier(str, "id"));
if (child != null) {
return (R) child;
}

throw new IllegalArgumentException("View with resource name '" + str + "' not found");
}

/**
* @param searchRecursively If children ViewGroups should also be
* recursively searched using depth first search.
Expand Down Expand Up @@ -710,4 +721,21 @@ public static void sortPreferenceGroups(@NonNull PreferenceGroup group) {
pref.setOrder(order);
}
}

/**
* If {@link Fragment} uses [Android library] rather than [AndroidX library],
* the Dialog theme corresponding to [Android library] should be used.
* <p>
* If not, the following issues will occur:
* <a href="https://github.com/ReVanced/revanced-patches/issues/3061">ReVanced/revanced-patches#3061</a>
* <p>
* To prevent these issues, apply the Dialog theme corresponding to [Android library].
*/
public static void setEditTextDialogTheme(AlertDialog.Builder builder) {
final int editTextDialogStyle = getResourceIdentifier(
"revanced_edit_text_dialog_style", "style");
if (editTextDialogStyle != 0) {
builder.getContext().setTheme(editTextDialogStyle);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import app.revanced.integrations.shared.Logger;
import app.revanced.integrations.shared.Utils;
import app.revanced.integrations.shared.settings.BaseSettings;
import app.revanced.integrations.shared.settings.BooleanSetting;
import app.revanced.integrations.shared.settings.Setting;

Expand Down Expand Up @@ -141,8 +142,13 @@ private void updatePreferenceScreen(@NonNull PreferenceScreen screen,
} else if (pref.hasKey()) {
String key = pref.getKey();
Setting<?> setting = Setting.getSettingFromPath(key);

if (setting != null) {
updatePreference(pref, setting, syncSettingValue, applySettingToPreference);
} else if (BaseSettings.DEBUG.get() && (pref instanceof SwitchPreference
|| pref instanceof EditTextPreference || pref instanceof ListPreference)) {
// Probably a typo in the patches preference declaration.
Logger.printException(() -> "Preference key has no setting: " + key);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public boolean onPreferenceClick(Preference preference) {
@Override
protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
try {
Utils.setEditTextDialogTheme(builder);

// Show the user the settings in JSON format.
builder.setNeutralButton(str("revanced_settings_import_copy"), (dialog, which) -> {
Utils.setClipboard(getEditText().getText().toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import android.util.AttributeSet;
import android.widget.Button;
import android.widget.EditText;

import app.revanced.integrations.shared.Utils;
import app.revanced.integrations.shared.settings.Setting;
import app.revanced.integrations.shared.Logger;

Expand All @@ -33,6 +35,8 @@ public ResettableEditTextPreference(Context context) {
@Override
protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
super.onPrepareDialogBuilder(builder);
Utils.setEditTextDialogTheme(builder);

Setting<?> setting = Setting.getSettingFromPath(getKey());
if (setting != null) {
builder.setNeutralButton(str("revanced_settings_reset"), null);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package app.revanced.integrations.syncforreddit;

import android.util.Pair;
import androidx.annotation.Nullable;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;

/**
* @noinspection unused
*/
public class FixRedditVideoDownloadPatch {
private static @Nullable Pair<Integer, String> getBestMpEntry(Element element) {
var representations = element.getElementsByTagName("Representation");
var entries = new ArrayList<Pair<Integer, String>>();

for (int i = 0; i < representations.getLength(); i++) {
Element representation = (Element) representations.item(i);
var bandwidthStr = representation.getAttribute("bandwidth");
try {
var bandwidth = Integer.parseInt(bandwidthStr);
var baseUrl = representation.getElementsByTagName("BaseURL").item(0);
if (baseUrl != null) {
entries.add(new Pair<>(bandwidth, baseUrl.getTextContent()));
}
} catch (NumberFormatException ignored) {
}
}

if (entries.isEmpty()) {
return null;
}

Collections.sort(entries, (e1, e2) -> e2.first - e1.first);
return entries.get(0);
}

private static String[] parse(byte[] data) throws ParserConfigurationException, IOException, SAXException {
var adaptionSets = DocumentBuilderFactory
.newInstance()
.newDocumentBuilder()
.parse(new ByteArrayInputStream(data))
.getElementsByTagName("AdaptationSet");

String videoUrl = null;
String audioUrl = null;

for (int i = 0; i < adaptionSets.getLength(); i++) {
Element element = (Element) adaptionSets.item(i);
var contentType = element.getAttribute("contentType");
var bestEntry = getBestMpEntry(element);
if (bestEntry == null) continue;

if (contentType.equalsIgnoreCase("video")) {
videoUrl = bestEntry.second;
} else if (contentType.equalsIgnoreCase("audio")) {
audioUrl = bestEntry.second;
}
}

return new String[]{videoUrl, audioUrl};
}

public static String[] getLinks(byte[] data) {
try {
return parse(data);
} catch (ParserConfigurationException | IOException | SAXException e) {
return new String[]{null, null};
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package app.revanced.integrations.twitter.patches.links;

public final class ChangeLinkSharingDomainPatch {
private static final String DOMAIN_NAME = "https://fxtwitter.com";
private static final String LINK_FORMAT = "%s/%s/status/%s";

public static String formatResourceLink(Object... formatArgs) {
String username = (String) formatArgs[0];
String tweetId = (String) formatArgs[1];
return String.format(LINK_FORMAT, DOMAIN_NAME, username, tweetId);
}

public static String formatLink(long tweetId, String username) {
return String.format(LINK_FORMAT, DOMAIN_NAME, username, tweetId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ public class BackgroundPlaybackPatch {
/**
* Injection point.
*/
public static boolean playbackIsNotShort() {
public static boolean allowBackgroundPlayback(boolean original) {
if (original) return true;

// Steps to verify most edge cases:
// 1. Open a regular video
// 2. Minimize app (PIP should appear)
Expand Down
Loading