Compare commits

...

2 commits

Author SHA1 Message Date
d9e7c903d9 Start work on resource patches. 2021-01-02 16:44:29 +00:00
34ed66d290 More work on patchsets 2021-01-02 16:41:50 +00:00
14 changed files with 223 additions and 1 deletions

View file

@ -1,12 +1,38 @@
package com.discord.models.domain;
import com.discord.stores.StoreStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import lanchon.dexpatcher.annotation.DexEdit;
import lanchon.dexpatcher.annotation.DexIgnore;
import lanchon.dexpatcher.annotation.DexWrap;
@DexIgnore
@DexEdit
public class ModelChannel implements Model {
// supplemental patch
@DexWrap
public Map<Long, ModelPermissionOverwrite> getPermissionOverwrites() {
// Allows us to see all channels
if (StoreStream.getUserSettings().getLeakChannels()) {
return EMPTY_PERMISSION_OVERWRITES;
}
return getPermissionOverwrites();
}
// end
// class setup
@DexIgnore
private static final Map<Long, ModelPermissionOverwrite> EMPTY_PERMISSION_OVERWRITES = new HashMap();
@DexIgnore
@Override
public void assignField(JsonReader jsonReader) throws IOException {

View file

@ -1,12 +1,14 @@
package com.discord.models.domain;
import com.PatchConfig;
import com.discord.stores.StoreStream;
import com.discordtest.BuildConfig;
import java.io.IOException;
import lanchon.dexpatcher.annotation.DexEdit;
import lanchon.dexpatcher.annotation.DexIgnore;
import lanchon.dexpatcher.annotation.DexReplace;
import lanchon.dexpatcher.annotation.DexWrap;
@DexEdit
@ -26,6 +28,23 @@ public class ModelMessageEmbed implements Model {
// end of nospoiler patch
// supplemental patch
// Enable gif autoplaying
@DexReplace
public boolean isVideo() {
String str = this.type;
boolean equals = str.equals("video");
return !StoreStream.getUserSettings().getAutoplayGifs() ? equals | str.equals("gifv") : equals;
}
// end
// class setup
@DexIgnore
private String type;
// Interfaces
@DexIgnore

View file

@ -0,0 +1,13 @@
package com.discord.models.domain;
import java.io.IOException;
import lanchon.dexpatcher.annotation.DexIgnore;
@DexIgnore
public class ModelPermissionOverwrite implements Model {
@DexIgnore
@Override
public void assignField(JsonReader jsonReader) throws IOException {
}
}

View file

@ -0,0 +1,34 @@
package com.discord.utilities.rest;
import com.discord.stores.StoreStream;
import lanchon.dexpatcher.annotation.DexAdd;
import lanchon.dexpatcher.annotation.DexEdit;
import lanchon.dexpatcher.annotation.DexIgnore;
import rx.Emitter;
import rx.functions.Action1;
@DexEdit
public final class SendUtils$getPart$1<T> implements Action1<Emitter<SendUtils.FileUpload>> {
// supplemental patch
@DexAdd
public static final String interceptFilename(String str) {
if (!StoreStream.getUserSettings().getImageSpoiler()) {
return str;
}
return "SPOILER_" + str;
}
// TODO see if theres a way to target the lambda directly..
@DexIgnore
@Override
public final void call(Emitter<SendUtils.FileUpload> emitter) {
}
// end
}

View file

@ -0,0 +1,14 @@
package com.discord.utilities.rest;
import lanchon.dexpatcher.annotation.DexEdit;
import lanchon.dexpatcher.annotation.DexIgnore;
@DexIgnore
public final class SendUtils {
@DexIgnore
public static final class FileUpload {
}
}

View file

@ -0,0 +1,9 @@
package rx;
import g0.g;
import lanchon.dexpatcher.annotation.DexIgnore;
@DexIgnore
public interface Emitter<T> extends g<T> {
}

View file

@ -0,0 +1,7 @@
<diffs>
<diff file="res/menu/menu_chat_toolbar.xml" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
<replace sel="menu/item[@android:icon='@drawable/ic_call_24dp']/@app:showAsAction">never</replace>
<replace sel="menu/item[@android:icon='@drawable/ic_videocam_white_24dp']/@app:showAsAction">never</replace>
<replace sel="menu/item[@android:icon='@drawable/ic_search_white_24dp']/@app:showAsAction">always</replace>
</diff>
</diffs>

View file

@ -0,0 +1,6 @@
<diffs>
<diff file="AndroidManifest.xml" xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Remove android:screenOrientation entry -->
<remove msel="manifest/application/activity/@android:screenOrientation"/>
</diff>
</diffs>

View file

@ -0,0 +1,65 @@
<diffs>
<diff file="res/drawable/drawable_bg_corners_20dp.xml">
<!-- TODO Seems to be missing in 1368 -->
<replace sel="shape/solid/@android:color">@android:color/transparent</replace>
</diff>
<diff file="res/drawable/drawable_circle_black.xml" xmlns:android="http://schemas.android.com/apk/res/android">
<replace sel="shape/solid/@android:color">@android:color/transparent</replace>
</diff>
<diff file="res/drawable/drawable_overlay_channels_active_dark.xml" xmlns:android="http://schemas.android.com/apk/res/android">
<replace sel="layer-list/item/shape/solid/@android:color">@color/primary_500</replace>
</diff>
<diff file="res/layout/widget_chat_input.xml" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
<replace sel="LinearLayout/LinearLayout/RelativeLayout/@android:background">@color/primary_600</replace>
</diff>
<diff file="res/values/colors.xml">
<replace sel="resources/color[@name='dark_grey_2']/text()">#ff000000</replace>
<replace sel="resources/color[@name='dark_grey_2_alpha_10']/text()">#ff000000</replace>
<replace sel="resources/color[@name='design_dark_default_color_background']/text()">#ff000000</replace>
<replace sel="resources/color[@name='design_dark_default_color_surface']/text()">#ff000000</replace>
<replace sel="resources/color[@name='grey_account']/text()">#ff000000</replace>
<replace sel="resources/color[@name='grey_unread']/text()">#ff000000</replace>
<replace sel="resources/color[@name='link']/text()">#ff50f148</replace>
<replace sel="resources/color[@name='primary_500']/text()">#ff333333</replace>
<replace sel="resources/color[@name='primary_500_alpha_20']/text()">#330f0f0f</replace>
<replace sel="resources/color[@name='primary_500_alpha_30']/text()">#4d0f0f0f</replace>
<replace sel="resources/color[@name='primary_500_alpha_32']/text()">#510f0f0f</replace>
<replace sel="resources/color[@name='primary_500_alpha_60']/text()">#990f0f0f</replace>
<replace sel="resources/color[@name='primary_600']/text()">#ff000000</replace>
<replace sel="resources/color[@name='primary_600_alpha_60']/text()">#99000000</replace>
<replace sel="resources/color[@name='primary_630']/text()">#ff000000</replace>
<replace sel="resources/color[@name='primary_630_alpha_60']/text()">#99000000</replace>
<replace sel="resources/color[@name='primary_630_alpha_90']/text()">#e6000000</replace>
<replace sel="resources/color[@name='primary_660']/text()">#ff000000</replace>
<replace sel="resources/color[@name='primary_660_alpha_90']/text()">#e6000000</replace>
<replace sel="resources/color[@name='primary_700']/text()">#ff000000</replace>
<replace sel="resources/color[@name='primary_700_alpha_50']/text()">#80000000</replace>
<replace sel="resources/color[@name='primary_700_alpha_60']/text()">#990f0f0f</replace>
<replace sel="resources/color[@name='primary_dark_600']/text()">#ff000000</replace>
<replace sel="resources/color[@name='primary_dark_630']/text()">#ff000000</replace>
<replace sel="resources/color[@name='primary_dark_700']/text()">#ff000000</replace>
<replace sel="resources/color[@name='purple_brand']/text()">#ff9c4249</replace>
<replace sel="resources/color[@name='purple_brand_alpha_10']/text()">#1a9c4249</replace>
<replace sel="resources/color[@name='purple_brand_dark']/text()">#ff000000</replace>
<replace sel="resources/color[@name='tooltip_background_dark']/text()">#e6000000</replace>
</diff>
<diff file="res/values/styles.xml">
<!-- Dark -->
<replace sel="resources/style[@name='AppTheme_Base_Dark']/item[@name='theme_chat_blocked_bg']/text()">@color/primary_500</replace>
<replace sel="resources/style[@name='AppTheme_Base_Dark']/item[@name='theme_chat_spoiler_bg']/text()">@color/primary_500</replace>
<replace sel="resources/style[@name='AppTheme_Dark_BottomSheet']/item[@name='colorPrimaryDark']/text()">@color/primary_630</replace>
<!-- Light -->
<replace sel="resources/style[@name='AppTheme_Base_Light']/item[@name='theme_chat_mentioned_me']/text()">@color/purple_brand_alpha_10</replace>
<replace sel="resources/style[@name='AppTheme_Base_Light']/item[@name='theme_chat_spoiler_bg']/text()">@color/primary_500</replace>
<replace sel="resources/style[@name='AppTheme_Dark_BottomSheet']/item[@name='colorPrimaryDark']/text()">@color/primary_630</replace>
</diff>
</diffs>

View file

@ -0,0 +1,13 @@
<diffs>
<diff file="res/layout/widget_chat_list_adapter_item_blocked.xml" xmlns:android="http://schemas.android.com/apk/res/android">
<replace sel="RelativeLayout/@android:paddingLeft">0px</replace>
<replace sel="RelativeLayout/@android:paddingTop">0px</replace>
<replace sel="RelativeLayout/@android:paddingRight">0px</replace>
<replace sel="RelativeLayout/@android:layout_width">0px</replace>
<replace sel="RelativeLayout/@android:layout_height">0px</replace>
<replace sel="RelativeLayout/@android:layout_marginLeft">0px</replace>
<replace sel="RelativeLayout/TextView/@android:textSize">0sp</replace>
<replace sel="RelativeLayout/TextView/@android:paddingTop">0dip</replace>
<replace sel="RelativeLayout/TextView/@android:paddingBottom">0dip</replace>
</diff>
</diffs>

View file

@ -0,0 +1,5 @@
<diffs>
<diff file="res/values/strings.xml">
<replace sel="resources/string[@name='com_crashlytics_android_build_id']/text()">00000000-0000-0000-0000-000000000000</replace>
</diff>
</diffs>

View file

@ -0,0 +1,10 @@
<diffs>
<diff file="res/values/dimens.xml">
<replace sel="/resources/dimen[@name='guild_icon_radius']/text()">0.0dip</replace>
</diff>
<diff file="res/values/styles.xml">
<replace sel="resources/style[@name='Avatar']/item[@name='roundAsCircle']/text()">false</replace>
<add pos="after" sel="resources/style[@name='Avatar']/item[@name='roundAsCircle']"><item name="roundedCornerRadius">3dp</item></add>
</diff>
</diffs>

1
patches/usage.txt Normal file
View file

@ -0,0 +1 @@
java -cp xml-patch-0.3.1.jar com.github.dnault.xmlpatch.BatchPatcher --patch path/to/patch.xml --srcdir path/to/resources --destdir out

BIN
patches/xml-patch-0.3.1.jar Normal file

Binary file not shown.