Skip to content

Commit 01b3cdc

Browse files
committed
Fix gradle build-related issues
1 parent 06683dc commit 01b3cdc

File tree

8 files changed

+37
-33
lines changed

8 files changed

+37
-33
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: "[Test] SDK Unit Tests"
3838
working-directory: OneSignalSDK
3939
run: |
40-
./gradlew unittest:testReleaseUnitTest --console=plain
40+
./gradlew test --console=plain
4141
- name: Unit tests results
4242
if: failure()
4343
uses: actions/upload-artifact@v3

Examples/OneSignalDemo/app/agconnect-services.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
"project_id":"9105385871709201822",
2424
"app_id":"102009847",
2525
"api_key":"CV68fkx9E2fU8Fv/v3zbuO8+rCjJ8w6QiMha7ZJUpIGTxs08n0/ddVXbOueUKBtxf3sD+ni8WPx27htLHhtse5eP5VrT",
26-
"package_name":"com.onesignal.example"
26+
"package_name":"com.onesignal.sdktest"
2727
},
2828
"oauth_client":{
2929
"client_id":"102009847",
3030
"client_type":1
3131
},
3232
"app_info":{
3333
"app_id":"102009847",
34-
"package_name":"com.onesignal.example"
34+
"package_name":"com.onesignal.sdktest"
3535
},
3636
"service":{
3737
"analytics":{
@@ -53,12 +53,12 @@
5353
"configuration_version":"3.0",
5454
"appInfos":[
5555
{
56-
"package_name":"com.onesignal.example",
56+
"package_name":"com.onesignal.sdktest",
5757
"client":{
5858
"app_id":"102009847"
5959
},
6060
"app_info":{
61-
"package_name":"com.onesignal.example",
61+
"package_name":"com.onesignal.sdktest",
6262
"app_id":"102009847"
6363
},
6464
"oauth_client":{

Examples/OneSignalDemo/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ android {
3030
huawei {
3131
dimension "default"
3232
minSdkVersion 17
33-
applicationId "com.onesignal.example"
33+
applicationId "com.onesignal.sdktest"
3434
}
3535
}
3636

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package com.onesignal.sdktest.notification;
22

33
import android.os.Bundle;
4+
import android.util.Log;
45

56
import com.huawei.hms.push.HmsMessageService;
67
import com.huawei.hms.push.RemoteMessage;
7-
import com.onesignal.OneSignal;
8-
import com.onesignal.OneSignalHmsEventBridge;
8+
import com.onesignal.notifications.bridges.OneSignalHmsEventBridge;
99

1010
public class HmsMessageServiceAppLevel extends HmsMessageService {
1111

@@ -19,19 +19,19 @@ public class HmsMessageServiceAppLevel extends HmsMessageService {
1919
*/
2020
@Override
2121
public void onNewToken(String token, Bundle bundle) {
22-
OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "HmsMessageServiceAppLevel onNewToken refresh token:" + token + " bundle: " + bundle);
22+
Log.d("MainApplication", "HmsMessageServiceAppLevel onNewToken refresh token:" + token + " bundle: " + bundle);
2323

2424
// Forward event on to OneSignal SDK
25-
OneSignalHmsEventBridge.onNewToken(this, token, bundle);
25+
OneSignalHmsEventBridge.INSTANCE.onNewToken(this, token, bundle);
2626
}
2727

2828
@Deprecated
2929
@Override
3030
public void onNewToken(String token) {
31-
OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "HmsMessageServiceAppLevel onNewToken refresh token:" + token);
31+
Log.d("MainApplication", "HmsMessageServiceAppLevel onNewToken refresh token:" + token);
3232

3333
// Forward event on to OneSignal SDK
34-
OneSignalHmsEventBridge.onNewToken(this, token);
34+
OneSignalHmsEventBridge.INSTANCE.onNewToken(this, token);
3535
}
3636

3737
/**
@@ -44,18 +44,18 @@ public void onNewToken(String token) {
4444
*/
4545
@Override
4646
public void onMessageReceived(RemoteMessage message) {
47-
OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "HMS onMessageReceived: " + message);
48-
OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "HMS onMessageReceived.ttl:" + message.getTtl());
49-
OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "HMS onMessageReceived.data:" + message.getData());
50-
OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "HMS onMessageReceived.title: " + message.getNotification().getTitle());
51-
OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "HMS onMessageReceived.body: " + message.getNotification().getBody());
52-
OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "HMS onMessageReceived.icon: " + message.getNotification().getIcon());
53-
OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "HMS onMessageReceived.color: " + message.getNotification().getColor());
54-
OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "HMS onMessageReceived.channelId: " + message.getNotification().getChannelId());
55-
OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "HMS onMessageReceived.imageURL: " + message.getNotification().getImageUrl());
56-
OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "HMS onMessageReceived.tag: " + message.getNotification().getTag());
47+
Log.d("MainApplication", "HMS onMessageReceived: " + message);
48+
Log.d("MainApplication", "HMS onMessageReceived.ttl:" + message.getTtl());
49+
Log.d("MainApplication", "HMS onMessageReceived.data:" + message.getData());
50+
Log.d("MainApplication", "HMS onMessageReceived.title: " + message.getNotification().getTitle());
51+
Log.d("MainApplication", "HMS onMessageReceived.body: " + message.getNotification().getBody());
52+
Log.d("MainApplication", "HMS onMessageReceived.icon: " + message.getNotification().getIcon());
53+
Log.d("MainApplication", "HMS onMessageReceived.color: " + message.getNotification().getColor());
54+
Log.d("MainApplication", "HMS onMessageReceived.channelId: " + message.getNotification().getChannelId());
55+
Log.d("MainApplication", "HMS onMessageReceived.imageURL: " + message.getNotification().getImageUrl());
56+
Log.d("MainApplication", "HMS onMessageReceived.tag: " + message.getNotification().getTag());
5757

