-
-
Notifications
You must be signed in to change notification settings - Fork 182
Feature : Add option to delete application #148
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
Conversation
jmattheis
left a comment
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.
Thanks for your contribution, remarks in subcomments.
| alert.setMessage("Are you sure?"); | ||
| alert.setPositiveButton( | ||
| "YES", | ||
| new DialogInterface.OnClickListener() { |
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.
Simplify this with a lambda:
alert.setPositiveButton( "YES", (dialog, which) -> deleteApp(appId));
| if (item.getItemId() == R.id.action_delete_app) { | ||
| android.app.AlertDialog.Builder alert = new android.app.AlertDialog.Builder(this); | ||
| alert.setTitle(R.string.delete_app); | ||
| alert.setMessage("Are you sure?"); |
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.
This message and yes/no should be added to strings.xml.
| } | ||
|
|
||
| private void deleteApp(Long appId) { | ||
| Thread thread = |
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.
You can use the async version of the api call instead of creating a thread for this:
private void deleteApp(Long appId) {
ApiClient client =
ClientFactory.clientToken(settings.url(), settings.sslSettings(), settings.token());
client.createService(ApplicationApi.class)
.deleteApp(appId)
.enqueue(
Callback.callInUI(
this,
(ignored) -> refreshAll(),
(e) -> Utils.showSnackBar(this, "Could not delete app")));
}"Could not delete app" should be put into strings.xml
jmattheis
left a comment
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.
Thanks
Since this feature can be useful for the main version I'm PR here. It will be used on the unifiedpush branch to unregister app too
If gotify shows all messages, nothing change.
If we select an app, the right corner menu add "Delete this application" option which shows a dialog to acknowledge to delete the application.
If yes is selected it deletes the app and refresh.
else it does nothing