Skip to content

Qiscus Chat SDK (core) v1.12.0

Compare
Choose a tag to compare
@ariefnurputranto ariefnurputranto released this 02 May 09:02
· 6 commits to master since this release

Changelog:

  • update flow expired token

for example for handle new flow

//set delegate QiscusCoreDelegate to get event QiscusRefreshTokenEvent in AllViewController or other
extension UIChatListPresenter : QiscusCoreDelegate {
    func onRefreshToken(event: QiscusRefreshTokenEvent) {
        if event == .isUnauthorized {
            //need to force re login or re init qiscusCore
            if let deviceToken = UserDefaults.standard.getDeviceToken(){
                QiscusCore.shared.removeDeviceToken(token: deviceToken, onSuccess: { (success) in
                    //success
                }) { (error) in
                    
                }
            }
            
            QiscusCore.clearUser { (error) in
            //re login or re initiate
                let app = UIApplication.shared.delegate as! AppDelegate
                app.auth()
            }
        }else if event == .isTokenExpired {
            //need to call api refresh token when auto refresh token from be is false, by default is true from be
            QiscusCore.shared.refreshToken { refreshToken in
            
            } onError: { error in

            }

        }
    }
 }