Coder Social home page Coder Social logo

Comments (8)

david-allison avatar david-allison commented on June 16, 2024 1

This is a regression and we'll handle it

This wasn't a planned deprecation of functionality. We shouldn't break downstream decks (with the exception of necessary re-aligning with upstream Anki changes/functionality)

@hanpingchinese I'm a little stretched for time, please follow up if you don't see a PR by Sunday

from anki-android.

hanpingchinese avatar hanpingchinese commented on June 16, 2024
anki-bug-16405.mp4

from anki-android.

david-allison avatar david-allison commented on June 16, 2024

@BrayanDSO

Relevant:

var intent: Intent? = null
try {
if (url.startsWith("intent:")) {
intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME)
} else if (url.startsWith("android-app:")) {
intent = Intent.parseUri(url, Intent.URI_ANDROID_APP_SCHEME)
}
if (intent != null) {
if (packageManager.resolveActivityCompat(
intent,
ResolveInfoFlagsCompat.EMPTY
) == null
) {
val packageName = intent.getPackage()
if (packageName == null) {
Timber.d(
"Not using resolved intent uri because not available: %s",
intent
)
intent = null
} else {
Timber.d(
"Resolving intent uri to market uri because not available: %s",
intent
)
intent = Intent(
Intent.ACTION_VIEW,
Uri.parse("market://details?id=$packageName")
)
if (packageManager.resolveActivityCompat(
intent,
ResolveInfoFlagsCompat.EMPTY
) == null
) {
intent = null
}
}
} else {
// https://developer.chrome.com/multidevice/android/intents says that we should remove this
intent.addCategory(Intent.CATEGORY_BROWSABLE)
}
}
} catch (t: Throwable) {
Timber.w("Unable to parse intent uri: %s because: %s", url, t.message)
}
if (intent == null) {
Timber.d("Opening external link \"%s\" with an Intent", url)
intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
} else {
Timber.d("Opening resolved external link \"%s\" with an Intent: %s", url, intent)
}
try {
startActivity(intent)
} catch (e: ActivityNotFoundException) {
Timber.w(e) // Don't crash if the intent is not handled
}

from anki-android.

BrayanDSO avatar BrayanDSO commented on June 16, 2024

Why hanping doesn't use standard Android deep links? We are not in 2016 anymore. You can tell your app to accept android-app:// links without depending on AnkiDroid or any other app.

I don't see why such a scheme should be handled in AnkiDroid's end.

from anki-android.

hanpingchinese avatar hanpingchinese commented on June 16, 2024

There are still legacy APKs out there that rely on android-app:// so regardless of how things should be done now, it's still worth supporting IMO.

Also it's worth noting that the android-app scheme has not been deprecated.

Should the scheme be handled in AnkiDroid's end? Yes, for the reason that it has done so historically and AnkiDroid has always been strong at supporting legacy decks.

Side note: one main reason of using android-app scheme is the ability to target a specific app. Furthermore, the app has multiple flavors some of which would potentially share the same deep links. I know it's possible to work around all this, but things get messy quickly.

Regardless, I hope the legacy factor mentioned above should be enough for this to be treated as a bug worth fixing.

from anki-android.

hanpingchinese avatar hanpingchinese commented on June 16, 2024

Just one more point. If an app handles the android-app scheme, then you end up with an Intent chooser because Google app also supports that scheme.

from anki-android.

BrayanDSO avatar BrayanDSO commented on June 16, 2024

that it has done so historically and AnkiDroid has always been strong at supporting legacy decks.

I don't think that sticking to the past per se is a reason for keeping features. Otherwise, Chess notation should be restored and the legacy TTS should be undeprecated, since they break a lot of decks and the workarounds are way harder than adding a simple deeplink, and need to be done by the users, not us.

But, the feature is nice because of X and Y, so it should be kept is a valid reason and I'm fine with it.

I still recommend deeplinks as a failproof measure instead of depending on AnkiDroid to avoid situations like this one.

from anki-android.

MorenoTropical avatar MorenoTropical commented on June 16, 2024

Leave it to me

from anki-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.