GijsTimmers / kotnetcli

An easy automated way to log in on Kotnet.
GNU General Public License v3.0
5 stars 4 forks source link

Android support via Kivy #39

Closed GijsTimmers closed 8 years ago

GijsTimmers commented 9 years ago

We should check whether we can support Android. Maybe Kivy is the way to go.

GijsTimmers commented 9 years ago

I've worked a bit on it, and it's really dirty code. At the moment, it doesn't look like it can be easily combined with the current codebase. Therefore, I propose to separate this into a different low-priority project: kotnetgui-mobile. Another reason to do so is that the Android version isn't really kotnetcli anymore. Kivy seems to support iOS too, so maybe we can create both .apks and .ipas.

jovanbulck commented 9 years ago

no idea on how easy it is to run python on android, but from a software design point of view, the android app should ideally be just another front end

kotnetcli.py will encapsulate the command line interface, parsing arguments to create the necessary back-end objects and start the machinery. Ideally (dont know if this is feasible), this can be implemented in a simple android app, without changing the back-end...

GijsTimmers commented 9 years ago

In that case, we'll have to at least create a different file for it. It can't be put in kotnetcli.py.

jovanbulck commented 9 years ago

yep indeed kotnetapp.py or so

GijsTimmers commented 9 years ago

Sitrep

I spent yesterday evening and today's afternoon, trying to get Kivy to compile, using mostly buildozer, but also python-for-android.

I haven't had any success doing so. Getting buildozer to work on a modern version of Ubuntu is a PITA. I'm constantly getting the error:

subprocess.CalledProcessError: Command '['ant', 'debug']' returned non-zero exit status 1

I've googled it, and it seems to have something to do with using a 64 bit version of Ubuntu, so I tried the proposed Virtualbox image.

This Virtualbox runs a 32-bit Ubuntu Quantal Quetzal, which is very bad at getting virtualized. After re-enabling the old software sources (old-releases.ubuntu.com), I managed to pull in lubuntu-core to have a better experience.

I tried compiling in this virtualbox, but it still fails. As soon as I get it working, I'll share a snapshot of this VM with you, so we have something to work with.

I found an online APK builder, which is kinda cool, but I've been waiting for 45 minutes now, and it hasn't compiled anything yet.

GijsTimmers commented 9 years ago

Some updates

I've tried a lot to resolve the error above, but nothing did the trick. Right now, I've posted an issue on the buildozer github, but in the meantime, I'll try compiling with python-for-android. That will be a lot harder, but it may work. Fingers crossed.

GijsTimmers commented 9 years ago

Update: I've managed to succesfully compile a Hello World app. We can now start working on the app.

Proof-of-concept demonstration video

jovanbulck commented 9 years ago

I've created a class diagram depicting intended android app integration with kotnetcli back-end; looks clean this way I think :-)

class diagram

GijsTimmers commented 9 years ago

Hi, this looks very nice. I agree on everything depicted here except for the progress output. Spawning a QuietLoginCommunicator here with a progressbar would be fancy, but we'd lose the cli aspect, which is something that's very dear to me. Actually, I see it as our task to get non-Linux people comfortable with terminal output.

What do you think about a combined approach? Terminal output and a progressbar at the same time? That would be fine for me, as well.

jovanbulck commented 9 years ago

What do you think about a combined approach? Terminal output and a progressbar at the same time? That would be fine for me, as well.

Yep good idea; the progress bar field was just a quick idea to show the general concept (of an Androidcommunicator that modifies Kivy-elements to display the progress)

GijsTimmers commented 9 years ago

A small update video to show you what the app currently looks like. Note that all shown behaviour is real: the login and parsing actually works.

Video

jovanbulck commented 9 years ago

Good progress here :-)

I think however, we should certainly not copy the necessary back-end classes as documented in issue #76 The ideal is depicted on the class diagram that I posted above:

class diagram

We should simply write implementations for the Android dependent classes (such as communicator, keyring, ...). The real workhorse back end code (worker, browser, ...) however, should not be duplicated. Code duplication is always the number one bad smell.

As far as I understand now, problems arise when trying to compile a Kivy app that simply imports for example a back-end Browser class. We should thus try to fix these: what is the exact nature of the problem? Has it something to do with the conflicting imports of BeautifulSoup and Mechanize? If so, we should probably drop BeautifulSoup and replace it with a regex?

GijsTimmers commented 9 years ago

We should simply write implementations for the Android dependent classes (such as communicator, keyring, ...). The real workhorse back end code (worker, browser, ...) however, should not be duplicated. Code duplication is always the number one bad smell.

Agreed.

As far as I understand now, problems arise when trying to compile a Kivy app that simply imports for example a back-end Browser class. We should thus try to fix these: what is the exact nature of the problem? Has it something to do with the conflicting imports of BeautifulSoup and Mechanize? If so, we should probably drop BeautifulSoup and replace it with a regex?

Probably, so the way to go right now would be to create a proof-of-concept parser based on re (the regex module) instead of BeautifulSoup.

GijsTimmers commented 8 years ago

We're not going to do this via Kivy. We made a lot of progress in the past, but the whole compilation procedure is just a pain in the ass.

Instead, we'll create a separate project, written in Java and fully native. You can find this project here: https://github.com/GijsTimmers/kotnetcli-mobile