What I have
A webapp with Laravel 5.6.
A webview with React Native.
What I want to do
Only allow users to access to webapp via Webview.
Allow all users to access to home page of webapp via web browsers.
Allow web administrators to access to admin pages of webapp via both
of webview and web browsers.
My questions
Can I control these golds only with Laravel?
If yes, how to do it?
Should I separate homepage of webapp and content page of webapp into
2 difference domain (or sub domain)?
Or is therer any other suggestion?
Thank you.
Okay here is what i got after extracting android from react, we need to do following changes in android
MainActivity.java
// REMOTE RESOURCE
mWebView.loadUrl("YOUR_URL_HERE");
And
MyWebViewClient.java : just return false
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// if (Uri.parse(url).getHost().endsWith("YOUR_URL_HERE")) {
// return false;
// }
//
// Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
// view.getContext().startActivity(intent);
// return true;
return (false);
}
Hope it helps
Here's is my webview screenshot
Related
I have a Xamarin Forms app that uses the WebView component to display our PWA website. We are needing the WebView component to display the cached webpages when the user does not have an internet connection. This works fine in the Xamarin: Android project with no extra code needed. However, the WKWebView that is rendered for the Xamarin: iOS project, does not appear to display any cached pages.
I am fairly new to Xamarin development, and not sure if there is a way to enable the caching for the iOS project, so that it will function offline (like the Android project does). Does anyone know how to make the WKWebView serve up the cached webpages, when there is no internet connection?
There is a ReturnCacheDataElseLoad Cache type of NSUrlRequestCachePolicy , you can use that to load cache data first else load from web .
Have a look at apple's doc about NSURLRequestReturnCacheDataElseLoad
Use existing cache data, regardless or age or expiration date, loading from originating source only if there is no cached data.
Therefore , coding iOS Renderer as follow :
public class CustomWebViewRenderer :WkWebViewRenderer
{
protected override void OnElementChanged(VisualElementChangedEventArgs e)
{
base.OnElementChanged(e);
if(e.NewElement != null)
{
NSUrlRequest request = new NSUrlRequest(new NSUrl("https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/hybridwebview"), NSUrlRequestCachePolicy.ReturnCacheDataElseLoad, 5);
LoadRequest(request);
}
}
}
I'm new to NativeScript and I've been following the instructions here to create my app.
However I find out that all pages are hooked to the drawer, how do I unhook some pages, such as Login, Create ...?
You can get a reference to the sidedrawer and disable the interaction.
import { getRootView } from "tns-core-modules/application";
this.drawer = <RadSideDrawer>getRootView();
this.drawer.gesturesEnabled = false;
The above is implemented in the login page of this POC application.
I am working on facebook authentication in a Xamarin forms app and want to use "native" login on each device.
The Facebook SDK (by Xamarin) is not designed for forms since it requires passing in an Android activity that implements some specific interfaces.
However; I was able to get the UI to display using a custom page renderer and then in that renderer calling StartActitivty with an activity that uses the exact implementation described in the Facebook SDK getting started. https://components.xamarin.com/view/facebookandroid
So far everything works perfect. The android app starts, xamarin forms kicks in, the custom page renderer is loaded the login android activity starts and the user logs in with facebook and we get to the console.writeline below.
So, how do I dismiss this intent or otherwise get back to xamarin forms?
Do I:
Dismiss this intent? - if so then what?
Inject something to "reset" the main page?
Other?
public void OnCompleted (Xamarin.Facebook.Model.IGraphUser user, Response response)
{
//TODO: show user details with welcome and button that takes them to main app.
//TODO: switch back to xam forms from here on out.
//TODO: figure out how to change the `main` activity to xam forms.
// 'Me' request callback
if (user != null) {
//How do I get back to Xamarin forms from here?
Console.WriteLine ("GOT USER: " + user.Name);
} else {
Console.WriteLine ("Failed to get 'me'!");
}
}
You should call Finish();
Anyway, if you want to see exactly how I did it, you can check it here:
https://github.com/IdoTene/XamarinFormsNativeFacebook
I can get mobile site in mobile phones using the code below in the default controller index function. But I want to browse desktop version again in mobile. Since the code above resides in default controller index function, there is no way to browse desktop site in mobile, please help
public function index() {
$this -> load -> library('Mobile_Detect');
$detect = new Mobile_Detect();
if ($detect->isMobile()) {
header("Location: ".$this->config->item('base_url')."/mobile"); exit;
}
}
Maybe you can check if the device is mobile and then ask the user if they would like the mobile version or the full version, and then load one or the other.
Also take a look at this and see if it helps you.
I am having a problem with running multiple Facebook applications under a single Web application.
Similar to this problem:
Multiple facebook apps under one web application
I do like the solution suggested here, however the CanvasAuthorizeAttribute uses the FacebookApplication.Current internally and this is a static instance of the FB application within the Web application.
I can't call the .SetApplication method within the controller as I will have concurrency issues.
It would be nice if the FacebookApplication.Current called the Func that is passed into the .SetApplication instead of just calling inside of the .SetApplication.
That way I could pass a function that does my logic for retrieving the correct FB application.
Am I missing something that is already in the SDK?
You can always have your own logic at http://facebook.stackoverflow.com/questions/4931240/multiple-facebook-apps-under-one-web-application/4936703#4936703
private IFacebookApplication Current
{
get
{
var url = HttpContext.Current.Request.Url;
var app = GetSettingsForUrl(url);
// put your custom logic here and return the appropriate IFacebookApplication
return app;
}
}
But you should do this during Application_Start where it is still running on a single thread and not in Controller.