public static AVIMConversation parseFromJson ( AVIMClient client , JSONObject jsonObj ) { if ( null == jsonObj || null == client ) { return null ; } String conversationId = jsonObj . getString ( AVObject . KEY_OBJECT_ID ) ; if ( StringUtil . isEmpty ( conversationId ) ) { return null ; } boolean systemConv = false ; boolean transientConv = false ; boolean tempConv = false ; if ( jsonObj . containsKey ( Conversation . SYSTEM ) ) { systemConv = jsonObj . getBoolean ( Conversation . SYSTEM ) ; } if ( jsonObj . containsKey ( Conversation . TRANSIENT ) ) { transientConv = jsonObj . getBoolean ( Conversation . TRANSIENT ) ; } if ( jsonObj . containsKey ( Conversation . TEMPORARY ) ) { tempConv = jsonObj . getBoolean ( Conversation . TEMPORARY ) ; } AVIMConversation originConv = null ; if ( systemConv ) { originConv = new AVIMServiceConversation ( client , conversationId ) ; } else if ( tempConv ) { originConv = new AVIMTemporaryConversation ( client , conversationId ) ; } else if ( transientConv ) { originConv = new AVIMChatRoom ( client , conversationId ) ; } else { originConv = new AVIMConversation ( client , conversationId ) ; } originConv . latestConversationFetch = System . currentTimeMillis ( ) ; return updateConversation ( originConv , jsonObj ) ; }
parse AVIMConversation from jsonObject