package com.adealink.weparty.profile

import com.adealink.frame.router.Router
import com.adealink.frame.router.annotation.RouterUri
import com.adealink.frame.router.handler.UriHandler
import com.adealink.frame.router.request.UriRequest
import com.adealink.frame.util.AppUtil
import com.adealink.weparty.module.profile.Profile
import com.adealink.weparty.router.AppLink

@RouterUri(
    path = [
        AppLink.UserProfile.PATH
    ],
    desc = "AppLink用户个人页"
)
class UserProfileAppLinkHandler : UriHandler() {
    override fun handle(request: UriRequest) {
        val uid = request.intent.getStringExtra(AppLink.UserProfile.EXTRA_ID)
        if (uid.isNullOrEmpty()) {
            return
        }
        val ctx = request.ctx ?: AppUtil.currentActivity
        if (ctx == null) {
            return
        }
        Router.build(ctx, Profile.UserProfile.PATH)
            .putExtra(Profile.Common.EXTRA_UID, uid)
            .start()
    }


}