當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。