Adding a Facebook log-in button in a hybrid Worklight app - ios

I want to add a Facebook log-in button in a hybrid page in worklight and deploy it in iOS.
So far, we tried to add the log-in button in the hybrid part of worklight(js/html), but the button is not displayed, and the sdk is not called. We`re thinking that we cannot implement the Facebook log-in in the hybrid page and deploy it as a iOS hybrid app, since when we deployed it as a web application and run it in a mobile web browser it was fine.
We tried to implement the whole page as native, but the UI is a little different from our previous hybrid pages, we are thinking to add just the native Facebook log-in button in a hybrid page, the page consists of back button, header, buttons, labels, text-boxes,etc. The Facebook log-in button is located at the middle.
Can we implement this in worklight? or do you have any suggestions how to implement the facebook log-in button?
Any help would be greatly appreciated. Thank you.

Well, adding a UIButton into a Web View sounds not very possible to me.
What you could do instead, though, is make the button actually invoke a Cordova plug-in. The plug-in will implement -- in Objective-C -- the whole authentication flow you want, and when done return the control the Hybrid application.
If you're using Worklight 6.2, you can look at using the new Send Action API to easily transition between Worklight's ViewController (which embeds the Web View) to your ViewController (if you need one), or to just do some native code processing. I'm pretty sure you'll be able to create the desired experience this way.
Related reading:
Sending actions and data objects from JavaScript code to native code
Sending actions and data objects from native code to JavaScript code
Orientation issue with native pages in Worklight 6.2 and iOS7 (shows a quick implementation of Send Action, JavaScript)
Integration with Xcode Storyboard project (shows a quick implementation of Send Action, Objective-C)

Related

Show recaptcha in iOS native app from supremenewyork.com

I have an iOS app in which supremenewyork.com website is opened in web view. Sometime website shows one click recaptha (like when do payment).
My client wants to show the same recaptcha in the native app if it’s shown on website when user returns to the app. Is it possible?
If yes then how?
In theory, yes — this is entirely possible. You'll first want to get the data-sitekey by inspecting the page source that contains the CAPTCHA, after which you can use this repo this repo to get the initial implementation working in your iOS app (assuming by native you mean Swift).

How do I avoid the "Open this page in 'appName'" alert from appearing in Safari for iOS?

I am creating a flow that:
1) takes the user from my iOS app to my website through Safari
2) and then navigates back into the app via javascript
However when I try and redirect the user back to my app from my site using url schemes, i get the familiar "Open this page in 'appName'" alert.
Is there a way to avoid this alert from showing up? Is there some way to whitelist my website as a source for my app to allow me to direct the user back to my app w/out any alerts?
It seems like it might be possible with Universal Links, but I am wondering if there is a simpler way to do so.
EDIT: I should have mentioned that I have the unique requirement that I need to use Safari. I am processing donations in my app, and Apple requires you to go this through Safari and not a webview. Any ideas? –
You can achieve this using webView instead of Safari,so that
control will not go out of the App.
Now the problem is how to get the click from webView, for that you can
use this approach
How to invoke Objective C method from Javascript and send back data to Javascript in iOS?
I have integrated this approach in my App so this approach will work for sure. It feels like you are in APP & some times it will diificult to differentiate between WebPage & native page

Google Plus iPhone API sign in and share without leaving app

I have integrated the Google+ API in my App for login and sharing posts. Problem with it, is that everything requires you to leave the app and then come back (it uses URL schemes for this). This is not the expected behavior. I would like to know if there is a way to directly open up the login dialog within the my app it self without going to safari.
I really want to avoid going back and forth between safari and my app.
I just implemented same thing for my application. I have used Google's Sign In SDK. it will present Webview controller inside your app and let you login with your account, after that it will dismiss the Webview controller and call a delegate to get info for user.
Please read and follow the steps from this link,
https://developers.google.com/identity/sign-in/ios/
hope it answers the question.

Multiple page native flow using WL.NativePage.show?

I have instrumented a native iOS application with the Worklight API's and it functions properly.
However, when I start with a Hybrid application and transition to native using WL.NativePage.show() I can only see the first native page. Buttons on that page are clickable but I am not sent to the next native page. I added [NativePage showWebView:returnedData] to one of the buttons and I am returned successfully to the hybrid app.
So my question is simply, once I go into native code I should be able to continue in native until I call the NativePage function, correct?
This is an iOS application on MFP 7.0 and when I click the native buttons I get no messages in the console.
WL.Nativepage.show is very limited and problematic when it comes to added more and more native functionality, esp if you add more classes and start interacting between them. That is because it is not properly set in the viewcontrollers stack.
It was meant to be a single page where you do native interaction only in it and no more.
Since you're using MFPF 7, you should have the Send Action API, which give you full control over what you'll be able to do when using native code in your Hybrid application.
You can see an example here: Integrating a Worklight-based iOS app with Xcode Storyboard
Read more about it here: Sending actions and data objects between JavaScript code and native code
Basically, after you send an action to the native layer of the application, you create your own classes (rather than use MFP's WL.NativePage.show API) and thus you control the entire flow.

Cordova/Phonegap Social Sharing

I'm looking for an easy solution for sharing inside of a cordova/phonegap application. I'm looking to add facebook, twitter and email sharing. Much like this app has: http://itunes.apple.com/us/app/mars-hill-church/id322993145?mt=8. If you click through the sermons you can actually share an individual sermon.
I've tried using this: http://developers.facebook.com/docs/reference/dialogs/feed/. I was going to launch the share post inside of an iframe but unfortunately facebook doesn't allow you to load within iframe.
Preferably I want the share portion to stay inside the app as much as possible without launching safari. However, I would settle for a facebook button (Customized look), that I could click on and it launched me out of the app into safari to share a story.
Cordova 1.8
IOS 5
JQuery
Jquery Mobile
Have you tried the official plugin for Facebook Connect in Apache Cordova/PhoneGap? The code is hosted at
https://github.com/davejohnson/phonegap-plugin-facebook-connect
and there's a press release at
http://phonegap.com/2011/08/30/get-the-new-phonegap-facebook-platform-plugin/.
This sounds like what you're after, but I haven't tried it myself yet.

Resources