[go: up one dir, main page]

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

Android notification system #1380

Merged
merged 14 commits into from
Sep 6, 2024
Merged

Android notification system #1380

merged 14 commits into from
Sep 6, 2024

Conversation

KoalaSat
Copy link
Member
@KoalaSat KoalaSat commented Jul 12, 2024

What does this PR do?

Screenshot from 2024-07-12 21-48-50

This PR includes all the necessary code to have torified notifications. A background job runs every 5 minutes, even if the app is off, to check if the user has new notifications on their active orders. Important points to consider:

  • There is a warning notification that runs every time the app starts, I couldn't find a way to show it only once, since it appears to be a warning forced by android.
  • The 5 minutes gap is set to avoid DDoSing our own coordinators, the idea is still to allow people to run coordinators with minimum reliable machines from home.
  • For the same reason, the android app has to see at least once the order of the robot, that way we make sure it's worth to query. Doing this for every robot in the garage for all coordinators every 5 minuter will be also dead by DDoS.
  • If the user taps on the notification, the app opens with the order view even if it was off. I had to do some black magic here because of WebView so it's worth testing.

This code also takes into consideration #1356, being compatible with latest release's code and these changes.

Checklist before merging

  • Install pre-commit and initialize it: pip install pre-commit, then pre-commit install. Pre-commit installs git hooks that automatically check the codebase. If pre-commit fails when you commit your changes, please fix the problems it points out.

}
}
});
}, []);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Necessary to catch navigation requests form the system

}
systemClient.setCookie('federation', JSON.stringify(federationUrls));
Copy link
Member Author
@KoalaSat KoalaSat Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Informs the system about current coordinators and their URLs, useful when changing to tesnet and to avoid duplication on the systems' code

@@ -3,6 +3,9 @@

<uses-permission android:name="android.permission.INTERNET" />

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New permissions to run notifications

fun updateTorKmpObject(newKmpObject: TorKmp) {
torKmp = newKmpObject
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can´t have 2 TorKmp running on your app, so this singleton makes sure it's accessible from the app and the notification foreground service

@@ -1,132 +0,0 @@
buildscript {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleaning the house

@KoalaSat KoalaSat force-pushed the android-notification-system branch from bff1c74 to b986c6e Compare July 13, 2024 13:36
@KoalaSat KoalaSat force-pushed the android-notification-system branch from b986c6e to 444ca99 Compare July 13, 2024 13:40
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we might have commited a few files under api/lightning that are not part of this PR and possibly shouod be ignored?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea why but these files has been extremely persistent on being created, everytine I tried to do a commit they appear probably because after-commit, any clue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed anyways

@KoalaSat
Copy link
Member Author
KoalaSat commented Sep 6, 2024

Tested and merging after some users giving good feedback

@KoalaSat KoalaSat merged commit e0bd103 into main Sep 6, 2024
@KoalaSat KoalaSat deleted the android-notification-system branch September 6, 2024 08:42
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

Successfully merging this pull request may close these issues.

2 participants