ES6 modules -> ES5 microlib in AeroGear.js 2.1
by Lukáš Fryč
Hey guys,
as you may know, for AeroGear.js 2.1 we are in the middle of refactoring
into ES6 module syntax, so finally we will be able to use following in ES6
based projects:
import Authorization from 'aerogear.authorization;
I've finished a prototype of how ES6 (JavaScript.tomorrow) module
transpilation to ES5 (JavaScript.today) could work., the code and sample
lives here:
https://github.com/aerogear/aerogear-js/pull/154
It basically takes ES6 classes and compiles them to AMD module syntax
(which is a browser-oriented module system, implemented e.g. in RequireJS
module loader).
These AMD modules can already be consumed by end-user who uses AMD in his
project:
require(['aerogear.authorization'], function( Authorization ) {
...
});
(Note that similarly we could compile to CommonJS module syntax, that could
be leveraged in Browserify projects today, but we agree with Luke to do not
dive into that atm).
We take it even further by allowing to leverage globally accessible API
AeroGear.Authorization without any module loader in your project. This way
you will be able to use AeroGear.js 1.3/2.0-like API as it is with no code
modifications.
AeroGear.Authorization
This is made to work by taking all the AMD modules, concatenating them and
wrapping them into minimal loader ("microlib") that exposes all the modules
on global AeroGear object.
Cheers,
~ Lukas
10 years, 1 month
Safari Push notifications
by Lucas Holmquist
Hello,
So i’ve decided to take today and try and add Safari Push notifications into the UPS. When i tried about a year ago, i was successful, but i had lots of duplicated code since it is very close to the iOS variant.
basically, the only real difference is that Safari notifications use the Production cert only. The other slight difference is how you send the message to the APNs service
I wondering if now is the time to start changing the variant names, so iOSVariant would become APNsVariant(or something like that).
This would also change the endpoint at which we connect from ‘ios' to ‘apns’ . Since this is sort of a breaking change, from a curl perspective, does this need to wait until a Major release?
plus this might make the current db migration stuff that is in progress more complex too
I have no problems keeping it separate, and then in a later release merging things together
wdyt?
-Luke
10 years, 1 month
Re: [aerogear-dev] AGPUSH-1047: Decouple UPS from Keycloak
by Pratik Parikh
Hi Bruno,
I have already taken this steps as part of the previous
troubleshooting. The problem is that adapter is keycloak expect a state
cookie which is not present in the header. This is either because of the
some application configuration in KeyCloak for UPS-JS or because something
is not getting set in UPS code based. Below is the debug trace, hope this
helps. At this point I am fully authenticate and am waiting for UPS
Angular App to load.
2014-11-17 15:03:11,360 DEBUG [org.keycloak.adapters.PreAuthActionsHandler]
(default task-26) adminRequest
https://XXX.XXX.XXX.XXX:8443/ag-push/index.html?code=HQUlGctT_-SJ3szGiVkD...
2014-11-17 15:03:11,360 DEBUG [org.keycloak.adapters.PreAuthActionsHandler]
(default task-26) adminRequest
https://XXX.XXX.XXX.XXX:8443/ag-push/index.html?code=HQUlGctT_-SJ3szGiVkD...
2014-11-17 15:03:11,360 DEBUG [org.keycloak.adapters.RequestAuthenticator]
(default task-26) session was null, returning null
2014-11-17 15:03:11,360 DEBUG
[org.keycloak.adapters.OAuthRequestAuthenticator] (default task-26) there
was a code, resolving
2014-11-17 15:03:11,360 DEBUG
[org.keycloak.adapters.OAuthRequestAuthenticator] (default task-26)
checking state cookie for after code
2014-11-17 15:03:11,360 WARN
[org.keycloak.adapters.OAuthRequestAuthenticator] (default task-26) No
state cookie
Regards,
--
Pratik Parikh
- Mantra - Keep It Simple and Straightforward
10 years, 1 month
Aerogear Website
by Andres Galante
Good morning, I've been working on Aerogears website and build a "live wireframe" to share with you and gather feedback.
The challenge was to combine a feature-orientated and a client-orientated UI, so this is what I propose:
The website itself is feature-orientated, since a user will want to know if the feature he wants to use its supported by other clients. But the documentation is client-orientated because I think that for example and Android developer doesn't want to read any iOS documentation.
Please view this on FireFox, I am using position sticky and I haven't done any js to make it work on other browsers.
Colors, spaces, sizes, fonts and styles are not done yet. This is just wireframe (better than a few squares with arrows though, plus its responsive).
On docs click on android docs to see how the submenu works, I am following the same pattern as in ionic, bootstrap, less and others
http://andresgalante.com/aerogearwebsite/
What do you think?
10 years, 1 month
File Upload
by Marc Pires
Hi Guys, well, i'm developing an app that uses the 1.6 version of
AeroGear. Everything is going very with except that i could not get an
image (from a UIImageView) upload to work.
Here what i'm doing.
1) Get a user photo from camera ou library
2) Issue a save request to the api endpoint.
The problem i'm having is that i get the following error:
*The operation couldn’t be completed. (NSURLErrorDomain error -1001.)"
UserInfo=0x79f01e00 {NSErrorFailingURLKey=http://<Server
IP>/service/test/uploadios, NSErrorFailingURLStringKey=http://**http://<Server
IP>/service/test/uploadios**, NSUnderlyingError=0x79fd9020 "The operation
couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.*
Below is the code i'm using from this:
-(void)performPhotoUpload
{
NSString *webservicePref = [[NSUserDefaults standardUserDefaults]
stringForKey:@"serviceUrlSetting"];
NSURL *projectsURL = [NSURL URLWithString:webservicePref];
id<AGPipe> registrationPipe;
AGPipeline *pipeline = [AGPipeline pipelineWithBaseURL:projectsURL];
registrationPipe = [pipeline pipe:^(id<AGPipeConfig> config) {
[config setName:@"/service/test/uploadios"];
[config setType:@"REST"];
}];
[registrationPipe save:[self extractMultiPartData]
success:^(id responseObject)
{
NSLog(@"Returned Object:%@", responseObject);
}
failure:^(NSError *error)
{
NSLog(@"Error:%@",[error description]);
}];
-(NSDictionary *)extractMultiPartData
{
NSString *filename = self.patientPhoto.accessibilityIdentifier;
//Check if an image was assigned for user
[self hasPhoto:filename];
NSData *imageData = UIImageJPEGRepresentation(self.patientPhoto.image,
0.2);
AGFileDataPart *dataPart = [[AGFileDataPart alloc]
initWithFileData:imageData
name:
@"image"
fileName
:filename
mimeType:
@"application/octet-stream"];
NSDictionary *imgDict = @{@"data": dataPart};
return imgDict;
--
Desenvolvedor IOS, Rails, RIA
http://www.linkedin.com/in/marcpires
http://about.me/marcelo_pires
10 years, 1 month
iOS Shoot Demo
by Lucas Holmquist
Hello,
so i was playing with the Shoot demo for iOS and connecting it to KC, a little research for a possible node.js adapter.
Anyway, i got everything working, i was able to perform the OAuth2 login, redirect back and upload a photo.
Then i went into the KC admin console thing, and disabled both the OAuth Client(shoot-third-party ) and the shoot-services, but when i then tried to upload, i was still successful.
i guess i was under the impression that once one or both of those things are disabled, the upload shouldn’t work.
as i’m writing i saw this PR come through, https://github.com/aerogear/aerogear-ios-cookbook/pull/45 <https://github.com/aerogear/aerogear-ios-cookbook/pull/45>, not sure if this will solve this issue though
-Luke
10 years, 2 months