ShawnCramp / intellileague

0 stars 0 forks source link

Loading Champion/Item Data #2

Open ShawnCramp opened 8 years ago

ShawnCramp commented 8 years ago

Not sure how hard it would be, but what if we had a splash screen on loading the app where we ran some of the async functions from assignment 6 and downloaded all the champion and item data, so when the user goes to look at the list of champions or items it doesn't take so long to load.

I know in the Xcode directory there is a "Launch Screen", which I think is like a startup splash where you can run things in the background.

xandros-na commented 8 years ago

The only thing is we're not sure how much time it's going to take to get all the data and finish the splash screen. We can run a test and time it. That also means we need some sort of object that will hold all the data when we load the splash screen. Then in all of our views, we need to grab what we need from this object. Thoughts?

ShawnCramp commented 8 years ago

I was thinking we could do it the same way we did the deck in a3. We have a champion class holding all the champ information, then a singleton class holding an array of all the champion objects. As for speed, when we did the CBC rss feed, it was like, half a second or so to get all the images of about ~12 articles. So I figure it shouldn't take more then 5-10 seconds to get all the champions and items. But you're right, we can always run a test to check speed. Only thing is, if we don't load it during splash or some other time, then we will have to load it when they click champ list or item list. So regardless we have to get the information at some point

xandros-na commented 8 years ago

Yeah since most of the data is static anyway we can save it locally. The only issue is that when there's a new patch we need to redownload and show the splash screen (not sure how this is done). I couldn't find the endpoint that checks if there's a new patch.

ShawnCramp commented 8 years ago

I wonder if there is patch information on the api, maybe we could just have a check at startup, be like if the saved patch number is different, reload all information.

ShawnCramp commented 8 years ago

It looks like we should be able to use this

https://na.api.pvp.net/api/lol/static-data/na/v1.2/versions?api_key=2472734e-3298-44d5-b026-b21e290f7959

But I keep getting forbidden returned.

xandros-na commented 8 years ago

Hmm, I get a list of patch numbers when I click that link

ShawnCramp commented 8 years ago

Dope, it seems the rest api tester I was using was broken. I see the patches now too. Thats good, so we can use that to check what the last loaded patch on the app was

xandros-na commented 8 years ago

Kk cool, we just need to figure out how to restart the app on a new patch lol.

ShawnCramp commented 8 years ago

Couldn't we just store the patch number when we download all the static information, then everytime the app is launched we can just query to check if there is a new latest patch. If there is, then download all the assets again, if not then just load everything from local?

ShawnCramp commented 8 years ago

I know with like the battle.net app, every time you either close it, or lock your phone, it reloads the app and checks your user and pass again. Might be able to do that, except just check patch version instead

xandros-na commented 8 years ago

I mean when the first time the app is launched we have the splash screen while the app is downloading stuff. If on app resume there's a new patch, we can't really resume to the previous view the user was on while we're downloading stuff. We need to point it again to the splash screen and resume the view. Idk lol

xandros-na commented 8 years ago

Actually we might be able to inject the splash screen programmatically on viewDidLoad. Like in his examples we can do something like:

if new patch:    
    var v : UIView = UIView()
    self.view.addSubview(self.v)
    make view have a label saying downloading new patch
    remove subview when done

We can add this in like a Utilities class and invoke this function in every view