123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- // --------------------------------------------------------------------------------
- // The MIT License (MIT)
- //
- // Copyright (c) 2014 Shiny Development
- //
- // Permission is hereby granted, free of charge, to any person obtaining a copy
- // of this software and associated documentation files (the "Software"), to deal
- // in the Software without restriction, including without limitation the rights
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- // copies of the Software, and to permit persons to whom the Software is
- // furnished to do so, subject to the following conditions:
- //
- // The above copyright notice and this permission notice shall be included in all
- // copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- // SOFTWARE.
- // --------------------------------------------------------------------------------
- #import <UIKit/UIKit.h>
- #import "SDStatusBarOverriderPre8_3.h"
- /* Generated by RuntimeBrowser.
- Image: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/UIKit.framework/UIKit
- */
- typedef struct {
- char boolitemIsEnabled[25];
- char timeString[64];
- int gsmSignalStrengthRaw;
- int gsmSignalStrengthBars;
- char serviceString[100];
- char serviceCrossfadeString[100];
- char serviceImages[2][100];
- char operatorDirectory[1024];
- unsigned int serviceContentType;
- int wifiSignalStrengthRaw;
- int wifiSignalStrengthBars;
- unsigned int dataNetworkType;
- int batteryCapacity;
- unsigned int batteryState;
- char batteryDetailString[150];
- int bluetoothBatteryCapacity;
- int thermalColor;
- unsigned int thermalSunlightMode : 1;
- unsigned int slowActivity : 1;
- unsigned int syncActivity : 1;
- BOOL activityDisplayId[256];
- unsigned int bluetoothConnected : 1;
- unsigned int displayRawGSMSignal : 1;
- unsigned int displayRawWifiSignal : 1;
- unsigned int locationIconType : 1;
- unsigned int quietModeInactive : 1;
- unsigned int tetheringConnectionCount;
- } StatusBarRawData;
- typedef struct {
- char booloverrideItemIsEnabled[25];
- unsigned int overrideTimeString : 1;
- unsigned int overrideGsmSignalStrengthRaw : 1;
- unsigned int overrideGsmSignalStrengthBars : 1;
- unsigned int overrideServiceString : 1;
- unsigned int overrideServiceImages : 2;
- unsigned int overrideOperatorDirectory : 1;
- unsigned int overrideServiceContentType : 1;
- unsigned int overrideWifiSignalStrengthRaw : 1;
- unsigned int overrideWifiSignalStrengthBars : 1;
- unsigned int overrideDataNetworkType : 1;
- unsigned int disallowsCellularDataNetworkTypes : 1;
- unsigned int overrideBatteryCapacity : 1;
- unsigned int overrideBatteryState : 1;
- unsigned int overrideBatteryDetailString : 1;
- unsigned int overrideBluetoothBatteryCapacity : 1;
- unsigned int overrideThermalColor : 1;
- unsigned int overrideSlowActivity : 1;
- unsigned int overrideActivityDisplayId : 1;
- unsigned int overrideBluetoothConnected : 1;
- unsigned int overrideDisplayRawGSMSignal : 1;
- unsigned int overrideDisplayRawWifiSignal : 1;
- StatusBarRawData values;
- } StatusBarOverrideData;
- @class UIStatusBarServerClient;
- @interface UIStatusBarServer : NSObject {
- UIStatusBarServerClient *_statusBar;
- struct __CFRunLoopSource { } *_source;
- }
- @property(retain) UIStatusBarServerClient * statusBar;
- + (unsigned int)_serverPort;
- + (void)runServer;
- + (id)getDoubleHeightStatusStringForStyle:(long long)arg1;
- + (bool)getGlowAnimationStateForStyle:(long long)arg1;
- + (int)getStyleOverrides;
- + (StatusBarOverrideData *)getStatusBarOverrideData;
- + (const StatusBarRawData*)getStatusBarData;
- + (void)permanentizeStatusBarOverrideData;
- + (void)postStatusBarOverrideData:(StatusBarOverrideData*)arg1;
- + (void)postStatusBarData:(const StatusBarRawData*)arg1 withActions:(int)arg2;
- + (unsigned int)_publisherPort;
- + (double)getGlowAnimationEndTimeForStyle:(long long)arg1;
- + (void)removeStatusBarItem:(int)arg1;
- + (void)addStatusBarItem:(int)arg1;
- + (void)postDoubleHeightStatusString:(id)arg1 forStyle:(long long)arg2;
- + (void)postGlowAnimationState:(bool)arg1 forStyle:(long long)arg2;
- + (void)removeStyleOverrides:(int)arg1;
- + (void)addStyleOverrides:(int)arg1;
- @end
- @implementation SDStatusBarOverriderPre8_3
- @synthesize timeString;
- @synthesize dateString;
- @synthesize carrierName;
- @synthesize bluetoothConnected;
- @synthesize bluetoothEnabled;
- @synthesize batteryDetailEnabled;
- @synthesize networkType;
- @synthesize iPadDateEnabled;
- @synthesize iPadGsmSignalEnabled;
- - (void)enableOverrides
- {
- StatusBarOverrideData *overrides = [UIStatusBarServer getStatusBarOverrideData];
-
- // Set 9:41 time in current localization
- overrides->overrideTimeString = 1;
- strcpy(overrides->values.timeString, [self.timeString cStringUsingEncoding:NSUTF8StringEncoding]);
-
- // Enable 5 bars of mobile (iPhone only)
- if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
- overrides->booloverrideItemIsEnabled[3] = 1;
- overrides->values.boolitemIsEnabled[3] = 1;
- overrides->overrideGsmSignalStrengthBars = 1;
- overrides->values.gsmSignalStrengthBars = 5;
- }
-
- overrides->overrideDataNetworkType = self.networkType != SDStatusBarManagerNetworkTypeWiFi;
- overrides->values.dataNetworkType = self.networkType - 1;
-
- // Remove carrier text for iPhone, set it to "iPad" for the iPad
- NSString *carrierText = self.carrierName;
- if ([carrierText length] <= 0) {
- carrierText = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) ? @"" : @"iPad";
- }
- overrides->overrideServiceString = 1;
- strcpy(overrides->values.serviceString, [carrierText cStringUsingEncoding:NSUTF8StringEncoding]);
-
- // Battery
- overrides->booloverrideItemIsEnabled[8] = 1;
- overrides->values.boolitemIsEnabled[8] = 1;
- overrides->overrideBatteryDetailString = 1;
- strcpy(overrides->values.batteryDetailString, [self.batteryDetailEnabled? @"100%" : @" " cStringUsingEncoding:NSUTF8StringEncoding]);
-
- // Bluetooth
- overrides->booloverrideItemIsEnabled[11] = self.bluetoothEnabled;
- overrides->values.boolitemIsEnabled[11] = self.bluetoothEnabled;
- if (self.bluetoothEnabled) {
- overrides->overrideBluetoothConnected = self.bluetoothConnected;
- overrides->values.bluetoothConnected = self.bluetoothConnected;
- }
-
- // Actually update the status bar
- [UIStatusBarServer postStatusBarOverrideData:overrides];
-
- // if battery detail was not required, then it was set to one space @" ", so let's correct it here in case bluetooth icon comes after it
- if (!self.batteryDetailEnabled) {
- strcpy(overrides->values.batteryDetailString, [@"" cStringUsingEncoding:NSUTF8StringEncoding]);
- [UIStatusBarServer postStatusBarOverrideData:overrides];
- }
-
- // Lock in the changes, reset simulator will remove this
- [UIStatusBarServer permanentizeStatusBarOverrideData];
- }
- - (void)disableOverrides
- {
- StatusBarOverrideData *overrides = [UIStatusBarServer getStatusBarOverrideData];
-
- // Remove specific overrides (separate flags)
- overrides->overrideTimeString = 0;
- overrides->overrideGsmSignalStrengthBars = 0;
- overrides->overrideDataNetworkType = 0;
- overrides->overrideBatteryDetailString = 0;
- overrides->overrideBatteryDetailString = 0;
- overrides->overrideBluetoothConnected = 0;
-
- // Remove all overrides that use the array of bools
- for (int i = 0; i < 25; i++) {
- overrides->booloverrideItemIsEnabled[i] = 0;
- overrides->values.boolitemIsEnabled[i] = 0;
- }
-
- // Carrier text (it's an override to set it back to the default)
- overrides->overrideServiceString = 1;
- strcpy(overrides->values.serviceString, [NSLocalizedString(@"Carrier", @"Carrier") cStringUsingEncoding:NSUTF8StringEncoding]);
-
- // Actually update the status bar
- [UIStatusBarServer postStatusBarOverrideData:overrides];
-
- // Have to call this to remove all the overrides
- [UIStatusBarServer permanentizeStatusBarOverrideData];
- }
- @end
|