5858
// Forward event on to OneSignal SDK
59-
OneSignalHmsEventBridge.onMessageReceived(this, message);
59+
OneSignalHmsEventBridge.INSTANCE.onMessageReceived(this, message);
6060
}
6161
}

Examples/OneSignalDemo/app/src/main/res/layout/main_activity_layout.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@
272272

273273
<!-- Aliases -->
274274
<LinearLayout
275-
android:id="@+id/main_activity_account_linear_layout"
275+
android:id="@+id/main_activity_aliases_linear_layout"
276276
android:layout_width="match_parent"
277277
android:layout_height="wrap_content"
278278
android:clipChildren="false"
@@ -302,7 +302,7 @@
302302
app:cardElevation="4dp">
303303

304304
<LinearLayout
305-
android:id="@+id/main_activity_account_details_linear_layout"
305+
android:id="@+id/main_activity_aliases_details_linear_layout"
306306
android:layout_width="match_parent"
307307
android:layout_height="wrap_content"
308308
android:orientation="vertical">
@@ -412,8 +412,8 @@
412412
android:layout_alignParentStart="true"
413413
android:layout_alignParentLeft="true"
414414
android:layout_centerVertical="true"
415-
android:layout_toStartOf="@id/main_activity_account_details_app_id_text_view"
416-
android:layout_toLeftOf="@id/main_activity_account_details_app_id_text_view"
415+
android:layout_toStartOf="@id/main_activity_push_subscription_id_text_view"
416+
android:layout_toLeftOf="@id/main_activity_push_subscription_id_text_view"
417417
android:text="@string/id_colon"
418418
android:textColor="@color/colorDarkText"
419419
android:textSize="16sp" />
@@ -1184,7 +1184,7 @@
11841184
<!-- Send In-App Messaging -->
11851185

11861186
<LinearLayout
1187-
android:id="@+id/main_activity_in_app_messaging_linear_layout"
1187+
android:id="@+id/main_activity_in_app_messaging_details_linear_layout"
11881188
android:layout_width="match_parent"
11891189
android:layout_height="wrap_content"
11901190
android:layout_marginBottom="8dp"

OneSignalSDK/onesignal/core/src/test/java/com/onesignal/session/internal/outcomes/OutcomeEventsControllerTests.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.onesignal.session.internal.outcomes
22

