Advertisement
Guest User

Untitled

a guest
Sep 24th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 1.80 KB | None | 0 0
  1. fun requestLogout(): Single<LogoutType> {
  2.         return networkHelper.isInternetAvailable()
  3.                 .flatMap { internetAvailable ->
  4.                     if (internetAvailable) {
  5.                         if (isLoggedInWithBrowser) {
  6.                             Single.just(LogoutType.WITH_BROWSER)
  7.                         } else {
  8.                             baseServerApi.navigatorLogout()
  9.                                     .andThen(ssoApi.logout())
  10.                                     .toSingle { LogoutType.WITH_API }
  11.                                     .subscribeOn(Schedulers.io())
  12.                         }
  13.  
  14.                     } else {
  15.                         Single.just(LogoutType.NO_NETWORK)
  16.                     }
  17.                 }
  18.                 .subscribeOn(Schedulers.io())
  19.                 .observeOn(AndroidSchedulers.mainThread())
  20.     }
  21.  
  22. @GET(LOGOUT_ENDPOINT)
  23.     fun navigatorLogout(): Completable where const val LOGOUT_ENDPOINT = "backapi/logout" and prefix SERVER_BASE_URL = "https://msp.everpoint.ru/";
  24.  
  25. @GET("/cas/logout")
  26.     fun logout(): Completable and prefix SSO_BASE_URL = "https://ssodev.smbn.ru/cas/";
  27.  
  28. //debug
  29.             buildConfigField "String", "SERVER_BASE_URL", '"https://msp.everpoint.ru/"'
  30.             buildConfigField "String", "PORTAL_BASE_URL", '"https://portaldev.smbn.ru/"'
  31.             buildConfigField "String", "SSO_BASE_URL", '"https://ssodev.smbn.ru/cas/"'
  32.             buildConfigField "String", "SSO_CLIENT_ID", '"bndev"'
  33.        
  34. //normal
  35.  
  36.             buildConfigField "String", "SERVER_BASE_URL", '"https://navigator.smbn.ru/"'
  37.             buildConfigField "String", "PORTAL_BASE_URL", '"https://smbn.ru/"'
  38.             buildConfigField "String", "SSO_BASE_URL", '"https://sso.smbn.ru/cas/"'
  39.             buildConfigField "String", "SSO_CLIENT_ID", '"bn"'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement