-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Subscriptions shortcuts #2434
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
Subscriptions shortcuts #2434
Conversation
|
@nv95 Works good, I'll go through the code soon. Could you take a look at the conflict? final boolean shortcutSupported = ShortcutManagerCompat.isRequestPinShortcutSupported(context);
final ArrayList<String> commands = new ArrayList<>(3);
commands.add(context.getResources().getString(R.string.unsubscribe));
if (shortcutSupported) {
commands.add(context.getResources().getString(R.string.create_shortcut));
}
commands.add(context.getResources().getString(R.string.share));
final DialogInterface.OnClickListener actions = (dialogInterface, i) -> {
final int commandIndexOffset = shortcutSupported ? 0 : 1;
if (i == 0) {
deleteChannel(selectedItem);
} else if (i + commandIndexOffset == 1) {
ShortcutsHelper.pinShortcut(context, selectedItem);
} else if (i + commandIndexOffset == 2) {
shareChannel(selectedItem);
}
}; |
|
Could you provide an apk? ;-) |
|
Release variant, signed by my key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to test since my launcher does not support shortcuts (I'm on Android 7.1, EMUI 5.0.4)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the idea putting this in a service is a good one, a IntentService would be a good fit here. It'd fix the situation of a slow network and the user moving away from the app, because when the call finally returns with the image, the following exception will be thrown: java.lang.IllegalStateException: Calling application must have a foreground activity or a foreground service. Starting the foreground status would be required here.
When using the image loader and the image comes from the cache, it's almost impossible to exit in time to cause this bug. But it is very possible when the user is in a slow network and the image happens to not be in the cache.
Some considerations:
- Remove shortcut from the list when unsubscribing.
- Maybe update the metadata of the shortcut?
- Though we should respect the rate limiting of the API.
|
@mauriciocolli I think, use service for shortcuts is not a good idea. |
679bc75 to
2aeccc0
Compare
|
No progress since a year, no GitHub actions build and merge conflicts. Closing this for now. Feel free to reopen it when there is progress again. |
Adding desktop shortcuts for subscriptions and application shortcuts (on Android 7.1+)