Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ichitaso committed Mar 20, 2021
0 parents commit f62ead3
Show file tree
Hide file tree
Showing 11 changed files with 789 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.o
.theos/*
debs/*
*.deb
*.dylib
**/.theos/*
*/.theos/*
*.sublime-workspace
_/*
*/obj/*
obj/*
*.zip
1 change: 1 addition & 0 deletions IconAnus.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ Filter = { Bundles = ( "com.apple.springboard" ); }; }
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
DEBUG = 0
GO_EASY_ON_ME = 1
PACKAGE_VERSION = $(THEOS_PACKAGE_BASE_VERSION)
ARCHS = arm64 arm64e

TARGET = iphone:13.0:11.0

THEOS_DEVICE_IP = localhost -p 2222

TWEAK_NAME = IconAnus
$(TWEAK_NAME)_FILES = Tweak.xm
$(TWEAK_NAME)_CFLAGS = -fobjc-arc

TOOL_NAME = postinst
$(TOOL_NAME)_FILES = main.m
$(TOOL_NAME)_FRAMEWORKS = UIKit
$(TOOL_NAME)_INSTALL_PATH = /DEBIAN
$(TOOL_NAME)_CODESIGN_FLAGS = -Sentitlements.xml
$(TOOL_NAME)_CFLAGS = -fobjc-arc

include $(THEOS)/makefiles/common.mk
include $(THEOS_MAKE_PATH)/tweak.mk
include $(THEOS_MAKE_PATH)/tool.mk

before-package::
sudo chown -R root:wheel $(THEOS_STAGING_DIR)
sudo chmod -R 755 $(THEOS_STAGING_DIR)
sudo chmod 666 $(THEOS_STAGING_DIR)/DEBIAN/control

after-package::
make clean
sudo rm -rf .theos/_

after-install::
install.exec "killall -9 backboardd"
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# IconAnus
Preserve custom icon layouts by Springboard Crash or reboots etc

## For Tweak dev
Add this to the control of your deb file:

```Depends: com.ichitaso.iconanus```
27 changes: 27 additions & 0 deletions Tweak.xm
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#import <UIKit/UIKit.h>

#define PREF_PATH @"/var/mobile/Library/Preferences/com.ichitaso.iconanus.plist"
#define KEY @"IconAnus"

NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:PREF_PATH];
NSMutableDictionary *mutableDict = dict ? [dict mutableCopy] : [NSMutableDictionary dictionary];

%hook SBDefaultIconModelStore
- (id)loadCurrentIconState:(id*)error {
id orig = %orig;

if ([mutableDict objectForKey:KEY]) {
return [mutableDict objectForKey:KEY];
} else {
[mutableDict setValue:orig forKey:KEY];
[mutableDict writeToFile:PREF_PATH atomically:YES];

return orig;
}
}
- (BOOL)saveCurrentIconState:(id)state error:(id*)error {
[mutableDict setValue:state forKey:KEY];
[mutableDict writeToFile:PREF_PATH atomically:YES];
return %orig;
}
%end
16 changes: 16 additions & 0 deletions control
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Author: ichitaso
Maintainer: Packix
Name: IconAnus
Package: com.ichitaso.iconanus
Pre-Depends: firmware (>= 13.0)
Depends: mobilesubstrate
Conflicts: me.nepeta.iconstate
Replaces: com.ichitaso.iconanus
Section: Tweaks
Version: 1.0.0
Architecture: iphoneos-arm
Description: Preserve custom icon layouts by Springboard Crash or reboots etc
Depiction: https://cydia.ichitaso.com/depiction/iconanus.html
Homepage: https://ichitaso.com/
dev: ichitaso
Tag: purpose::extension, compatible::ios14
8 changes: 8 additions & 0 deletions entitlements.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>platform-application</key>
<true/>
</dict>
</plist>
5 changes: 5 additions & 0 deletions layout/DEBIAN/postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

rm -rf /var/mobile/Library/Preferences/com.ichitaso.iconanus.plist

exit 0
15 changes: 15 additions & 0 deletions main.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#import <UIKit/UIKit.h>

#define PREF_PATH @"/var/mobile/Library/Preferences/com.apple.springboard.plist"
#define KEY @"_NepetaIconState"

int main(int argc, char **argv, char **envp) {
@autoreleasepool {
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:PREF_PATH];
NSMutableDictionary *mutableDict = dict ? [dict mutableCopy] : [NSMutableDictionary dictionary];

[mutableDict removeObjectForKey:KEY];
[mutableDict writeToFile:PREF_PATH atomically:YES];
}
return 0;
}

0 comments on commit f62ead3

Please sign in to comment.