Skip to content

Commit

Permalink
linter fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jinliu9508 committed Nov 28, 2023
1 parent 06047c2 commit a29b25b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ class ModelChangedArgs(
/**
* The arguments passed to the [IModelChangedHandler] handler when subscribed via [Model.subscribe]
*/
class ModelReplacedArgs<TModel> (
/**
* The full model in its previous and current state.
*/
val oldModel: TModel,
val newModel: TModel,
class ModelReplacedArgs<TModel>(
/**
* The full model in its previous and current state.
*/
val oldModel: TModel,
val newModel: TModel,
) where TModel : Model
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ interface IUserStateObserver {
* @param state The user changed state.
*/
fun onUserStateChange(state: UserChangedState)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,24 @@ import org.json.JSONObject
/**
* A user state.
*/
class UserState (
/**
* The unique identifier for your OneSignal account. This will be a null string until the
* user has been successfully logged in on the backend and assigned an ID.
* Use [addObserver] to be notified when the [onesignalId] has been successfully assigned.
*/
val onesignalId: String?,

/**
* The external identifier that you use to identify users. This will be an null string
* until the user has been successfully logged in on the backend and
* assigned an ID. Use [addObserver] to be notified when the [externalId] has
* been successfully assigned.
*/
val externalId: String?,
class UserState(
/**
* The unique identifier for your OneSignal account. This will be a null string until the
* user has been successfully logged in on the backend and assigned an ID.
* Use [addObserver] to be notified when the [onesignalId] has been successfully assigned.
*/
val onesignalId: String?,
/**
* The external identifier that you use to identify users. This will be an null string
* until the user has been successfully logged in on the backend and
* assigned an ID. Use [addObserver] to be notified when the [externalId] has
* been successfully assigned.
*/
val externalId: String?,
) {
fun toJSONObject(): JSONObject {
return JSONObject()
.put("onesignalId", onesignalId)
.put("externalId", externalId)
.put("onesignalId", onesignalId)
.put("externalId", externalId)
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.onesignal.user.internal

import android.os.Debug
import android.util.Log
import com.onesignal.common.OneSignalUtils
import com.onesignal.common.events.EventProducer
import com.onesignal.common.modeling.ISingletonModelStoreChangeHandler
Expand Down Expand Up @@ -235,9 +233,14 @@ internal open class UserManager(
return _propertiesModel.tags.toMap()
}

override fun addObserver(observer: IUserStateObserver) = changeHandlersNotifier.subscribe(observer)
override fun addObserver(observer: IUserStateObserver) {
changeHandlersNotifier.subscribe(observer)
}

override fun removeObserver(observer: IUserStateObserver) {
changeHandlersNotifier.unsubscribe(observer)
}

override fun removeObserver(observer: IUserStateObserver) = changeHandlersNotifier.unsubscribe(observer)
override fun onModelReplaced(model: ModelReplacedArgs<IdentityModel>, tag: String) {
val oldUserState = UserState(model.oldModel.onesignalId, model.oldModel.externalId)
val newUserState = UserState(model.newModel.onesignalId, model.newModel.externalId)
Expand Down

0 comments on commit a29b25b

Please sign in to comment.