View ProfileDetailDataSource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProfileDetailDataSource( | |
private val profileService: ProfileService, | |
private val apiCallAdapter: ApiCallAdapter | |
) : BaseDataSource<ResponseTemplate<ProfileDetailDataTemplate>, ProfileDetailNetworkDTO>() { | |
override suspend fun getDataSourceResult(request: BaseRequest<ResponseTemplate<ProfileDetailDataTemplate>>): | |
DataHolder<ProfileDetailNetworkDTO> = apiCallAdapter.adapt { | |
profileService.getProfileDetail(request) | |
} | |
} |
View Interactor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ChangePasswordInteractor(private val repository: ProfileRepository) : | |
BaseInteractor(), Interactor.SingleInteractor<ChangePasswordInteractor.Params, Any> { | |
class Params(val oldPassword:String,val newPassword:String) : Interactor.Params() | |
override suspend fun execute(params: Params): DataHolder<Any> = | |
repository.changePassword(ChangePasswordRequest(params.oldPassword,params.newPassword)) | |
} |
View DataHolder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed class DataHolder<out T: Any> { | |
data class Success<out T : Any>(val data:T) : DataHolder<T>() | |
data class Fail(val error: BaseError?=null) : DataHolder<Nothing>() | |
data class Loading() : DataHolder<Nothing>() | |
} |
View NotificationHelper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val builder = NotificationCompat.Builder(context, AppNavigator.NOTF_CHANNEL_ID) | |
.setSmallIcon(android.R.drawable.arrow_up_float) | |
.setContentTitle(context.getString(R.string.app_name)) | |
.setContentText(context.getString(R.string.channel_description)) | |
.setPriority(NotificationCompat.PRIORITY_HIGH) | |
.setCategory(NotificationCompat.CATEGORY_CALL) | |
.setAutoCancel(true) | |
val pendingIntent = PendingIntent.getActivity(context, | |
0, | |
Intent(context, RingActivity::class.java), |
View HMSPushService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onMessageReceived(remoteMessage: RemoteMessage?) { | |
super.onMessageReceived(remoteMessage) | |
remoteMessage?.let { | |
if(it.data.isNotEmpty()){ | |
//data message | |
try { | |
val pushDataModel= Gson().fromJson(it.data,PushDataModel::class.java) | |
handleNotification(pushDataMceodel) | |
} | |
catch (e:Exception){ |
View DataMessageModel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"validate_only": false, | |
"message": { | |
"data": "{'param1':'value1','param2':'value2'}", | |
"token": ["pushtoken1","pushtoken2"] | |
} | |
} |