33
import com.onesignal.common.exceptions.BackendException
4+
import com.onesignal.common.threading.Waiter
45
import com.onesignal.debug.LogLevel
56
import com.onesignal.debug.internal.logging.Logging
67
import com.onesignal.mocks.MockHelper
@@ -360,6 +361,7 @@ class OutcomeEventsControllerTests : FunSpec({
360361

361362
test("send unique outcome with different indirect influences") {
362363
/* Given */
364+
val waiter = Waiter()
363365
val now = 111L
364366
val notificationIds1 = "[\"id1\",\"id2\"]"
365367
val notificationIds2 = "[\"id3\",\"id4\"]"
@@ -378,7 +380,7 @@ class OutcomeEventsControllerTests : FunSpec({
378380

379381
val mockOutcomeEventsRepository = mockk<IOutcomeEventsRepository>()
380382
coEvery { mockOutcomeEventsRepository.getNotCachedUniqueInfluencesForOutcome("OUTCOME_1", any()) } returns listOf(notificationInfluence1) andThen listOf(notificationInfluence2)
381-
coEvery { mockOutcomeEventsRepository.saveUniqueOutcomeEventParams(any()) }
383+
coEvery { mockOutcomeEventsRepository.saveUniqueOutcomeEventParams(any()) } answers { waiter.wake() }
382384

383385
val mockOutcomeEventsPreferences = spyk<IOutcomeEventsPreferences>()
384386
val mockOutcomeEventsBackend = spyk<IOutcomeEventsBackendService>()
@@ -399,6 +401,8 @@ class OutcomeEventsControllerTests : FunSpec({
399401
val evnt1 = outcomeEventsController.sendUniqueOutcomeEvent("OUTCOME_1")
400402
val evnt2 = outcomeEventsController.sendUniqueOutcomeEvent("OUTCOME_1")
401403

404+
waiter.waitForWake()
405+
402406
/* Then */
403407
evnt1 shouldNotBe null
404408
evnt1!!.name shouldBe "OUTCOME_1"

OneSignalSDK/onesignal/location/src/test/java/com/onesignal/location/internal/background/LocationBackgroundServiceTests.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class LocationBackgroundServiceTests : FunSpec({
5555
test("scheduleBackgroundRunIn will return null when location services are disabled in SDK") {
5656
/* Given */
5757
val mockLocationManager = mockk<ILocationManager>()
58-
every { mockLocationManager.isLocationShared } returns false
58+
every { mockLocationManager.isShared } returns false
5959

6060
val mockLocationPreferencesService = mockk<ILocationPreferencesService>()
6161
val mockLocationCapturer = mockk<ILocationCapturer>()
@@ -73,13 +73,13 @@ class LocationBackgroundServiceTests : FunSpec({
7373

7474
/* Then */
7575
result shouldBe null
76-
verify(exactly = 1) { mockLocationManager.isLocationShared }
76+
verify(exactly = 1) { mockLocationManager.isShared }
7777
}
7878

7979
test("scheduleBackgroundRunIn will return null when no android permissions") {
8080
/* Given */
8181
val mockLocationManager = mockk<ILocationManager>()
82-
every { mockLocationManager.isLocationShared } returns true
82+
every { mockLocationManager.isShared } returns true
8383

8484
val mockLocationPreferencesService = mockk<ILocationPreferencesService>()
8585
every { mockLocationPreferencesService.lastLocationTime } returns 1111

OneSignalSDK/onesignal/notifications/src/main/java/com/onesignal/notifications/receivers/FCMBroadcastReceiver.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class FCMBroadcastReceiver : BroadcastReceiver() {
5858
// W/GCM: broadcast intent callback: result=CANCELLED forIntent {
5959
// act=com.google.android.c2dm.intent.RECEIVE
6060
// flg=0x10000000
61-
// pkg=com.onesignal.example (has extras)
61+
// pkg=com.onesignal.sdktest (has extras)
6262
// }
6363
resultCode = Activity.RESULT_OK
6464
}

0 commit comments

Comments
 (0)