After you installed MYO 6, you will find a new menu in Settings, called WUG Setup.

In this WUG Setup menu you enter your WeatherUnderground API key and select your preferred language. These will be stored in /var/mobile/Library/Preferences/com.gps.wug.plist.
What you don't see is that with MYO 6 also comes a LaunchDaemons file which will run a shell script every 5 minutes. This shell script is actually a cycript script in an executable shell script.
This cycript script has this content
Code: Select all
#!/usr/bin/cycript -p SpringBoard
var loc, key, lang;
WPref = [WeatherPreferences sharedPreferences];
WLocation = [WeatherLocationManager sharedWeatherLocationManager];
WCity = [WPref localWeatherCity];
LUpdate = [TWCLocationUpdater sharedLocationUpdater];
[WLocation setDelegate:[[CLLocationManager alloc] init]];
[WLocation setLocationTrackingReady:YES activelyTracking:NO watchKitExtension:NO];
[WLocation setLocationTrackingActive:YES];
[WPref setLocalWeatherEnabled:YES];
[LUpdate updateWeatherForLocation:[WLocation location] city:WCity];
loc = WCity.locationID;
loc = loc.split(',');
var settings = [NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.gps.wug.plist"];
if(settings!=null){
key=settings.api_key;
lang=settings.language;
}
url = 'http://api.wunderground.com/api/'+key+'/forecast/conditions/astronomy/hourly/lang:'+lang+'/q/'+loc[0]+','+loc[1]+'.xml'
url = [NSURL URLWithString:url];
var urlData = [NSData dataWithContentsOfURL:url];
var filePath = 'var/mobile/Documents/wug.xml';
[urlData writeToFile:filePath atomically:YES];
url = null;
urlData = null;
This happens every 5 minutes and takes seconds to do.
Now that cycript script is also part of the MYO 6 cydget, but slightly changed.
Code: Select all
<script type="text/cycript">
getDict = function(){
return [NSDictionary dictionaryWithContentsOfFile: @"/var/mobile/Library/Preferences/com.gps.wug.plist"];
};
var loc, lati, longi;
getUpdate = function(){// full gps
WPref = [WeatherPreferences sharedPreferences];
WLocation = [WeatherLocationManager sharedWeatherLocationManager];
WCity = [WPref localWeatherCity];
LUpdate = [TWCLocationUpdater sharedLocationUpdater];
[WLocation setDelegate:[[CLLocationManager alloc] init]];
[WLocation setLocationTrackingReady:YES activelyTracking:NO watchKitExtension:NO];
[WLocation setLocationTrackingActive:YES];
[WPref setLocalWeatherEnabled:YES];
[LUpdate updateWeatherForLocation:[WLocation location] city:WCity];
loc = WCity.locationID;
loc = loc.split(',');
obj.latitude = loc[0];
obj.longitude = loc[1];
nextStep();
}
saveFile=function(){
var loc, key, lang;
WPref = [WeatherPreferences sharedPreferences];
WLocation = [WeatherLocationManager sharedWeatherLocationManager];
WCity = [WPref localWeatherCity];
LUpdate = [TWCLocationUpdater sharedLocationUpdater];
[WLocation setDelegate:[[CLLocationManager alloc] init]];
[WLocation setLocationTrackingReady:YES activelyTracking:NO watchKitExtension:NO];
[WLocation setLocationTrackingActive:YES];
[WPref setLocalWeatherEnabled:YES];
[LUpdate updateWeatherForLocation:[WLocation location] city:WCity];
loc = WCity.locationID;
loc = loc.split(',');
var settings = [NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.gps.wug.plist"];
if(settings!=null){
key=settings.api_key;
lang=settings.language;
}
url = 'http://api.wunderground.com/api/'+key+'/forecast/conditions/astronomy/hourly/lang:'+lang+'/q/'+loc[0]+','+loc[1]+'.xml'
url = [NSURL URLWithString:url];
var urlData = [NSData dataWithContentsOfURL:url];
var filePath = 'var/mobile/Documents/wug.xml';
[urlData writeToFile:filePath atomically:YES];
url = null;
urlData = null;
}
</script>