Skip to content
This repository has been archived by the owner on Mar 28, 2021. It is now read-only.
ivanperez-keera edited this page Feb 5, 2012 · 8 revisions

Welcome to Keera's Diamodcard SMS sending app wiki!

What is Keera's Diamondcard SMS sending app?

This little app is a toy example of how the SMS sending library and the Protected Reactive Models library can be combined to create an interactive GTK app to send SMSs.

Internal design

The design of this application follows the MVC with one tiny difference: the controller is just a list of conditions.

Instead of creating an event-oriented controller, this controller simply tries to capture or formalise a list of equivalences between the model and the view. Of course when a button is clicked, a button is clicked and we just have to react to that event, but when a String value changes in the model and the view must be updated (or the other way around), the Controller should not focus on listening to the events, but rather on maintaining the equivalence between the field in the model and that in the view. For that reason, you'll see lots of modules in keera-diamondcard-sms-trayicon/Controller/Conditions/.

For beginners

I've started putting together some notes on gtk. They should help you learn how to write gtk applications in Haskell using gtk2hs. You can find them at Basic UI Elements. The example I use for that manual is actually an SMS sending program, so it should help you learn how to do this yourself.

For developers

This code is in constant change, keep an eye or watch the project if you may be interested. In particular, there's a new interface for protected reactive models that I'm rolling out soon. In this new interface, a protected model is composed of protected fields that have a type (String, Int,...) and can be read or written. When the types between a field in the view and a field in the model match, the equivalences can be written in a very simple and declarative way, with no explicit references to events in the code.

Basic instructions


DISCLAIMER: I accept no responsibility for this program. If you run out of money in your Diamondcard account, that's not my fault. Ye have been warned. In particular: there's no sms length check, or number check of any kind. What you type in is sent as is, so do not make mistakes!


Installation

I'm assuming you know how to download the project using github. Just copy the code somewhere (and the code of all the dependencies that are in other repos), and for each one of them do 'cabal install'. Then execute ~/.cabal/bin/keera-diamondcard-sms-trayicon. You'll see an icon with a plus sign appear on your traybar. Right click on it, select preferences, enter your diamondcard data, and close the preferences. Left click on the icon, type in the destination number (with no 00 or + sign, but with international prefix, for instance, 447425000000 for a mobile phone in UK), the message, and click send. If you place the mouse over the icon you should be able to tell what's going on.

You will need to install: protected-objects, combined-mvc-environment, keera-network-sms-diamondcard >= 0.0.2

You'll also need gtk and a lot more stuff, but cabal knows about those so you only need to manually install my packages.

Usage

The first time you run the program you have to right-click on its icon, select preferences and fill in your data (Diamondcard account id, pincode and your phone number with international code, without + sign or 00).

You can get yourself a diamondcard account here: http://www.diamondcard.us/keera-studios. If you use that link for subsequent purchases, we'll get a small commission that will help us get going. See "Donations and contributions" for further info.

The rest is very simple. I could tell you how it works (easy as pie is how it works), but I want to show you as well:

  • Step 1: click on the plus sign you'll see on your system traybar.

Step 1: click on the plus sign you'll see on your system traybar

  • Step 2: write the message and the destination number with international prefix, without + sign or 00).

Step 2: write the message and the destination number with international prefix, without + sign or 00)

  • Step 3: click send.

Step 3: click send)

  • Step 4: message is being sent.

Step 4: message is being sent)

  • Step 5: message sent to Diamondcard.us. You can cheer now and let your friends know that you sent a message using Haskell.

Step 5: message sent to Diamondcard.us)

Drop me a line and let me know how it went. I use this app a lot and I have no problems, but I'm sure you can think of many improvements that would be very useful for many of us.

Donations and contributions

You are more than welcome to contribute to this program. You can do so with code contributions, reviews, links to this website, comments on your blog, emails, bug reports and donations.

Although this program has not been created for profit, donations are welcome. When I notified diamondcard.us that this program had been published (so that they could mention it on their website), they kindly let me know that they would give me a 10% commission for every purchase I got them. So, if you are wondering how to contribute to this project, this is your chance: http://www.diamondcard.us/keera-studios.

Credits

I think the font creator deserves some recognition: the font used in the screenshots is really nice. Here's my tribute to the designer's work: http://www.dafont.com/where-stars-shine-the-brightest.font