pocmo / Yaaic

Yaaic (Yet Another Android IRC Client) is as the name already says an Internet Relay Chat (IRC) client for Android devices.
http://www.yaaic.org
GNU General Public License v3.0
332 stars 120 forks source link

Yaaic as a library #130

Open dadatuputi opened 11 years ago

dadatuputi commented 11 years ago

I would love to have access to a yaaic View, where I pass all the necessary connection and authentication information, display options, etc. My app ties into existing services, which use IRC to chat. I don't want a full-fledged IRC client, just a simple view that I can theme myself.

I'm forking Yaaic to try and add this functionality and may eventually make a pull request.

pocmo commented 11 years ago

This is a pretty cool idea :)

dadatuputi commented 11 years ago

I think what has to happen is a separate project, a library that stands alone. Yaaic would use that library, and any other application that wants to. Using fragments would be ideal. It would take a major restructuring of the code though. I'd like to help, but I can't do it all on my own because of time and familiarity with the code base. What do you think pocmo?

pocmo commented 11 years ago

It won't be simple if you want to have Yaaic use that library as well.

I guess the main problem would be that an ongoing IRC connection always needs a background service running. This connection / service would have to be shared by multiple fragments.

The tricky part will be to keep the service running when there's no UI visible (or in between activity changes) but at the same time not having a zombie service running that's connected to irc networks for ever.

dadatuputi commented 11 years ago

I am not as familiar with the code as you, but have you considered using fragments? The library could provide a fragment that, in my understanding of fragments, do all that your current ConversationActivity does. It could spawn the service in much the same way, and clean it up in onDestroy(). Is there something I'm missing about the current implementation that would stop this from working? You say that the service would have to be shared between multiple fragments - how do you currently manage this? Is it during the onDestroy in ConversationActivity? In any case, we could document the library so that any activity that implements it will manage the service lifecycle in the same safe way it is managed now. I read somewhere that you wanted to create a library out of pircbot. I think an open source android irc library that provides a basic, configurable fragment would be fantastic and used by a lot of android apps. Those are my thoughts. What do you think?

pocmo commented 11 years ago

Yeah, fragments would be the way to go.

But the Service life cycle is independent from the Fragment life cycle -> The fragment can get destroyed for several reasons but the service should not. This is true for at least Yaaic: Yaaic should stay connected even if the chat is not visible or there's no activity on the stack at all.

Aat the same time the service should not stay connected for ever. This is easy for Yaaic (Currently it closes the connections itself) but tricky for a library: fragment destroy != disconnect != service destroy

dadatuputi commented 11 years ago

It's been awhile, but I've kind of come back to what drove me to look for a IRC library on android :)

What about forcing any application that uses the IRC library to implement an interface defined in the library? For example,

public class MainActivity extends SherlockFragmentActivity implements YaiicServiceHandler { ... [methods to manage the service lifecycle to implement the YaiicServiceHandler] [methods to spawn service & irc fragments provided by library] ... }

Is that possible? Perhaps it is simply a solution for MY problem and not really applicable to other applications, but that's the thought that came into my head while thinking about this problem.

Your thoughts?

Bradford

dadatuputi commented 11 years ago

I'd even be willing to offer my time and even a bounty on this.

vivorisataamore commented 11 years ago

@elBradford have you tried putting a bounty on this at Bountysource? https://www.bountysource.com/issues/823103-yaaic-as-a-library

aldolo69 commented 10 years ago

yaaic could be useful to build other client. i really like the idea of a floating (standup library) client but i don't wont to rebuild all the communication part.

Xenega commented 10 years ago

@aldolo69, YAAIC already use a library for the connection stuff, PircBot. Still better, you can use PircBotX (http://code.google.com/p/pircbotx/), a up-to-date fork.