traccar / traccar-manager-ios

Traccar Manager for iOS
https://www.traccar.org/manager
Apache License 2.0
109 stars 193 forks source link

Add device and positions to app #3

Closed wpearse closed 8 years ago

wpearse commented 8 years ago

In this PR, new features:

Known issues:

wpearse commented 8 years ago

simulator screen shot 8 05 2016 4 21 51 pm simulator screen shot 8 05 2016 4 22 02 pm simulator screen shot 8 05 2016 4 21 56 pm

tananaev commented 8 years ago

I will try later and see if WebSocket connection works for me.

tananaev commented 8 years ago

I have figured out the problem with websocket. The cookie is set for /api path, so you need to request cookie for http://demo.traccar.org/api instead of top level http://demo.traccar.org/.

Please check login screen layout on iPhone 4S screen. It doesn't work properly. There must be some auto-layout issue.

wpearse commented 8 years ago

You were correct about the cookie path. This PR is ready for review now.

Positions are pushed to the app using the web socket, but the map only redraws all the positions every 10s on a timer. I did this because I wasn't sure what would happen if a massive amount of positions were pushed to the app quickly and repeatedly -- I wondered if maybe the app would lock up/freeze.

tananaev commented 8 years ago

It doesn't sound right. The map should be updated in real time. That was the whole point of using WebSockets. Why does map re-draw on every update? You just need to add/update single marker.

wpearse commented 8 years ago

OK. Just pushed a change to remove the timer, and update the map as soon as new positions are received from the web socket.

Only single markers are updated (only the ones that change), not all markers.

tananaev commented 8 years ago

OK, I'll try to find time to review it later today.

Does it mean we can publish the app after the merge is done? Is anything missing?

wpearse commented 8 years ago

For me personally, the only major thing I feel I need "right now" is to add the ability to change the map type (between: roads, roads + satellite imagery, and just satellite imagery).

I would also like some guidance about how the app should look/feel. I've built the UI in the app in what I think is a tidy way, but I have only used Traccar for a few weeks... you will have a much better idea about how things should work.

tananaev commented 8 years ago

Changing map type can wait. It's not that important for the first version. Let me review the code and the app, merge PR, and submit the app for Apple review if everything is fine. After that we can start on other features.

tananaev commented 8 years ago

Issues I found so far:

  1. You need to support HTTPS version of WebSocket. As far as I remember, you don't need to change schema to ws or wss. Just use regular http schema.
  2. App crashes on self.lastUpdate = dateFormatter.dateFromString(value as! String). I'm not able to see variables in debug mode for some reason, but I guess the issue is with date format. Make sure you are using latest version of Traccar server for testing.

Trying to fix my debug issues at the moment. Not sure why it doesn't show any variable values.

tananaev commented 8 years ago

Are you sure you are using Carthage dependencies correctly? I have another project and it looks completely different. I'm not a huge expert in iOS, so please correct me if I'm talking nonsense.

In my other project:

  1. Dependencies in project navigator show as suitcases (frameworks).
  2. I don't have anything in embedded binaries.
  3. There is an extra build phase to copy frameworks.

In Traccar Manager project:

  1. Dependencies in project navigator show with blue icons (sub-projects?)
  2. Libraries are in embedded binaries section.
  3. Extra build phase in missing

I was thinking my debugging issues are somehow related to dependencies. Does debugging work for you?

wpearse commented 8 years ago

By debugging you mean the symbol inspector? It works most of the time for me -- on this and other projects. When it doesn't work I assume it is just another Xcode bug :)

I've just pushed changes to:

tananaev commented 8 years ago

Thanks. I'll try it in the evening.

tananaev commented 8 years ago

Can you please fix the warning:

.../TraccarManager/LoginViewController.swift:48:17: 'UIAlertView' was deprecated in iOS 9.0: UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead

tananaev commented 8 years ago

Everything else looks good. I think we can merge and publish it. What's the minimum iOS we can target? iOS 8?

wpearse commented 8 years ago

Fixed that warning. Did your debug issues go away with those Carthage changes?

I've only tested on iOS 8 and above, so I wouldn't feel comfortable targeting anything lower.

I was playing with the app on the iPads today, and it might be nice to tweak so the app feels a bit more "at home" on the iPad. But for now, I think it is OK.

tananaev commented 8 years ago

Merged. I'll try to find time tomorrow to submit the app for Apple review.

tananaev commented 8 years ago

By the way, do you want me to include you as an author in the README file and license headers? If yes, do you want to add your email address there as well?

wpearse commented 8 years ago

That'd be awesome. Yes please -- "Will Pearse" and w.pearse@gmail.com. Thanks!