-
-
Notifications
You must be signed in to change notification settings - Fork 45
Added PushNotificationActivity and handle navigation for it #3313
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
Changes from all commits
8313b55
e80fc4f
46436b5
b468a46
098abfd
41b639e
134ef25
185eefb
3975e22
b1ca828
a19d80a
dcdb19b
16ed3a3
ec3fae5
bf8e794
c01fd27
4eebd9f
667f8dc
c1967db
8f3534e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -580,7 +580,7 @@ | |
| <receiver | ||
| android:name="org.commcare.services.PaymentAcknowledgeReceiver" | ||
| android:exported="false"/> | ||
| <activity android:name="org.commcare.activities.connect.PersonalIdCredentialActivity"/> | ||
| <activity android:name="org.commcare.activities.PushNotificationActivity" /> | ||
| </application> | ||
|
Comment on lines
+583
to
584
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Harden component declaration: explicitly set exported, parent activity, and label. The activity has no intent-filters, so it should not be exported. Also wire Up-navigation at the manifest level and set the screen label. Apply: - <activity android:name="org.commcare.activities.PushNotificationActivity" />
+ <activity
+ android:name="org.commcare.activities.PushNotificationActivity"
+ android:exported="false"
+ android:label="@string/personalid_notification"
+ android:parentActivityName="org.commcare.activities.connect.ConnectActivity">
+ <meta-data
+ android:name="android.support.PARENT_ACTIVITY"
+ android:value="org.commcare.activities.connect.ConnectActivity" />
+ </activity>🤖 Prompt for AI Agents |
||
|
|
||
| </manifest> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:width="24dp" | ||
| android:height="24dp" | ||
| android:viewportWidth="24" | ||
| android:viewportHeight="24"> | ||
| <path | ||
| android:pathData="M20.431,15.078C19.306,14.043 18.447,12.954 18.447,9.262C18.447,6.151 15.901,3.617 12.661,3.309V2.625C12.66,2.278 12.375,2 12.018,2C11.66,2 11.375,2.278 11.375,2.625V3.309C8.136,3.616 5.553,6.152 5.553,9.262C5.553,12.953 4.694,14.043 3.569,15.078C3.006,15.601 2.83,16.387 3.117,17.08C3.444,17.793 4.147,18.25 4.946,18.25H19.089C19.887,18.25 20.59,17.791 20.882,17.113C21.17,16.387 20.993,15.598 20.431,15.078ZM19.089,17H4.946C4.373,17 4.087,16.355 4.489,16.02C5.89,14.721 6.874,13.27 6.874,9.297C6.839,6.629 9.173,4.5 12.018,4.5C14.862,4.5 17.16,6.629 17.16,9.262C17.16,13.223 18.135,14.684 19.546,15.984C19.949,16.359 19.656,17 19.089,17ZM13.95,19.5C13.651,19.5 13.373,19.662 13.271,19.925C13.086,20.406 12.592,20.75 11.981,20.75C11.371,20.75 10.912,20.405 10.726,19.925C10.66,19.66 10.382,19.5 10.081,19.5C9.655,19.5 9.343,19.89 9.475,20.27C9.824,21.273 10.832,22 11.981,22C13.165,22 14.174,21.272 14.522,20.27C14.689,19.855 14.38,19.5 13.95,19.5Z" | ||
| android:fillColor="#ffffff"/> | ||
| </vector> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:width="24dp" | ||
| android:height="24dp" | ||
| android:viewportWidth="24" | ||
| android:viewportHeight="24"> | ||
| <path | ||
| android:pathData="M20.431,15.078C19.306,14.043 18.447,12.954 18.447,9.262C18.447,6.151 15.901,3.617 12.661,3.309V2.625C12.66,2.278 12.375,2 12.018,2C11.66,2 11.375,2.278 11.375,2.625V3.309C8.136,3.616 5.553,6.152 5.553,9.262C5.553,12.953 4.694,14.043 3.569,15.078C3.006,15.601 2.83,16.387 3.117,17.08C3.444,17.793 4.147,18.25 4.946,18.25H19.089C19.887,18.25 20.59,17.791 20.882,17.113C21.17,16.387 20.993,15.598 20.431,15.078ZM19.089,17H4.946C4.373,17 4.087,16.355 4.489,16.02C5.89,14.721 6.874,13.27 6.874,9.297C6.839,6.629 9.173,4.5 12.018,4.5C14.862,4.5 17.16,6.629 17.16,9.262C17.16,13.223 18.135,14.684 19.546,15.984C19.949,16.359 19.656,17 19.089,17ZM13.95,19.5C13.651,19.5 13.373,19.662 13.271,19.925C13.086,20.406 12.592,20.75 11.981,20.75C11.371,20.75 10.912,20.405 10.726,19.925C10.66,19.66 10.382,19.5 10.081,19.5C9.655,19.5 9.343,19.89 9.475,20.27C9.824,21.273 10.832,22 11.981,22C13.165,22 14.174,21.272 14.522,20.27C14.689,19.855 14.38,19.5 13.95,19.5Z" | ||
| android:fillColor="#ffffff"/> | ||
| <group> | ||
| <clip-path | ||
| android:pathData="M20.431,15.078C19.306,14.043 18.447,12.954 18.447,9.262C18.447,6.151 15.901,3.617 12.661,3.309V2.625C12.66,2.278 12.375,2 12.018,2C11.66,2 11.375,2.278 11.375,2.625V3.309C8.136,3.616 5.553,6.152 5.553,9.262C5.553,12.953 4.694,14.043 3.569,15.078C3.006,15.601 2.83,16.387 3.117,17.08C3.444,17.793 4.147,18.25 4.946,18.25H19.089C19.887,18.25 20.59,17.791 20.882,17.113C21.17,16.387 20.993,15.598 20.431,15.078ZM19.089,17H4.946C4.373,17 4.087,16.355 4.489,16.02C5.89,14.721 6.874,13.27 6.874,9.297C6.839,6.629 9.173,4.5 12.018,4.5C14.862,4.5 17.16,6.629 17.16,9.262C17.16,13.223 18.135,14.684 19.546,15.984C19.949,16.359 19.656,17 19.089,17ZM13.95,19.5C13.651,19.5 13.373,19.662 13.271,19.925C13.086,20.406 12.592,20.75 11.981,20.75C11.371,20.75 10.912,20.405 10.726,19.925C10.66,19.66 10.382,19.5 10.081,19.5C9.655,19.5 9.343,19.89 9.475,20.27C9.824,21.273 10.832,22 11.981,22C13.165,22 14.174,21.272 14.522,20.27C14.689,19.855 14.38,19.5 13.95,19.5Z"/> | ||
| <path | ||
| android:pathData="M20.431,15.078L27.216,7.732L27.209,7.726L27.202,7.719L20.431,15.078ZM12.661,3.309H2.661V12.401L11.713,13.264L12.661,3.309ZM12.661,2.625H22.661V2.613L22.661,2.602L12.661,2.625ZM11.375,3.309L12.321,13.264L21.375,12.403V3.309H11.375ZM3.569,15.078L-3.202,7.719L-3.22,7.736L-3.238,7.752L3.569,15.078ZM3.117,17.08L-6.125,20.899L-6.051,21.078L-5.97,21.254L3.117,17.08ZM20.882,17.113L30.069,21.062L30.124,20.934L30.176,20.803L20.882,17.113ZM4.489,16.02L10.903,23.691L11.099,23.528L11.286,23.354L4.489,16.02ZM6.874,9.297H16.874V9.23L16.874,9.163L6.874,9.297ZM19.546,15.984L26.362,8.667L26.343,8.649L26.323,8.631L19.546,15.984ZM13.271,19.925L3.948,16.308L3.942,16.324L3.936,16.34L13.271,19.925ZM10.726,19.925L1.025,22.353L1.177,22.96L1.403,23.543L10.726,19.925ZM9.475,20.27L18.921,16.986L18.919,16.983L9.475,20.27ZM14.522,20.27L5.252,16.518L5.158,16.751L5.075,16.99L14.522,20.27ZM20.431,15.078L27.202,7.719C27.079,7.606 27.272,7.77 27.524,8.093C27.814,8.463 28.075,8.9 28.264,9.359C28.603,10.181 28.447,10.443 28.447,9.262H18.447H8.447C8.447,11.773 8.721,14.425 9.77,16.973C10.931,19.793 12.641,21.5 13.66,22.437L20.431,15.078ZM18.447,9.262H28.447C28.447,0.321 21.28,-5.916 13.61,-6.646L12.661,3.309L11.713,13.264C10.521,13.15 8.447,11.982 8.447,9.262H18.447ZM12.661,3.309H22.661V2.625H12.661H2.661V3.309H12.661ZM12.661,2.625L22.661,2.602C22.647,-3.498 17.646,-8 12.018,-8V2V12C7.104,12 2.674,8.055 2.661,2.648L12.661,2.625ZM12.018,2V-8C6.394,-8 1.375,-3.498 1.375,2.625H11.375H21.375C21.375,8.055 16.926,12 12.018,12V2ZM11.375,2.625H1.375V3.309H11.375H21.375V2.625H11.375ZM11.375,3.309L10.429,-6.647C2.836,-5.925 -4.447,0.249 -4.447,9.262H5.553H15.553C15.553,10.575 14.988,11.631 14.356,12.271C13.747,12.885 13.017,13.198 12.321,13.264L11.375,3.309ZM5.553,9.262H-4.447C-4.447,10.442 -4.602,10.181 -4.264,9.359C-4.075,8.9 -3.815,8.464 -3.525,8.093C-3.273,7.77 -3.08,7.606 -3.202,7.719L3.569,15.078L10.34,22.437C11.36,21.499 13.069,19.792 14.23,16.973C15.279,14.425 15.553,11.773 15.553,9.262H5.553ZM3.569,15.078L-3.238,7.752C-6.783,11.046 -8.046,16.251 -6.125,20.899L3.117,17.08L12.359,13.262C13.707,16.523 12.795,20.156 10.376,22.404L3.569,15.078ZM3.117,17.08L-5.97,21.254C-4.019,25.503 0.224,28.25 4.946,28.25V18.25V8.25C8.071,8.25 10.907,10.083 12.204,12.906L3.117,17.08ZM4.946,18.25V28.25H19.089V18.25V8.25H4.946V18.25ZM19.089,18.25V28.25C23.663,28.25 28.115,25.61 30.069,21.062L20.882,17.113L11.694,13.165C13.067,9.972 16.111,8.25 19.089,8.25V18.25ZM20.882,17.113L30.176,20.803C31.961,16.307 30.875,11.111 27.216,7.732L20.431,15.078L13.646,22.424C11.113,20.084 10.379,16.466 11.588,13.423L20.882,17.113ZM19.089,17V7H4.946V17V27H19.089V17ZM4.946,17V7C8.656,7 11.945,9.197 13.445,12.474C14.994,15.859 14.571,20.625 10.903,23.691L4.489,16.02L-1.926,8.348C-5.995,11.75 -6.476,17.006 -4.741,20.797C-3.055,24.481 0.663,27 4.946,27V17ZM4.489,16.02L11.286,23.354C12.579,22.156 14.279,20.318 15.452,17.473C16.546,14.819 16.874,12.038 16.874,9.297H6.874H-3.126C-3.126,9.891 -3.163,10.184 -3.176,10.264C-3.187,10.329 -3.165,10.158 -3.038,9.849C-2.902,9.519 -2.714,9.199 -2.509,8.929C-2.326,8.688 -2.204,8.588 -2.309,8.685L4.489,16.02ZM6.874,9.297L16.874,9.163C16.924,12.905 13.875,14.5 12.018,14.5V4.5V-5.5C4.471,-5.5 -3.246,0.353 -3.125,9.431L6.874,9.297ZM12.018,4.5V14.5C10.077,14.5 7.161,12.862 7.161,9.262H17.16H27.16C27.16,0.396 19.648,-5.5 12.018,-5.5V4.5ZM17.16,9.262H7.161C7.161,11.989 7.484,14.766 8.574,17.419C9.743,20.268 11.444,22.117 12.769,23.338L19.546,15.984L26.323,8.631C26.228,8.543 26.356,8.649 26.543,8.896C26.751,9.17 26.94,9.493 27.075,9.822C27.201,10.13 27.222,10.3 27.211,10.232C27.198,10.15 27.16,9.856 27.16,9.262H17.16ZM19.546,15.984L12.73,23.302C9.553,20.342 9.031,15.908 10.573,12.505C12.059,9.226 15.35,7 19.089,7V17V27C23.395,27 27.116,24.454 28.789,20.76C30.519,16.944 29.942,12.001 26.362,8.667L19.546,15.984ZM13.95,19.5V9.5C10.366,9.5 5.826,11.468 3.948,16.308L13.271,19.925L22.594,23.542C20.921,27.856 16.937,29.5 13.95,29.5V19.5ZM13.271,19.925L3.936,16.34C5.361,12.629 8.815,10.75 11.981,10.75V20.75V30.75C16.369,30.75 20.812,28.184 22.607,23.51L13.271,19.925ZM11.981,20.75V10.75C15.474,10.75 18.733,12.918 20.048,16.307L10.726,19.925L1.403,23.543C3.092,27.892 7.268,30.75 11.981,30.75V20.75ZM10.726,19.925L20.427,17.497C18.872,11.287 13.224,9.5 10.081,9.5V19.5V29.5C7.54,29.5 2.447,28.033 1.025,22.353L10.726,19.925ZM10.081,19.5V9.5C3.968,9.5 -2.742,15.591 0.031,23.558L9.475,20.27L18.919,16.983C21.428,24.19 15.341,29.5 10.081,29.5V19.5ZM9.475,20.27L0.03,23.554C1.82,28.704 6.71,32 11.981,32V22V12C14.955,12 17.828,13.843 18.921,16.986L9.475,20.27ZM11.981,22V32C17.217,32 22.156,28.768 23.968,23.551L14.522,20.27L5.075,16.99C6.191,13.777 9.114,12 11.981,12V22ZM14.522,20.27L23.791,24.023C25.169,20.619 24.729,16.626 22.336,13.568C20.12,10.735 16.882,9.5 13.95,9.5V19.5V29.5C11.448,29.5 8.58,28.443 6.584,25.891C4.411,23.114 4.042,19.507 5.252,16.518L14.522,20.27Z" | ||
| android:fillColor="#ffffff"/> | ||
| </group> | ||
| <path | ||
| android:pathData="M20.417,2.5m-2.5,0a2.5,2.5 0,1 1,5 0a2.5,2.5 0,1 1,-5 0" | ||
| android:fillColor="#E44434"/> | ||
| </vector> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <androidx.constraintlayout.widget.ConstraintLayout | ||
| xmlns:android="http://schemas.android.com/apk/res/android" | ||
| xmlns:tools="http://schemas.android.com/tools" | ||
| android:id="@+id/main" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="match_parent" | ||
| tools:context="org.commcare.activities.PushNotificationActivity"> | ||
|
|
||
| </androidx.constraintlayout.widget.ConstraintLayout> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,14 @@ | |
| android:title="@string/personalid_credential" | ||
| android:visible="false" | ||
| app:showAsAction="always" /> | ||
|
|
||
| <item | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lets hide it for now on UI untill we decide to publish this out to the users
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, we need to show icon with dot if there are new push notifications available.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Jignesh-dimagi I think this can be managed using flag while creating db schema for push notification
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jaypanchal-13 do you plan to address that in a separate PR or this one ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @shubham1g5 there is different PR for notification db schema in that we can add flag for it and manage it there. What's your suggestion?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good to me
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jaypanchal-13 I agree for the logic but we need to have bell icon with dot in this PR only so that it can directly used in your next PR.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Jignesh-dimagi Added new notification bell icon |
||
| android:id="@+id/action_bell" | ||
| android:icon="@drawable/ic_bell" | ||
| android:title="@string/personalid_notification" | ||
| android:visible="false" | ||
| app:showAsAction="always" /> | ||
|
|
||
| <item | ||
| android:id="@+id/action_sync" | ||
| android:icon="@drawable/ic_backup" | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,11 @@ | ||||||||||||||||||||||||||||||
| <?xml version="1.0" encoding="utf-8"?> | ||||||||||||||||||||||||||||||
| <menu xmlns:android="http://schemas.android.com/apk/res/android" | ||||||||||||||||||||||||||||||
| xmlns:app="http://schemas.android.com/apk/res-auto"> | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| <item | ||||||||||||||||||||||||||||||
| android:id="@+id/notification_cloud_sync" | ||||||||||||||||||||||||||||||
| android:icon="@drawable/ic_backup" | ||||||||||||||||||||||||||||||
| app:iconTint="@color/white" | ||||||||||||||||||||||||||||||
| android:title="@string/personalid_sync_menu_title" | ||||||||||||||||||||||||||||||
| app:showAsAction="always" /> | ||||||||||||||||||||||||||||||
| </menu> | ||||||||||||||||||||||||||||||
|
Comment on lines
+5
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent ❓ Verification inconclusiveAdd tooltip and verify string exists across locales.
Apply: <item
android:id="@+id/notification_cloud_sync"
android:icon="@drawable/ic_backup"
app:iconTint="@color/white"
android:title="@string/personalid_sync_menu_title"
+ android:tooltipText="@string/personalid_sync_menu_title"
app:showAsAction="always" />Run to verify strings: 🏁 Script executed: #!/bin/bash
rg -nP '<string name="personalid_sync_menu_title"\b' app/res/values*/*.xml -C0Length of output: 1401 Add tooltip and define missing string resource
<item
android:id="@+id/notification_cloud_sync"
android:icon="@drawable/ic_backup"
app:iconTint="@color/white"
android:title="@string/personalid_sync_menu_title"
+ android:tooltipText="@string/personalid_sync_menu_title"
app:showAsAction="always" />📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| package org.commcare.activities | ||
|
|
||
| import android.os.Bundle | ||
| import android.view.Menu | ||
| import android.view.MenuItem | ||
| import androidx.appcompat.app.AppCompatActivity | ||
| import org.commcare.dalvik.R | ||
| import org.commcare.dalvik.databinding.ActivityPushNotificationBinding | ||
|
|
||
| class PushNotificationActivity : AppCompatActivity() { | ||
| private val binding: ActivityPushNotificationBinding by lazy { | ||
| ActivityPushNotificationBinding.inflate(layoutInflater) | ||
| } | ||
|
|
||
| override fun onCreate(savedInstanceState: Bundle?) { | ||
| super.onCreate(savedInstanceState) | ||
| setContentView(binding.root) | ||
| setUpUi() | ||
| } | ||
|
|
||
| private fun setUpUi() { | ||
| supportActionBar!!.apply { | ||
| title = getString(R.string.personalid_notification) | ||
| setDisplayShowHomeEnabled(true) | ||
| setDisplayHomeAsUpEnabled(true) | ||
| } | ||
| } | ||
shubham1g5 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| override fun onCreateOptionsMenu(menu: Menu): Boolean { | ||
| menuInflater.inflate(R.menu.menu_notification, menu) | ||
| return true | ||
| } | ||
|
|
||
| override fun onOptionsItemSelected(item: MenuItem): Boolean { | ||
| return when (item.itemId) { | ||
| android.R.id.home -> { | ||
| onBackPressedDispatcher.onBackPressed() | ||
| true | ||
| } | ||
|
|
||
| R.id.notification_cloud_sync -> { | ||
| //api call to sync notification | ||
| true | ||
| } | ||
|
|
||
| else -> super.onOptionsItemSelected(item) | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.