32
32
33
33
import java .util .UUID ;
34
34
35
+ import static com .onesignal .OneSignalPackagePrivateHelper .NotificationBundleProcessor .PUSH_ADDITIONAL_DATA_KEY ;
36
+ import static com .onesignal .OneSignalPackagePrivateHelper .OSNotificationFormatHelper .PAYLOAD_OS_ROOT_CUSTOM ;
37
+ import static com .onesignal .OneSignalPackagePrivateHelper .OSNotificationFormatHelper .PAYLOAD_OS_NOTIFICATION_ID ;
35
38
import static com .onesignal .OneSignalPackagePrivateHelper .GenerateNotification .BUNDLE_KEY_ACTION_ID ;
36
39
import static com .onesignal .InAppMessagingHelpers .ONESIGNAL_APP_ID ;
37
40
import static com .test .onesignal .RestClientAsserts .assertNotificationOpenAtIndex ;
57
60
@ RunWith (RobolectricTestRunner .class )
58
61
public class NotificationOpenedActivityHMSIntegrationTestsRunner {
59
62
63
+ private static final String TEST_ACTION_ID = "myTestActionId" ;
64
+
60
65
@ BeforeClass // Runs only once, before any tests
61
66
public static void setUpClass () throws Exception {
62
67
ShadowLog .stream = System .out ;
@@ -79,19 +84,19 @@ public void beforeEachTest() throws Exception {
79
84
private static @ NonNull Intent helper_basicOSHMSOpenIntent () throws JSONException {
80
85
return helper_baseHMSOpenIntent ()
81
86
.putExtra (
82
- "custom" ,
83
- new JSONObject () {{
84
- put ("i" , UUID .randomUUID ().toString ());
85
- }}.toString ()
87
+ PAYLOAD_OS_ROOT_CUSTOM ,
88
+ new JSONObject () {{
89
+ put (PAYLOAD_OS_NOTIFICATION_ID , UUID .randomUUID ().toString ());
90
+ }}.toString ()
86
91
);
87
92
}
88
93
89
94
private static @ NonNull Intent helper_basicOSHMSOpenIntentWithActionId (final @ NonNull String actionId ) throws JSONException {
90
95
return helper_baseHMSOpenIntent ()
91
96
.putExtra (
92
- "custom" ,
97
+ PAYLOAD_OS_ROOT_CUSTOM ,
93
98
new JSONObject () {{
94
- put ("i" , UUID .randomUUID ().toString ());
99
+ put (PAYLOAD_OS_NOTIFICATION_ID , UUID .randomUUID ().toString ());
95
100
put (BUNDLE_KEY_ACTION_ID , actionId );
96
101
}}.toString ()
97
102
);
@@ -139,7 +144,6 @@ public void barebonesOSPayload_makesNotificationOpenRequest() throws Exception {
139
144
assertNotificationOpenAtIndex (1 , UserState .DEVICE_TYPE_HUAWEI );
140
145
}
141
146
142
- private static final String TEST_ACTION_ID = "myTestActionId" ;
143
147
private static String lastActionId ;
144
148
@ Test
145
149
public void firesOSNotificationOpenCallbackWithActionId () throws Exception {
@@ -163,10 +167,10 @@ public void osIAMPreview_showsPreview() throws Exception {
163
167
164
168
Intent intent = helper_baseHMSOpenIntent ()
165
169
.putExtra (
166
- "custom" ,
170
+ PAYLOAD_OS_ROOT_CUSTOM ,
167
171
new JSONObject () {{
168
- put ("i" , UUID .randomUUID ().toString ());
169
- put ("a" , new JSONObject () {{
172
+ put (PAYLOAD_OS_NOTIFICATION_ID , UUID .randomUUID ().toString ());
173
+ put (PUSH_ADDITIONAL_DATA_KEY , new JSONObject () {{
170
174
put ("os_in_app_message_preview_id" , "UUID" );
171
175
}});
172
176
}}.toString ()
0 commit comments