bastilimbach / timeu

Timeu - The modern Kimai client for iOS
https://sebastianlimbach.com/timeu
Mozilla Public License 2.0
3 stars 0 forks source link

Want to share it with the community? #5

Open kevinpapst opened 5 years ago

kevinpapst commented 5 years ago

Dude, I didn't even know this repo existed, why didn't you tell us about it?

Really cool! That looks fantastic, I will test it the next days.

We can feature the app here: https://www.kimai.org/apps/ You would just need to submit a PR in this repo: https://github.com/kimai/www.kimai.org The file you need to change is this one: https://github.com/kimai/www.kimai.org/blob/master/apps.md

bastilimbach commented 5 years ago

@kevinpapst Thank you very much! I didn't submit a PR to get included in the app homepage, because this project is very much work in progress and is currently on hold until the Kimai 2.0 API is done. (Therefore my feature request on the Kimai2 repo 😉)

But sure, go ahead and give it a try! Currently, you can only view your timesheet records. I have a local build which has the creation feature 40% complete, but I stopped working on that as soon as I saw a new Kimai was in the works. After the API is in a reasonable state I plan to continue the work on Timeu!

I'm looking forward to feedback and ideas for the new version with Kimai2 support 👍

kevinpapst commented 5 years ago

I bought a Swift book a while ago and played around a bit, but that was just scratching at the surface... Any chance you could add a small readme on how to install it?

I did a brew install carthage and while executing carthage update --platform iOS I got:

***  Skipped installing KeychainAccess.framework binary due to the error:
    "Incompatible Swift version - framework was built with 4.1 (swiftlang-902.0.48 clang-902.0.37.1) and the local version is 4.2 (swiftlang-1000.11.37.1 clang-1000.11.45.1)."

    Falling back to building from the source

but the installation went on and no more errors showed up.

I cloned the repo, imported it into Xcode. But how to go on from there? It doesn't build, Xcode complains that error: There are no accounts registered with Xcode. Add your developer account to Xcode (in target 'Timeu').

And it says also error: No profiles for 'com.sebastianlimbach.Timeu' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.sebastianlimbach.Timeu'. (in target 'Timeu')'.

Any ideas?

bastilimbach commented 5 years ago

Nice, which book did you buy? Swift is awesome!

The error is showing because the Framework "KeychainAccess" is not yet available for Swift 4.2. Version 4.2 just released yesterday but a PR is already created over at their repo.

The error error: There are no accounts registered with Xcode. Add your developer account to Xcode (in target 'Timeu') is showing because you are not part of my Developer Team.

You need to change the team in the Target View (Try None):

screen shot 2018-09-18 at 16 08 47
bastilimbach commented 5 years ago

Btw, Timeu is also built on a previous Swift Version. You might need to fix something to run Timeu on 4.2. I'll look into that this evening.

bastilimbach commented 5 years ago

@kevinpapst I updated the master branch to Swift 4.2 in commit 6b44c09. You should be able to build and run the app if you change the team.

The "Try the demo" currently doesn't work because the Kimai instance at https://demo.kimai.org/ isn't available anymore. I tried it with a custom install of the old Kimai and it worked like a charm.

kevinpapst commented 5 years ago

I updated some XCode components yesterday. What a coincidence that I started testing it today after upgrading to 4.2 without knowing it ;-) Its "Swift 4 by Michael Koffer" - very likely the biggest book I own. Swift seems to be awesome, but hard to wrap my head around, after so many years of Java and PHP.

Ok, I pulled the latest changes and after some fiddling around I could get it up and running. "None" wasn't allowed, Xcode said something like "TimeU needs to be signed". So I logged in with my Apple ID and selected my personal account. Still failing, as the bundle identifier collided with my account. After changing it to com.kevinpapst.Timeu I could finally build it.

Still complaining "SwiftLint not installed, download from https://github.com/realm/SwiftLint" but thats not a critical error.

I can't login as the demo is currently broken and I have no running Kimai 1 around. If you start with changing it for v2 let me know. I can at least help testing/debugging new stuff... I'd really like to have a real-life Swift project to learn from!

kevinpapst commented 5 years ago

Ah, found the new branch. Could you merge your fixes int it?

bastilimbach commented 5 years ago

Yeah, Swift has some very unique concepts. But they really did take all the good stuff from various programming languages.

Yes, that was it! You need to change the bundle identifier, right. That's super annoying. I need to check if there is a better way.

I should definitely add the SwiftLint dependency to the install steps in the README! (Fixed with: 4550975)

I'm currently rewriting the login screen to support Kimai2. You could really help me with that. The current/old workflow was the following:

  1. The user enters their custom Kimai URL.
  2. The User enters their credentials for this Kimai instance.
  3. Timeu sends a request to get the API Token with the provided user credentials and saves it securely.
  4. Now on every API request, the App sends the Token as an authentication header. If the token is revoked the app shows the log in screen again to request a new one.

Now in Kimai2, there are no "Tokens". The user has to set a specific API password, which I (currently) can't request through the API. So the workflow for Kimai2 would be the following:

  1. The user enters their custom Kimai URL.
  2. The User enters their credentials for this Kimai instance.
  3. Timeu throws an error and asks the user to create a specific API password.
  4. After the user created one, they now need to log in with this specific password instead of there normal one.

In my opinion, this isn't really user-friendly. What do you think? Should I create an issue over at the Kimai2 repository?

bastilimbach commented 5 years ago

I rebased the kimai2 branch to include the Swift 4.2 update 👍

kevinpapst commented 5 years ago

Ok, Demo is fixed, login works. First refresh with just one running entry brings a weird result. But lets ignore that, I'd like to concentrate on v2...

I think the workflow should be the same like in v1, only requiring the user to enter the API password. Your app shouldn't care about somehow dealing with the "normal" password and then displaying a message. If the user enters the wrong password, it simply won't work.

But tbh I am not happy with the current solution as well, as you would have to store the users plaintext password, which is a no-go for production usage. When implementing the first draft of the API I was struggling with the fact that I'd like to be able to use the API from the web-frontend (user-session) and from apps (per request login) at the same time. This kinda works now, but the flow using the password needs to be replaced by a proper solution and I think I will switch it to an O-Auth implementation. I hope there are free libraries in Swift that would help in implementing the O-Auth flow?

Yes, lets discuss that over in the Kimai repo. You can open a new issue for the login change.

I'd say: for now ask for the API password only, so we can concentrate on the required API functions and start implementing them in Timeu and Kimai v2.

kevinpapst commented 5 years ago

Or is the password saved in the normal iOS Keychain? Then it wouldn't be a problem I guess.

bastilimbach commented 5 years ago

On going (running) records aren't implemented correctly.

Of course, the password is stored securely and encrypted in the iOS Keychain. So that wouldn't be a problem. The only reason I'm not that happy with the current implementation is, that the user needs to remember two separate passwords. But for the first version, this is more than enough. I'll just add a little hint to remind the user to use the API password instead of the normal one if the authentication failed.

There are plenty of OAuth libraries for swift for later versions 👍

bastilimbach commented 5 years ago

I'm currently really busy writing my bachelor thesis. I try to work on that on Sunday and the next weekend.

kevinpapst commented 5 years ago

Nice, sure. Just ping me when you want to do a rapid coding session! I'll try to prepare some new API calls until then.