Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Morpheus committed Oct 19, 2024
1 parent 33486fd commit a4eecac
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 63 deletions.
49 changes: 0 additions & 49 deletions varClean.h

This file was deleted.

6 changes: 6 additions & 0 deletions varClean.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
4C5819A92CC3940A00366BB9 /* SettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C5819A82CC3940A00366BB9 /* SettingViewController.m */; };
8477B5E22A7526AB000632D0 /* NSJSONSerialization+Comments.m in Sources */ = {isa = PBXBuildFile; fileRef = 8477B5E02A7526AB000632D0 /* NSJSONSerialization+Comments.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
8477B6052A866437000632D0 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8477B6072A866437000632D0 /* Localizable.strings */; };
84BBFAC92A7420100054A68E /* varCleanRules.json in Resources */ = {isa = PBXBuildFile; fileRef = 84BBFAC72A741C800054A68E /* varCleanRules.json */; };
Expand All @@ -18,6 +19,8 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
4C5819A72CC3940A00366BB9 /* SettingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SettingViewController.h; path = ../../../varclean/RHMA15/varClean/SettingViewController.h; sourceTree = "<group>"; };
4C5819A82CC3940A00366BB9 /* SettingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SettingViewController.m; path = ../../../varclean/RHMA15/varClean/SettingViewController.m; sourceTree = "<group>"; };
842F706A2ACB58BB002E5574 /* control */ = {isa = PBXFileReference; lastKnownFileType = text; path = control; sourceTree = "<group>"; };
8438C17D2AB3361A001BAB8C /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Localizable.strings; sourceTree = "<group>"; };
8438C17E2AB33673001BAB8C /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -87,6 +90,8 @@
BF0FF1BB2A550FFA00FFA27E /* varCleanController.h */,
BF0FF1BC2A550FFA00FFA27E /* varCleanController.m */,
84BBFAC72A741C800054A68E /* varCleanRules.json */,
4C5819A72CC3940A00366BB9 /* SettingViewController.h */,
4C5819A82CC3940A00366BB9 /* SettingViewController.m */,
A672ABC427F748E100878787 /* main.m */,
A672ABBE27F748E100878787 /* Assets.xcassets */,
A672ABC327F748E100878787 /* Info.plist */,
Expand Down Expand Up @@ -194,6 +199,7 @@
8477B5E22A7526AB000632D0 /* NSJSONSerialization+Comments.m in Sources */,
BF0FF1C12A5510CE00FFA27E /* ZFCheckbox.m in Sources */,
BF0FF1BD2A550FFA00FFA27E /* varCleanController.m in Sources */,
4C5819A92CC3940A00366BB9 /* SettingViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Binary file not shown.
32 changes: 18 additions & 14 deletions varClean/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import "AppDelegate.h"
#import "VarCleanController.h"
#import "varCleanController.h"
#import "SettingViewController.h"
#include "NSJSONSerialization+Comments.h"

#include <sys/mount.h>
Expand Down Expand Up @@ -112,34 +113,37 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
if(err) NSLog(@"json error=%@", err);
assert(rules != NULL);
NSLog(@"default rules=%@", rules);
// NSString *rulesFilePath = @"/var/mobile/Library/varClean/varCleanRules.plist";
// if([NSFileManager.defaultManager fileExistsAtPath:rulesFilePath]) {
// assert([NSFileManager.defaultManager removeItemAtPath:rulesFilePath error:nil]);
// }
// NSLog(@"copy default rules to %@", rulesFilePath);
// assert([rules writeToFile:rulesFilePath atomically:YES]);
//
// NSString *customedRulesFilePath = @"/var/mobile/Library/varClean/varCleanRules-custom.plist";
// if(![NSFileManager.defaultManager fileExistsAtPath:customedRulesFilePath]) {
// NSDictionary* template = [[NSDictionary alloc] init];
// assert([template writeToFile:customedRulesFilePath atomically:YES]);
// }
NSString *rulesFilePath = @"/var/mobile/Library/varClean/varCleanRules.plist";
if([NSFileManager.defaultManager fileExistsAtPath:rulesFilePath]) {
assert([NSFileManager.defaultManager removeItemAtPath:rulesFilePath error:nil]);
}
NSLog(@"copy default rules to %@", rulesFilePath);
assert([rules writeToFile:rulesFilePath atomically:YES]);

NSString *customedRulesFilePath = @"/var/mobile/Library/varClean/varCleanRules-custom.plist";
if(![NSFileManager.defaultManager fileExistsAtPath:customedRulesFilePath]) {
NSDictionary* template = [[NSDictionary alloc] init];
assert([template writeToFile:customedRulesFilePath atomically:YES]);
}

self.window = UIWindow.alloc.init;
self.window.backgroundColor = [UIColor clearColor];
[self.window makeKeyAndVisible];

varCleanController *cleanController = [varCleanController sharedInstance];
SettingViewController *setController = [SettingViewController sharedInstance];

// Tab bar item setup
cleanController.tabBarItem = [[UITabBarItem alloc] initWithTitle:NSLocalizedString(@"varClean",@"") image:[UIImage systemImageNamed:@"trash"] tag:1];
setController.tabBarItem = [[UITabBarItem alloc] initWithTitle:NSLocalizedString(@"Setting",@"") image:[UIImage systemImageNamed:@"gearshape"] tag:2];

// Navigation controllers setup
UINavigationController *cleanNavigationController = [[UINavigationController alloc] initWithRootViewController:cleanController];
UINavigationController *setNavigationController = [[UINavigationController alloc] initWithRootViewController:setController];

// Tab bar controller setup
UITabBarController *tabBarController = [[UITabBarController alloc] init];
tabBarController.viewControllers = @[cleanNavigationController]; // Assign the navigation controllers
tabBarController.viewControllers = @[cleanNavigationController, setNavigationController]; // Assign the navigation controllers

self.window.rootViewController = tabBarController; // Optionally set to cleanController if you want it as the main screen directly

Expand Down

0 comments on commit a4eecac

Please sign in to comment.