Page 11 of 11 FirstFirst ... 91011
Results 201 to 210 of 210

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.


Thread: Cydget for iOS 7 (make LockScreen plugins with HTML and Cycript)

  1. #201
    Quote Originally Posted by rachael7 View Post
    Thanks for the reply, June. The trouble is, I want to do exactly what you said creates an issue - change the background based on changes in the foreground. I can move the event-causing JS to the background, but I still have the same problem, since there are elements in the foreground that need to change as well. The only solution I came up with was pretty much what you said - store the information in local storage or a plist file and have a JS in the background page poll periodically to see if it has changed. It isn't a whole lot of overhead to poll every second or two, but I just hate using JS that way, just feels wrong to leave a loop running like that. I guess I was hoping that maybe one page was the parent of the other or that there could be some local equivalent of cross-site scripting. Probably too much to hope for from a lockscreen.
    You could pull the exact plist in FG and BG at the same time. Since it will be saved in a central location both htmls could use it. Think of it as a js file, but one which variables get changed.

    It isn't much at all to run a function checking if a timestamp has changed. I actually use this in LockBuilder Springboard. By pressing savetosb in LBLS it will set a timestamp. On LBSB if this timestamp is changed then it will run further functions. Since I couldn't communicate from cydget to sbhml this was the only way. Due to it having an interval that checks this timestamp. It's not a huge overhead, but you must have it where it only checks the timestamp and nothing else. It's always best practice to have nothing running on a loop, but you could say its almost like having a clock that updates every second. Only difference is you're not touching the DOM. I see no issue with it just cumbersome.

    Quote Originally Posted by rachael7 View Post
    As long as I have you here June, I had another question for you. I've been playing around with the GPS in my LS, based on the code you published - great work sussing out those commands, btw! Anyway, at first it didn't work at all - was returning null. But then, I got an incoming phone call, and at exactly that moment, I finally got asked for permission for the lockscreen to use GPS. Once I gave it permission, your code worked great, just as expected, with no changes required. In the settings app, the lockscreen now shows up in location services as "CoreLocation.framework" with no icon. I've been studying the dumped headers for CLLocation, trying to figure out how to get the permissions prompting right and give the package a name in the settings app, but so far, no joy. Have you had any luck there?
    I have not, it took me a long time to get the location services to work. So much that when I got it I was just happy with what I had. I asked 4-5 developers including Saurik when I was trying to figure this out. No one was familiar with what I was trying to achieve. So in the end I was tired of even looking at anything that said CLLocation:P I do have an idea of how you could change the name, but I am unsure if it would work.


    Code:
    var manager = [[[CLLocationManager alloc] initWithEffectiveBundle: [NSBundle bundleForClass: CLLocationManager.class]]autorelease];
    This is where I would allocate the CLLocationManager. In theory NSBundle bundleForClass: CLLocationManager.class would be the name. As to how to change it I dunno. Maybe by changing class to some other name, but I am really unsure. By default it is setting to CoreLocation as you have seen. Even when you receive a popup it will say "" wants to use location services. Which isn't 100% right. I have made an app that did use CLLocation and everything worked great, even had the name of the app when asking to use Location. With cycript and cydget it didn't and much had to be changed to work.

    You should get a prompt immediately when you go to the ls, then to the sb. When you enter the sb you would get the prompt. If you click cancel, then you will need to go to private/location and turn core.location.framework on.

  2. The Following User Says Thank You to June'sIphone For This Useful Post:

    rachael7 (2014-09-17)

  3. #202
    Quote Originally Posted by June'sIphone View Post
    Code:
    var manager = [[[CLLocationManager alloc] initWithEffectiveBundle: [NSBundle bundleForClass: CLLocationManager.class]]autorelease];
    This is where I would allocate the CLLocationManager. In theory NSBundle bundleForClass: CLLocationManager.class would be the name. As to how to change it I dunno. Maybe by changing class to some other name, but I am really unsure. By default it is setting to CoreLocation as you have seen. Even when you receive a popup it will say "" wants to use location services. Which isn't 100% right. I have made an app that did use CLLocation and everything worked great, even had the name of the app when asking to use Location. With cycript and cydget it didn't and much had to be changed to work.

    You should get a prompt immediately when you go to the ls, then to the sb. When you enter the sb you would get the prompt. If you click cancel, then you will need to go to private/location and turn core.location.framework on.
    Thanks again, June; I really appreciate your help. I'll play around with the NSBundle bit for a while, and if I get anywhere, I'll let you know. Also appreciate knowing what it was supposed to do as far as the permissions popup - that explains why I didn't get it. I was only playing in the ls and never unlocked the phone to sb up to that point in testing. Then the phone rang, which I think disables Cydget (doesn't it?) and must have had the same effect as sb in terms of making the popup visible. Anyway, thanks again for your help and I'll post back if I make any further progress with the GPS implementation.

  4. The Following User Says Thank You to rachael7 For This Useful Post:

    Poolman1 (2014-09-17)

  5. #203
    Thanks, pretty sure if a call comes in it will close cydget. Probably loading the call bundle triggered the popup. There is a way to force location services to be on, and you could set core-location.framework to be too with obj-c. I didn't though felt intrusive. Better to instruct the users how to do it, lets them see whats really going on.
    Last edited by June'sIphone; 2014-09-17 at 03:55 AM.

  6. The Following 2 Users Say Thank You to June'sIphone For This Useful Post:

    Poolman1 (2014-09-17), rachael7 (2014-09-17)

  7. #204
    Just a quick follow-up here. You're on the right track with the .class property, June, but I'm still trying to get it to work right. So far, anything I put there besides "class" just makes the permissions show up in settings as "SpringBoard.app" - no change to the blank prompt or other behavior. I haven't given up though!

  8. The Following User Says Thank You to rachael7 For This Useful Post:

    June'sIphone (2014-10-07)

  9. #205
    While updating LockBuilder Evo I found a way to retrieve javascript info. In doing this I realized that every time I unlocked my device the Javascript fast malloc committed value would constantly go up until a crash. Also the heap size would get huge. Over 100+mb on malloc and 40+mb on heap, Not knowing what was causing this I made a temp cydget and began loading everything that LBEvo had. A long process, but what I found is the code below was the culprit.

    Code:
    [^ void () { [[SBLockScreenManager sharedInstance] _bioAuthenticated: 0]; } performSelectorOnMainThread:@selector(invoke) withObject:nil waitUntilDone:NO]
    Why this happens I dunno. I needed a code to unlock the device, I asked Saurik and this is what he offered. At the time he seemed surprised it worked.

    But

    If you change it to.
    Code:
    [[SBLockScreenManager sharedInstance] _bioAuthenticated: 0];
    It does not constantly add to the malloc value meaning it will not constantly increase. Right now heap is around 2mb and malloc sits around 20mb.

    You can get memory for javascript by.

    Code:
    var memory=[WebCoreStatistics memoryStatistics];
      var jheap=formatSizeUnits(memory.JavaScriptHeapSize);
      var jfree=formatSizeUnits(memory.JavaScriptFreeSize);
      var jmalloc=formatSizeUnits(memory.FastMallocCommittedVMBytes);
      var jmallocr=formatSizeUnits(memory.FastMallocReservedVMBytes);
      var jmallocf=formatSizeUnits(memory.FastMallocFreeListBytes);
    formatSizeUnits just converts the values to kb, mb, etc.

    Code:
            function formatSizeUnits(bytes){
        if  (bytes>=1000000000) {bytes=(bytes/1000000000).toFixed(2)+' GB';}
        else if (bytes>=1000000)    {bytes=(bytes/1000000).toFixed(2)+' MB';}
        else if (bytes>=1000)       {bytes=(bytes/1000).toFixed(2)+' KB';}
        else if (bytes>1)       {bytes=bytes+' bytes';}
        else if (bytes==1)      {bytes=bytes+' byte';}
        else                {bytes='0 byte';}
        return bytes;
    }
    Last edited by June'sIphone; 2014-10-07 at 03:01 AM.

  10. The Following User Says Thank You to June'sIphone For This Useful Post:

    rachael7 (2014-10-07)

  11. #206
    Hi guys. This is kind of a novice question, but could somebody help me w/ a widget?

    I'm using ProcessingJS in a canvas tag, but this creates a second of lag. It doesn't bug me too much, but is there anything I can do? I read what saurik wrote on local storage but I do not know how to incorporate it in this situation.

    Here is a download link for reference.
    https://docs.google.com/uc?export=do...XdQR3EyR2pDWVk

  12. #207
    Superbad Modder-ator Simon's Avatar
    Join Date
    Nov 2007
    Location
    Bermuda
    Posts
    48,875
    Thanks
    8,108
    Thanked 17,645 Times in 8,025 Posts

    Anyone know if it's possible with a split cydget for a touch event to be registered and affect the background layer? For example I touch screen to bring up more weather info on top layer whilst blurring wallpaper that is showing in background layer.

  13. #208
    Quote Originally Posted by Simon View Post
    Anyone know if it's possible with a split cydget for a touch event to be registered and affect the background layer? For example I touch screen to bring up more weather info on top layer whilst blurring wallpaper that is showing in background layer.
    I haven't found a good way to pass a touch function to the background layer without a function that is constantly running on an interval. Since these two layers are totally independent they do not communicate to each other, but if you set a localStorage on the foreground.html the background.html will be able to get this localStorage. This is why it would take a function that is constantly running on an interval to see if that localStorage changed. I wouldn't recommend it, but it is possible.

    A better way would be if you do not set a wallpaper in the background.html but set the wallpaper to the lockscreen (basically the same as it being set by settings.app) You could then run a function in the foreground layer that would then blur the wallpaper.

  14. The Following User Says Thank You to June'sIphone For This Useful Post:

    Simon (2015-01-06)

  15. #209
    This is how it could be achieved.

    Code:
    setWeatherWall = function(url){
    img=[UIImage imageWithContentsOfFile:@""+url];
    wViewController = [[[PLStaticWallpaperImageViewController alloc] initWithUIImage:img] autorelease];
    wViewController->_wallpaperMode=2;
    wViewController.saveWallpaperData = YES;
    [wViewController _savePhoto];
    }
    Basically this is just a function that would change the settings set wallpaper. You would call this function like this.

    Code:
    var newimage = "/var/mobile/Library/LBEvoWeatherWalls/wallpaper.jpg";
         setWeatherWall(newimage);
    Just change the url of new image to whatever image you wish to set. Even if it was a weather wallpaper you could add a variable which would change dynamically to whatever condition it needs.

    To blur the wallpaper you would only need to use one method.

    Code:
    [[[[SBLockScreenManager sharedInstance]lockScreenViewController]lockScreenView]_showFakeWallpaperBlurWithAlpha:1 withFactory:null];
    _showFakeWallpaperBlurWithAlpha:1 (You can set the blur from 0 to 1. Even 0.1, 0.2 etc would work.)

    Full blur would be 1, no blur would be 0.

    Code:
    <div onclick="blurWall()"></div>
    
    function blurSettings(toggle){
    if(toggle==1){
    [[[[SBLockScreenManager sharedInstance]lockScreenViewController]lockScreenView]_showFakeWallpaperBlurWithAlpha:1 withFactory:null];
    }
    else{
    [[[[SBLockScreenManager sharedInstance]lockScreenViewController]lockScreenView]_showFakeWallpaperBlurWithAlpha:0 withFactory:null];
    }
    }
    
    var count=0;
    function blurWall(){
    count++
    if(count==1){
    blurSettings(count);
    }
    else{
    count = 0;
    blurSettings(count);
    }
    
    }
    I have a little bit more detailed post here. Cydgets

    The wallpaper code I used in LockBuilder and has worked great. The blur and wallpaper code I use in miWeather V2 Cydget which has a vertically scrolling lockscreen. When the lockscreen is scrolled by 10 it blurs the back wallpaper so content is readable. If it is scrolled back to 0 it removes the blur. So far I haven't had any issues with either one.
    Last edited by June'sIphone; 2015-01-06 at 04:38 AM.

  16. The Following 2 Users Say Thank You to June'sIphone For This Useful Post:

    NewD (2015-01-06), Simon (2015-01-06)

  17. #210
    Superbad Modder-ator Simon's Avatar
    Join Date
    Nov 2007
    Location
    Bermuda
    Posts
    48,875
    Thanks
    8,108
    Thanked 17,645 Times in 8,025 Posts

    Nice, thanks man. Think I may be able to use that to achieve what I want. Right now it is a slideshow that is in the background layer. Using what you said I may be able to replicate the slideshow by having the stock wallpaper keep changing. Then I can use the second part there to blur that wallpaper. Will give it a go tomorrow.

  18. The Following User Says Thank You to Simon For This Useful Post:

    June'sIphone (2015-01-06)

Page 11 of 11 FirstFirst ... 91011
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •