Skip to content

Commit

Permalink
Fix theming for newer versions (#18)
Browse files Browse the repository at this point in the history
This PR features the following:

- Themes all semantic and raw colors for the native side (chat area)
- Use a unique hook method that hooks whatever keys are in your theme.json
- Add version and type to the JS bridge so that the JS side can show it in debug logs
- Fix image BG for newer versions
- Lower cache time to 3 minutes
  • Loading branch information
acquitelol authored Apr 12, 2023
1 parent e1df073 commit 802ee60
Show file tree
Hide file tree
Showing 17 changed files with 2,021 additions and 2,164 deletions.
66 changes: 0 additions & 66 deletions .github/workflows/debug.yml

This file was deleted.

44 changes: 33 additions & 11 deletions .github/workflows/stable.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: Create a stable release
on:
push:
tags:
- '*'
pull_request:
tags:
- '*'
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -42,6 +38,10 @@ jobs:
curl -L https://github.com/enmity-mod/patcher/releases/latest/download/patcher.mac-amd64 -o ${{ github.workspace }}/patcher
chmod +x patcher
- name: Prepare coreutils

run: brew install coreutils

- name: Patch Discord
run : |
${{ github.workspace }}/patcher
Expand All @@ -53,10 +53,14 @@ jobs:
gmake clean package FINALPACKAGE=1
mv $(find packages -name "*.deb" -print -quit) out/Enmity.deb
- name: Retrieve version
id: version
run: echo "::set-output name=EM_VERSION::$(cat control | grep -E 'Version:(.*)' | awk '{ print $2 }')"

- name: Create Enmity.ipa
run : |
${{ github.workspace }}/Azule/azule -i Enmity.ipa -o out -f out/enmity.deb
mv out/Enmity+enmity.deb.ipa out/Enmity.ipa
${{ github.workspace }}/Azule/azule -i Enmity.ipa -o out -f $PWD/out/Enmity.deb
mv out/Enmity+Enmity.deb.ipa out/Enmity.ipa
- name: Build dev deb
run: |
Expand All @@ -66,14 +70,32 @@ jobs:
gmake clean package FINALPACKAGE=1 DEVTOOLS=1
mv $(find packages -name "*.deb" -print -quit) out/Enmity.Development.deb
- name: Build regular rootless deb
run: |
rm -f packages/*
echo $"$(sed 's/Name\:.*/Name\: Enmity (Rootless)/' control)" > control
echo $"$(sed 's/Package\:.*/Package\: app.enmity.rootless/' control)" > control
gmake clean package FINALPACKAGE=1 THEOS_PACKAGE_SCHEME=rootless
mv $(find packages -name "*.deb" -print -quit) out/Enmity.Rootless.deb
- name: Build dev rootless deb
run: |
rm -f packages/*
echo $"$(sed 's/Name\:.*/Name\: Enmity (Rootless)/' control)" > control
echo $"$(sed 's/Package\:.*/Package\: app.enmity.rootless/' control)" > control
gmake clean package FINALPACKAGE=1 DEVTOOLS=1 THEOS_PACKAGE_SCHEME=rootless
mv $(find packages -name "*.deb" -print -quit) out/Enmity.Rootless.Development.deb
- name: Create Enmity.Dev.ipa
run : |
${{ github.workspace }}/Azule/azule -i Enmity.ipa -o out -f out/Enmity.Development.deb
${{ github.workspace }}/Azule/azule -i Enmity.ipa -o out -f $PWD/out/Enmity.Development.deb
mv out/Enmity+Enmity.Development.deb.ipa out/Enmity.Development.ipa
- name: Create release
uses: softprops/action-gh-release@v1
uses: marvinpinto/action-automatic-releases@latest
with:
tag_name: v${{ github.ref_name }}
files: |
out/*
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
automatic_release_tag: v${{ steps.version.outputs.EM_VERSION }}
title: "Enmity v${{ steps.version.outputs.EM_VERSION }}"
files: out/*
4 changes: 2 additions & 2 deletions Discord.ipa
Git LFS file not shown
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include $(THEOS)/makefiles/common.mk
DEBUG_IP = 192.168.0.35
TWEAK_NAME = Enmity
DEVTOOLS = 0
Enmity_FILES = $(shell find src -name "*.x")
Enmity_FILES = $(shell find src -name "*.x" && find src -name "*.xi")
Enmity_CFLAGS = -DDEBUG_IP=@\"$(DEBUG_IP)\" -DDEVTOOLS=$(DEVTOOLS) -fobjc-arc
Enmity_FRAMEWORKS = UIKit Foundation CoreGraphics CoreImage

Expand Down
16 changes: 8 additions & 8 deletions Resources/themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ Object.freeze = function (obj, ...args) {
try {
const theme = %@;

if (obj.hasOwnProperty?.('BACKGROUND_PRIMARY')) {
return oObjectFreeze.call(this, Object.assign(obj, theme.theme_color_map), ...args);
if (obj.hasOwnProperty?.('BACKGROUND_PRIMARY') || obj.hasOwnProperty?.('BACKGROUND_SECONDARY')) {
return oObjectFreeze.call(this, Object.assign(obj, theme.spec === 2
? theme.semanticColors ?? theme.theme_color_map
: theme.theme_color_map), ...args);
}

if (obj.hasOwnProperty?.('PRIMARY_DARK')) {
return oObjectFreeze.call(this, Object.assign(obj, theme.colours), ...args);
}

if (obj.hasOwnProperty?.('CHAT_GREY')) {
return oObjectFreeze.call(this, Object.assign(obj,theme.unsafe_colors), ...args);
if (obj.hasOwnProperty?.('PRIMARY_100') || obj.hasOwnProperty?.('RED_400')) {
return oObjectFreeze.call(this, Object.assign(obj, theme.spec === 2
? theme.rawColors ?? theme.colours ?? theme.colors
: theme.colours), ...args);
}
} catch (e) {
console.log(e);
Expand Down
6 changes: 3 additions & 3 deletions control
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Package: app.enmity
Name: Enmity
Version: 2.1.4
Version: 2.2.2
Architecture: iphoneos-arm
Description: The power of addons, all in your hand.
Maintainer: Zoey, eternal
Author: Enmity Team
Maintainer: Rosie
Author: Zoey & Eternal
Section: Tweaks
Depends: mobilesubstrate (>= 0.9.5000)
SileoDepiction: https://repo.enmity.app/depictions/enmity.json
Expand Down
Loading

0 comments on commit 802ee60

Please sign in to comment.