Skip to content

Commit

Permalink
OttSessionProvider - remove udid from switchUser
Browse files Browse the repository at this point in the history
  • Loading branch information
tehilar committed Mar 19, 2017
1 parent f1e604e commit 4c0fab5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public void onComplete(PrimitiveResult response) {
}


@Test
@Test
public void testOttAnonymousSession() {
final OttSessionProvider ottSessionProvider = new OttSessionProvider(PnxBaseUrl, PnxPartnerId);

Expand Down Expand Up @@ -235,6 +235,14 @@ public void onComplete(ResultElement<PKMediaEntry> response) {
wait(1);
}

@Test
public void testOttSwitchUser(){

}




@Test
public void testOvpSessionProviderBaseFlow() {
ovpSessionProvider = new OvpSessionProvider(OvpBaseUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public OttSessionProvider setRefreshListener(OnCompletion<String> listener){
* @param udid
*/
public void startAnonymousSession(@Nullable String udid, final OnCompletion<PrimitiveResult> completion) {
//this.sessionParams = new OttSessionParams().setUdid(udid);

this.sessionUdid = udid;

MultiRequestBuilder multiRequest = PhoenixService.getMultirequest(apiBaseUrl, null);
Expand All @@ -143,9 +143,9 @@ public void onComplete(ResponseElement response) {
* @param completion
*/
public void startSession(@NonNull String username, @NonNull String password, @Nullable String udid, final OnCompletion<PrimitiveResult> completion) {
// login user
//get session data for expiration time
//this.sessionParams = new OttSessionParams().setPassword(password).setUsername(username).setUdid(udid);
//1. login user
//2. get session data: expiration time

this.sessionUdid = udid;

MultiRequestBuilder multiRequest = PhoenixService.getMultirequest(apiBaseUrl, null);
Expand All @@ -170,6 +170,7 @@ public void onComplete(ResponseElement response) {
* @param completion
*/
public void startSocialSession(@NonNull OttUserService.KalturaSocialNetwork socialNetwork, @NonNull String socialToken, @Nullable String udid, final OnCompletion<PrimitiveResult> completion) {

this.sessionUdid = udid;

MultiRequestBuilder multiRequest = PhoenixService.getMultirequest(apiBaseUrl, null);
Expand All @@ -184,13 +185,15 @@ public void onComplete(ResponseElement response) {
APIOkRequestsExecutor.getSingleton().queue(multiRequest.build());
}

public void switchUser(@NonNull String userId, @Nullable String udid, final OnCompletion<PrimitiveResult> completion) {
// switchUser
//get session data for expiration time
this.sessionUdid = udid;
/**
* switch to another user in household
* @param userId
* @param completion
*/
public void switchUser(@NonNull String userId, final OnCompletion<PrimitiveResult> completion) {

MultiRequestBuilder multiRequest = PhoenixService.getMultirequest(apiBaseUrl, null);
multiRequest.add(PhoenixSessionService.switchUser(apiBaseUrl, getSessionToken(), userId, udid),
multiRequest.add(PhoenixSessionService.switchUser(apiBaseUrl, getSessionToken(), userId),
PhoenixSessionService.get(apiBaseUrl, "{1:result:loginSession:ks}")).
completion(new OnRequestCompletion() {
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.kaltura.playkit.backend.phoenix.services;

import android.support.annotation.Nullable;
import android.text.TextUtils;

import com.google.gson.JsonObject;
import com.kaltura.playkit.backend.phoenix.PhoenixRequestBuilder;

Expand All @@ -25,13 +22,10 @@ public static PhoenixRequestBuilder get(String baseUrl, String ks){
.params(params);
}

public static PhoenixRequestBuilder switchUser(String baseUrl, String ks, String userIdToSwitch, @Nullable String udid){
public static PhoenixRequestBuilder switchUser(String baseUrl, String ks, String userIdToSwitch){
JsonObject params = new JsonObject();
params.addProperty("ks", ks);
params.addProperty("userIdToSwitch", userIdToSwitch);
if(!TextUtils.isEmpty(udid)){
params.addProperty("udid", udid);
}

return new PhoenixRequestBuilder()
.service("session")
Expand Down

0 comments on commit 4c0fab5

Please sign in to comment.