Skip to content

Commit d18894b

Browse files
brismithersjinliu9508
authored andcommitted
Merge pull request #1730 from OneSignal/user-model/pre-beta-fixes
[User Model] Pre-Beta Fixes
2 parents f4d30c7 + 0b311f5 commit d18894b

File tree

39 files changed

+153
-113
lines changed

39 files changed

+153
-113
lines changed

Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/notification/NotificationServiceExtension.java

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

33
import android.content.Context;
4+
import android.util.Log;
45

5-
import com.onesignal.debug.LogLevel;
6-
import com.onesignal.debug.internal.logging.Logging;
76
import com.onesignal.notifications.IActionButton;
87
import com.onesignal.notifications.IMutableNotification;
98
import com.onesignal.notifications.INotification;
@@ -15,14 +14,13 @@ public class NotificationServiceExtension implements IRemoteNotificationReceived
1514

1615
@Override
1716
public void remoteNotificationReceived(Context context, INotificationReceivedEvent notificationReceivedEvent) {
18-
Logging.log(LogLevel.VERBOSE, "OSRemoteNotificationReceivedHandler fired!" +
19-
" with OSNotificationReceived: " + notificationReceivedEvent.toString());
17+
Log.v("MainApplication", "IRemoteNotificationReceivedHandler fired!" + " with INotificationReceivedEvent: " + notificationReceivedEvent.toString());
2018

2119
INotification notification = notificationReceivedEvent.getNotification();
2220

2321
if (notification.getActionButtons() != null) {
2422
for (IActionButton button : notification.getActionButtons()) {
25-
Logging.log(LogLevel.VERBOSE, "ActionButton: " + button.toString());
23+
Log.v("MainApplication", "ActionButton: " + button.toString());
2624
}
2725
}
2826

Loading
Loading

Examples/OneSignalDemo/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml

Lines changed: 0 additions & 5 deletions
This file was deleted.

Examples/OneSignalDemo/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml

Lines changed: 0 additions & 5 deletions
This file was deleted.
Binary file not shown.
Binary file not shown.
Loading
Binary file not shown.
Binary file not shown.
Loading
Binary file not shown.
Binary file not shown.
Loading
Binary file not shown.
Binary file not shown.
Loading
Binary file not shown.
Binary file not shown.
Loading

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/common/OneSignalUtils.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ package com.onesignal.common
33
import java.util.regex.Pattern
44

55
object OneSignalUtils {
6-
@JvmStatic
7-
var sdkType = "native"
8-
9-
@JvmStatic
10-
val sdkVersion: String = "050000"
6+
/**
7+
* The version of this SDK.
8+
*/
9+
const val sdkVersion: String = "050000"
1110

1211
fun isValidEmail(email: String): Boolean {
1312
if (email.isEmpty())
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.onesignal.common
2+
3+
object OneSignalWrapper {
4+
/**
5+
* The type of the wrapper SDK.
6+
*/
7+
@JvmStatic
8+
var sdkType: String? = null
9+
10+
/**
11+
* The version of the wrapper SDK.
12+
*/
13+
@JvmStatic
14+
val sdkVersion: String? = null
15+
}

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/http/impl/HttpClient.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.net.TrafficStats
44
import android.os.Build
55
import com.onesignal.common.JSONUtils
66
import com.onesignal.common.OneSignalUtils
7+
import com.onesignal.common.OneSignalWrapper
78
import com.onesignal.core.internal.config.ConfigModelStore
89
import com.onesignal.core.internal.http.HttpResponse
910
import com.onesignal.core.internal.http.IHttpClient
@@ -109,6 +110,11 @@ internal class HttpClient(
109110
con.connectTimeout = timeout
110111
con.readTimeout = timeout
111112
con.setRequestProperty("SDK-Version", "onesignal/android/" + OneSignalUtils.sdkVersion)
113+
114+
if(OneSignalWrapper.sdkType != null && OneSignalWrapper.sdkVersion != null) {
115+
con.setRequestProperty("SDK-Wrapper", "onesignal/${OneSignalWrapper.sdkType}/${OneSignalWrapper.sdkVersion}")
116+
}
117+
112118
con.setRequestProperty("Accept", OS_ACCEPT_HEADER)
113119

114120
val subscriptionId = _configModelStore.model.pushSubscriptionId

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/preferences/IPreferencesService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ object PreferenceOneSignalKeys {
199199
/**
200200
* (Long) The last time an IAM was dismissed, in unix time milliseconds.
201201
*/
202-
const val PREFS_OS_LAST_TIME_IAM_DISMISSED = "PREFS_OS_LAST_TIME_IAM_DISMISSED"
202+
const val PREFS_OS_IAM_LAST_DISMISSED_TIME = "PREFS_OS_IAM_LAST_DISMISSED_TIME"
203203

204204
// Models
205205
/**

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/debug/LogLevel.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,12 @@ enum class LogLevel {
77
WARN,
88
INFO,
99
DEBUG,
10-
VERBOSE
10+
VERBOSE;
11+
12+
companion object {
13+
@JvmStatic
14+
fun fromInt(value: Int) : LogLevel {
15+
return values()[value];
16+
}
17+
}
1118
}

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/inAppMessages/IInAppMessageAction.kt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ package com.onesignal.inAppMessages
55
* being displayed.
66
*/
77
interface IInAppMessageAction {
8-
/**
9-
* UUID assigned by OneSignal for internal use.
10-
* Package-private to track which element was tapped to report to the OneSignal dashboard.
11-
*/
12-
val clickId: String?
13-
148
/**
159
* An optional click name entered defined by the app developer when creating the IAM
1610
*/
@@ -26,11 +20,6 @@ interface IInAppMessageAction {
2620
*/
2721
val clickUrl: String?
2822

29-
/**
30-
* UUID for the page in an IAM Carousel
31-
*/
32-
val pageId: String?
33-
3423
/**
3524
* Determines if this was the first action taken on the in app message
3625
*/

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/notifications/INotificationsManager.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,22 @@ interface INotificationsManager {
3232
*
3333
* @param id The android ID of the notification to be removed. See [INotification.androidNotificationId].
3434
*/
35-
suspend fun removeNotification(id: Int)
35+
fun removeNotification(id: Int)
3636

3737
/**
3838
* Cancels a group of OneSignal notifications with the provided group key. Grouping notifications
3939
* is a OneSignal concept, there is no [android.app.NotificationManager] equivalent.
4040
*
4141
* @param group The group key which all notifications fall under will be removed. See [INotification.groupKey].
4242
*/
43-
suspend fun removeGroupedNotifications(group: String)
43+
fun removeGroupedNotifications(group: String)
4444

4545
/**
4646
* Removes all OneSignal notifications from the Notification Shade. If you just use
4747
* [android.app.NotificationManager.cancelAll], OneSignal notifications will be restored when
4848
* your app is restarted.
4949
*/
50-
suspend fun clearAllNotifications()
50+
fun clearAllNotifications()
5151

5252
/**
5353
* The [IPermissionChangedHandler.onPermissionChanged] method will be fired on the passed-in

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/notifications/internal/MisconfiguredNotificationsManager.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ internal class MisconfiguredNotificationsManager : INotificationsManager {
1414
get() = throw EXCEPTION
1515

1616
override suspend fun requestPermission(fallbackToSettings: Boolean): Boolean = throw EXCEPTION
17-
override suspend fun removeNotification(id: Int) = throw EXCEPTION
18-
override suspend fun removeGroupedNotifications(group: String) = throw EXCEPTION
19-
override suspend fun clearAllNotifications() = throw EXCEPTION
17+
override fun removeNotification(id: Int) = throw EXCEPTION
18+
override fun removeGroupedNotifications(group: String) = throw EXCEPTION
19+
override fun clearAllNotifications() = throw EXCEPTION
2020
override fun addPermissionChangedHandler(handler: IPermissionChangedHandler) = throw EXCEPTION
2121
override fun removePermissionChangedHandler(handler: IPermissionChangedHandler) = throw EXCEPTION
2222
override fun setNotificationWillShowInForegroundHandler(handler: INotificationWillShowInForegroundHandler?) = throw EXCEPTION

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/session/internal/session/SessionModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class SessionModel : Model() {
2424
* When this session started, in Unix time milliseconds.
2525
*/
2626
var startTime: Long
27-
get() = getLongProperty(::startTime.name)
27+
get() = getLongProperty(::startTime.name) { System.currentTimeMillis() }
2828
set(value) { setLongProperty(::startTime.name, value) }
2929

3030
/**

OneSignalSDK/onesignal/in-app-messages/src/main/java/com/onesignal/inAppMessages/internal/InAppMessageAction.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ internal class InAppMessageAction(json: JSONObject, promptFactory: IInAppMessage
1414
* UUID assigned by OneSignal for internal use.
1515
* Package-private to track which element was tapped to report to the OneSignal dashboard.
1616
*/
17-
override val clickId: String?
17+
val clickId: String?
1818

1919
/**
2020
* An optional click name entered defined by the app developer when creating the IAM
@@ -34,7 +34,7 @@ internal class InAppMessageAction(json: JSONObject, promptFactory: IInAppMessage
3434
/**
3535
* UUID for the page in an IAM Carousel
3636
*/
37-
override val pageId: String?
37+
val pageId: String?
3838

3939
/**
4040
* Outcome for action

0 commit comments

Comments
 (0)