Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Want to share it with the community? #5

Open
kevinpapst opened this issue Sep 1, 2018 · 14 comments
Open

Want to share it with the community? #5

kevinpapst opened this issue Sep 1, 2018 · 14 comments
Assignees
Labels

Comments

@kevinpapst
Copy link

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
Copy link
Owner

bastilimbach commented Sep 1, 2018

@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 👍

@bastilimbach bastilimbach self-assigned this Sep 1, 2018
@kevinpapst
Copy link
Author

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
Copy link
Owner

bastilimbach commented Sep 18, 2018

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
Copy link
Owner

bastilimbach commented Sep 18, 2018

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
Copy link
Owner

bastilimbach commented Sep 18, 2018

@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
Copy link
Author

kevinpapst commented Sep 18, 2018

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
Copy link
Author

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

@bastilimbach
Copy link
Owner

bastilimbach commented Sep 18, 2018

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
Copy link
Owner

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

@kevinpapst
Copy link
Author

kevinpapst commented Sep 18, 2018

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
Copy link
Author

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

@bastilimbach
Copy link
Owner

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
Copy link
Owner

bastilimbach commented Sep 18, 2018

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

@kevinpapst
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants