当前位置: 首页>>代码示例>>Java>>正文


Java MXSession.getCredentials方法代码示例

本文整理汇总了Java中org.matrix.androidsdk.MXSession.getCredentials方法的典型用法代码示例。如果您正苦于以下问题:Java MXSession.getCredentials方法的具体用法?Java MXSession.getCredentials怎么用?Java MXSession.getCredentials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.matrix.androidsdk.MXSession的用法示例。


在下文中一共展示了MXSession.getCredentials方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSession

import org.matrix.androidsdk.MXSession; //导入方法依赖的package包/类
/**
 *Retrieve a session from an user Id.
 * The application should be able to manage multi session.
 * @param matrixId the matrix id
 * @return the MXsession if it exists.
 */
public synchronized MXSession getSession(String matrixId) {
    if (null != matrixId) {
        ArrayList<MXSession> sessions;

        synchronized (this) {
            sessions = getSessions();
        }

        for (MXSession session : sessions) {
            Credentials credentials = session.getCredentials();

            if ((null != credentials) && (credentials.userId.equals(matrixId))) {
                return session;
            }
        }
    }

    return getDefaultSession();
}
 
开发者ID:matrix-org,项目名称:matrix-android-console,代码行数:26,代码来源:Matrix.java

示例2: getSession

import org.matrix.androidsdk.MXSession; //导入方法依赖的package包/类
/**
 * Retrieve a session from an user Id.
 * The application should be able to manage multi session.
 *
 * @param matrixId the matrix id
 * @return the MXsession if it exists.
 */
public synchronized MXSession getSession(String matrixId) {
    if (null != matrixId) {
        ArrayList<MXSession> sessions;

        synchronized (this) {
            sessions = getSessions();
        }

        for (MXSession session : sessions) {
            Credentials credentials = session.getCredentials();

            if ((null != credentials) && (credentials.userId.equals(matrixId))) {
                return session;
            }
        }
    }

    return getDefaultSession();
}
 
开发者ID:vector-im,项目名称:riot-android,代码行数:27,代码来源:Matrix.java

示例3: onRegistrationDone

import org.matrix.androidsdk.MXSession; //导入方法依赖的package包/类
/**
 * The account login / creation succeeds so create the dedicated session and store it.
 *
 * @param appCtx      the application context.
 * @param hsConfig    the homeserver config
 * @param credentials the credentials
 * @param callback    the callback
 */
private void onRegistrationDone(Context appCtx, HomeServerConnectionConfig hsConfig, Credentials credentials, SimpleApiCallback<HomeServerConnectionConfig> callback) {
    // sanity check - GA issue
    if (TextUtils.isEmpty(credentials.userId)) {
        callback.onMatrixError(new MatrixError(MatrixError.FORBIDDEN, "No user id"));
        return;
    }

    Collection<MXSession> sessions = Matrix.getMXSessions(appCtx);
    boolean isDuplicated = false;

    for (MXSession existingSession : sessions) {
        Credentials cred = existingSession.getCredentials();
        isDuplicated |= TextUtils.equals(credentials.userId, cred.userId) && TextUtils.equals(credentials.homeServer, cred.homeServer);
    }

    if (!isDuplicated) {
        hsConfig.setCredentials(credentials);
        MXSession session = Matrix.getInstance(appCtx).createSession(hsConfig);
        Matrix.getInstance(appCtx).addSession(session);
    }

    callback.onSuccess(hsConfig);
}
 
开发者ID:vector-im,项目名称:riot-android,代码行数:32,代码来源:LoginHandler.java

示例4: VectorMemberDetailsDevicesAdapter

import org.matrix.androidsdk.MXSession; //导入方法依赖的package包/类
/**
 * Constructor
 *
 * @param aContext              app context
 * @param aItemLayoutResourceId layout id to be displayed on each row
 * @param aSession              session
 */
public VectorMemberDetailsDevicesAdapter(Context aContext, int aItemLayoutResourceId, MXSession aSession) {
    super(aContext, aItemLayoutResourceId);

    mLayoutInflater = LayoutInflater.from(aContext);
    mItemLayoutResourceId = aItemLayoutResourceId;

    if (null != aSession.getCredentials()) {
        myDeviceId = aSession.getCredentials().deviceId;
    } else {
        myDeviceId = null;
    }
}
 
开发者ID:vector-im,项目名称:riot-android,代码行数:20,代码来源:VectorMemberDetailsDevicesAdapter.java


注:本文中的org.matrix.androidsdk.MXSession.getCredentials方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。