Skip to content

Commit 69f43ca

Browse files
authored
Merge pull request #1708 from OneSignal/user-model/core-module
[User Model] Core Module
2 parents d32966b + ccd8c46 commit 69f43ca

File tree

328 files changed

+249
-173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

328 files changed

+249
-173
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: 3 additions & 7 deletions
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

@@ -67,17 +67,13 @@ dependencies {
6767

6868
implementation 'com.github.bumptech.glide:glide:4.12.0'
6969

70-
implementation('com.onesignal:OneSignal:4.8.2')
71-
implementation('com.onesignal:Location:4.8.2')
72-
implementation('com.onesignal:InAppMessages:4.8.2')
73-
7470
/** START - Google Play Builds **/
75-
gmsImplementation('com.onesignal:Notifications:4.8.2')
71+
gmsImplementation('com.onesignal:OneSignal:5.0.0')
7672
/** END - Google Play Builds **/
7773

7874
/** START - Huawei Builds **/
7975
// Omit Google / Firebase libraries for Huawei builds.
80-
huaweiImplementation('com.onesignal:Notifications:4.8.2') {
76+
huaweiImplementation('com.onesignal:OneSignal:5.0.0') {
8177
exclude group: 'com.google.android.gms', module: 'play-services-gcm'
8278
exclude group: 'com.google.android.gms', module: 'play-services-analytics'
8379
exclude group: 'com.google.android.gms', module: 'play-services-location'
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/build.gradle

Lines changed: 6 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
11
plugins {
22
id 'com.android.library'
3-
id 'kotlin-android'
4-
id 'org.jlleitschuh.gradle.ktlint'
5-
id 'io.gitlab.arturbosch.detekt'
63
}
74

85
android {
96
compileSdkVersion rootProject.buildVersions.compileSdkVersion
107
defaultConfig {
118
minSdkVersion rootProject.buildVersions.minSdkVersion
12-
consumerProguardFiles 'consumer-rules.pro'
13-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
149
}
1510

1611
buildTypes {
1712
original {
1813
minifyEnabled false
19-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2014
}
2115
release {
2216
minifyEnabled false
@@ -25,72 +19,23 @@ android {
2519
minifyEnabled false
2620
}
2721
}
28-
testOptions {
29-
unitTests.all {
30-
maxParallelForks 1
31-
maxHeapSize '2048m'
32-
}
33-
unitTests {
34-
includeAndroidResources = true
35-
}
36-
}
3722
// Forced downgrade to Java 8 so SDK is backwards compatible in consuming projects
3823
compileOptions {
3924
sourceCompatibility JavaVersion.VERSION_1_8
4025
targetCompatibility JavaVersion.VERSION_1_8
4126
}
42-
kotlinOptions {
43-
jvmTarget = '1.8'
44-
}
4527
namespace 'com.onesignal'
4628
}
4729

48-
tasks.withType(Test) {
49-
testLogging {
50-
exceptionFormat "full"
51-
events "started", "skipped", "passed", "failed"
52-
showStandardStreams false // Enable to have logging print
53-
}
30+
ext {
31+
projectDescription = "OneSignal Android SDK - All Modules"
5432
}
5533

56-
// api || implementation = compile and runtime
57-
58-
// KEEP: version ranges, these get used in the released POM file for maven central
59-
// NOTE: To prevent consumers from getting alpha or beta version of dependencies listed here
60-
// make sure the latest minor value is a known stable version. Using a range for the
61-
// patch version is ok, since this allows getting bug fix versions.
6234
dependencies {
63-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
64-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
65-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
66-
67-
compileOnly('com.amazon.device:amazon-appstore-sdk:[3.0.1, 3.0.99]')
68-
69-
api('androidx.legacy:legacy-support-v4') {
70-
version {
71-
require '[1.0.0, 1.0.99]'
72-
prefer '1.0.0'
73-
}
74-
}
75-
api('androidx.appcompat:appcompat') {
76-
version {
77-
require '[1.0.0, 1.3.99]'
78-
prefer '1.3.1'
79-
}
80-
}
81-
82-
testImplementation("junit:junit:$junitVersion")
83-
testImplementation("io.kotest:kotest-runner-junit4:$kotestVersion")
84-
testImplementation("io.kotest:kotest-runner-junit4-jvm:$kotestVersion")
85-
testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
86-
testImplementation("io.kotest:kotest-property:$kotestVersion")
87-
testImplementation("org.robolectric:robolectric:4.8.1")
88-
testImplementation("androidx.test:core-ktx:1.4.0")
89-
testImplementation("androidx.test:core:1.4.0")
90-
testImplementation("io.mockk:mockk:1.13.2")
91-
testImplementation("org.json:json:20180813")
92-
testImplementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
35+
api project(':OneSignal:core')
36+
api project(':OneSignal:notifications')
37+
api project(':OneSignal:in-app-messages')
38+
api project(':OneSignal:location')
9339
}
9440

9541
apply from: 'maven-push.gradle'
96-
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
plugins {
2+
id 'com.android.library'
3+
id 'kotlin-android'
4+
id 'org.jlleitschuh.gradle.ktlint'
5+
id 'io.gitlab.arturbosch.detekt'
6+
}
7+
8+
android {
9+
compileSdkVersion rootProject.buildVersions.compileSdkVersion
10+
defaultConfig {
11+
minSdkVersion rootProject.buildVersions.minSdkVersion
12+
consumerProguardFiles "consumer-rules.pro"
13+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
14+
}
15+
16+
buildTypes {
17+
original {
18+
minifyEnabled false
19+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20+
}
21+
release {
22+
minifyEnabled false
23+
}
24+
unity {
25+
minifyEnabled false
26+
}
27+
}
28+
testOptions {
29+
unitTests.all {
30+
maxParallelForks 1
31+
maxHeapSize '2048m'
32+
}
33+
unitTests {
34+
includeAndroidResources = true
35+
}
36+
}
37+
compileOptions {
38+
sourceCompatibility JavaVersion.VERSION_1_8
39+
targetCompatibility JavaVersion.VERSION_1_8
40+
}
41+
kotlinOptions {
42+
jvmTarget = '1.8'
43+
}
44+
namespace 'com.onesignal.core'
45+
}
46+
47+
tasks.withType(Test) {
48+
testLogging {
49+
exceptionFormat "full"
50+
events "started", "skipped", "passed", "failed"
51+
showStandardStreams false // Enable to have logging print
52+
}
53+
}
54+
55+
ext {
56+
projectDescription = "OneSignal Android SDK - Core Module"
57+
}
58+
59+
dependencies {
60+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
61+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
62+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
63+
64+
compileOnly('com.amazon.device:amazon-appstore-sdk:[3.0.1, 3.0.99]')
65+
66+
api('androidx.legacy:legacy-support-v4') {
67+
version {
68+
require '[1.0.0, 1.0.99]'
69+
prefer '1.0.0'
70+
}
71+
}
72+
api('androidx.appcompat:appcompat') {
73+
version {
74+
require '[1.0.0, 1.3.99]'
75+
prefer '1.3.1'
76+
}
77+
}
78+
79+
testImplementation("junit:junit:$junitVersion")
80+
testImplementation("io.kotest:kotest-runner-junit4:$kotestVersion")
81+
testImplementation("io.kotest:kotest-runner-junit4-jvm:$kotestVersion")
82+
testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
83+
testImplementation("io.kotest:kotest-property:$kotestVersion")
84+
testImplementation("org.robolectric:robolectric:4.8.1")
85+
testImplementation("androidx.test:core-ktx:1.4.0")
86+
testImplementation("androidx.test:core:1.4.0")
87+
testImplementation("io.mockk:mockk:1.13.2")
88+
testImplementation("org.json:json:20180813")
89+
testImplementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
90+
}
91+
92+
apply from: '../maven-push.gradle'
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
3+
<!-- Required so the device can access the internet. -->
4+
<uses-permission android:name="android.permission.INTERNET" />
5+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
6+
7+
<application>
8+
<service
9+
android:name="com.onesignal.core.services.SyncService"
10+
android:stopWithTask="true"
11+
android:exported="false" />
12+
13+
<service
14+
android:name="com.onesignal.core.services.SyncJobService"
15+
android:permission="android.permission.BIND_JOB_SERVICE"
16+
android:exported="false" />
17+
18+
<activity android:name="com.onesignal.core.activities.PermissionsActivity"
19+
android:theme="@android:style/Theme.Translucent.NoTitleBar"
20+
android:exported="false" />
21+
</application>
22+
23+
<!-- NOTE: See release version for tags with placeholders -->
24+
</manifest>

0 commit comments

Comments
 (0)