diff --git a/Info.plist b/Info.plist
deleted file mode 100755
index 3ef20a0..0000000
--- a/Info.plist
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
- description
- Switch your wallpaper
- title
- Wallmart
- compatible-modes
-
- springboard
- application
-
-
-
diff --git a/Interwall.plist b/Interwall.plist
new file mode 100644
index 0000000..f0cca7d
--- /dev/null
+++ b/Interwall.plist
@@ -0,0 +1,7 @@
+{
+ Filter = {
+ Bundles = (
+ "com.apple.springboard",
+ );
+ };
+}
\ No newline at end of file
diff --git a/Interwall.xm b/Interwall.xm
new file mode 100644
index 0000000..dbbdbaa
--- /dev/null
+++ b/Interwall.xm
@@ -0,0 +1,412 @@
+//
+// Interwall.xm
+// Wallmart
+//
+// Created by Timm Kandziora on 16.01.15.
+// Copyright (c) 2015 Timm Kandziora. All rights reserved.
+//
+
+#import "WallmartHeader.h"
+
+/* HELPER VARIABLES, TWEAK ONLY */
+
+static PCPersistentTimer *persistentTimer;
+static BOOL unlockedOnce = NO;
+static ALAssetsLibrary *assetsLibrary;
+static int currentIndexHomeScreen = 0;
+static int currentIndexLockScreen = 0;
+
+/* INFORMATION FROM SETTINGS */
+
+static BOOL wallmartGeneralEnabled = YES;
+
+static BOOL interwallEnabled = NO;
+static int interwallTime = 60;
+static BOOL interwallMomentsEnabled = NO;
+
+static NSMutableArray *moments;
+
+static int wallpaperModeInterwall = 0;
+
+static BOOL blurEnabledInterwall = NO;
+static int blurStrengthInterwall = 5;
+static int blurModeInterwall = 0;
+
+static BOOL perspectiveZoomInterwall = YES;
+static BOOL shuffleInterwall = NO;
+
+static NSString *albumNameLockscreenInterwall;
+static NSString *albumNameHomescreenInterwall;
+
+static UIImage* BlurImage(UIImage *image)
+{
+ CIFilter *gaussianBlurFilter = [CIFilter filterWithName:@"CIGaussianBlur"];
+ [gaussianBlurFilter setDefaults];
+ [gaussianBlurFilter setValue:[CIImage imageWithCGImage:image.CGImage] forKey:kCIInputImageKey];
+ [gaussianBlurFilter setValue:@(blurStrengthInterwall) forKey:kCIInputRadiusKey];
+
+ CIImage *outputImage = [gaussianBlurFilter outputImage];
+ CIContext *context = [CIContext contextWithOptions:nil];
+ CGRect rect = [outputImage extent];
+
+ rect.origin.x += (rect.size.width - image.size.width ) / 2;
+ rect.origin.y += (rect.size.height - image.size.height) / 2;
+ rect.size = image.size;
+
+ CGImageRef cgimg = [context createCGImage:outputImage fromRect:rect];
+ UIImage *blurredImage = [UIImage imageWithCGImage:cgimg];
+ CGImageRelease(cgimg);
+
+ return blurredImage;
+}
+
+static UIImage* GetBlurredImageFrom(UIImage *image, PLWallpaperMode wallpaperMode)
+{
+ if ((wallpaperMode == PLWallpaperModeHomeScreen && blurModeInterwall == 0) || (wallpaperMode == PLWallpaperModeHomeScreen && blurModeInterwall == 1)) {
+ return BlurImage(image);
+ } else if ((wallpaperMode == PLWallpaperModeLockScreen && blurModeInterwall == 0) || (wallpaperMode == PLWallpaperModeLockScreen && blurModeInterwall == 2)) {
+ return BlurImage(image);
+ } else {
+ return image;
+ }
+}
+
+static void SetWallpaperWithImage(UIImage *image, PLWallpaperMode wallpaperMode)
+{
+ PLStaticWallpaperImageViewController *wallpaperViewController = [[PLStaticWallpaperImageViewController alloc] initWithUIImage:image];
+ wallpaperViewController.saveWallpaperData = YES;
+
+ PLWallpaperMode wallpaperModeToSet = wallpaperMode;
+ uintptr_t address = (uintptr_t)&wallpaperModeToSet;
+ object_setInstanceVariable(wallpaperViewController, "_wallpaperMode", *(PLWallpaperMode **)address);
+
+ [wallpaperViewController _savePhoto];
+ [wallpaperViewController release];
+}
+
+static void ChangeWallpaperForMode(PLWallpaperMode wallpaperMode)
+{
+ if (wallpaperMode == PLWallpaperModeBoth) {
+ [assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
+ if ([[group valueForProperty:ALAssetsGroupPropertyName] isEqualToString:albumNameHomescreenInterwall]) {
+ [group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
+ if (index == currentIndexHomeScreen) {
+ ALAssetRepresentation *representation = [result defaultRepresentation];
+ UIImage *image = [UIImage imageWithCGImage:[representation fullScreenImage]];
+
+ if (blurEnabledInterwall) {
+ SetWallpaperWithImage(GetBlurredImageFrom(image, PLWallpaperModeHomeScreen), PLWallpaperModeHomeScreen);
+ } else {
+ SetWallpaperWithImage(image, PLWallpaperModeHomeScreen);
+ }
+
+ if (shuffleInterwall) {
+ currentIndexHomeScreen = arc4random_uniform([group numberOfAssets]);
+ } else {
+ currentIndexHomeScreen++;
+
+ if (currentIndexHomeScreen == [group numberOfAssets]) {
+ currentIndexHomeScreen = 0;
+ }
+ }
+
+ *stop = YES;
+ }
+ }];
+ }
+
+ if ([[group valueForProperty:ALAssetsGroupPropertyName] isEqualToString:albumNameLockscreenInterwall]) {
+ [group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
+ if (index == currentIndexLockScreen) {
+ ALAssetRepresentation *representation = [result defaultRepresentation];
+ UIImage *image = [UIImage imageWithCGImage:[representation fullScreenImage]];
+
+ if (blurEnabledInterwall) {
+ SetWallpaperWithImage(GetBlurredImageFrom(image, PLWallpaperModeLockScreen), PLWallpaperModeLockScreen);
+ } else {
+ SetWallpaperWithImage(image, PLWallpaperModeLockScreen);
+ }
+
+ if (shuffleInterwall) {
+ currentIndexLockScreen = arc4random_uniform([group numberOfAssets]);
+ } else {
+ currentIndexLockScreen++;
+
+ if (currentIndexLockScreen == [group numberOfAssets]) {
+ currentIndexLockScreen = 0;
+ }
+ }
+
+ *stop = YES;
+ }
+ }];
+ }
+ } failureBlock:^(NSError *error) {
+ NSLog(@"\n\n [Wallmart] Following error occured: %@", [error description]);
+ }];
+ } else if (wallpaperMode == PLWallpaperModeHomeScreen) {
+ [assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
+ if ([[group valueForProperty:ALAssetsGroupPropertyName] isEqualToString:albumNameHomescreenInterwall]) {
+ [group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
+ if (index == currentIndexHomeScreen) {
+ ALAssetRepresentation *representation = [result defaultRepresentation];
+ UIImage *image = [UIImage imageWithCGImage:[representation fullScreenImage]];
+
+ if (blurEnabledInterwall) {
+ SetWallpaperWithImage(GetBlurredImageFrom(image, wallpaperMode), wallpaperMode);
+ } else {
+ SetWallpaperWithImage(image, wallpaperMode);
+ }
+
+ if (shuffleInterwall) {
+ currentIndexHomeScreen = arc4random_uniform([group numberOfAssets]);
+ } else {
+ currentIndexHomeScreen++;
+
+ if (currentIndexHomeScreen == [group numberOfAssets]) {
+ currentIndexHomeScreen = 0;
+ }
+ }
+
+ *stop = YES;
+ }
+ }];
+ }
+ } failureBlock:^(NSError *error) {
+ NSLog(@"\n\n [Wallmart] Following error occured: %@", [error description]);
+ }];
+ } else {
+ [assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
+ if ([[group valueForProperty:ALAssetsGroupPropertyName] isEqualToString:albumNameLockscreenInterwall]) {
+ [group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
+ if (index == currentIndexLockScreen) {
+ ALAssetRepresentation *representation = [result defaultRepresentation];
+ UIImage *image = [UIImage imageWithCGImage:[representation fullScreenImage]];
+
+ if (blurEnabledInterwall) {
+ SetWallpaperWithImage(GetBlurredImageFrom(image, wallpaperMode), wallpaperMode);
+ } else {
+ SetWallpaperWithImage(image, wallpaperMode);
+ }
+
+ if (shuffleInterwall) {
+ currentIndexLockScreen = arc4random_uniform([group numberOfAssets]);
+ } else {
+ currentIndexLockScreen++;
+
+ if (currentIndexLockScreen == [group numberOfAssets]) {
+ currentIndexLockScreen = 0;
+ }
+ }
+
+ *stop = YES;
+ }
+ }];
+ }
+ } failureBlock:^(NSError *error) {
+ NSLog(@"\n\n [Wallmart] Following error occured: %@", [error description]);
+ }];
+ }
+}
+
+%hook SpringBoard
+
+- (void)applicationDidFinishLaunching:(UIApplication *)application
+{
+ %orig;
+
+ if (wallmartGeneralEnabled && interwallEnabled) {
+ [self configureTimer];
+ }
+}
+
+%new - (void)configureTimer
+{
+ persistentTimer = [[PCPersistentTimer alloc] initWithFireDate:[[NSDate date] dateByAddingTimeInterval:interwallTime] serviceIdentifier:@"com.shinvou.wallmartinterwall" target:self selector:@selector(updateWallpaper) userInfo:nil];
+ [persistentTimer scheduleInRunLoop:[NSRunLoop mainRunLoop]];
+}
+
+%new - (void)updateWallpaper
+{
+ if (wallmartGeneralEnabled && interwallEnabled) {
+ if (unlockedOnce) {
+ ChangeWallpaperForMode(wallpaperModeInterwall);
+ }
+
+ [self configureTimer];
+ }
+}
+
+%end
+
+%hook SBLockScreenManager
+
+- (void)_finishUIUnlockFromSource:(int)source withOptions:(id)options
+{
+ %orig;
+
+ if (!unlockedOnce) {
+ unlockedOnce = YES;
+ assetsLibrary = [[ALAssetsLibrary alloc] init];
+ }
+}
+
+%end
+
+%hook PLStaticWallpaperImageViewController
+
+- (void)providerLegibilitySettingsChanged:(SBSUIWallpaperPreviewViewController *)wallpaperPreviewViewController
+{
+ [wallpaperPreviewViewController setMotionEnabled:perspectiveZoomInterwall];
+
+ %orig(wallpaperPreviewViewController);
+}
+
+%end
+
+%hook SBStatusBarStateAggregator
+
+- (void)_updateTimeItems
+{
+ %orig;
+
+ if (wallmartGeneralEnabled && interwallMomentsEnabled) {
+ NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
+ [dateFormatter setDateFormat:@"HH:mm"];
+
+ NSString *currentTimeString = [dateFormatter stringFromDate:[NSDate date]];
+
+ for (int i = 0; i < moments.count; i++) {
+ if ([moments[i] isEqualToString:currentTimeString]) {
+ [self updateWallpaper];
+ [moments removeObjectAtIndex:i];
+ }
+ }
+ }
+}
+
+%new - (void)updateWallpaper
+{
+ if (wallmartGeneralEnabled && interwallMomentsEnabled) {
+ if (unlockedOnce) {
+ if (wallpaperModeInterwall == PLWallpaperModeBoth) {
+ ChangeWallpaperForMode(PLWallpaperModeHomeScreen);
+ ChangeWallpaperForMode(PLWallpaperModeLockScreen);
+ } else {
+ if (wallpaperModeInterwall == PLWallpaperModeHomeScreen) {
+ ChangeWallpaperForMode(PLWallpaperModeHomeScreen);
+ } else {
+ ChangeWallpaperForMode(PLWallpaperModeLockScreen);
+ }
+ }
+ }
+ }
+}
+
+%end
+
+static void ReloadSettings()
+{
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
+
+ if (settings) {
+ if ([settings objectForKey:@"interwallEnabled"]) {
+ if ([[settings objectForKey:@"interwallEnabled"] boolValue] != interwallEnabled) {
+ interwallEnabled = [[settings objectForKey:@"interwallEnabled"] boolValue];
+
+ [persistentTimer invalidate];
+ [(SpringBoard *)[UIApplication sharedApplication] configureTimer];
+ }
+ }
+
+ if ([settings objectForKey:@"interwallTime"]) {
+ NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
+ NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
+ [numberFormatter setLocale:locale];
+ [numberFormatter setAllowsFloats:NO];
+
+ if (![[settings objectForKey:@"interwallTime"] isEqualToString:@""] && [numberFormatter numberFromString:[settings objectForKey:@"interwallTime"]]) {
+ if ([[settings objectForKey:@"interwallTime"] intValue] != interwallTime) {
+ interwallTime = [[settings objectForKey:@"interwallTime"] intValue];
+
+ [persistentTimer invalidate];
+ [(SpringBoard *)[UIApplication sharedApplication] configureTimer];
+ }
+ } else {
+ interwallTime = 60;
+ }
+
+ [numberFormatter release];
+ [locale release];
+ }
+
+ if ([settings objectForKey:@"interwallMomentsEnabled"]) {
+ interwallMomentsEnabled = [[settings objectForKey:@"interwallMomentsEnabled"] boolValue];
+ }
+
+ if ([settings objectForKey:@"moments"]) {
+ moments = [[settings objectForKey:@"moments"] mutableCopy];
+ }
+
+ if ([settings objectForKey:@"wallpaperModeInterwall"]) {
+ wallpaperModeInterwall = [[settings objectForKey:@"wallpaperModeInterwall"] intValue];
+ }
+
+ if ([settings objectForKey:@"blurEnabledInterwall"]) {
+ blurEnabledInterwall = [[settings objectForKey:@"blurEnabledInterwall"] boolValue];
+ }
+
+ if ([settings objectForKey:@"blurStrengthInterwall"]) {
+ blurStrengthInterwall = [[settings objectForKey:@"blurStrengthInterwall"] intValue];
+ }
+
+ if ([settings objectForKey:@"blurModeInterwall"]) {
+ blurModeInterwall = [[settings objectForKey:@"blurModeInterwall"] intValue];
+ }
+
+ if ([settings objectForKey:@"perspectiveZoomInterwall"]) {
+ perspectiveZoomInterwall = [[settings objectForKey:@"perspectiveZoomInterwall"] boolValue];
+ }
+
+ if ([settings objectForKey:@"shuffleInterwall"]) {
+ shuffleInterwall = [[settings objectForKey:@"shuffleInterwall"] boolValue];
+ }
+
+ if ([settings objectForKey:@"albumNameLockscreenInterwall"]) {
+ if (unlockedOnce && ![[settings objectForKey:@"albumNameLockscreenInterwall"] isEqualToString:albumNameLockscreenInterwall]) {
+ currentIndexHomeScreen = 0;
+ currentIndexLockScreen = 0;
+ }
+
+ albumNameLockscreenInterwall = [[settings objectForKey:@"albumNameLockscreenInterwall"] mutableCopy];
+ }
+
+ if ([settings objectForKey:@"albumNameHomescreenInterwall"]) {
+ if (unlockedOnce && ![[settings objectForKey:@"albumNameHomescreenInterwall"] isEqualToString:albumNameHomescreenInterwall]) {
+ currentIndexHomeScreen = 0;
+ currentIndexLockScreen = 0;
+ }
+
+ albumNameHomescreenInterwall = [[settings objectForKey:@"albumNameHomescreenInterwall"] mutableCopy];
+ }
+ }
+
+ [settings release];
+}
+
+%ctor {
+ @autoreleasepool {
+ [[NSNotificationCenter defaultCenter] addObserverForName:NSCalendarDayChangedNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) {
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
+
+ if ([settings objectForKey:@"moments"]) {
+ moments = [[settings objectForKey:@"moments"] mutableCopy];
+ }
+
+ [settings release];
+ }];
+
+ ReloadSettings();
+ CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)ReloadSettings, CFSTR("com.shinvou.wallmart/reloadInterwallSettings"), NULL, CFNotificationSuspensionBehaviorCoalesce);
+ }
+}
diff --git a/Makefile b/Makefile
index af435f8..6df9622 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
GO_EASY_ON_ME = 1
TARGET = iphone:clang:latest:8.0
-ARCHS = armv7 armv7s arm64
+ARCHS = armv7 arm64
THEOS_DEVICE_IP = 127.0.0.1
THEOS_DEVICE_PORT = 2222
@@ -10,7 +10,7 @@ THEOS_PACKAGE_DIR_NAME = deb
include theos/makefiles/common.mk
TWEAK_NAME = Wallmart
-Wallmart_FILES = Tweak.xm WallmartEvent.xm
+Wallmart_FILES = Wallmart.xm Interwall.xm WallmartEvents.xm
Wallmart_FRAMEWORKS = UIKit AssetsLibrary CoreImage CoreGraphics
Wallmart_PRIVATE_FRAMEWORKS = PhotoLibrary PersistentConnection
@@ -20,9 +20,6 @@ SUBPROJECTS += WallmartSettings
include $(THEOS_MAKE_PATH)/aggregate.mk
-internal-stage::
- @mkdir -p $(THEOS_STAGING_DIR)/Library/Activator/Listeners/com.shinvou.wallmartevent
- @cp Info.plist $(THEOS_STAGING_DIR)/Library/Activator/Listeners/com.shinvou.wallmartevent/Info.plist
before-stage::
find . -name ".DS_Store" -delete
after-install::
diff --git a/TODO.txt b/TODO.txt
index e0d5bc1..1756462 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,8 +1,15 @@
-- option to resize photos to force fit the screen
-- option to enable cycling only between specific hours
-- separate album for ls and hs
+### FEATURE REQUESTS
- option to dim wallpaper
+- option to resize photos to force fit the screen
+
+## MAYBE
+- change one wall more often/less often than other one
+- support for paths
-- folder customizer support
-- weatherboard support
-- auxo support
\ No newline at end of file
+### POSSIBLE INCOMPATIBILITY (NEEDS TO BE CONFIRMED)
+- auxo
+- barrel
+- folder customizer
+- springtomize
+- weatherboard
+- lockinfo
diff --git a/Tweak.xm b/Tweak.xm
deleted file mode 100644
index d50bb6e..0000000
--- a/Tweak.xm
+++ /dev/null
@@ -1,312 +0,0 @@
-//
-// Tweak.xm
-// Wallmart
-//
-// Created by Timm Kandziora on 09.01.15.
-// Copyright (c) 2015 Timm Kandziora. All rights reserved.
-//
-
-#import
-#import
-#import
-#import
-
-@interface SpringBoard
-- (void)applicationDidFinishLaunching:(UIApplication *)application;
-- (void)configureTimer;
-- (void)updateWallpaper;
-@end
-
-@interface PCPersistentTimer : NSObject
-- (id)initWithFireDate:(NSDate *)date serviceIdentifier:(NSString *)identifier target:(id)target selector:(SEL)selector userInfo:(id)userInfo;
-- (void)scheduleInRunLoop:(NSRunLoop *)runLoop;
-- (void)invalidate;
-@end
-
-@interface SBSUIWallpaperPreviewViewController : UIViewController
-- (void)setMotionEnabled:(BOOL)enabled;
-@end
-
-#define settingsPath @"/var/mobile/Library/Preferences/com.shinvou.wallmart.plist"
-
-static BOOL unlockedAfterBoot = NO;
-static int currentIndex = 0;
-static NSString *albumName = @"Wallmart";
-static ALAssetsLibrary *assetsLibrary = nil;
-static PCPersistentTimer *persistentTimer = nil;
-
-static BOOL enabled = YES;
-static PLWallpaperMode wallpaperMode = PLWallpaperModeBoth;
-static BOOL shuffleEnabled = NO;
-static BOOL perspectiveZoom = YES;
-static BOOL blurEnabled = NO;
-static int blurStrenght = 5;
-static int blurMode = 0;
-static BOOL interwallEnabled = NO;
-static int interwallTime = 60;
-
-static void SetWallpaper(UIImage *image, int mode)
-{
- PLStaticWallpaperImageViewController *wallpaperViewController = [[PLStaticWallpaperImageViewController alloc] initWithUIImage:image];
- wallpaperViewController.saveWallpaperData = YES;
-
- PLWallpaperMode wallMode = mode;
- uintptr_t address = (uintptr_t)&wallMode;
- object_setInstanceVariable(wallpaperViewController, "_wallpaperMode", *(PLWallpaperMode **)address);
-
- [wallpaperViewController _savePhoto];
- [wallpaperViewController release];
-}
-
-static void PrepareWallpaper(UIImage *image)
-{
- UIImage *normalImage = image;
-
- if (blurEnabled) {
- CIFilter *gaussianBlurFilter = [CIFilter filterWithName:@"CIGaussianBlur"];
- [gaussianBlurFilter setDefaults];
- [gaussianBlurFilter setValue:[CIImage imageWithCGImage:image.CGImage] forKey:kCIInputImageKey];
- [gaussianBlurFilter setValue:@(blurStrenght) forKey:kCIInputRadiusKey];
-
- CIImage *outputImage = [gaussianBlurFilter outputImage];
- CIContext *context = [CIContext contextWithOptions:nil];
- CGRect rect = [outputImage extent];
-
- rect.origin.x += (rect.size.width - image.size.width ) / 2;
- rect.origin.y += (rect.size.height - image.size.height) / 2;
- rect.size = image.size;
-
- CGImageRef cgimg = [context createCGImage:outputImage fromRect:rect];
- UIImage *blurredImage = [UIImage imageWithCGImage:cgimg];
- CGImageRelease(cgimg);
-
- switch (blurMode) {
- case 1:
- if (wallpaperMode == 0) {
- SetWallpaper(normalImage, 2);
- SetWallpaper(blurredImage, 1);
- } else if (wallpaperMode == 1) {
- SetWallpaper(blurredImage, 1);
- } else {
- SetWallpaper(normalImage, 2);
- }
-
- break;
-
- case 2:
- if (wallpaperMode == 0) {
- SetWallpaper(normalImage, 1);
- SetWallpaper(blurredImage, 2);
- } else if (wallpaperMode == 2) {
- SetWallpaper(blurredImage, 2);
- } else {
- SetWallpaper(normalImage, 1);
- }
-
- break;
-
- default:
- SetWallpaper(blurredImage, wallpaperMode);
-
- break;
- }
- } else {
- SetWallpaper(normalImage, wallpaperMode);
- }
-}
-
-static void GetWallpaperFromAlbum()
-{
- if (!assetsLibrary) {
- assetsLibrary = [[ALAssetsLibrary alloc] init];
- }
-
- [assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
- NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
-
- if (settings && [settings objectForKey:@"albumName"] && ![[settings objectForKey:@"albumName"] isEqualToString:@""]) {
- if ([[group valueForProperty:ALAssetsGroupPropertyName] isEqualToString:[settings objectForKey:@"albumName"]]) {
- [group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
- if (index == currentIndex) {
- ALAssetRepresentation *representation = [result defaultRepresentation];
- UIImage *image = [UIImage imageWithCGImage:[representation fullScreenImage]];
- PrepareWallpaper(image);
-
- if (shuffleEnabled) {
- currentIndex = arc4random_uniform([group numberOfAssets]);
- } else {
- currentIndex++;
-
- if (currentIndex == [group numberOfAssets]) {
- currentIndex = 0;
- }
- }
-
- *stop = YES;
- }
- }];
-
- [settings release];
- }
- } else {
- if ([[group valueForProperty:ALAssetsGroupPropertyName] isEqualToString:albumName]) {
- [group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
- if (index == currentIndex) {
- ALAssetRepresentation *representation = [result defaultRepresentation];
- UIImage *image = [UIImage imageWithCGImage:[representation fullScreenImage]];
- PrepareWallpaper(image);
-
- if (shuffleEnabled) {
- currentIndex = arc4random_uniform([group numberOfAssets]);
- } else {
- currentIndex++;
-
- if (currentIndex == [group numberOfAssets]) {
- currentIndex = 0;
- }
- }
-
- *stop = YES;
- }
- }];
- }
- }
- } failureBlock:^(NSError *error) {
- NSLog(@"\n\n [Wallmart] Following error occured: %@", [error description]);
- }];
-}
-
-static void ReloadSettings()
-{
- NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
-
- if (settings) {
- if ([settings objectForKey:@"enabled"]) {
- enabled = [[settings objectForKey:@"enabled"] boolValue];
- }
-
- if ([settings objectForKey:@"wallpaperMode"]) {
- wallpaperMode = [[settings objectForKey:@"wallpaperMode"] intValue];
- }
-
- if ([settings objectForKey:@"shuffle_enabled"]) {
- shuffleEnabled = [[settings objectForKey:@"shuffle_enabled"] boolValue];
- }
-
- if ([settings objectForKey:@"perspective_zoom"]) {
- perspectiveZoom = [[settings objectForKey:@"perspective_zoom"] boolValue];
- }
-
- if ([settings objectForKey:@"blur_enabled"]) {
- blurEnabled = [[settings objectForKey:@"blur_enabled"] boolValue];
- }
-
- if ([settings objectForKey:@"blur_strenght"]) {
- blurStrenght = [[settings objectForKey:@"blur_strenght"] intValue];
- }
-
- if ([settings objectForKey:@"wallpaper_blur_options"]) {
- blurMode = [[settings objectForKey:@"wallpaper_blur_options"] intValue];
- }
-
- if ([settings objectForKey:@"interwall_enabled"]) {
- interwallEnabled = [[settings objectForKey:@"interwall_enabled"] boolValue];
- }
-
- if ([settings objectForKey:@"interwallTime"]) {
- NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
- NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
- [numberFormatter setLocale:locale];
- [numberFormatter setAllowsFloats:NO];
-
- if (![[settings objectForKey:@"interwallTime"] isEqualToString:@""] && [numberFormatter numberFromString:[settings objectForKey:@"interwallTime"]]) {
- if ([[settings objectForKey:@"interwallTime"] intValue] != interwallTime) {
- interwallTime = [[settings objectForKey:@"interwallTime"] intValue];
-
- [persistentTimer invalidate];
- [(SpringBoard *)[UIApplication sharedApplication] configureTimer];
- }
- } else {
- interwallTime = 60;
- }
-
- [numberFormatter release];
- [locale release];
- }
- }
-
- [settings release];
-
- if (enabled && unlockedAfterBoot) {
- currentIndex--;
- GetWallpaperFromAlbum();
- }
-}
-
-%hook SBLockScreenManager
-
-- (void)lockUIFromSource:(int)source withOptions:(id)options
-{
- %orig;
-
- if (enabled && unlockedAfterBoot) {
- GetWallpaperFromAlbum();
- }
-}
-
-- (void)_finishUIUnlockFromSource:(int)source withOptions:(id)options
-{
- %orig;
-
- unlockedAfterBoot = YES;
-}
-
-%end
-
-%hook SpringBoard
-
-- (void)applicationDidFinishLaunching:(UIApplication *)application
-{
- %orig;
-
- [self configureTimer];
-}
-
-%new - (void)configureTimer
-{
- persistentTimer = [[PCPersistentTimer alloc] initWithFireDate:[[NSDate date] dateByAddingTimeInterval:interwallTime] serviceIdentifier:@"com.shinvou.wallmart" target:self selector:@selector(updateWallpaper) userInfo:nil];
- [persistentTimer scheduleInRunLoop:[NSRunLoop mainRunLoop]];
-}
-
-%new - (void)updateWallpaper
-{
- if (interwallEnabled && unlockedAfterBoot) {
- GetWallpaperFromAlbum();
- }
-
- [self configureTimer];
-}
-
-%end
-
-%hook PLStaticWallpaperImageViewController
-
-- (void)providerLegibilitySettingsChanged:(SBSUIWallpaperPreviewViewController *)wallpaperPreviewViewController
-{
- [wallpaperPreviewViewController setMotionEnabled:perspectiveZoom];
-
- %orig(wallpaperPreviewViewController);
-}
-
-%end
-
-%ctor {
- @autoreleasepool {
- [[NSDistributedNotificationCenter defaultCenter] addObserverForName:@"WallmartEvent" object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) {
- GetWallpaperFromAlbum();
- }];
-
- ReloadSettings();
- CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)ReloadSettings, CFSTR("com.shinvou.wallmart/reloadSettings"), NULL, CFNotificationSuspensionBehaviorCoalesce);
- }
-}
diff --git a/Wallmart.xm b/Wallmart.xm
new file mode 100644
index 0000000..2211367
--- /dev/null
+++ b/Wallmart.xm
@@ -0,0 +1,379 @@
+//
+// Wallmart.xm
+// Wallmart
+//
+// Created by Timm Kandziora on 16.01.15.
+// Copyright (c) 2015 Timm Kandziora. All rights reserved.
+//
+
+#import "WallmartHeader.h"
+
+/* HELPER VARIABLES, TWEAK ONLY */
+
+static BOOL unlockedOnce = NO;
+static ALAssetsLibrary *assetsLibrary;
+static int currentIndexHomeScreen = 0;
+static int currentIndexLockScreen = 0;
+
+/* INFORMATION FROM SETTINGS */
+
+static BOOL wallmartGeneralEnabled = YES;
+
+static BOOL wallmartEnabled = YES;
+static int wallpaperModeWallmart = 0;
+
+static BOOL blurEnabledWallmart = NO;
+static int blurStrengthWallmart = 5;
+static int blurModeWallmart = 0;
+
+static BOOL perspectiveZoomWallmart = YES;
+static BOOL shuffleWallmart = NO;
+
+static BOOL cycleEnabledWallmart = NO;
+static NSString *cycleStartTime = @"10:00";
+static NSString *cycleEndTime = @"20:00";
+
+static NSString *albumNameLockscreenWallmart;
+static NSString *albumNameHomescreenWallmart;
+
+static UIImage* BlurImage(UIImage *image)
+{
+ CIFilter *gaussianBlurFilter = [CIFilter filterWithName:@"CIGaussianBlur"];
+ [gaussianBlurFilter setDefaults];
+ [gaussianBlurFilter setValue:[CIImage imageWithCGImage:image.CGImage] forKey:kCIInputImageKey];
+ [gaussianBlurFilter setValue:@(blurStrengthWallmart) forKey:kCIInputRadiusKey];
+
+ CIImage *outputImage = [gaussianBlurFilter outputImage];
+ CIContext *context = [CIContext contextWithOptions:nil];
+ CGRect rect = [outputImage extent];
+
+ rect.origin.x += (rect.size.width - image.size.width ) / 2;
+ rect.origin.y += (rect.size.height - image.size.height) / 2;
+ rect.size = image.size;
+
+ CGImageRef cgimg = [context createCGImage:outputImage fromRect:rect];
+ UIImage *blurredImage = [UIImage imageWithCGImage:cgimg];
+ CGImageRelease(cgimg);
+
+ return blurredImage;
+}
+
+static UIImage* GetBlurredImageFrom(UIImage *image, PLWallpaperMode wallpaperMode)
+{
+ if ((wallpaperMode == PLWallpaperModeHomeScreen && blurModeWallmart == 0) || (wallpaperMode == PLWallpaperModeHomeScreen && blurModeWallmart == 1)) {
+ return BlurImage(image);
+ } else if ((wallpaperMode == PLWallpaperModeLockScreen && blurModeWallmart == 0) || (wallpaperMode == PLWallpaperModeLockScreen && blurModeWallmart == 2)) {
+ return BlurImage(image);
+ } else {
+ return image;
+ }
+}
+
+static void SetWallpaperWithImage(UIImage *image, PLWallpaperMode wallpaperMode)
+{
+ PLStaticWallpaperImageViewController *wallpaperViewController = [[PLStaticWallpaperImageViewController alloc] initWithUIImage:image];
+ wallpaperViewController.saveWallpaperData = YES;
+
+ PLWallpaperMode wallpaperModeToSet = wallpaperMode;
+ uintptr_t address = (uintptr_t)&wallpaperModeToSet;
+ object_setInstanceVariable(wallpaperViewController, "_wallpaperMode", *(PLWallpaperMode **)address);
+
+ [wallpaperViewController _savePhoto];
+ [wallpaperViewController release];
+}
+
+static void ChangeWallpaperForMode(PLWallpaperMode wallpaperMode)
+{
+ if (wallpaperMode == PLWallpaperModeBoth) {
+ [assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
+ if ([[group valueForProperty:ALAssetsGroupPropertyName] isEqualToString:albumNameHomescreenWallmart]) {
+ [group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
+ if (index == currentIndexHomeScreen) {
+ ALAssetRepresentation *representation = [result defaultRepresentation];
+ UIImage *image = [UIImage imageWithCGImage:[representation fullScreenImage]];
+
+ if (blurEnabledWallmart) {
+ SetWallpaperWithImage(GetBlurredImageFrom(image, PLWallpaperModeHomeScreen), PLWallpaperModeHomeScreen);
+ } else {
+ SetWallpaperWithImage(image, PLWallpaperModeHomeScreen);
+ }
+
+ if (shuffleWallmart) {
+ currentIndexHomeScreen = arc4random_uniform([group numberOfAssets]);
+ } else {
+ currentIndexHomeScreen++;
+
+ if (currentIndexHomeScreen == [group numberOfAssets]) {
+ currentIndexHomeScreen = 0;
+ }
+ }
+
+ *stop = YES;
+ }
+ }];
+ }
+
+ if ([[group valueForProperty:ALAssetsGroupPropertyName] isEqualToString:albumNameLockscreenWallmart]) {
+ [group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
+ if (index == currentIndexLockScreen) {
+ ALAssetRepresentation *representation = [result defaultRepresentation];
+ UIImage *image = [UIImage imageWithCGImage:[representation fullScreenImage]];
+
+ if (blurEnabledWallmart) {
+ SetWallpaperWithImage(GetBlurredImageFrom(image, PLWallpaperModeLockScreen), PLWallpaperModeLockScreen);
+ } else {
+ SetWallpaperWithImage(image, PLWallpaperModeLockScreen);
+ }
+
+ if (shuffleWallmart) {
+ currentIndexLockScreen = arc4random_uniform([group numberOfAssets]);
+ } else {
+ currentIndexLockScreen++;
+
+ if (currentIndexLockScreen == [group numberOfAssets]) {
+ currentIndexLockScreen = 0;
+ }
+ }
+
+ *stop = YES;
+ }
+ }];
+ }
+ } failureBlock:^(NSError *error) {
+ NSLog(@"\n\n [Wallmart] Following error occured: %@", [error description]);
+ }];
+ } else if (wallpaperMode == PLWallpaperModeHomeScreen) {
+ [assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
+ if ([[group valueForProperty:ALAssetsGroupPropertyName] isEqualToString:albumNameHomescreenWallmart]) {
+ [group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
+ if (index == currentIndexHomeScreen) {
+ ALAssetRepresentation *representation = [result defaultRepresentation];
+ UIImage *image = [UIImage imageWithCGImage:[representation fullScreenImage]];
+
+ if (blurEnabledWallmart) {
+ SetWallpaperWithImage(GetBlurredImageFrom(image, wallpaperMode), wallpaperMode);
+ } else {
+ SetWallpaperWithImage(image, wallpaperMode);
+ }
+
+ if (shuffleWallmart) {
+ currentIndexHomeScreen = arc4random_uniform([group numberOfAssets]);
+ } else {
+ currentIndexHomeScreen++;
+
+ if (currentIndexHomeScreen == [group numberOfAssets]) {
+ currentIndexHomeScreen = 0;
+ }
+ }
+
+ *stop = YES;
+ }
+ }];
+ }
+ } failureBlock:^(NSError *error) {
+ NSLog(@"\n\n [Wallmart] Following error occured: %@", [error description]);
+ }];
+ } else {
+ [assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
+ if ([[group valueForProperty:ALAssetsGroupPropertyName] isEqualToString:albumNameLockscreenWallmart]) {
+ [group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
+ if (index == currentIndexLockScreen) {
+ ALAssetRepresentation *representation = [result defaultRepresentation];
+ UIImage *image = [UIImage imageWithCGImage:[representation fullScreenImage]];
+
+ if (blurEnabledWallmart) {
+ SetWallpaperWithImage(GetBlurredImageFrom(image, wallpaperMode), wallpaperMode);
+ } else {
+ SetWallpaperWithImage(image, wallpaperMode);
+ }
+
+ if (shuffleWallmart) {
+ currentIndexLockScreen = arc4random_uniform([group numberOfAssets]);
+ } else {
+ currentIndexLockScreen++;
+
+ if (currentIndexLockScreen == [group numberOfAssets]) {
+ currentIndexLockScreen = 0;
+ }
+ }
+
+ *stop = YES;
+ }
+ }];
+ }
+ } failureBlock:^(NSError *error) {
+ NSLog(@"\n\n [Wallmart] Following error occured: %@", [error description]);
+ }];
+ }
+}
+
+static BOOL CurrentTimeIsLaterThan(NSString *timeToCompareString)
+{
+ NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
+ [dateFormatter setDateFormat:@"HH:mm"];
+
+ NSString *currentTimeString = [dateFormatter stringFromDate:[NSDate date]];
+ NSDate *currentTime= [dateFormatter dateFromString:currentTimeString];
+ NSDate *timeToCompare = [dateFormatter dateFromString:timeToCompareString];
+
+ NSComparisonResult result = [currentTime compare:timeToCompare];
+
+ if (result == NSOrderedDescending) {
+ return YES;
+ } else if (result == NSOrderedAscending) {
+ return NO;
+ } else {
+ return MAYBE;
+ }
+}
+
+%hook SBLockScreenManager
+
+- (void)lockUIFromSource:(int)source withOptions:(id)options
+{
+ %orig;
+
+ if (unlockedOnce && wallmartGeneralEnabled && wallmartEnabled) {
+ if (cycleEnabledWallmart) {
+ if (CurrentTimeIsLaterThan(cycleStartTime) && !CurrentTimeIsLaterThan(cycleEndTime)) {
+ goto CHANGE;
+ } else {
+ return;
+ }
+ }
+
+ CHANGE:
+ ChangeWallpaperForMode(wallpaperModeWallmart);
+ }
+}
+
+- (void)_finishUIUnlockFromSource:(int)source withOptions:(id)options
+{
+ %orig;
+
+ if (!unlockedOnce) {
+ unlockedOnce = YES;
+ assetsLibrary = [[ALAssetsLibrary alloc] init];
+ }
+}
+
+%end
+
+%hook PLStaticWallpaperImageViewController
+
+- (void)providerLegibilitySettingsChanged:(SBSUIWallpaperPreviewViewController *)wallpaperPreviewViewController
+{
+ [wallpaperPreviewViewController setMotionEnabled:perspectiveZoomWallmart];
+
+ %orig(wallpaperPreviewViewController);
+}
+
+%end
+
+static void ReloadSettings()
+{
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
+
+ if (settings) {
+ if ([settings objectForKey:@"wallmartGeneralEnabled"]) {
+ wallmartGeneralEnabled = [[settings objectForKey:@"wallmartGeneralEnabled"] boolValue];
+ }
+
+ if ([settings objectForKey:@"wallmartEnabled"]) {
+ wallmartEnabled = [[settings objectForKey:@"wallmartEnabled"] boolValue];
+ }
+
+ if ([settings objectForKey:@"wallpaperModeWallmart"]) {
+ wallpaperModeWallmart = [[settings objectForKey:@"wallpaperModeWallmart"] intValue];
+ }
+
+ if ([settings objectForKey:@"blurEnabledWallmart"]) {
+ blurEnabledWallmart = [[settings objectForKey:@"blurEnabledWallmart"] boolValue];
+ }
+
+ if ([settings objectForKey:@"blurStrengthWallmart"]) {
+ blurStrengthWallmart = [[settings objectForKey:@"blurStrengthWallmart"] intValue];
+ }
+
+ if ([settings objectForKey:@"blurModeWallmart"]) {
+ blurModeWallmart = [[settings objectForKey:@"blurModeWallmart"] intValue];
+ }
+
+ if ([settings objectForKey:@"perspectiveZoomWallmart"]) {
+ perspectiveZoomWallmart = [[settings objectForKey:@"perspectiveZoomWallmart"] boolValue];
+ }
+
+ if ([settings objectForKey:@"shuffleWallmart"]) {
+ shuffleWallmart = [[settings objectForKey:@"shuffleWallmart"] boolValue];
+ }
+
+ if ([settings objectForKey:@"cycleEnabledWallmart"]) {
+ cycleEnabledWallmart = [[settings objectForKey:@"cycleEnabledWallmart"] boolValue];
+ }
+
+ if ([settings objectForKey:@"cycleStartTime"]) {
+ cycleStartTime = [[settings objectForKey:@"cycleStartTime"] mutableCopy];
+ }
+
+ if ([settings objectForKey:@"cycleEndTime"]) {
+ cycleEndTime = [[settings objectForKey:@"cycleEndTime"] mutableCopy];
+ }
+
+ if ([settings objectForKey:@"albumNameLockscreenWallmart"]) {
+ if (unlockedOnce && ![[settings objectForKey:@"albumNameLockscreenWallmart"] isEqualToString:albumNameLockscreenWallmart]) {
+ currentIndexHomeScreen = 0;
+ currentIndexLockScreen = 0;
+ }
+
+ albumNameLockscreenWallmart = [[settings objectForKey:@"albumNameLockscreenWallmart"] mutableCopy];
+ }
+
+ if ([settings objectForKey:@"albumNameHomescreenWallmart"]) {
+ if (unlockedOnce && ![[settings objectForKey:@"albumNameHomescreenWallmart"] isEqualToString:albumNameHomescreenWallmart]) {
+ currentIndexHomeScreen = 0;
+ currentIndexLockScreen = 0;
+ }
+
+ albumNameHomescreenWallmart = [[settings objectForKey:@"albumNameHomescreenWallmart"] mutableCopy];
+ }
+ }
+
+ [settings release];
+}
+
+%ctor {
+ @autoreleasepool {
+ ReloadSettings();
+ CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)ReloadSettings, CFSTR("com.shinvou.wallmart/reloadWallmartSettings"), NULL, CFNotificationSuspensionBehaviorCoalesce);
+
+ [[NSDistributedNotificationCenter defaultCenter] addObserverForName:@"WallmartEventSwitchBothWallpapers" object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) {
+ if (unlockedOnce) {
+ ChangeWallpaperForMode(PLWallpaperModeBoth);
+ }
+ }];
+
+ [[NSDistributedNotificationCenter defaultCenter] addObserverForName:@"WallmartEventSwitchLockScreenWallpaper" object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) {
+ if (unlockedOnce) {
+ ChangeWallpaperForMode(PLWallpaperModeLockScreen);
+ }
+ }];
+
+ [[NSDistributedNotificationCenter defaultCenter] addObserverForName:@"WallmartEventSwitchHomeScreenWallpaper" object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) {
+ if (unlockedOnce) {
+ if (unlockedOnce) {
+ ChangeWallpaperForMode(PLWallpaperModeHomeScreen);
+ }
+ }
+ }];
+
+ [[NSDistributedNotificationCenter defaultCenter] addObserverForName:@"WallmartEventToggleWallmartEnabled" object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) {
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] init];
+ [settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:settingsPath]];
+
+ [settings setObject:@(!wallmartEnabled) forKey:@"wallmartEnabled"];
+ [settings writeToFile:settingsPath atomically:YES];
+
+ wallmartEnabled = !wallmartEnabled;
+ }];
+ }
+}
diff --git a/WallmartEvent.xm b/WallmartEvent.xm
deleted file mode 100644
index b8ea1be..0000000
--- a/WallmartEvent.xm
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-// WallmartEvent.xm
-// Wallmart
-//
-// Created by Timm Kandziora on 09.01.15.
-// Copyright (c) 2015 Timm Kandziora. All rights reserved.
-//
-
-#import
-#import
-
-@interface WallmartEvent : NSObject
-@end
-
-@implementation WallmartEvent
-
-- (void)activator:(LAActivator *)activator receiveEvent:(LAEvent *)event
-{
- [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"WallmartEvent" object:nil userInfo:nil];
-
- [event setHandled:YES]; // To prevent the default OS implementation
-}
-
-+ (void)load
-{
- if ([[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.springboard"]) {
- [[%c(LAActivator) sharedInstance] registerListener:[self new] forName:@"com.shinvou.wallmartevent"];
- }
-}
-@end
diff --git a/WallmartEvents.xm b/WallmartEvents.xm
new file mode 100644
index 0000000..77441ff
--- /dev/null
+++ b/WallmartEvents.xm
@@ -0,0 +1,206 @@
+//
+// WallmartEvents.xm
+// Wallmart
+//
+// Created by Timm Kandziora on 19.01.15.
+// Copyright (c) 2015 Timm Kandziora. All rights reserved.
+//
+
+#import
+#import
+
+@interface WallmartEventSwitchBothWallpapers : NSObject
+@end
+
+@implementation WallmartEventSwitchBothWallpapers
+
+- (void)activator:(LAActivator *)activator receiveEvent:(LAEvent *)event
+{
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"WallmartEventSwitchBothWallpapers" object:nil userInfo:nil];
+
+ [event setHandled:YES]; // To prevent the default OS implementation
+}
+
+- (UIImage *)activator:(LAActivator *)activator requiresSmallIconForListenerName:(NSString *)listenerName scale:(CGFloat)scale
+{
+ if (scale > 2) {
+ return [UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings@3x.png"];
+ }
+
+ return [UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings@2x.png"];
+}
+
+- (NSString *)activator:(LAActivator *)activator requiresLocalizedGroupForListenerName:(NSString *)listenerName
+{
+ return @"Wallmart";
+}
+
+- (NSString *)activator:(LAActivator *)activator requiresLocalizedTitleForListenerName:(NSString *)listenerName
+{
+ return @"Wallmart";
+}
+
+- (NSString *)activator:(LAActivator *)activator requiresLocalizedDescriptionForListenerName:(NSString *)listenerName
+{
+ return @"Switch your wallpapers on ls and hs";
+}
+
+- (NSArray *)activator:(LAActivator *)activator requiresCompatibleEventModesForListenerWithName:(NSString *)listenerName
+{
+ return [NSArray arrayWithObjects:@"springboard", @"lockscreen", @"application", nil];
+}
+
++ (void)load
+{
+ if ([[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.springboard"]) {
+ [[%c(LAActivator) sharedInstance] registerListener:[self new] forName:@"com.shinvou.wallmartevent.switchbothwallpapers"];
+ }
+}
+@end
+
+@interface WallmartEventSwitchLockScreenWallpaper : NSObject
+@end
+
+@implementation WallmartEventSwitchLockScreenWallpaper
+
+- (void)activator:(LAActivator *)activator receiveEvent:(LAEvent *)event
+{
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"WallmartEventSwitchLockScreenWallpaper" object:nil userInfo:nil];
+
+ [event setHandled:YES]; // To prevent the default OS implementation
+}
+
+- (UIImage *)activator:(LAActivator *)activator requiresSmallIconForListenerName:(NSString *)listenerName scale:(CGFloat)scale
+{
+ if (scale > 2) {
+ return [UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings@3x.png"];
+ }
+
+ return [UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings@2x.png"];
+}
+
+- (NSString *)activator:(LAActivator *)activator requiresLocalizedGroupForListenerName:(NSString *)listenerName
+{
+ return @"Wallmart";
+}
+
+- (NSString *)activator:(LAActivator *)activator requiresLocalizedTitleForListenerName:(NSString *)listenerName
+{
+ return @"Wallmart";
+}
+
+- (NSString *)activator:(LAActivator *)activator requiresLocalizedDescriptionForListenerName:(NSString *)listenerName
+{
+ return @"Switch your wallpaper on ls";
+}
+
+- (NSArray *)activator:(LAActivator *)activator requiresCompatibleEventModesForListenerWithName:(NSString *)listenerName
+{
+ return [NSArray arrayWithObjects:@"springboard", @"lockscreen", @"application", nil];
+}
+
++ (void)load
+{
+ if ([[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.springboard"]) {
+ [[%c(LAActivator) sharedInstance] registerListener:[self new] forName:@"com.shinvou.wallmartevent.switchlockscreenwallpaper"];
+ }
+}
+@end
+
+@interface WallmartEventSwitchHomeScreenWallpaper : NSObject
+@end
+
+@implementation WallmartEventSwitchHomeScreenWallpaper
+
+- (void)activator:(LAActivator *)activator receiveEvent:(LAEvent *)event
+{
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"WallmartEventSwitchHomeScreenWallpaper" object:nil userInfo:nil];
+
+ [event setHandled:YES]; // To prevent the default OS implementation
+}
+
+- (UIImage *)activator:(LAActivator *)activator requiresSmallIconForListenerName:(NSString *)listenerName scale:(CGFloat)scale
+{
+ if (scale > 2) {
+ return [UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings@3x.png"];
+ }
+
+ return [UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings@2x.png"];
+}
+
+- (NSString *)activator:(LAActivator *)activator requiresLocalizedGroupForListenerName:(NSString *)listenerName
+{
+ return @"Wallmart";
+}
+
+- (NSString *)activator:(LAActivator *)activator requiresLocalizedTitleForListenerName:(NSString *)listenerName
+{
+ return @"Wallmart";
+}
+
+- (NSString *)activator:(LAActivator *)activator requiresLocalizedDescriptionForListenerName:(NSString *)listenerName
+{
+ return @"Switch your wallpaper on hs";
+}
+
+- (NSArray *)activator:(LAActivator *)activator requiresCompatibleEventModesForListenerWithName:(NSString *)listenerName
+{
+ return [NSArray arrayWithObjects:@"springboard", @"lockscreen", @"application", nil];
+}
+
++ (void)load
+{
+ if ([[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.springboard"]) {
+ [[%c(LAActivator) sharedInstance] registerListener:[self new] forName:@"com.shinvou.wallmartevent.switchhomescreenwallpaper"];
+ }
+}
+@end
+
+@interface WallmartEventToggleWallmartEnabled : NSObject
+@end
+
+@implementation WallmartEventToggleWallmartEnabled
+
+- (void)activator:(LAActivator *)activator receiveEvent:(LAEvent *)event
+{
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"WallmartEventToggleWallmartEnabled" object:nil userInfo:nil];
+
+ [event setHandled:YES]; // To prevent the default OS implementation
+}
+
+- (UIImage *)activator:(LAActivator *)activator requiresSmallIconForListenerName:(NSString *)listenerName scale:(CGFloat)scale
+{
+ if (scale > 2) {
+ return [UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings@3x.png"];
+ }
+
+ return [UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings@2x.png"];
+}
+
+- (NSString *)activator:(LAActivator *)activator requiresLocalizedGroupForListenerName:(NSString *)listenerName
+{
+ return @"Wallmart";
+}
+
+- (NSString *)activator:(LAActivator *)activator requiresLocalizedTitleForListenerName:(NSString *)listenerName
+{
+ return @"Wallmart";
+}
+
+- (NSString *)activator:(LAActivator *)activator requiresLocalizedDescriptionForListenerName:(NSString *)listenerName
+{
+ return @"Toggle Wallmart enabled";
+}
+
+- (NSArray *)activator:(LAActivator *)activator requiresCompatibleEventModesForListenerWithName:(NSString *)listenerName
+{
+ return [NSArray arrayWithObjects:@"springboard", @"lockscreen", @"application", nil];
+}
+
++ (void)load
+{
+ if ([[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.springboard"]) {
+ [[%c(LAActivator) sharedInstance] registerListener:[self new] forName:@"com.shinvou.wallmartevent.togglewallmartenabled"];
+ }
+}
+@end
diff --git a/WallmartHeader.h b/WallmartHeader.h
new file mode 100644
index 0000000..c9b9afb
--- /dev/null
+++ b/WallmartHeader.h
@@ -0,0 +1,37 @@
+//
+// WallmartHeader.h
+// Wallmart
+//
+// Created by Timm Kandziora on 16.01.15.
+// Copyright (c) 2015 Timm Kandziora. All rights reserved.
+//
+
+#import
+#import
+#import
+#import
+
+#define MAYBE arc4random_uniform(2)
+
+#define settingsPath @"/var/mobile/Library/Preferences/com.shinvou.wallmart.plist"
+
+@interface SpringBoard
+- (void)applicationDidFinishLaunching:(UIApplication *)application;
+- (void)configureTimer;
+- (void)updateWallpaper;
+@end
+
+@interface SBStatusBarStateAggregator
+- (void)_updateTimeItems;
+- (void)updateWallpaper;
+@end
+
+@interface PCPersistentTimer : NSObject
+- (id)initWithFireDate:(NSDate *)date serviceIdentifier:(NSString *)identifier target:(id)target selector:(SEL)selector userInfo:(id)userInfo;
+- (void)scheduleInRunLoop:(NSRunLoop *)runLoop;
+- (void)invalidate;
+@end
+
+@interface SBSUIWallpaperPreviewViewController : UIViewController
+- (void)setMotionEnabled:(BOOL)enabled;
+@end
diff --git a/WallmartSettings/Makefile b/WallmartSettings/Makefile
index 1062d2c..884c574 100644
--- a/WallmartSettings/Makefile
+++ b/WallmartSettings/Makefile
@@ -1,4 +1,4 @@
-ARCHS = armv7 armv7s arm64
+ARCHS = armv7 arm64
include theos/makefiles/common.mk
diff --git a/WallmartSettings/Resources/WallmartSettings@2x.png b/WallmartSettings/Resources/WallmartSettings@2x.png
index 63592bf..13c4774 100644
Binary files a/WallmartSettings/Resources/WallmartSettings@2x.png and b/WallmartSettings/Resources/WallmartSettings@2x.png differ
diff --git a/WallmartSettings/Resources/WallmartSettings@3x.png b/WallmartSettings/Resources/WallmartSettings@3x.png
index f8683d5..a1886f4 100644
Binary files a/WallmartSettings/Resources/WallmartSettings@3x.png and b/WallmartSettings/Resources/WallmartSettings@3x.png differ
diff --git a/WallmartSettings/WallmartSettings.mm b/WallmartSettings/WallmartSettings.mm
index 8468901..e3316ee 100644
--- a/WallmartSettings/WallmartSettings.mm
+++ b/WallmartSettings/WallmartSettings.mm
@@ -1,5 +1,8 @@
+#import "WallmartSettingsGeneral.mm"
+#import "WallmartSettingsWallmart.mm"
+#import "WallmartSettingsInterwall.mm"
+
#import
-#import
#define settingsPath @"/var/mobile/Library/Preferences/com.shinvou.wallmart.plist"
#define UIColorRGB(r, g, b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0]
@@ -12,150 +15,25 @@ @implementation WallmartBanner
- (id)initWithStyle:(int)style reuseIdentifier:(NSString *)identifier specifier:(PSSpecifier *)specifier
{
self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"wallmartBannerCell" specifier:specifier];
-
+
if (self) {
self.backgroundColor = UIColorRGB(74, 74, 74);
-
+
UILabel *label =[[UILabel alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, 206)];
label.font = [UIFont fontWithName:@"Helvetica-Light" size:60];
label.textAlignment = NSTextAlignmentCenter;
label.textColor = [UIColor whiteColor];
label.text = @"#pantarhei";
-
- [self addSubview:label];
- }
-
- return self;
-}
-
-@end
-
-@interface WallmartBlurSettingsListController: PSListController { }
-@end
-
-@implementation WallmartBlurSettingsListController
-
-- (id)specifiers
-{
- if (_specifiers == nil) {
- [self setTitle:@"Blur Settings"];
-
- PSSpecifier *firstGroup = [PSSpecifier groupSpecifierWithName:@"MC BLURRY WITH SMARTIES"];
- [firstGroup setProperty:@"Blur affects the performance, it is possible that switching the wallpaper takes longer." forKey:@"footerText"];
-
- PSSpecifier *blur_enabled = [PSSpecifier preferenceSpecifierNamed:@"Enabled"
- target:self
- set:@selector(setValue:forSpecifier:)
- get:@selector(getValueForSpecifier:)
- detail:Nil
- cell:PSSwitchCell
- edit:Nil];
- [blur_enabled setIdentifier:@"blur_enabled"];
- [blur_enabled setProperty:@(YES) forKey:@"enabled"];
- PSSpecifier *secondGroup = [PSSpecifier groupSpecifierWithName:@"Blur strenght"];
-
- PSSpecifier *blur_strenght = [PSSpecifier preferenceSpecifierNamed:nil
- target:self
- set:@selector(setValue:forSpecifier:)
- get:@selector(getValueForSpecifier:)
- detail:Nil
- cell:PSSliderCell
- edit:Nil];
- [blur_strenght setIdentifier:@"blur_strenght"];
- [blur_strenght setProperty:@(YES) forKey:@"enabled"];
-
- [blur_strenght setProperty:@(0) forKey:@"min"];
- [blur_strenght setProperty:@(40) forKey:@"max"];
- [blur_strenght setProperty:@(NO) forKey:@"showValue"];
-
- PSSpecifier *thirdGroup = [PSSpecifier groupSpecifierWithName:@""];
- [thirdGroup setProperty:@"These settings respect the default wallpaper mode settings." forKey:@"footerText"];
-
- PSSpecifier *wallpaper_blur_options = [PSSpecifier preferenceSpecifierNamed:@"More options"
- target:self
- set:@selector(setValue:forSpecifier:)
- get:@selector(getValueForSpecifier:)
- detail:[PSListItemsController class]
- cell:PSLinkListCell
- edit:Nil];
- [wallpaper_blur_options setIdentifier:@"wallpaper_blur_options"];
- [wallpaper_blur_options setProperty:@(YES) forKey:@"enabled"];
- [wallpaper_blur_options setValues:@[@(0), @(2), @(1)]
- titles:@[@"Blur lockscreen and homescreen", @"Blur lockscreen only", @"Blur homescreen only"]
- shortTitles:@[@"Blur lockscreen and homescreen", @"Blur lockscreen only", @"Blur homescreen only"]];
-
- _specifiers = [NSArray arrayWithObjects:firstGroup, blur_enabled, secondGroup, blur_strenght, thirdGroup, wallpaper_blur_options, nil];
- }
-
- return _specifiers;
-}
-
-- (id)getValueForSpecifier:(PSSpecifier *)specifier
-{
- NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
-
- if ([specifier.identifier isEqualToString:@"blur_enabled"]) {
- if (settings) {
- if ([settings objectForKey:@"blur_enabled"]) {
- return [settings objectForKey:@"blur_enabled"];
- } else {
- return @(NO);
- }
- } else {
- return @(NO);
- }
- } else if ([specifier.identifier isEqualToString:@"blur_strenght"]) {
- if (settings) {
- if ([settings objectForKey:@"blur_strenght"]) {
- return [settings objectForKey:@"blur_strenght"];
- } else {
- return @(5);
- }
- } else {
- return @(5);
- }
- } else if ([specifier.identifier isEqualToString:@"wallpaper_blur_options"]) {
- if (settings) {
- if ([settings objectForKey:@"wallpaper_blur_options"]) {
- return [settings objectForKey:@"wallpaper_blur_options"];
- } else {
- return @(0);
- }
- } else {
- return @(0);
- }
- }
-
- return nil;
-}
-
-- (void)setValue:(id)value forSpecifier:(PSSpecifier *)specifier
-{
- NSMutableDictionary *settings = [[NSMutableDictionary alloc] init];
- [settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:settingsPath]];
-
- if ([specifier.identifier isEqualToString:@"blur_enabled"]) {
- [settings setObject:value forKey:@"blur_enabled"];
- [settings writeToFile:settingsPath atomically:YES];
- } else if ([specifier.identifier isEqualToString:@"blur_strenght"]) {
- [settings setObject:value forKey:@"blur_strenght"];
- [settings writeToFile:settingsPath atomically:YES];
- } else if ([specifier.identifier isEqualToString:@"wallpaper_blur_options"]) {
- [settings setObject:value forKey:@"wallpaper_blur_options"];
- [settings writeToFile:settingsPath atomically:YES];
+ [self addSubview:label];
}
- CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.shinvou.wallmart/reloadSettings"), NULL, NULL, TRUE);
+ return self;
}
@end
-
-@interface WallmartSettingsListController: PSListController { }
-
-@property (strong, nonatomic) NSMutableArray *albumNames;
-
+@interface WallmartSettingsListController : PSListController
@end
@implementation WallmartSettingsListController
@@ -163,10 +41,8 @@ @implementation WallmartSettingsListController
- (id)specifiers
{
if (_specifiers == nil) {
- [self populateAlbumNames];
-
[self setTitle:@"Wallmart"];
-
+
PSSpecifier *banner = [PSSpecifier preferenceSpecifierNamed:nil
target:self
set:NULL
@@ -176,95 +52,52 @@ - (id)specifiers
edit:Nil];
[banner setProperty:[WallmartBanner class] forKey:@"cellClass"];
[banner setProperty:@"206" forKey:@"height"];
-
- PSSpecifier *firstGroup = [PSSpecifier groupSpecifierWithName:@"wallmart a priori"];
- [firstGroup setProperty:@"Default album name is 'Wallmart'." forKey:@"footerText"];
-
- PSSpecifier *enabled = [PSSpecifier preferenceSpecifierNamed:@"Enabled"
- target:self
- set:@selector(setValue:forSpecifier:)
- get:@selector(getValueForSpecifier:)
- detail:Nil
- cell:PSSwitchCell
- edit:Nil];
- [enabled setIdentifier:@"enabled"];
- [enabled setProperty:@(YES) forKey:@"enabled"];
-
- PSSpecifier *wallpaperMode = [PSSpecifier preferenceSpecifierNamed:@"Wallpaper mode"
- target:self
- set:@selector(setValue:forSpecifier:)
- get:@selector(getValueForSpecifier:)
- detail:[PSListItemsController class]
- cell:PSLinkListCell
- edit:Nil];
- [wallpaperMode setIdentifier:@"wallpaperMode"];
- [wallpaperMode setProperty:@(YES) forKey:@"enabled"];
- [wallpaperMode setValues:@[@(0), @(2), @(1)]
- titles:@[@"Lockscreen and homescreen", @"Lockscreen only", @"Homescreen only"]
- shortTitles:@[@"Lockscreen and homescreen", @"Lockscreen only", @"Homescreen only"]];
- PSSpecifier *shuffle_enabled = [PSSpecifier preferenceSpecifierNamed:@"Shuffle"
+ PSSpecifier *firstGroup = [PSSpecifier groupSpecifierWithName:nil];
+ [firstGroup setProperty:@"These settings apply to 'Wallmart' and 'Interwall and moments'." forKey:@"footerText"];
+
+ PSSpecifier *generalSettings = [PSSpecifier preferenceSpecifierNamed:nil
target:self
- set:@selector(setValue:forSpecifier:)
- get:@selector(getValueForSpecifier:)
- detail:Nil
- cell:PSSwitchCell
+ set:NULL
+ get:NULL
+ detail:[WallmartSettingsGeneralListController class]
+ cell:PSLinkCell
edit:Nil];
- [shuffle_enabled setIdentifier:@"shuffle_enabled"];
- [shuffle_enabled setProperty:@(YES) forKey:@"enabled"];
+ generalSettings.name = @"General";
+ [generalSettings setIdentifier:@"generalSettings"];
+ [generalSettings setProperty:@(YES) forKey:@"enabled"];
+
+ PSSpecifier *secondGroup = [PSSpecifier groupSpecifierWithName:nil];
- PSSpecifier *perspective_zoom = [PSSpecifier preferenceSpecifierNamed:@"Perspective Zoom"
+ PSSpecifier *wallmartSettings = [PSSpecifier preferenceSpecifierNamed:nil
target:self
- set:@selector(setValue:forSpecifier:)
- get:@selector(getValueForSpecifier:)
- detail:Nil
- cell:PSSwitchCell
+ set:NULL
+ get:NULL
+ detail:[WallmartSettingsWallmartListController class]
+ cell:PSLinkCell
edit:Nil];
- [perspective_zoom setIdentifier:@"perspective_zoom"];
- [perspective_zoom setProperty:@(YES) forKey:@"enabled"];
-
- PSSpecifier *blur_controller_link = [PSSpecifier preferenceSpecifierNamed:@"blur_controller_link"
- target:self
- set:nil
- get:nil
- detail:[WallmartBlurSettingsListController class]
- cell:PSLinkCell
- edit:Nil];
- blur_controller_link.name = @"Blur settings";
- [blur_controller_link setIdentifier:@"blur_controller_link"];
- [blur_controller_link setProperty:@(YES) forKey:@"enabled"];
+ wallmartSettings.name = @"Wallmart";
+ [wallmartSettings setIdentifier:@"wallmartSettings"];
+ [wallmartSettings setProperty:@(YES) forKey:@"enabled"];
- PSSpecifier *secondGroup = [PSSpecifier groupSpecifierWithName:@"interwall"];
- [secondGroup setProperty:@"Set an interwall for the wallpaper to be changed automatically, e.g. '30' would mean '30 seconds'. Default is 60 seconds.\n\nInterwall also works if Wallmart is not enabled." forKey:@"footerText"];
-
- PSSpecifier *interwall_enabled = [PSSpecifier preferenceSpecifierNamed:@"Enabled"
+ PSSpecifier *interwallSettings = [PSSpecifier preferenceSpecifierNamed:nil
target:self
- set:@selector(setValue:forSpecifier:)
- get:@selector(getValueForSpecifier:)
- detail:Nil
- cell:PSSwitchCell
+ set:NULL
+ get:NULL
+ detail:[WallmartSettingsInterwallListController class]
+ cell:PSLinkCell
edit:Nil];
- [interwall_enabled setIdentifier:@"interwall_enabled"];
- [interwall_enabled setProperty:@(YES) forKey:@"enabled"];
+ interwallSettings.name = @"Interwall and moments";
+ [interwallSettings setIdentifier:@"interwallSettings"];
+ [interwallSettings setProperty:@(YES) forKey:@"enabled"];
- PSTextFieldSpecifier *interwallTime = [PSTextFieldSpecifier preferenceSpecifierNamed:nil
- target:self
- set:@selector(setValue:forSpecifier:)
- get:@selector(getValueForSpecifier:)
- detail:Nil
- cell:PSEditTextCell
- edit:Nil];
- [interwallTime setPlaceholder:@"Enter interwall in seconds ..."];
- [interwallTime setIdentifier:@"interwallTime"];
- [interwallTime setProperty:@(YES) forKey:@"enabled"];
-
PSSpecifier *thirdGroup = [PSSpecifier groupSpecifierWithName:@"contact developer"];
[thirdGroup setProperty:@"Feel free to follow me on twitter for any updates on my apps and tweaks or contact me for support questions.\n \nThis tweak is Open-Source, so make sure to check out my GitHub." forKey:@"footerText"];
-
+
PSSpecifier *twitter = [PSSpecifier preferenceSpecifierNamed:@"twitter"
target:self
- set:nil
- get:nil
+ set:NULL
+ get:NULL
detail:Nil
cell:PSLinkCell
edit:Nil];
@@ -273,11 +106,11 @@ - (id)specifiers
[twitter setIdentifier:@"twitter"];
[twitter setProperty:@(YES) forKey:@"enabled"];
[twitter setProperty:[UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/WallmartSettings.bundle/twitter.png"] forKey:@"iconImage"];
-
+
PSSpecifier *github = [PSSpecifier preferenceSpecifierNamed:@"github"
target:self
- set:nil
- get:nil
+ set:NULL
+ get:NULL
detail:Nil
cell:PSLinkCell
edit:Nil];
@@ -286,153 +119,11 @@ - (id)specifiers
[github setIdentifier:@"github"];
[github setProperty:@(YES) forKey:@"enabled"];
[github setProperty:[UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/WallmartSettings.bundle/github.png"] forKey:@"iconImage"];
-
- _specifiers = [NSArray arrayWithObjects:banner, firstGroup, enabled, wallpaperMode, shuffle_enabled, perspective_zoom, blur_controller_link, secondGroup, interwall_enabled, interwallTime, thirdGroup, twitter, github, nil];
- }
-
- return _specifiers;
-}
-
-- (id)getValueForSpecifier:(PSSpecifier *)specifier
-{
- NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
-
- if ([specifier.identifier isEqualToString:@"enabled"]) {
- if (settings) {
- if ([settings objectForKey:@"enabled"]) {
- return [settings objectForKey:@"enabled"];
- } else {
- return @(YES);
- }
- } else {
- return @(YES);
- }
- } else if ([specifier.identifier isEqualToString:@"wallpaperMode"]) {
- if (settings) {
- if ([settings objectForKey:@"wallpaperMode"]) {
- return [settings objectForKey:@"wallpaperMode"];
- } else {
- return @(0);
- }
- } else {
- return @(0);
- }
- } else if ([specifier.identifier isEqualToString:@"interwall_enabled"]) {
- if (settings) {
- if ([settings objectForKey:@"interwall_enabled"]) {
- return [settings objectForKey:@"interwall_enabled"];
- } else {
- return @(NO);
- }
- } else {
- return @(NO);
- }
- } else if ([specifier.identifier isEqualToString:@"interwallTime"]) {
- if (settings) {
- if ([settings objectForKey:@"interwallTime"]) {
- return [settings objectForKey:@"interwallTime"];
- } else {
- return nil;
- }
- } else {
- return nil;
- }
- } else if ([specifier.identifier isEqualToString:@"perspective_zoom"]) {
- if (settings) {
- if ([settings objectForKey:@"perspective_zoom"]) {
- return [settings objectForKey:@"perspective_zoom"];
- } else {
- return @(YES);
- }
- } else {
- return @(YES);
- }
- } else if ([specifier.identifier isEqualToString:@"album_list"]) {
- if (settings) {
- if ([settings objectForKey:@"albumName"]) {
- return [settings objectForKey:@"albumName"];
- } else {
- return nil;
- }
- } else {
- return nil;
- }
- } else if ([specifier.identifier isEqualToString:@"shuffle_enabled"]) {
- if (settings) {
- if ([settings objectForKey:@"shuffle_enabled"]) {
- return [settings objectForKey:@"shuffle_enabled"];
- } else {
- return @(NO);
- }
- } else {
- return @(NO);
- }
- }
-
- return nil;
-}
-
-- (void)setValue:(id)value forSpecifier:(PSSpecifier *)specifier
-{
- NSMutableDictionary *settings = [[NSMutableDictionary alloc] init];
- [settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:settingsPath]];
-
- if ([specifier.identifier isEqualToString:@"enabled"]) {
- [settings setObject:value forKey:@"enabled"];
- [settings writeToFile:settingsPath atomically:YES];
- } else if ([specifier.identifier isEqualToString:@"wallpaperMode"]) {
- [settings setObject:value forKey:@"wallpaperMode"];
- [settings writeToFile:settingsPath atomically:YES];
- } else if ([specifier.identifier isEqualToString:@"interwall_enabled"]) {
- [settings setObject:value forKey:@"interwall_enabled"];
- [settings writeToFile:settingsPath atomically:YES];
- } else if ([specifier.identifier isEqualToString:@"interwallTime"]) {
- [settings setObject:value forKey:@"interwallTime"];
- [settings writeToFile:settingsPath atomically:YES];
- } else if ([specifier.identifier isEqualToString:@"perspective_zoom"]) {
- [settings setObject:value forKey:@"perspective_zoom"];
- [settings writeToFile:settingsPath atomically:YES];
- } else if ([specifier.identifier isEqualToString:@"shuffle_enabled"]) {
- [settings setObject:value forKey:@"shuffle_enabled"];
- [settings writeToFile:settingsPath atomically:YES];
- } else if ([specifier.identifier isEqualToString:@"album_list"]) {
- [settings setObject:value forKey:@"albumName"];
- [settings writeToFile:settingsPath atomically:YES];
+
+ _specifiers = [NSArray arrayWithObjects:banner, firstGroup, generalSettings, secondGroup, wallmartSettings, interwallSettings, thirdGroup, twitter, github, nil];
}
-
- CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.shinvou.wallmart/reloadSettings"), NULL, NULL, TRUE);
-}
-
-- (void)populateAlbumNames
-{
- NSMutableArray *albumNames = [[NSMutableArray alloc] init];
- ALAssetsLibrary *assetsLibrary = [[ALAssetsLibrary alloc] init];
-
- [assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
- if ([group valueForProperty:ALAssetsGroupPropertyName]) {
- [albumNames addObject:[group valueForProperty:ALAssetsGroupPropertyName]];
- } else {
- _albumNames = albumNames;
-
- PSSpecifier *album_list = [PSSpecifier preferenceSpecifierNamed:@"Choose album"
- target:self
- set:@selector(setValue:forSpecifier:)
- get:@selector(getValueForSpecifier:)
- detail:[PSListItemsController class]
- cell:PSLinkListCell
- edit:Nil];
- [album_list setIdentifier:@"album_list"];
- [album_list setProperty:@(YES) forKey:@"enabled"];
- [album_list setValues:_albumNames
- titles:_albumNames
- shortTitles:_albumNames];
-
- [self insertSpecifier:album_list afterSpecifierID:@"blur_controller_link" animated:NO];
- }
- } failureBlock:^(NSError *error) {
- NSLog(@"\n\n [Wallmart Settings] Following error occured: %@", [error description]);
- }];
+ return _specifiers;
}
- (void)openTwitter
diff --git a/WallmartSettings/WallmartSettingsGeneral.mm b/WallmartSettings/WallmartSettingsGeneral.mm
new file mode 100644
index 0000000..2af72b5
--- /dev/null
+++ b/WallmartSettings/WallmartSettingsGeneral.mm
@@ -0,0 +1,66 @@
+#import
+
+#define settingsPath @"/var/mobile/Library/Preferences/com.shinvou.wallmart.plist"
+
+@interface WallmartSettingsGeneralListController : PSListController
+@end
+
+@implementation WallmartSettingsGeneralListController
+
+- (id)specifiers
+{
+ if (_specifiers == nil) {
+ [self setTitle:@"General"];
+
+ PSSpecifier *firstGroup = [PSSpecifier groupSpecifierWithName:nil];
+
+ PSSpecifier *wallmartGeneralEnabled = [PSSpecifier preferenceSpecifierNamed:@"Enabled"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:Nil
+ cell:PSSwitchCell
+ edit:Nil];
+ [wallmartGeneralEnabled setIdentifier:@"wallmartGeneralEnabled"];
+ [wallmartGeneralEnabled setProperty:@(YES) forKey:@"enabled"];
+
+ _specifiers = [NSArray arrayWithObjects:firstGroup, wallmartGeneralEnabled, nil];
+ }
+
+ return _specifiers;
+}
+
+- (id)getValueForSpecifier:(PSSpecifier *)specifier
+{
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
+
+ if ([specifier.identifier isEqualToString:@"wallmartGeneralEnabled"]) {
+ if (settings) {
+ if ([settings objectForKey:@"wallmartGeneralEnabled"]) {
+ return [settings objectForKey:@"wallmartGeneralEnabled"];
+ } else {
+ return @(YES);
+ }
+ } else {
+ return @(YES);
+ }
+ }
+
+ return nil;
+}
+
+- (void)setValue:(id)value forSpecifier:(PSSpecifier *)specifier
+{
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] init];
+ [settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:settingsPath]];
+
+ if ([specifier.identifier isEqualToString:@"wallmartGeneralEnabled"]) {
+ [settings setObject:value forKey:@"wallmartGeneralEnabled"];
+ [settings writeToFile:settingsPath atomically:YES];
+ }
+
+ CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.shinvou.wallmart/reloadWallmartSettings"), NULL, NULL, TRUE);
+ CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.shinvou.wallmart/reloadInterwallSettings"), NULL, NULL, TRUE);
+}
+
+@end
diff --git a/WallmartSettings/WallmartSettingsInterwall.mm b/WallmartSettings/WallmartSettingsInterwall.mm
new file mode 100644
index 0000000..e9657cb
--- /dev/null
+++ b/WallmartSettings/WallmartSettingsInterwall.mm
@@ -0,0 +1,291 @@
+#import "WallmartSettingsInterwallMoments.mm"
+#import "WallmartSettingsInterwallBlur.mm"
+
+#import
+#import
+
+#define settingsPath @"/var/mobile/Library/Preferences/com.shinvou.wallmart.plist"
+
+@interface WallmartSettingsInterwallListController : PSListController
+@end
+
+@implementation WallmartSettingsInterwallListController
+
+- (id)specifiers
+{
+ if (_specifiers == nil) {
+ [self setTitle:@"Interwall and moments"];
+
+ PSSpecifier *firstGroup = [PSSpecifier groupSpecifierWithName:@"Interwall"];
+ [firstGroup setProperty:@"Default interval is 60 seconds.\n\n'Interwall' is used for time periods." forKey:@"footerText"];
+
+ PSSpecifier *interwallEnabled = [PSSpecifier preferenceSpecifierNamed:@"Interwall enabled"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:Nil
+ cell:PSSwitchCell
+ edit:Nil];
+ [interwallEnabled setIdentifier:@"interwallEnabled"];
+ [interwallEnabled setProperty:@(YES) forKey:@"enabled"];
+
+ PSTextFieldSpecifier *interwallTime = [PSTextFieldSpecifier preferenceSpecifierNamed:nil
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:Nil
+ cell:PSEditTextCell
+ edit:Nil];
+ [interwallTime setPlaceholder:@"Enter interval in seconds ..."];
+ [interwallTime setIdentifier:@"interwallTime"];
+ [interwallTime setProperty:@(YES) forKey:@"enabled"];
+
+ PSSpecifier *secondGroup = [PSSpecifier groupSpecifierWithName:@"Moments"];
+ [secondGroup setProperty:@"'Moments' is used for specific moments in time." forKey:@"footerText"];
+
+ PSSpecifier *interwallMomentsEnabled = [PSSpecifier preferenceSpecifierNamed:@"Moments enabled"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:Nil
+ cell:PSSwitchCell
+ edit:Nil];
+ [interwallMomentsEnabled setIdentifier:@"interwallMomentsEnabled"];
+ [interwallMomentsEnabled setProperty:@(YES) forKey:@"enabled"];
+
+ PSSpecifier *interwallMoments = [PSSpecifier preferenceSpecifierNamed:nil
+ target:self
+ set:NULL
+ get:NULL
+ detail:[WallmartSettingsInterwallMomentsListController class]
+ cell:PSLinkCell
+ edit:Nil];
+ interwallMoments.name = @"Set moments";
+ [interwallMoments setIdentifier:@"interwallMoments"];
+ [interwallMoments setProperty:@(YES) forKey:@"enabled"];
+
+ PSSpecifier *thirdGroup = [PSSpecifier groupSpecifierWithName:@"A priori"];
+
+ PSSpecifier *wallpaperModeInterwall = [PSSpecifier preferenceSpecifierNamed:@"Mode"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:[PSListItemsController class]
+ cell:PSLinkListCell
+ edit:Nil];
+ [wallpaperModeInterwall setIdentifier:@"wallpaperModeInterwall"];
+ [wallpaperModeInterwall setProperty:@(YES) forKey:@"enabled"];
+ [wallpaperModeInterwall setValues:@[@(0), @(2), @(1)]
+ titles:@[@"Lockscreen and homescreen", @"Lockscreen only", @"Homescreen only"]
+ shortTitles:@[@"Lockscreen and homescreen", @"Lockscreen only", @"Homescreen only"]];
+
+ PSSpecifier *blurSettingsInterwall = [PSSpecifier preferenceSpecifierNamed:nil
+ target:self
+ set:NULL
+ get:NULL
+ detail:[WallmartSettingsInterwallBlurListController class]
+ cell:PSLinkCell
+ edit:Nil];
+ blurSettingsInterwall.name = @"Blur settings";
+ [blurSettingsInterwall setIdentifier:@"blurSettingsInterwall"];
+ [blurSettingsInterwall setProperty:@(YES) forKey:@"enabled"];
+
+ PSSpecifier *perspectiveZoomInterwall = [PSSpecifier preferenceSpecifierNamed:@"Perspective zoom"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:Nil
+ cell:PSSwitchCell
+ edit:Nil];
+ [perspectiveZoomInterwall setIdentifier:@"perspectiveZoomInterwall"];
+ [perspectiveZoomInterwall setProperty:@(YES) forKey:@"enabled"];
+
+ PSSpecifier *shuffleInterwall = [PSSpecifier preferenceSpecifierNamed:@"Shuffle wallpapers"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:Nil
+ cell:PSSwitchCell
+ edit:Nil];
+ [shuffleInterwall setIdentifier:@"shuffleInterwall"];
+ [shuffleInterwall setProperty:@(YES) forKey:@"enabled"];
+
+ PSSpecifier *fourthGroup = [PSSpecifier groupSpecifierWithName:@"Photo albums"];
+ [fourthGroup setIdentifier:@"fourthGroup"];
+ [self doPhotoAlbumStuff];
+
+ _specifiers = [NSArray arrayWithObjects:firstGroup, interwallEnabled, interwallTime, secondGroup, interwallMomentsEnabled, interwallMoments, thirdGroup, wallpaperModeInterwall, blurSettingsInterwall, perspectiveZoomInterwall, shuffleInterwall, fourthGroup, nil];
+ }
+
+ return _specifiers;
+}
+
+- (id)getValueForSpecifier:(PSSpecifier *)specifier
+{
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
+
+ if ([specifier.identifier isEqualToString:@"interwallEnabled"]) {
+ if (settings) {
+ if ([settings objectForKey:@"interwallEnabled"]) {
+ return [settings objectForKey:@"interwallEnabled"];
+ } else {
+ return @(NO);
+ }
+ } else {
+ return @(NO);
+ }
+ } else if ([specifier.identifier isEqualToString:@"interwallTime"]) {
+ if (settings) {
+ if ([settings objectForKey:@"interwallTime"]) {
+ return [settings objectForKey:@"interwallTime"];
+ } else {
+ return nil;
+ }
+ } else {
+ return nil;
+ }
+ } else if ([specifier.identifier isEqualToString:@"interwallMomentsEnabled"]) {
+ if (settings) {
+ if ([settings objectForKey:@"interwallMomentsEnabled"]) {
+ return [settings objectForKey:@"interwallMomentsEnabled"];
+ } else {
+ return @(NO);
+ }
+ } else {
+ return @(NO);
+ }
+ } else if ([specifier.identifier isEqualToString:@"wallpaperModeInterwall"]) {
+ if (settings) {
+ if ([settings objectForKey:@"wallpaperModeInterwall"]) {
+ return [settings objectForKey:@"wallpaperModeInterwall"];
+ } else {
+ return @(0);
+ }
+ } else {
+ return @(0);
+ }
+ } else if ([specifier.identifier isEqualToString:@"perspectiveZoomInterwall"]) {
+ if (settings) {
+ if ([settings objectForKey:@"perspectiveZoomInterwall"]) {
+ return [settings objectForKey:@"perspectiveZoomInterwall"];
+ } else {
+ return @(YES);
+ }
+ } else {
+ return @(YES);
+ }
+ } else if ([specifier.identifier isEqualToString:@"shuffleInterwall"]) {
+ if (settings) {
+ if ([settings objectForKey:@"shuffleInterwall"]) {
+ return [settings objectForKey:@"shuffleInterwall"];
+ } else {
+ return @(NO);
+ }
+ } else {
+ return @(NO);
+ }
+ } else if ([specifier.identifier isEqualToString:@"albumNamesLockscreenInterwall"]) {
+ if (settings) {
+ if ([settings objectForKey:@"albumNameLockscreenInterwall"]) {
+ return [settings objectForKey:@"albumNameLockscreenInterwall"];
+ } else {
+ return nil;
+ }
+ } else {
+ return nil;
+ }
+ } else if ([specifier.identifier isEqualToString:@"albumNamesHomescreenInterwall"]) {
+ if (settings) {
+ if ([settings objectForKey:@"albumNameHomescreenInterwall"]) {
+ return [settings objectForKey:@"albumNameHomescreenInterwall"];
+ } else {
+ return nil;
+ }
+ } else {
+ return nil;
+ }
+ }
+
+ return nil;
+}
+
+- (void)setValue:(id)value forSpecifier:(PSSpecifier *)specifier
+{
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] init];
+ [settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:settingsPath]];
+
+ if ([specifier.identifier isEqualToString:@"interwallEnabled"]) {
+ [settings setObject:value forKey:@"interwallEnabled"];
+ [settings writeToFile:settingsPath atomically:YES];
+ } else if ([specifier.identifier isEqualToString:@"interwallTime"]) {
+ [settings setObject:value forKey:@"interwallTime"];
+ [settings writeToFile:settingsPath atomically:YES];
+ } else if ([specifier.identifier isEqualToString:@"interwallMomentsEnabled"]) {
+ [settings setObject:value forKey:@"interwallMomentsEnabled"];
+ [settings writeToFile:settingsPath atomically:YES];
+ } else if ([specifier.identifier isEqualToString:@"wallpaperModeInterwall"]) {
+ [settings setObject:value forKey:@"wallpaperModeInterwall"];
+ [settings writeToFile:settingsPath atomically:YES];
+ } else if ([specifier.identifier isEqualToString:@"perspectiveZoomInterwall"]) {
+ [settings setObject:value forKey:@"perspectiveZoomInterwall"];
+ [settings writeToFile:settingsPath atomically:YES];
+ } else if ([specifier.identifier isEqualToString:@"shuffleInterwall"]) {
+ [settings setObject:value forKey:@"shuffleInterwall"];
+ [settings writeToFile:settingsPath atomically:YES];
+ } else if ([specifier.identifier isEqualToString:@"albumNamesLockscreenInterwall"]) {
+ [settings setObject:value forKey:@"albumNameLockscreenInterwall"];
+ [settings writeToFile:settingsPath atomically:YES];
+ } else if ([specifier.identifier isEqualToString:@"albumNamesHomescreenInterwall"]) {
+ [settings setObject:value forKey:@"albumNameHomescreenInterwall"];
+ [settings writeToFile:settingsPath atomically:YES];
+ }
+
+ CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.shinvou.wallmart/reloadInterwallSettings"), NULL, NULL, TRUE);
+}
+
+- (void)doPhotoAlbumStuff
+{
+ NSMutableArray *albumNames = [[NSMutableArray alloc] init];
+
+ ALAssetsLibrary *assetsLibrary = [[ALAssetsLibrary alloc] init];
+
+ [assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
+ if ([group valueForProperty:ALAssetsGroupPropertyName]) {
+ [albumNames insertObject:[group valueForProperty:ALAssetsGroupPropertyName] atIndex:0];
+ } else {
+ PSSpecifier *albumNamesLockscreenInterwall = [PSSpecifier preferenceSpecifierNamed:@"Lockscreen"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:[PSListItemsController class]
+ cell:PSLinkListCell
+ edit:Nil];
+ [albumNamesLockscreenInterwall setIdentifier:@"albumNamesLockscreenInterwall"];
+ [albumNamesLockscreenInterwall setProperty:@(YES) forKey:@"enabled"];
+ [albumNamesLockscreenInterwall setValues:albumNames
+ titles:albumNames
+ shortTitles:albumNames];
+
+ [self insertSpecifier:albumNamesLockscreenInterwall afterSpecifierID:@"fourthGroup" animated:NO];
+
+ PSSpecifier *albumNamesHomescreenInterwall = [PSSpecifier preferenceSpecifierNamed:@"Homescreen"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:[PSListItemsController class]
+ cell:PSLinkListCell
+ edit:Nil];
+ [albumNamesHomescreenInterwall setIdentifier:@"albumNamesHomescreenInterwall"];
+ [albumNamesHomescreenInterwall setProperty:@(YES) forKey:@"enabled"];
+ [albumNamesHomescreenInterwall setValues:albumNames
+ titles:albumNames
+ shortTitles:albumNames];
+
+ [self insertSpecifier:albumNamesHomescreenInterwall afterSpecifierID:@"albumNamesLockscreenInterwall" animated:NO];
+ }
+ } failureBlock:^(NSError *error) {
+ NSLog(@"\n\n [Wallmart Settings] Following error occured: %@", [error description]);
+ }];
+}
+
+@end
diff --git a/WallmartSettings/WallmartSettingsInterwallBlur.mm b/WallmartSettings/WallmartSettingsInterwallBlur.mm
new file mode 100644
index 0000000..45d0bea
--- /dev/null
+++ b/WallmartSettings/WallmartSettingsInterwallBlur.mm
@@ -0,0 +1,122 @@
+#import
+
+#define settingsPath @"/var/mobile/Library/Preferences/com.shinvou.wallmart.plist"
+
+@interface WallmartSettingsInterwallBlurListController : PSListController
+@end
+
+@implementation WallmartSettingsInterwallBlurListController
+
+- (id)specifiers
+{
+ if (_specifiers == nil) {
+ [self setTitle:@"Blur settings"];
+
+ PSSpecifier *firstGroup = [PSSpecifier groupSpecifierWithName:nil];
+ [firstGroup setProperty:@"Blur affects the performance, it is possible that switching the wallpaper takes longer." forKey:@"footerText"];
+
+ PSSpecifier *blurEnabledInterwall = [PSSpecifier preferenceSpecifierNamed:@"Blur enabled"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:Nil
+ cell:PSSwitchCell
+ edit:Nil];
+ [blurEnabledInterwall setIdentifier:@"blurEnabledInterwall"];
+ [blurEnabledInterwall setProperty:@(YES) forKey:@"enabled"];
+
+ PSSpecifier *secondGroup = [PSSpecifier groupSpecifierWithName:@"MC BLURRY WITH SMARTIES"];
+ [secondGroup setProperty:@"These settings respect the wallpaper mode settings." forKey:@"footerText"];
+
+ PSSpecifier *blurStrengthInterwall = [PSSpecifier preferenceSpecifierNamed:nil
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:Nil
+ cell:PSSliderCell
+ edit:Nil];
+ [blurStrengthInterwall setIdentifier:@"blurStrengthInterwall"];
+ [blurStrengthInterwall setProperty:@(YES) forKey:@"enabled"];
+
+ [blurStrengthInterwall setProperty:@(0) forKey:@"min"];
+ [blurStrengthInterwall setProperty:@(40) forKey:@"max"];
+ [blurStrengthInterwall setProperty:@(NO) forKey:@"showValue"];
+
+ PSSpecifier *blurModeInterwall = [PSSpecifier preferenceSpecifierNamed:@"Blur mode"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:[PSListItemsController class]
+ cell:PSLinkListCell
+ edit:Nil];
+ [blurModeInterwall setIdentifier:@"blurModeInterwall"];
+ [blurModeInterwall setProperty:@(YES) forKey:@"enabled"];
+ [blurModeInterwall setValues:@[@(0), @(2), @(1)]
+ titles:@[@"Blur lockscreen and homescreen", @"Blur lockscreen only", @"Blur homescreen only"]
+ shortTitles:@[@"Blur lockscreen and homescreen", @"Blur lockscreen only", @"Blur homescreen only"]];
+
+ _specifiers = [NSArray arrayWithObjects:firstGroup, blurEnabledInterwall, secondGroup, blurStrengthInterwall, blurModeInterwall, nil];
+ }
+
+ return _specifiers;
+}
+
+- (id)getValueForSpecifier:(PSSpecifier *)specifier
+{
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
+
+ if ([specifier.identifier isEqualToString:@"blurEnabledInterwall"]) {
+ if (settings) {
+ if ([settings objectForKey:@"blurEnabledInterwall"]) {
+ return [settings objectForKey:@"blurEnabledInterwall"];
+ } else {
+ return @(NO);
+ }
+ } else {
+ return @(NO);
+ }
+ } else if ([specifier.identifier isEqualToString:@"blurStrengthInterwall"]) {
+ if (settings) {
+ if ([settings objectForKey:@"blurStrengthInterwall"]) {
+ return [settings objectForKey:@"blurStrengthInterwall"];
+ } else {
+ return @(5);
+ }
+ } else {
+ return @(5);
+ }
+ } else if ([specifier.identifier isEqualToString:@"blurModeInterwall"]) {
+ if (settings) {
+ if ([settings objectForKey:@"blurModeInterwall"]) {
+ return [settings objectForKey:@"blurModeInterwall"];
+ } else {
+ return @(0);
+ }
+ } else {
+ return @(0);
+ }
+ }
+
+ return nil;
+}
+
+- (void)setValue:(id)value forSpecifier:(PSSpecifier *)specifier
+{
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] init];
+ [settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:settingsPath]];
+
+ if ([specifier.identifier isEqualToString:@"blurEnabledInterwall"]) {
+ [settings setObject:value forKey:@"blurEnabledInterwall"];
+ [settings writeToFile:settingsPath atomically:YES];
+ } else if ([specifier.identifier isEqualToString:@"blurStrengthInterwall"]) {
+ [settings setObject:value forKey:@"blurStrengthInterwall"];
+ [settings writeToFile:settingsPath atomically:YES];
+ } else if ([specifier.identifier isEqualToString:@"blurModeInterwall"]) {
+ [settings setObject:value forKey:@"blurModeInterwall"];
+ [settings writeToFile:settingsPath atomically:YES];
+ }
+
+ CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.shinvou.wallmart/reloadInterwallSettings"), NULL, NULL, TRUE);
+}
+
+@end
diff --git a/WallmartSettings/WallmartSettingsInterwallMoments.mm b/WallmartSettings/WallmartSettingsInterwallMoments.mm
new file mode 100644
index 0000000..083ea73
--- /dev/null
+++ b/WallmartSettings/WallmartSettingsInterwallMoments.mm
@@ -0,0 +1,101 @@
+#import "WallmartSettingsInterwallMomentsAdd.mm"
+
+#import
+
+#define settingsPath @"/var/mobile/Library/Preferences/com.shinvou.wallmart.plist"
+
+@interface WallmartSettingsInterwallMomentsListController : PSEditableListController
+@end
+
+@implementation WallmartSettingsInterwallMomentsListController
+
+- (void)viewWillAppear:(BOOL)animated
+{
+ [super viewWillAppear:animated];
+
+ [self reloadSpecifiers];
+}
+
+- (id)specifiers
+{
+ if (_specifiers == nil) {
+ NSMutableArray *specifiers = [[NSMutableArray alloc] init];
+
+ [self setTitle:@"Moments"];
+
+ PSSpecifier *firstGroup = [PSSpecifier groupSpecifierWithName:nil];
+ [firstGroup setProperty:@"Below are the moments when your wallpaper/wallpapers change." forKey:@"footerText"];
+ [specifiers addObject:firstGroup];
+
+ PSSpecifier *addMoment = [PSSpecifier preferenceSpecifierNamed:nil
+ target:self
+ set:NULL
+ get:NULL
+ detail:[WallmartSettingsInterwallMomentsAddListController class]
+ cell:PSLinkCell
+ edit:Nil];
+ addMoment.name = @"Add moment";
+ [addMoment setProperty:@(YES) forKey:@"enabled"];
+ [specifiers addObject:addMoment];
+
+ PSSpecifier *secondGroup = [PSSpecifier groupSpecifierWithName:nil];
+ [specifiers addObject:secondGroup];
+
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
+
+ if (settings) {
+ if ([settings objectForKey:@"moments"]) {
+ NSMutableArray *momentsArray = [[NSMutableArray alloc] init];
+ [momentsArray addObjectsFromArray:[settings objectForKey:@"moments"]];
+
+ for (int i = 0; i < [momentsArray count]; i++) {
+ PSSpecifier *moment = [PSSpecifier preferenceSpecifierNamed:[NSString stringWithFormat:@"%@", momentsArray[i]]
+ target:self
+ set:NULL
+ get:NULL
+ detail:Nil
+ cell:PSTitleValueCell
+ edit:Nil];
+ [moment setIdentifier:[NSString stringWithFormat:@"%@", momentsArray[i]]];
+ [moment setProperty:@(YES) forKey:@"enabled"];
+ [specifiers addObject:moment];
+ }
+ }
+ }
+
+ _specifiers = specifiers;
+ }
+
+ return _specifiers;
+}
+
+- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ if (indexPath.section == 0) {
+ return UITableViewCellEditingStyleNone;
+ }
+
+ return UITableViewCellEditingStyleDelete;
+}
+
+- (void)removeSpecifier:(PSSpecifier *)specifier animated:(BOOL)animated
+{
+ [super removeSpecifier:specifier animated:animated];
+
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] init];
+ [settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:settingsPath]];
+
+ NSMutableArray *momentsArray = [[NSMutableArray alloc] init];
+ [momentsArray addObjectsFromArray:[settings objectForKey:@"moments"]];
+
+ for (int i = 0; i < [momentsArray count]; i++) {
+ if ([momentsArray[i] isEqualToString:specifier.identifier]) {
+ [momentsArray removeObjectAtIndex:i];
+ }
+ }
+
+ [settings setObject:momentsArray forKey:@"moments"];
+ [settings writeToFile:settingsPath atomically:YES];
+}
+
+@end
diff --git a/WallmartSettings/WallmartSettingsInterwallMomentsAdd.mm b/WallmartSettings/WallmartSettingsInterwallMomentsAdd.mm
new file mode 100644
index 0000000..4842df5
--- /dev/null
+++ b/WallmartSettings/WallmartSettingsInterwallMomentsAdd.mm
@@ -0,0 +1,91 @@
+#import
+
+#define settingsPath @"/var/mobile/Library/Preferences/com.shinvou.wallmart.plist"
+
+@interface WallmartDatePicker : PSTableCell
+
+@property (strong, nonatomic) UIDatePicker *datePicker;
+
+@end
+
+@implementation WallmartDatePicker
+
+- (id)initWithStyle:(int)style reuseIdentifier:(NSString *)identifier specifier:(PSSpecifier *)specifier
+{
+ self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"wallmartDatePickerCell" specifier:specifier];
+
+ if (self) {
+ _datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, 205)];
+ _datePicker.datePickerMode = UIDatePickerModeTime;
+
+ [self addSubview:_datePicker];
+ }
+
+ return self;
+}
+
+- (void)saveDateToPreferences
+{
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] init];
+ [settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:settingsPath]];
+
+ NSMutableArray *momentsArray = [[NSMutableArray alloc] init];
+ [momentsArray addObjectsFromArray:[settings objectForKey:@"moments"]];
+
+ NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
+ [formatter setDateFormat:@"HH:mm"];
+
+ [momentsArray addObject:[formatter stringFromDate:_datePicker.date]];
+
+ [settings setObject:momentsArray forKey:@"moments"];
+ [settings writeToFile:settingsPath atomically:YES];
+
+ CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.shinvou.wallmart/reloadInterwallSettings"), NULL, NULL, TRUE);
+}
+
+@end
+
+@interface WallmartSettingsInterwallMomentsAddListController : PSListController
+@end
+
+@implementation WallmartSettingsInterwallMomentsAddListController
+
+- (void)loadView
+{
+ [super loadView];
+
+ self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(saveMomentTapped)];
+}
+
+- (id)specifiers
+{
+ if (_specifiers == nil) {
+ [self setTitle:@"Add moment"];
+
+ PSSpecifier *momentDatePicker = [PSSpecifier preferenceSpecifierNamed:nil
+ target:self
+ set:NULL
+ get:NULL
+ detail:Nil
+ cell:PSStaticTextCell
+ edit:Nil];
+ [momentDatePicker setProperty:[WallmartDatePicker class] forKey:@"cellClass"];
+ [momentDatePicker setProperty:@"205" forKey:@"height"];
+ [momentDatePicker setIdentifier:@"momentDatePicker"];
+ [momentDatePicker setProperty:@(YES) forKey:@"enabled"];
+
+ _specifiers = [NSArray arrayWithObjects:momentDatePicker, nil];
+ }
+
+ return _specifiers;
+}
+
+- (void)saveMomentTapped
+{
+ WallmartDatePicker *wallmartDatePicker = [[self specifierForID:@"momentDatePicker"] propertyForKey:@"cellObject"];
+ [wallmartDatePicker saveDateToPreferences];
+
+ [self.navigationController popViewControllerAnimated:YES];
+}
+
+@end
diff --git a/WallmartSettings/WallmartSettingsWallmart.mm b/WallmartSettings/WallmartSettingsWallmart.mm
new file mode 100644
index 0000000..7ee7a32
--- /dev/null
+++ b/WallmartSettings/WallmartSettingsWallmart.mm
@@ -0,0 +1,242 @@
+#import "WallmartSettingsWallmartBlur.mm"
+#import "WallmartSettingsWallmartCycle.mm"
+
+#import
+#import
+
+#define settingsPath @"/var/mobile/Library/Preferences/com.shinvou.wallmart.plist"
+
+@interface WallmartSettingsWallmartListController : PSListController
+@end
+
+@implementation WallmartSettingsWallmartListController
+
+- (id)specifiers
+{
+ if (_specifiers == nil) {
+ [self setTitle:@"Wallmart"];
+
+ PSSpecifier *firstGroup = [PSSpecifier groupSpecifierWithName:nil];
+
+ PSSpecifier *wallmartEnabled = [PSSpecifier preferenceSpecifierNamed:@"Enabled"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:Nil
+ cell:PSSwitchCell
+ edit:Nil];
+ [wallmartEnabled setIdentifier:@"wallmartEnabled"];
+ [wallmartEnabled setProperty:@(YES) forKey:@"enabled"];
+
+ PSSpecifier *secondGroup = [PSSpecifier groupSpecifierWithName:@"A priori"];
+
+ PSSpecifier *wallpaperModeWallmart = [PSSpecifier preferenceSpecifierNamed:@"Mode"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:[PSListItemsController class]
+ cell:PSLinkListCell
+ edit:Nil];
+ [wallpaperModeWallmart setIdentifier:@"wallpaperModeWallmart"];
+ [wallpaperModeWallmart setProperty:@(YES) forKey:@"enabled"];
+ [wallpaperModeWallmart setValues:@[@(0), @(2), @(1)]
+ titles:@[@"Lockscreen and homescreen", @"Lockscreen only", @"Homescreen only"]
+ shortTitles:@[@"Lockscreen and homescreen", @"Lockscreen only", @"Homescreen only"]];
+
+ PSSpecifier *blurSettingsWallmart = [PSSpecifier preferenceSpecifierNamed:nil
+ target:self
+ set:NULL
+ get:NULL
+ detail:[WallmartSettingsWallmartBlurListController class]
+ cell:PSLinkCell
+ edit:Nil];
+ blurSettingsWallmart.name = @"Blur settings";
+ [blurSettingsWallmart setIdentifier:@"blurSettingsWallmart"];
+ [blurSettingsWallmart setProperty:@(YES) forKey:@"enabled"];
+
+ PSSpecifier *perspectiveZoomWallmart = [PSSpecifier preferenceSpecifierNamed:@"Perspective zoom"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:Nil
+ cell:PSSwitchCell
+ edit:Nil];
+ [perspectiveZoomWallmart setIdentifier:@"perspectiveZoomWallmart"];
+ [perspectiveZoomWallmart setProperty:@(YES) forKey:@"enabled"];
+
+ PSSpecifier *shuffleWallmart = [PSSpecifier preferenceSpecifierNamed:@"Shuffle wallpapers"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:Nil
+ cell:PSSwitchCell
+ edit:Nil];
+ [shuffleWallmart setIdentifier:@"shuffleWallmart"];
+ [shuffleWallmart setProperty:@(YES) forKey:@"enabled"];
+
+ PSSpecifier *thirdGroup = [PSSpecifier groupSpecifierWithName:nil];
+
+ PSSpecifier *cycleSettingsWallmart = [PSSpecifier preferenceSpecifierNamed:nil
+ target:self
+ set:NULL
+ get:NULL
+ detail:[WallmartSettingsWallmartCycleListController class]
+ cell:PSLinkCell
+ edit:Nil];
+ cycleSettingsWallmart.name = @"Cycle settings";
+ [cycleSettingsWallmart setIdentifier:@"cycleSettingsWallmart"];
+ [cycleSettingsWallmart setProperty:@(YES) forKey:@"enabled"];
+
+ PSSpecifier *fourthGroup = [PSSpecifier groupSpecifierWithName:@"Photo albums"];
+ [fourthGroup setIdentifier:@"fourthGroup"];
+ [self doPhotoAlbumStuff];
+
+ _specifiers = [NSArray arrayWithObjects:firstGroup, wallmartEnabled, secondGroup, wallpaperModeWallmart, blurSettingsWallmart, perspectiveZoomWallmart, shuffleWallmart, thirdGroup, cycleSettingsWallmart, fourthGroup, nil];
+ }
+
+ return _specifiers;
+}
+
+- (id)getValueForSpecifier:(PSSpecifier *)specifier
+{
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
+
+ if ([specifier.identifier isEqualToString:@"wallmartEnabled"]) {
+ if (settings) {
+ if ([settings objectForKey:@"wallmartEnabled"]) {
+ return [settings objectForKey:@"wallmartEnabled"];
+ } else {
+ return @(YES);
+ }
+ } else {
+ return @(YES);
+ }
+ } else if ([specifier.identifier isEqualToString:@"wallpaperModeWallmart"]) {
+ if (settings) {
+ if ([settings objectForKey:@"wallpaperModeWallmart"]) {
+ return [settings objectForKey:@"wallpaperModeWallmart"];
+ } else {
+ return @(0);
+ }
+ } else {
+ return @(0);
+ }
+ } else if ([specifier.identifier isEqualToString:@"perspectiveZoomWallmart"]) {
+ if (settings) {
+ if ([settings objectForKey:@"perspectiveZoomWallmart"]) {
+ return [settings objectForKey:@"perspectiveZoomWallmart"];
+ } else {
+ return @(YES);
+ }
+ } else {
+ return @(YES);
+ }
+ } else if ([specifier.identifier isEqualToString:@"shuffleWallmart"]) {
+ if (settings) {
+ if ([settings objectForKey:@"shuffleWallmart"]) {
+ return [settings objectForKey:@"shuffleWallmart"];
+ } else {
+ return @(NO);
+ }
+ } else {
+ return @(NO);
+ }
+ } else if ([specifier.identifier isEqualToString:@"albumNamesLockscreenWallmart"]) {
+ if (settings) {
+ if ([settings objectForKey:@"albumNameLockscreenWallmart"]) {
+ return [settings objectForKey:@"albumNameLockscreenWallmart"];
+ } else {
+ return nil;
+ }
+ } else {
+ return nil;
+ }
+ } else if ([specifier.identifier isEqualToString:@"albumNamesHomescreenWallmart"]) {
+ if (settings) {
+ if ([settings objectForKey:@"albumNameHomescreenWallmart"]) {
+ return [settings objectForKey:@"albumNameHomescreenWallmart"];
+ } else {
+ return nil;
+ }
+ } else {
+ return nil;
+ }
+ }
+
+ return nil;
+}
+
+- (void)setValue:(id)value forSpecifier:(PSSpecifier *)specifier
+{
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] init];
+ [settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:settingsPath]];
+
+ if ([specifier.identifier isEqualToString:@"wallmartEnabled"]) {
+ [settings setObject:value forKey:@"wallmartEnabled"];
+ [settings writeToFile:settingsPath atomically:YES];
+ } else if ([specifier.identifier isEqualToString:@"wallpaperModeWallmart"]) {
+ [settings setObject:value forKey:@"wallpaperModeWallmart"];
+ [settings writeToFile:settingsPath atomically:YES];
+ } else if ([specifier.identifier isEqualToString:@"perspectiveZoomWallmart"]) {
+ [settings setObject:value forKey:@"perspectiveZoomWallmart"];
+ [settings writeToFile:settingsPath atomically:YES];
+ } else if ([specifier.identifier isEqualToString:@"shuffleWallmart"]) {
+ [settings setObject:value forKey:@"shuffleWallmart"];
+ [settings writeToFile:settingsPath atomically:YES];
+ } else if ([specifier.identifier isEqualToString:@"albumNamesLockscreenWallmart"]) {
+ [settings setObject:value forKey:@"albumNameLockscreenWallmart"];
+ [settings writeToFile:settingsPath atomically:YES];
+ } else if ([specifier.identifier isEqualToString:@"albumNamesHomescreenWallmart"]) {
+ [settings setObject:value forKey:@"albumNameHomescreenWallmart"];
+ [settings writeToFile:settingsPath atomically:YES];
+ }
+
+ CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.shinvou.wallmart/reloadWallmartSettings"), NULL, NULL, TRUE);
+}
+
+- (void)doPhotoAlbumStuff
+{
+ NSMutableArray *albumNames = [[NSMutableArray alloc] init];
+
+ ALAssetsLibrary *assetsLibrary = [[ALAssetsLibrary alloc] init];
+
+ [assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
+ if ([group valueForProperty:ALAssetsGroupPropertyName]) {
+ [albumNames insertObject:[group valueForProperty:ALAssetsGroupPropertyName] atIndex:0];
+ } else {
+ PSSpecifier *albumNamesLockscreenWallmart = [PSSpecifier preferenceSpecifierNamed:@"Lockscreen"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:[PSListItemsController class]
+ cell:PSLinkListCell
+ edit:Nil];
+ [albumNamesLockscreenWallmart setIdentifier:@"albumNamesLockscreenWallmart"];
+ [albumNamesLockscreenWallmart setProperty:@(YES) forKey:@"enabled"];
+ [albumNamesLockscreenWallmart setValues:albumNames
+ titles:albumNames
+ shortTitles:albumNames];
+
+ [self insertSpecifier:albumNamesLockscreenWallmart afterSpecifierID:@"fourthGroup" animated:NO];
+
+ PSSpecifier *albumNamesHomescreenWallmart = [PSSpecifier preferenceSpecifierNamed:@"Homescreen"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:[PSListItemsController class]
+ cell:PSLinkListCell
+ edit:Nil];
+ [albumNamesHomescreenWallmart setIdentifier:@"albumNamesHomescreenWallmart"];
+ [albumNamesHomescreenWallmart setProperty:@(YES) forKey:@"enabled"];
+ [albumNamesHomescreenWallmart setValues:albumNames
+ titles:albumNames
+ shortTitles:albumNames];
+
+ [self insertSpecifier:albumNamesHomescreenWallmart afterSpecifierID:@"albumNamesLockscreenWallmart" animated:NO];
+ }
+ } failureBlock:^(NSError *error) {
+ NSLog(@"\n\n [Wallmart Settings] Following error occured: %@", [error description]);
+ }];
+}
+
+@end
diff --git a/WallmartSettings/WallmartSettingsWallmartBlur.mm b/WallmartSettings/WallmartSettingsWallmartBlur.mm
new file mode 100644
index 0000000..e44e02f
--- /dev/null
+++ b/WallmartSettings/WallmartSettingsWallmartBlur.mm
@@ -0,0 +1,122 @@
+#import
+
+#define settingsPath @"/var/mobile/Library/Preferences/com.shinvou.wallmart.plist"
+
+@interface WallmartSettingsWallmartBlurListController : PSListController
+@end
+
+@implementation WallmartSettingsWallmartBlurListController
+
+- (id)specifiers
+{
+ if (_specifiers == nil) {
+ [self setTitle:@"Blur settings"];
+
+ PSSpecifier *firstGroup = [PSSpecifier groupSpecifierWithName:nil];
+ [firstGroup setProperty:@"Blur affects the performance, it is possible that switching the wallpaper takes longer." forKey:@"footerText"];
+
+ PSSpecifier *blurEnabledWallmart = [PSSpecifier preferenceSpecifierNamed:@"Blur enabled"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:Nil
+ cell:PSSwitchCell
+ edit:Nil];
+ [blurEnabledWallmart setIdentifier:@"blurEnabledWallmart"];
+ [blurEnabledWallmart setProperty:@(YES) forKey:@"enabled"];
+
+ PSSpecifier *secondGroup = [PSSpecifier groupSpecifierWithName:@"MC BLURRY WITH SMARTIES"];
+ [secondGroup setProperty:@"These settings respect the wallpaper mode settings." forKey:@"footerText"];
+
+ PSSpecifier *blurStrengthWallmart = [PSSpecifier preferenceSpecifierNamed:nil
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:Nil
+ cell:PSSliderCell
+ edit:Nil];
+ [blurStrengthWallmart setIdentifier:@"blurStrengthWallmart"];
+ [blurStrengthWallmart setProperty:@(YES) forKey:@"enabled"];
+
+ [blurStrengthWallmart setProperty:@(0) forKey:@"min"];
+ [blurStrengthWallmart setProperty:@(40) forKey:@"max"];
+ [blurStrengthWallmart setProperty:@(NO) forKey:@"showValue"];
+
+ PSSpecifier *blurModeWallmart = [PSSpecifier preferenceSpecifierNamed:@"Blur mode"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:[PSListItemsController class]
+ cell:PSLinkListCell
+ edit:Nil];
+ [blurModeWallmart setIdentifier:@"blurModeWallmart"];
+ [blurModeWallmart setProperty:@(YES) forKey:@"enabled"];
+ [blurModeWallmart setValues:@[@(0), @(2), @(1)]
+ titles:@[@"Blur lockscreen and homescreen", @"Blur lockscreen only", @"Blur homescreen only"]
+ shortTitles:@[@"Blur lockscreen and homescreen", @"Blur lockscreen only", @"Blur homescreen only"]];
+
+ _specifiers = [NSArray arrayWithObjects:firstGroup, blurEnabledWallmart, secondGroup, blurStrengthWallmart, blurModeWallmart, nil];
+ }
+
+ return _specifiers;
+}
+
+- (id)getValueForSpecifier:(PSSpecifier *)specifier
+{
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
+
+ if ([specifier.identifier isEqualToString:@"blurEnabledWallmart"]) {
+ if (settings) {
+ if ([settings objectForKey:@"blurEnabledWallmart"]) {
+ return [settings objectForKey:@"blurEnabledWallmart"];
+ } else {
+ return @(NO);
+ }
+ } else {
+ return @(NO);
+ }
+ } else if ([specifier.identifier isEqualToString:@"blurStrengthWallmart"]) {
+ if (settings) {
+ if ([settings objectForKey:@"blurStrengthWallmart"]) {
+ return [settings objectForKey:@"blurStrengthWallmart"];
+ } else {
+ return @(5);
+ }
+ } else {
+ return @(5);
+ }
+ } else if ([specifier.identifier isEqualToString:@"blurModeWallmart"]) {
+ if (settings) {
+ if ([settings objectForKey:@"blurModeWallmart"]) {
+ return [settings objectForKey:@"blurModeWallmart"];
+ } else {
+ return @(0);
+ }
+ } else {
+ return @(0);
+ }
+ }
+
+ return nil;
+}
+
+- (void)setValue:(id)value forSpecifier:(PSSpecifier *)specifier
+{
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] init];
+ [settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:settingsPath]];
+
+ if ([specifier.identifier isEqualToString:@"blurEnabledWallmart"]) {
+ [settings setObject:value forKey:@"blurEnabledWallmart"];
+ [settings writeToFile:settingsPath atomically:YES];
+ } else if ([specifier.identifier isEqualToString:@"blurStrengthWallmart"]) {
+ [settings setObject:value forKey:@"blurStrengthWallmart"];
+ [settings writeToFile:settingsPath atomically:YES];
+ } else if ([specifier.identifier isEqualToString:@"blurModeWallmart"]) {
+ [settings setObject:value forKey:@"blurModeWallmart"];
+ [settings writeToFile:settingsPath atomically:YES];
+ }
+
+ CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.shinvou.wallmart/reloadWallmartSettings"), NULL, NULL, TRUE);
+}
+
+@end
diff --git a/WallmartSettings/WallmartSettingsWallmartCycle.mm b/WallmartSettings/WallmartSettingsWallmartCycle.mm
new file mode 100644
index 0000000..7fd337b
--- /dev/null
+++ b/WallmartSettings/WallmartSettingsWallmartCycle.mm
@@ -0,0 +1,206 @@
+#import
+
+#define settingsPath @"/var/mobile/Library/Preferences/com.shinvou.wallmart.plist"
+
+@interface CycleDatePickerStart : PSTableCell
+
+@property (strong, nonatomic) UIDatePicker *datePicker;
+
+@end
+
+@implementation CycleDatePickerStart
+
+- (id)initWithStyle:(int)style reuseIdentifier:(NSString *)identifier specifier:(PSSpecifier *)specifier
+{
+ self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cycleDatePickerStartCell" specifier:specifier];
+
+ if (self) {
+ _datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, 205)];
+ _datePicker.datePickerMode = UIDatePickerModeTime;
+ _datePicker.date = [self getDateFromPreferences];
+
+ [_datePicker addTarget:self action:@selector(saveDateToPreferences) forControlEvents:UIControlEventValueChanged];
+
+ [self addSubview:_datePicker];
+ }
+
+ return self;
+}
+
+- (NSDate *)getDateFromPreferences
+{
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
+
+ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+ [dateFormatter setDateFormat:@"HH:mm"];
+
+ if (settings) {
+ if ([settings objectForKey:@"cycleStartTime"]) {
+ return [dateFormatter dateFromString:[settings objectForKey:@"cycleStartTime"]];
+ }
+ }
+
+ return [dateFormatter dateFromString:@"10:00"];
+}
+
+- (void)saveDateToPreferences
+{
+ NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
+ [formatter setDateFormat:@"HH:mm"];
+
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] init];
+ [settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:settingsPath]];
+ [settings setObject:[formatter stringFromDate:_datePicker.date] forKey:@"cycleStartTime"];
+ [settings writeToFile:settingsPath atomically:YES];
+
+ CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.shinvou.wallmart/reloadWallmartSettings"), NULL, NULL, TRUE);
+}
+
+@end
+
+@interface CycleDatePickerEnd : PSTableCell
+
+@property (strong, nonatomic) UIDatePicker *datePicker;
+
+@end
+
+@implementation CycleDatePickerEnd
+
+- (id)initWithStyle:(int)style reuseIdentifier:(NSString *)identifier specifier:(PSSpecifier *)specifier
+{
+ self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cycleDatePickerEndCell" specifier:specifier];
+
+ if (self) {
+ _datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, 205)];
+ _datePicker.datePickerMode = UIDatePickerModeTime;
+ _datePicker.date = [self getDateFromPreferences];
+
+ [_datePicker addTarget:self action:@selector(saveDateToPreferences) forControlEvents:UIControlEventValueChanged];
+
+ [self addSubview:_datePicker];
+ }
+
+ return self;
+}
+
+- (NSDate *)getDateFromPreferences
+{
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
+
+ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+ [dateFormatter setDateFormat:@"HH:mm"];
+
+ if (settings) {
+ if ([settings objectForKey:@"cycleEndTime"]) {
+ return [dateFormatter dateFromString:[settings objectForKey:@"cycleEndTime"]];
+ }
+ }
+
+ return [dateFormatter dateFromString:@"20:00"];
+}
+
+- (void)saveDateToPreferences
+{
+ NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
+ [formatter setDateFormat:@"HH:mm"];
+
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] init];
+ [settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:settingsPath]];
+ [settings setObject:[formatter stringFromDate:_datePicker.date] forKey:@"cycleEndTime"];
+ [settings writeToFile:settingsPath atomically:YES];
+
+ CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.shinvou.wallmart/reloadWallmartSettings"), NULL, NULL, TRUE);
+}
+
+@end
+
+@interface WallmartSettingsWallmartCycleListController : PSListController
+@end
+
+@implementation WallmartSettingsWallmartCycleListController
+
+- (id)specifiers
+{
+ if (_specifiers == nil) {
+ [self setTitle:@"Cycle settings"];
+
+ PSSpecifier *firstGroup = [PSSpecifier groupSpecifierWithName:nil];
+ [firstGroup setProperty:@"With cycle enabled the wallpaper/wallpapers only change between START TIME and END TIME." forKey:@"footerText"];
+
+ PSSpecifier *cycleEnabledWallmart = [PSSpecifier preferenceSpecifierNamed:@"Cycle enabled"
+ target:self
+ set:@selector(setValue:forSpecifier:)
+ get:@selector(getValueForSpecifier:)
+ detail:Nil
+ cell:PSSwitchCell
+ edit:Nil];
+ [cycleEnabledWallmart setIdentifier:@"cycleEnabledWallmart"];
+ [cycleEnabledWallmart setProperty:@(YES) forKey:@"enabled"];
+
+ PSSpecifier *secondGroup = [PSSpecifier groupSpecifierWithName:@"START TIME"];
+
+ PSSpecifier *cycleDatePickerStart = [PSSpecifier preferenceSpecifierNamed:nil
+ target:self
+ set:NULL
+ get:NULL
+ detail:Nil
+ cell:PSStaticTextCell
+ edit:Nil];
+ [cycleDatePickerStart setProperty:[CycleDatePickerStart class] forKey:@"cellClass"];
+ [cycleDatePickerStart setProperty:@"205" forKey:@"height"];
+ [cycleDatePickerStart setIdentifier:@"cycleDatePickerStart"];
+ [cycleDatePickerStart setProperty:@(YES) forKey:@"enabled"];
+
+ PSSpecifier *thirdGroup = [PSSpecifier groupSpecifierWithName:@"END TIME"];
+
+ PSSpecifier *cycleDatePickerEnd = [PSSpecifier preferenceSpecifierNamed:nil
+ target:self
+ set:NULL
+ get:NULL
+ detail:Nil
+ cell:PSStaticTextCell
+ edit:Nil];
+ [cycleDatePickerEnd setProperty:[CycleDatePickerEnd class] forKey:@"cellClass"];
+ [cycleDatePickerEnd setProperty:@"205" forKey:@"height"];
+ [cycleDatePickerEnd setIdentifier:@"cycleDatePickerEnd"];
+ [cycleDatePickerEnd setProperty:@(YES) forKey:@"enabled"];
+
+ _specifiers = [NSArray arrayWithObjects:firstGroup, cycleEnabledWallmart, secondGroup, cycleDatePickerStart, thirdGroup, cycleDatePickerEnd, nil];
+ }
+
+ return _specifiers;
+}
+
+- (id)getValueForSpecifier:(PSSpecifier *)specifier
+{
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
+
+ if ([specifier.identifier isEqualToString:@"cycleEnabledWallmart"]) {
+ if (settings) {
+ if ([settings objectForKey:@"cycleEnabledWallmart"]) {
+ return [settings objectForKey:@"cycleEnabledWallmart"];
+ } else {
+ return @(NO);
+ }
+ } else {
+ return @(NO);
+ }
+ }
+
+ return nil;
+}
+
+- (void)setValue:(id)value forSpecifier:(PSSpecifier *)specifier
+{
+ NSMutableDictionary *settings = [[NSMutableDictionary alloc] init];
+ [settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:settingsPath]];
+
+ if ([specifier.identifier isEqualToString:@"cycleEnabledWallmart"]) {
+ [settings setObject:value forKey:@"cycleEnabledWallmart"];
+ [settings writeToFile:settingsPath atomically:YES];
+ }
+
+ CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.shinvou.wallmart/reloadWallmartSettings"), NULL, NULL, TRUE);
+}
+
+@end
diff --git a/WallmartSettings/obj/WallmartSettings.bundle/WallmartSettings b/WallmartSettings/obj/WallmartSettings.bundle/WallmartSettings
index 8a8e807..4f75c04 100755
Binary files a/WallmartSettings/obj/WallmartSettings.bundle/WallmartSettings and b/WallmartSettings/obj/WallmartSettings.bundle/WallmartSettings differ
diff --git a/WallmartSettings/obj/WallmartSettings.bundle/WallmartSettings@2x.png b/WallmartSettings/obj/WallmartSettings.bundle/WallmartSettings@2x.png
index 63592bf..13c4774 100644
Binary files a/WallmartSettings/obj/WallmartSettings.bundle/WallmartSettings@2x.png and b/WallmartSettings/obj/WallmartSettings.bundle/WallmartSettings@2x.png differ
diff --git a/WallmartSettings/obj/WallmartSettings.bundle/WallmartSettings@3x.png b/WallmartSettings/obj/WallmartSettings.bundle/WallmartSettings@3x.png
index f8683d5..a1886f4 100644
Binary files a/WallmartSettings/obj/WallmartSettings.bundle/WallmartSettings@3x.png and b/WallmartSettings/obj/WallmartSettings.bundle/WallmartSettings@3x.png differ
diff --git a/WallmartSettings/obj/WallmartSettings.mm.64c3325b.o b/WallmartSettings/obj/WallmartSettings.mm.64c3325b.o
new file mode 100644
index 0000000..cefa90b
Binary files /dev/null and b/WallmartSettings/obj/WallmartSettings.mm.64c3325b.o differ
diff --git a/WallmartSettings/obj/WallmartSettings.mm.7d079acb.o b/WallmartSettings/obj/WallmartSettings.mm.7d079acb.o
deleted file mode 100644
index 97b9aa0..0000000
Binary files a/WallmartSettings/obj/WallmartSettings.mm.7d079acb.o and /dev/null differ
diff --git a/_/DEBIAN/control b/_/DEBIAN/control
index ac3f1f1..cd7bbdf 100644
--- a/_/DEBIAN/control
+++ b/_/DEBIAN/control
@@ -5,5 +5,5 @@ Architecture: iphoneos-arm
Description: Wallmart
Author: Timm Kandziora
Section: Tweaks
-Version: 1.8-1
-Installed-Size: 644
+Version: 2.0-1
+Installed-Size: 576
diff --git a/_/Library/Activator/Listeners/com.shinvou.wallmartevent/Info.plist b/_/Library/Activator/Listeners/com.shinvou.wallmartevent/Info.plist
deleted file mode 100755
index 3ef20a0..0000000
--- a/_/Library/Activator/Listeners/com.shinvou.wallmartevent/Info.plist
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
- description
- Switch your wallpaper
- title
- Wallmart
- compatible-modes
-
- springboard
- application
-
-
-
diff --git a/_/Library/MobileSubstrate/DynamicLibraries/Wallmart.dylib b/_/Library/MobileSubstrate/DynamicLibraries/Wallmart.dylib
index 70cd955..e9a4c8c 100755
Binary files a/_/Library/MobileSubstrate/DynamicLibraries/Wallmart.dylib and b/_/Library/MobileSubstrate/DynamicLibraries/Wallmart.dylib differ
diff --git a/_/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings b/_/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings
index 8a8e807..4f75c04 100755
Binary files a/_/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings and b/_/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings differ
diff --git a/_/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings@2x.png b/_/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings@2x.png
index 63592bf..13c4774 100644
Binary files a/_/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings@2x.png and b/_/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings@2x.png differ
diff --git a/_/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings@3x.png b/_/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings@3x.png
index f8683d5..a1886f4 100644
Binary files a/_/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings@3x.png and b/_/Library/PreferenceBundles/WallmartSettings.bundle/WallmartSettings@3x.png differ
diff --git a/control b/control
index 7d32cfd..dd3b8d0 100644
--- a/control
+++ b/control
@@ -1,7 +1,7 @@
Package: com.shinvou.Wallmart
Name: Wallmart
Depends: mobilesubstrate
-Version: 1.8
+Version: 2.0
Architecture: iphoneos-arm
Description: Wallmart
Author: Timm Kandziora
diff --git a/deb/com.shinvou.Wallmart_1.8-1_iphoneos-arm.deb b/deb/com.shinvou.Wallmart_1.8-1_iphoneos-arm.deb
deleted file mode 100644
index 7acf78f..0000000
Binary files a/deb/com.shinvou.Wallmart_1.8-1_iphoneos-arm.deb and /dev/null differ
diff --git a/deb/com.shinvou.Wallmart_2.0-1_iphoneos-arm.deb b/deb/com.shinvou.Wallmart_2.0-1_iphoneos-arm.deb
new file mode 100644
index 0000000..33144af
Binary files /dev/null and b/deb/com.shinvou.Wallmart_2.0-1_iphoneos-arm.deb differ
diff --git a/obj/Interwall.xm.9b2fdb67.o b/obj/Interwall.xm.9b2fdb67.o
new file mode 100644
index 0000000..e386807
Binary files /dev/null and b/obj/Interwall.xm.9b2fdb67.o differ
diff --git a/obj/Tweak.xm.51ec5270.o b/obj/Tweak.xm.51ec5270.o
deleted file mode 100644
index f025b71..0000000
Binary files a/obj/Tweak.xm.51ec5270.o and /dev/null differ
diff --git a/obj/Wallmart.dylib b/obj/Wallmart.dylib
index 70cd955..e9a4c8c 100755
Binary files a/obj/Wallmart.dylib and b/obj/Wallmart.dylib differ
diff --git a/obj/Wallmart.xm.9b2fdb67.o b/obj/Wallmart.xm.9b2fdb67.o
new file mode 100644
index 0000000..0e60063
Binary files /dev/null and b/obj/Wallmart.xm.9b2fdb67.o differ
diff --git a/obj/WallmartEvent.xm.51ec5270.o b/obj/WallmartEvent.xm.51ec5270.o
deleted file mode 100644
index 0b3382b..0000000
Binary files a/obj/WallmartEvent.xm.51ec5270.o and /dev/null differ
diff --git a/obj/WallmartEvents.xm.9b2fdb67.o b/obj/WallmartEvents.xm.9b2fdb67.o
new file mode 100644
index 0000000..14a0ad4
Binary files /dev/null and b/obj/WallmartEvents.xm.9b2fdb67.o differ