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

Fix: incorrect activity path for NotificationOpenedActivityHMS #2243

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@
</intent-filter>
</service>

<!-- CAUTION: OneSignal backend includes the activity name in the payload, modifying the name without sync may result in notification click not firing -->
<activity
android:name="com.onesignal.notifications.activities.NotificationOpenedActivityHMS"
android:name="com.onesignal.NotificationOpenedActivityHMS"
Copy link
Member

Choose a reason for hiding this comment

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

Let's add a comment here that we can't change the android:name, since the OneSignal backend incudes it in the payload.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion. I have added the comment for the change.

android:noHistory="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:exported="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.onesignal.notifications.activities
package com.onesignal
Copy link
Member

Choose a reason for hiding this comment

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

Let's also put a comment here and before the class definition too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion. I have added the comment for the change. Note that I added it below the first line as first line comment is not allowed in the coding standard.

// OneSignal backend includes the activity name in the payload, modifying the namespace may result in notification click not firing

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import com.onesignal.OneSignal
import com.onesignal.common.threading.suspendifyBlocking
import com.onesignal.notifications.internal.open.INotificationOpenedProcessorHMS

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.onesignal.notifications

import io.kotest.core.spec.style.FunSpec
import org.junit.jupiter.api.assertDoesNotThrow

class ClassPathTests : FunSpec({
test("ensure the class path for NotificationOpenedActivityHMS.kt is in consistent with that returned by the backend service") {
// The test will fail if the classpath is changed by accident.
// If the change is intentional and corresponds with the backend update, modify or remove this test accordingly.
val fullClassName = "com.onesignal.NotificationOpenedActivityHMS"
assertDoesNotThrow {
Class.forName(fullClassName)
}
}
})
Loading