Skip to content

Instantly share code, notes, and snippets.

View corinnekrych's full-sized avatar
🐝

corinnekrych corinnekrych

🐝
View GitHub Profile

iOS app for Java developer

(devoxx uk) You boss said: "I need an iPhone version". And you're a Java guy...

So, that's mean: Objective-C! You're scared of this barbarian syntax? Relax Objective-C is a cool dude. Xcode is not a bad guy, he’ll help you. And if you want to stay in known territory: AppCode is here. Using template, you get up and running in no time. UI designing with interface builder and storyboard are dead easy to start with. Your app has to be connected to your enterprise cloud-based server application? No worries, all the plumbing for accessing REST services feels fluent using iOS AeroGear libraries.

Join us to follow the tribulations of a Java guy in the world of iOS programming. And of course, the unbearable suspense: will he get his iOS app on time?

Easy enterprise mobile app

ls-la /Users/corinne/.rvm/rubies/
total 8
lrwxr-xr-x 1 corinne staff 42B Nov 15 17:40 default -> /Users/corinne/.rvm/rubies/ruby-2.0.0-p247
drwxr-xr-x 9 corinne staff 306B Sep 5 10:16 ruby-1.9.1-p431
drwxr-xr-x 8 corinne staff 272B Sep 5 10:18 ruby-1.9.2-p320
drwxr-xr-x 8 corinne staff 272B Sep 17 11:31 ruby-1.9.3-p429
drwxr-xr-x 8 corinne staff 272B Sep 17 13:30 ruby-1.9.3-p448
drwxr-xr-x 7 corinne staff 238B Sep 17 11:26 ruby-2.0.0-p0
drwxr-xr-x 9 corinne staff 306B Nov 15 16:36 ruby-2.0.0-p247
D/CordovaLog(13484): file:///android_asset/www/js/index.js: Line 39 : :::::::::::::::::::::::::::::::::::::::::DEVICE READY
I/Web Console(13484): :::::::::::::::::::::::::::::::::::::::::DEVICE READY at file:///android_asset/www/js/index.js:39
V/PushPlugin(13484): execute: action=register
V/PushPlugin(13484): execute: data=[{"pushConfig":{"senderID":"107028882733","variantID":"d366b4df-a9bc-4a16-a4f2-8884d094cc19","variantSecret":"d565cace-ab1b-4898-b4a6-f5ddf4242135","alias":"corinne","pushServerURL":"https:\/\/judconpush-sblanc.rhcloud.com\/"},"ecb":"onNotification","sound":"true","badge":"true"}]
V/PushPlugin(13484): execute: jo={"pushConfig":{"senderID":"107028882733","variantID":"d366b4df-a9bc-4a16-a4f2-8884d094cc19","variantSecret":"d565cace-ab1b-4898-b4a6-f5ddf4242135","alias":"corinne","pushServerURL":"https:\/\/judconpush-sblanc.rhcloud.com\/"},"ecb":"onNotification","sound":"true","badge":"true"}
V/PushPlugin(13484): execute: ECB=onNotification
D/dalvikvm(13484): GC_CONCURRENT freed 218K, 51% free 2
curl -3 -u "4106d2d1-0549-4dbe-8134-88f27cf25d1b:34373832-e82e-4a4e-b6ed-55cda5555c75" -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{
"message": {
"alert":"HELLO!"
}
}' https://judconpush-sblanc.rhcloud.com/rest/sender
onDeviceReady: function() {
app.receivedEvent('deviceready');
console.log(':::::::::::::::::::::::::::::::::::::::::DEVICE READY');
var pushConfig = {
// senderID is only used in the Android/GCM case
senderID: "107028882733",
pushServerURL: "https://judconpush-sblanc.rhcloud.com/",
variantID: "d366b4df-a9bc-4a16-a4f2-8884d094cc19",
variantSecret: "XXXXXXX",
alias: "corinne"
// AGSyncPipe protocol
@protocol AGSyncPipe
// to dicuss: conflict callback could also have baseObject for 3 ways merge options
-(void) save:(AGSyncObject*) object
success:(void (^)(id responseObject))success
failure:(void (^)(NSError *error))failure
conflict:(void (^)(NSError *error, AGSyncObject* fromObject, AGSyncObject* toObject))conflict;
-(void) read:(void (^)(id responseObject))success
failure:(void (^)(NSError *error))failure;
// AGSyncPipe protocol
@protocol AGSyncPipe
// to dicuss: conflict callback could also have baseObject for 3 ways merge options
-(void) save:(AGSyncMetaData*) object
success:(void (^)(id responseObject))success
failure:(void (^)(NSError *error))failure
conflict:(void (^)(NSError *error, AGSyncMetaData* fromObject, AGSyncMetaData* toObject))conflict;
-(void) read:(void (^)(id responseObject))success
failure:(void (^)(NSError *error))failure;
@corinnekrych
corinnekrych / gist:8744777
Last active November 27, 2015 06:04
Let's practise OAuth2 dance !

You want to build a cool app to share your photos on Twitter, Googgle+, Facebook... Tackle all the 'cool' social networks. First thing you need to do is: authenticate and authorize your app for each providers.

Good news is: there is a common protocol for that. Its little name is 'OAuth2'. Each provider comes with an iOS sdk to ease the OAuth2 dance, but of course, each has its own API.

Ouch! And what you really want is use the same API for all them. Let's see how you can implement OAuth2 protocol and provide a common API across providers. Much easier than his elder brother OAuth, we will dive into OAuth2 protocol and see the challenges of implementing it from a native app perspective.

[tabs]
[names="Java,iOS,JavaScript"]
[source,java]
----
* public class Car {
* @RecordId
* public Long id;
* public String make;
* public String model;
@corinnekrych
corinnekrych / gist:8472700
Last active January 3, 2016 13:59
Devoxx FR
Crash course sur iOS et Objective-C pour developpeur Java
====
Super fier: ta mobile app vient d'être publiée sur Google Store! Seulement voila ton boss veut la version native iOS...
Ca veut dire développer avec Objective-C! Tu trouves la syntaxe barbare? Relax, en utilisant les templates et le storyboard tu construis ta UI très rapidement. Ton appli doit etre connectée à un backend Cloud? Accéder aux resources de tes médias sociaux préférés? Sauver et encrypter tes données sensibles? Gérer le mode offline et la syncho. Pas de problème, toute cette plomberie est transparente en utilisant les librairies iOS d'AeroGear.