Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web link is opened in general browser intent #53

Open
unix14 opened this issue May 13, 2020 · 10 comments
Open

Web link is opened in general browser intent #53

unix14 opened this issue May 13, 2020 · 10 comments

Comments

@unix14
Copy link

unix14 commented May 13, 2020

Web link is opened in general browser intent instead of opening the custom web view implementation.

if not clear enough, i can add code

@mikemee
Copy link
Collaborator

mikemee commented May 13, 2020

@unix14 What’s the benefit? Do you know if the custom web view is available back to Android 15? Thanks!

@unix14
Copy link
Author

unix14 commented May 13, 2020

Well im not sure about backwards compabilities issues, but i was talking about this:
image
Once you overrided open Url function, it works for only some of the links, but whenever you click on "Web" link it's using the default and not overrided implementations, also called webHomePage.

@mikemee
Copy link
Collaborator

mikemee commented May 14, 2020

@unix14 Sorry, it's been a long time since I worked with this code. Perhaps you can add code to show me. FWIW, this is what we typically have in our apps to use this library. Not sure this helps to be honest, but I see it's a different override on open compared to the README:

    public void initAboutBox() {
        final AboutConfig aboutConfig = AboutConfig.getInstance();
        aboutConfig.appName = getString(R.string.app_name);
        aboutConfig.appIcon = R.mipmap.ic_launcher;
        aboutConfig.version = BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + ")";
        aboutConfig.aboutLabelTitle = getString(R.string.about_egghead_games);
        aboutConfig.packageName = getApplicationContext().getPackageName();
        aboutConfig.buildType = "google".equalsIgnoreCase(BuildConfig.FLAVOR_appstore)
                ? AboutConfig.BuildType.GOOGLE : AboutConfig.BuildType.AMAZON;

        aboutConfig.logUiEventName = LOG_UI_EVENT_NAME;
        aboutConfig.facebookUserName = FACEBOOK_USER_NAME;
        aboutConfig.twitterUserName = TWITTER_USER_NAME;
        aboutConfig.webHomePage = WEB_HOME_PAGE;
        aboutConfig.appPublisher = APP_PUBLISHER;
        aboutConfig.guideHtmlPath = GUIDE_HTML_PATH;
        aboutConfig.companyHtmlPath = COMPANY_HTML_PATH;
        aboutConfig.privacyHtmlPath = PRIVACY_HTML_PATH;
        aboutConfig.acknowledgmentHtmlPath = ACKNOWLEDGMENT_HTML_PATH;

        aboutConfig.emailAddress = EMAIL_ADDRESS;
        aboutConfig.emailSubject = getResources().getString(R.string.app_name) + " Question";
        aboutConfig.emailBody = "";
        aboutConfig.shareMessage = getString(R.string.share_message);
        aboutConfig.sharingTitle = getString(R.string.sharing_title);

        aboutConfig.dialog = new IDialog() {
            @Override
            public void open(AppCompatActivity appCompatActivity, String url, String tag) {
                GuideDialog guideDialog = GuideDialog.createDialog(url, tag, true);
                guideDialog.show(appCompatActivity.getSupportFragmentManager(), tag);
            }
        };
    }

Our GuideDialog extends DialogFragment and it uses a WebView with the passed url (within a view that adds a toolbar at the top with an "X" to handle closing).

@unix14
Copy link
Author

unix14 commented May 14, 2020

Well i didn't used GuideDialog but implemented my own open URL imlepemntation.. and it does work with all of the links, but "Web" link
image

if im still being not clear i can provide code but it's using CustomTabs in order to launch a mini in-app browser, and it's kinda out-of-scope of the About Box.

@mikemee
Copy link
Collaborator

mikemee commented May 14, 2020

So it works ok PrivacyPolicy but not for an external web page? Interesting. Perhaps because of the CustomTabs need? Yes, perhaps provide a PR that demonstrates what you need (code is often easier than English!), and if it's general enough we can add it.

FWIW, the relevant code is this (from here, though I suspect you know that:

    public static void openHTMLPage(Activity context, String htmlPath) {
        context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(htmlPath)));
    }

That same code is used in both the PrivacyPolicy and view web page scenarios, so I'm a bit confused. Sorry!

@unix14
Copy link
Author

unix14 commented May 14, 2020

Lol
The code is the same code you entered here above, which is the same code in documentation,
image
I will try to make it simple.
Whenever i override this function :
image
and do whatever i want inside of the implementation,
And then click on either of this :
image
It's working the overrided function i provided and works correctly, but if i click on this:
image
It's just opens a regular browser intent, basically it's working this implementation:
image
Instead of running my implementation of open URL function

Hope everything is clear now

@mikemee
Copy link
Collaborator

mikemee commented May 14, 2020

Thanks! Ok, we’ll chat about this and think about fixes.

@unix14
Copy link
Author

unix14 commented May 15, 2020

BTW - I'd recommend to use LeakCanary to detect leaks in this library, because I've found it to leak without even starting the AboutActivity...

@unix14
Copy link
Author

unix14 commented May 21, 2020

updated now to 2.0.1, and I still see leaks reports (am using LeakCanary),
Also i would make the DarkMode optional, and maybe even with a black(ish) background and white textColor and icon's tint.. because the traditional dark mode should not be with a white background, obviously 😄

Keep up the great work!

edit::::

Web link STILL opens in general browser intent INSTEAD of using the custom implementation i provided
image

@unix14
Copy link
Author

unix14 commented May 21, 2020

AboutUsActivity:
image

instead of line 212 you should enter the same as in here
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants