idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
27,700
private TitledUrl findFormattedUrl ( TextCursor cursor , int limit ) { start_loop : for ( int start = cursor . currentOffset ; start < limit ; start ++ ) { if ( cursor . text . charAt ( start ) == '[' ) { if ( ! isGoodAnchor ( cursor . text , start - 1 ) ) { continue start_loop ; } } else { continue start_loop ; } middle_loop : for ( int middle = start + 1 ; middle < limit - 1 ; middle ++ ) { if ( cursor . text . charAt ( middle ) != ']' || cursor . text . charAt ( middle + 1 ) != '(' ) { continue middle_loop ; } end_loop : for ( int end = middle + 2 ; end < limit ; end ++ ) { if ( cursor . text . charAt ( end ) != ')' ) { continue end_loop ; } return new TitledUrl ( start , middle , end ) ; } } } return null ; }
Searching for valid formatted url
27,701
private BasicUrl findUrl ( TextCursor cursor , int limit ) { for ( int i = cursor . currentOffset ; i < limit ; i ++ ) { if ( ! isGoodAnchor ( cursor . text , i - 1 ) ) { continue ; } String currentText = cursor . text . substring ( i , limit ) ; MatcherCompat matcher = Patterns . WEB_URL_START . matcher ( currentText ) ; if ( matcher . hasMatch ( ) ) { String url = matcher . group ( ) ; int start = i + matcher . start ( ) ; return new BasicUrl ( start , start + url . length ( ) ) ; } } return null ; }
Finding non - formatted urls in texts
27,702
private boolean isGoodAnchor ( String text , int index ) { String punct = " .,:!?\t\n" ; if ( index >= 0 && index < text . length ( ) ) { if ( punct . indexOf ( text . charAt ( index ) ) == - 1 ) { return false ; } } return true ; }
Test if symbol at index is space or out of string bounds
27,703
private boolean isNotSymbol ( String text , int index , char c ) { if ( index >= 0 && index < text . length ( ) ) { return text . charAt ( index ) != c ; } return true ; }
Checking if symbol is not eq to c
27,704
public static < T > T [ ] append ( T [ ] array , int currentSize , T element ) { assert currentSize <= array . length ; if ( currentSize + 1 > array . length ) { @ SuppressWarnings ( "unchecked" ) T [ ] newArray = ( T [ ] ) new Object [ growSize ( currentSize ) ] ; System . arraycopy ( array , 0 , newArray , 0 , currentSize ) ; array = newArray ; } array [ currentSize ] = element ; return array ; }
Appends an element to the end of the array growing the array if there is no more room .
27,705
public static < T > T [ ] insert ( T [ ] array , int currentSize , int index , T element ) { assert currentSize <= array . length ; if ( currentSize + 1 <= array . length ) { System . arraycopy ( array , index , array , index + 1 , currentSize - index ) ; array [ index ] = element ; return array ; } @ SuppressWarnings ( "unchecked" ) T [ ] newArray = ( T [ ] ) new Object [ growSize ( currentSize ) ] ; System . arraycopy ( array , 0 , newArray , 0 , index ) ; newArray [ index ] = element ; System . arraycopy ( array , index , newArray , index + 1 , array . length - index ) ; return newArray ; }
Inserts an element into the array at the specified index growing the array if there is no more room .
27,706
ViewPager . OnPageChangeListener setInternalPageChangeListener ( ViewPager . OnPageChangeListener listener ) { ViewPager . OnPageChangeListener oldListener = mInternalPageChangeListener ; mInternalPageChangeListener = listener ; return oldListener ; }
Set a separate OnPageChangeListener for internal use by the support library .
27,707
public String getFileUrl ( long id , long accessHash ) { CachedFileUrl cachedFileUrl = keyValueStorage . getValue ( id ) ; if ( cachedFileUrl != null ) { long urlTime = cachedFileUrl . getTimeout ( ) ; long currentTime = im . actor . runtime . Runtime . getCurrentSyncedTime ( ) ; if ( urlTime <= currentTime ) { Log . w ( "JsFilesModule" , "URL #" + id + " timeout (urlTime: " + urlTime + ", current:" + currentTime + ")" ) ; keyValueStorage . removeItem ( id ) ; } else { return cachedFileUrl . getUrl ( ) ; } } if ( ! requestedFiles . contains ( id ) ) { requestedFiles . add ( id ) ; urlLoader . send ( new FileRequest ( id , accessHash ) ) ; } return null ; }
Getting URL for file if available
27,708
public static byte kuz_mul_gf256 ( byte x , byte y ) { byte z = 0 ; while ( ( y & 0xFF ) != 0 ) { if ( ( y & 1 ) != 0 ) { z ^= x ; } x = ( byte ) ( ( ( x & 0xFF ) << 1 ) ^ ( ( x & 0x80 ) != 0 ? 0xC3 : 0x00 ) ) ; y = ( byte ) ( ( y & 0xFF ) >> 1 ) ; } return z ; }
totally not constant time
27,709
public boolean requestTime ( String host , int timeout ) { DatagramSocket socket = null ; try { socket = new DatagramSocket ( ) ; socket . setSoTimeout ( timeout ) ; InetAddress address = InetAddress . getByName ( host ) ; byte [ ] buffer = new byte [ NTP_PACKET_SIZE ] ; DatagramPacket request = new DatagramPacket ( buffer , buffer . length , address , NTP_PORT ) ; buffer [ 0 ] = NTP_MODE_CLIENT | ( NTP_VERSION << 3 ) ; long requestTime = System . currentTimeMillis ( ) ; long requestTicks = SystemClock . elapsedRealtime ( ) ; writeTimeStamp ( buffer , TRANSMIT_TIME_OFFSET , requestTime ) ; socket . send ( request ) ; DatagramPacket response = new DatagramPacket ( buffer , buffer . length ) ; socket . receive ( response ) ; long responseTicks = SystemClock . elapsedRealtime ( ) ; long responseTime = requestTime + ( responseTicks - requestTicks ) ; long originateTime = readTimeStamp ( buffer , ORIGINATE_TIME_OFFSET ) ; long receiveTime = readTimeStamp ( buffer , RECEIVE_TIME_OFFSET ) ; long transmitTime = readTimeStamp ( buffer , TRANSMIT_TIME_OFFSET ) ; long roundTripTime = responseTicks - requestTicks - ( transmitTime - receiveTime ) ; mClockOffset = ( ( receiveTime - originateTime ) + ( transmitTime - responseTime ) ) / 2 ; mNtpTime = responseTime + mClockOffset ; mNtpTimeReference = responseTicks ; mRoundTripTime = roundTripTime ; } catch ( Exception e ) { return false ; } finally { if ( socket != null ) { socket . close ( ) ; } } return true ; }
Sends an SNTP request to the given host and processes the response .
27,710
private long read32 ( byte [ ] buffer , int offset ) { byte b0 = buffer [ offset ] ; byte b1 = buffer [ offset + 1 ] ; byte b2 = buffer [ offset + 2 ] ; byte b3 = buffer [ offset + 3 ] ; int i0 = ( ( b0 & 0x80 ) == 0x80 ? ( b0 & 0x7F ) + 0x80 : b0 ) ; int i1 = ( ( b1 & 0x80 ) == 0x80 ? ( b1 & 0x7F ) + 0x80 : b1 ) ; int i2 = ( ( b2 & 0x80 ) == 0x80 ? ( b2 & 0x7F ) + 0x80 : b2 ) ; int i3 = ( ( b3 & 0x80 ) == 0x80 ? ( b3 & 0x7F ) + 0x80 : b3 ) ; return ( ( long ) i0 << 24 ) + ( ( long ) i1 << 16 ) + ( ( long ) i2 << 8 ) + ( long ) i3 ; }
Reads an unsigned 32 bit big endian number from the given offset in the buffer .
27,711
public int countAll ( ) { checkTable ( ) ; Cursor mCount = null ; try { mCount = database . rawQuery ( "SELECT COUNT(*) FROM \"" + tableName + "\"" , null ) ; if ( mCount . moveToNext ( ) ) { return mCount . getInt ( 1 ) ; } } finally { if ( mCount != null ) { mCount . close ( ) ; } } return 0 ; }
Just for unit test
27,712
public void setAdapter ( RecyclerView . Adapter adapter ) { if ( mWrappedAdapter != null && mWrappedAdapter . getItemCount ( ) > 0 ) { notifyItemRangeRemoved ( getHeaderCount ( ) , mWrappedAdapter . getItemCount ( ) ) ; } setWrappedAdapter ( adapter ) ; notifyItemRangeInserted ( getHeaderCount ( ) , mWrappedAdapter . getItemCount ( ) ) ; }
Replaces the underlying adapter notifying RecyclerView of changes
27,713
public static long longFromBase64 ( String value ) { int pos = 0 ; long longVal = base64Values [ value . charAt ( pos ++ ) ] ; int len = value . length ( ) ; while ( pos < len ) { longVal <<= 6 ; longVal |= base64Values [ value . charAt ( pos ++ ) ] ; } return longVal ; }
Decode a base64 string into a long value .
27,714
public void send ( Object message , ActorRef sender ) { endpoint . getMailbox ( ) . schedule ( new Envelope ( message , endpoint . getScope ( ) , endpoint . getMailbox ( ) , sender ) ) ; }
Send message with specified sender
27,715
public void sendFirst ( Object message , ActorRef sender ) { endpoint . getMailbox ( ) . scheduleFirst ( new Envelope ( message , endpoint . getScope ( ) , endpoint . getMailbox ( ) , sender ) ) ; }
Sending message before all other messages
27,716
private static String getTopLevelCauseMessage ( Throwable t ) { Throwable topLevelCause = t ; while ( topLevelCause . getCause ( ) != null ) { topLevelCause = topLevelCause . getCause ( ) ; } return topLevelCause . getMessage ( ) ; }
Returns the Message attached to the original Cause of |t| .
27,717
public static void colorizeToolbar ( Toolbar toolbarView , int toolbarIconsColor , Activity activity ) { final PorterDuffColorFilter colorFilter = new PorterDuffColorFilter ( toolbarIconsColor , PorterDuff . Mode . SRC_IN ) ; for ( int i = 0 ; i < toolbarView . getChildCount ( ) ; i ++ ) { final View v = toolbarView . getChildAt ( i ) ; doColorizing ( v , colorFilter , toolbarIconsColor ) ; } toolbarView . setTitleTextColor ( toolbarIconsColor ) ; toolbarView . setSubtitleTextColor ( toolbarIconsColor ) ; }
Use this method to colorize toolbar icons to the desired target color
27,718
public Promise < PeerSession > pickSession ( final int uid , final int keyGroupId , final long ownKeyId , final long theirKeyId ) { return pickCachedSession ( uid , keyGroupId , ownKeyId , theirKeyId ) . fallback ( new Function < Exception , Promise < PeerSession > > ( ) { public Promise < PeerSession > apply ( Exception e ) { return Promises . tuple ( keyManager . getOwnIdentity ( ) , keyManager . getOwnPreKey ( ownKeyId ) , keyManager . getUserKeyGroups ( uid ) , keyManager . getUserPreKey ( uid , keyGroupId , theirKeyId ) ) . map ( new FunctionTupled4 < KeyManagerActor . OwnIdentity , PrivateKey , UserKeys , PublicKey , PeerSession > ( ) { public PeerSession apply ( KeyManagerActor . OwnIdentity ownIdentity , PrivateKey ownPreKey , UserKeys userKeys , PublicKey theirPreKey ) { UserKeysGroup keysGroup = ManagedList . of ( userKeys . getUserKeysGroups ( ) ) . filter ( UserKeysGroup . BY_KEY_GROUP ( keyGroupId ) ) . first ( ) ; return spawnSession ( uid , ownIdentity . getKeyGroup ( ) , keyGroupId , ownIdentity . getIdentityKey ( ) , keysGroup . getIdentityKey ( ) , ownPreKey , theirPreKey ) ; } } ) ; } } ) ; }
Pick session for specific keys
27,719
private PeerSession spawnSession ( int uid , int ownKeyGroup , int theirKeyGroup , PrivateKey ownIdentity , PublicKey theirIdentity , PrivateKey ownPreKey , PublicKey theirPreKey ) { byte [ ] masterSecret = RatchetMasterSecret . calculateMasterSecret ( new RatchetPrivateKey ( ownIdentity . getKey ( ) ) , new RatchetPrivateKey ( ownPreKey . getKey ( ) ) , new RatchetPublicKey ( theirIdentity . getPublicKey ( ) ) , new RatchetPublicKey ( theirPreKey . getPublicKey ( ) ) ) ; PeerSession peerSession = new PeerSession ( RandomUtils . nextRid ( ) , uid , ownKeyGroup , theirKeyGroup , ownPreKey . getKeyId ( ) , theirPreKey . getKeyId ( ) , masterSecret ) ; PeerSessionsStorage sessionsStorage = peerSessions . getValue ( uid ) ; if ( sessionsStorage == null ) { sessionsStorage = new PeerSessionsStorage ( uid , new ArrayList < PeerSession > ( ) ) ; } sessionsStorage = sessionsStorage . addSession ( peerSession ) ; peerSessions . addOrUpdateItem ( sessionsStorage ) ; return peerSession ; }
Spawn new session
27,720
private Promise < PeerSession > pickCachedSession ( int uid , final int keyGroupId ) { return ManagedList . of ( peerSessions . getValue ( uid ) ) . flatMap ( PeerSessionsStorage . SESSIONS ) . filter ( PeerSession . BY_THEIR_GROUP ( keyGroupId ) ) . sorted ( PeerSession . COMPARATOR ) . firstPromise ( ) ; }
Picking cached session
27,721
public static void drawTo ( Bitmap src , Bitmap dest , int color ) { clearBitmap ( src , color ) ; Canvas canvas = new Canvas ( dest ) ; canvas . drawBitmap ( src , 0 , 0 , null ) ; canvas . setBitmap ( null ) ; }
Drawing bitmap over dest bitmap with clearing last one before drawing
27,722
public static void drawInRound ( Bitmap src , Bitmap dest , int clearColor ) { if ( dest . getWidth ( ) != dest . getHeight ( ) ) { throw new RuntimeException ( "dest Bitmap must have square size" ) ; } clearBitmap ( dest , clearColor ) ; Canvas canvas = new Canvas ( dest ) ; int r = dest . getWidth ( ) / 2 ; Rect sourceRect = WorkCache . RECT1 . get ( ) ; Rect destRect = WorkCache . RECT2 . get ( ) ; sourceRect . set ( 0 , 0 , src . getWidth ( ) , src . getHeight ( ) ) ; destRect . set ( 0 , 0 , dest . getWidth ( ) , dest . getHeight ( ) ) ; Paint paint = WorkCache . PAINT . get ( ) ; paint . reset ( ) ; paint . setStyle ( Paint . Style . FILL ) ; paint . setColor ( Color . RED ) ; paint . setAntiAlias ( true ) ; canvas . drawCircle ( r , r , r , paint ) ; paint . reset ( ) ; paint . setFilterBitmap ( true ) ; paint . setXfermode ( new PorterDuffXfermode ( PorterDuff . Mode . SRC_IN ) ) ; canvas . drawBitmap ( src , sourceRect , destRect , paint ) ; canvas . setBitmap ( null ) ; }
Drawing src bitmap to dest bitmap with round mask . Dest might be squared src is recommended to be square
27,723
public static Bitmap scaleFill ( Bitmap src , int w , int h ) { Bitmap res = Bitmap . createBitmap ( w , h , Bitmap . Config . ARGB_8888 ) ; scaleFill ( src , res ) ; return res ; }
Scaling bitmap to fill rect with centering . Method keep aspect ratio .
27,724
public static void scaleFill ( Bitmap src , Bitmap dest , int clearColor ) { float ratio = Math . max ( dest . getWidth ( ) / ( float ) src . getWidth ( ) , dest . getHeight ( ) / ( float ) src . getHeight ( ) ) ; int newW = ( int ) ( src . getWidth ( ) * ratio ) ; int newH = ( int ) ( src . getHeight ( ) * ratio ) ; int paddingTop = ( dest . getHeight ( ) - ( int ) ( src . getHeight ( ) * ratio ) ) / 2 ; int paddingLeft = ( dest . getWidth ( ) - ( int ) ( src . getWidth ( ) * ratio ) ) / 2 ; scale ( src , dest , clearColor , 0 , 0 , src . getWidth ( ) , src . getHeight ( ) , paddingLeft , paddingTop , newW + paddingLeft , newH + paddingTop ) ; }
Scaling src bitmap to fill dest bitmap with centering . Method keep aspect ratio .
27,725
public static void scaleFit ( Bitmap src , Bitmap dest , int clearColor ) { float ratio = Math . min ( dest . getWidth ( ) / ( float ) src . getWidth ( ) , dest . getHeight ( ) / ( float ) src . getHeight ( ) ) ; int newW = ( int ) ( src . getWidth ( ) * ratio ) ; int newH = ( int ) ( src . getHeight ( ) * ratio ) ; int paddingTop = ( dest . getHeight ( ) - ( int ) ( src . getHeight ( ) * ratio ) ) / 2 ; int paddingLeft = ( dest . getWidth ( ) - ( int ) ( src . getWidth ( ) * ratio ) ) / 2 ; scale ( src , dest , clearColor , 0 , 0 , src . getWidth ( ) , src . getHeight ( ) , paddingLeft , paddingTop , newW + paddingLeft , newH + paddingTop ) ; }
Scaling src Bitmap to fit and cenetered in dest bitmap . Method keep aspect ratio .
27,726
public static Bitmap scale ( Bitmap src , int dw , int dh ) { Bitmap res = Bitmap . createBitmap ( dw , dh , Bitmap . Config . ARGB_8888 ) ; scale ( src , res ) ; return res ; }
Scaling bitmap to specific width and height without keeping aspect ratio .
27,727
public static Object wrap ( Object o ) { if ( o == null ) { return NULL ; } if ( o instanceof JSONArray || o instanceof JSONObject ) { return o ; } if ( o . equals ( NULL ) ) { return o ; } try { if ( o instanceof Collection ) { return new JSONArray ( ( Collection ) o ) ; } else if ( o . getClass ( ) . isArray ( ) ) { return new JSONArray ( o ) ; } if ( o instanceof Map ) { return new JSONObject ( ( Map ) o ) ; } if ( o instanceof Boolean || o instanceof Byte || o instanceof Character || o instanceof Double || o instanceof Float || o instanceof Integer || o instanceof Long || o instanceof Short || o instanceof String ) { return o ; } } catch ( Exception ignored ) { } return null ; }
Wraps the given object if necessary .
27,728
@ ObjectiveCName ( "doStartAuthWithEmail:" ) public Promise < AuthStartRes > doStartEmailAuth ( String email ) { return modules . getAuthModule ( ) . doStartEmailAuth ( email ) ; }
Starting email auth
27,729
@ ObjectiveCName ( "doStartAuthWithPhone:" ) public Promise < AuthStartRes > doStartPhoneAuth ( long phone ) { return modules . getAuthModule ( ) . doStartPhoneAuth ( phone ) ; }
Starting phone auth
27,730
@ ObjectiveCName ( "doValidateCode:withTransaction:" ) public Promise < AuthCodeRes > doValidateCode ( String code , String transactionHash ) { return modules . getAuthModule ( ) . doValidateCode ( transactionHash , code ) ; }
Validating Confirmation Code
27,731
@ ObjectiveCName ( "doSendCodeViaCall:" ) public Promise < Boolean > doSendCodeViaCall ( String transactionHash ) { return modules . getAuthModule ( ) . doSendCall ( transactionHash ) ; }
Sending activation code via voice
27,732
@ ObjectiveCName ( "requestStartAuthCommandWithEmail:" ) public Command < AuthState > requestStartEmailAuth ( final String email ) { return modules . getAuthModule ( ) . requestStartEmailAuth ( email ) ; }
Request email auth
27,733
@ ObjectiveCName ( "requestStartAuthCommandWithPhone:" ) public Command < AuthState > requestStartPhoneAuth ( final long phone ) { return modules . getAuthModule ( ) . requestStartPhoneAuth ( phone ) ; }
Request phone auth
27,734
@ ObjectiveCName ( "requestStartAnonymousAuthWithUserName:" ) public Command < AuthState > requestStartAnonymousAuth ( String userName ) { return modules . getAuthModule ( ) . requestStartAnonymousAuth ( userName ) ; }
Request user name anonymous auth
27,735
@ ObjectiveCName ( "requestStartAuthCommandWithUserName:" ) public Command < AuthState > requestStartUserNameAuth ( String userName ) { return modules . getAuthModule ( ) . requestStartUserNameAuth ( userName ) ; }
Request user name auth
27,736
@ ObjectiveCName ( "requestCompleteOAuthCommandWithCode:" ) public Command < AuthState > requestCompleteOAuth ( String code ) { return modules . getAuthModule ( ) . requestCompleteOauth ( code ) ; }
Request complete OAuth
27,737
@ ObjectiveCName ( "validateCodeCommand:" ) public Command < AuthState > validateCode ( final String code ) { return modules . getAuthModule ( ) . requestValidateCode ( code ) ; }
Sending activation code
27,738
@ ObjectiveCName ( "getUsers" ) public MVVMCollection < User , UserVM > getUsers ( ) { if ( modules . getUsersModule ( ) == null ) { return null ; } return modules . getUsersModule ( ) . getUsers ( ) ; }
Get User View Model Collection
27,739
@ ObjectiveCName ( "getGroups" ) public MVVMCollection < Group , GroupVM > getGroups ( ) { if ( modules . getGroupsModule ( ) == null ) { return null ; } return modules . getGroupsModule ( ) . getGroupsCollection ( ) ; }
Get Group View Model Collection
27,740
@ ObjectiveCName ( "getTypingWithUid:" ) public ValueModel < Boolean > getTyping ( int uid ) { return modules . getTypingModule ( ) . getTyping ( uid ) . getTyping ( ) ; }
Get private chat ViewModel
27,741
@ ObjectiveCName ( "getGroupTypingWithGid:" ) public ValueModel < int [ ] > getGroupTyping ( int gid ) { return modules . getTypingModule ( ) . getGroupTyping ( gid ) . getActive ( ) ; }
Get group chat ViewModel
27,742
@ ObjectiveCName ( "onProfileOpenWithUid:" ) public void onProfileOpen ( int uid ) { modules . getEvents ( ) . post ( new PeerInfoOpened ( Peer . user ( uid ) ) ) ; }
MUST be called on profile open
27,743
@ ObjectiveCName ( "onProfileClosedWithUid:" ) public void onProfileClosed ( int uid ) { modules . getEvents ( ) . post ( new PeerInfoClosed ( Peer . user ( uid ) ) ) ; }
MUST be called on profile closed
27,744
@ ObjectiveCName ( "onPushReceivedWithSeq:withAuthId:" ) public void onPushReceived ( int seq , long authId ) { if ( modules . getUpdatesModule ( ) != null ) { modules . getUpdatesModule ( ) . onPushReceived ( seq , authId ) ; } }
MUST be called when external push received
27,745
@ ObjectiveCName ( "getConversationVM" ) public ConversationVM getConversationVM ( Peer peer ) { return modules . getMessagesModule ( ) . getConversationVM ( peer ) ; }
Getting Conversation VM
27,746
@ ObjectiveCName ( "sendVideoWithPeer:withName:withW:withH:withDuration:withThumb:withDescriptor:" ) public void sendVideo ( Peer peer , String fileName , int w , int h , int duration , FastThumb fastThumb , String descriptor ) { modules . getMessagesModule ( ) . sendVideo ( peer , fileName , w , h , duration , fastThumb , descriptor ) ; }
Send Video message
27,747
@ ObjectiveCName ( "sendDocumentWithPeer:withName:withMime:withThumb:withDescriptor:" ) public void sendDocument ( Peer peer , String fileName , String mimeType , FastThumb fastThumb , String descriptor ) { modules . getMessagesModule ( ) . sendDocument ( peer , fileName , mimeType , fastThumb , descriptor ) ; }
Send document with preview
27,748
@ ObjectiveCName ( "forwardContentContentWithPeer:withContent:" ) public void forwardContent ( Peer peer , AbsContent content ) { modules . getMessagesModule ( ) . forwardContent ( peer , content ) ; }
Send DocumentContent - used for forwarding
27,749
@ ObjectiveCName ( "addReactionWithPeer:withRid:withCode:" ) public Command < Void > addReaction ( Peer peer , long rid , String code ) { return callback -> modules . getMessagesModule ( ) . addReaction ( peer , rid , code ) . then ( v -> callback . onResult ( v ) ) . failure ( e -> callback . onError ( e ) ) ; }
Adding reaction to a message
27,750
@ ObjectiveCName ( "saveDraftWithPeer:withDraft:" ) public void saveDraft ( Peer peer , String draft ) { modules . getMessagesModule ( ) . saveDraft ( peer , draft ) ; }
Save message draft
27,751
@ ObjectiveCName ( "loadDraftWithPeer:" ) public String loadDraft ( Peer peer ) { return modules . getMessagesModule ( ) . loadDraft ( peer ) ; }
Load message draft
27,752
@ ObjectiveCName ( "findMentionsWithGid:withQuery:" ) public List < MentionFilterResult > findMentions ( int gid , String query ) { return modules . getMentions ( ) . findMentions ( gid , query ) ; }
Finding suitable mentions
27,753
@ ObjectiveCName ( "findPeersWithType:" ) public Command < List < PeerSearchEntity > > findPeers ( PeerSearchType type ) { return callback -> modules . getSearchModule ( ) . findPeers ( type ) . then ( v -> callback . onResult ( v ) ) . failure ( e -> callback . onError ( e ) ) ; }
Finding peers by type
27,754
@ ObjectiveCName ( "findPeersWithQuery:" ) public Command < List < PeerSearchEntity > > findPeers ( String query ) { return callback -> modules . getSearchModule ( ) . findPeers ( query ) . then ( v -> callback . onResult ( v ) ) . failure ( e -> callback . onError ( e ) ) ; }
Finding peers by text query
27,755
@ ObjectiveCName ( "findTextMessagesWithPeer:withQuery:" ) public Command < List < MessageSearchEntity > > findTextMessages ( Peer peer , String query ) { return callback -> modules . getSearchModule ( ) . findTextMessages ( peer , query ) . then ( v -> callback . onResult ( v ) ) . failure ( e -> callback . onError ( e ) ) ; }
Finding text messages by query
27,756
@ ObjectiveCName ( "findAllDocsWithPeer:" ) public Command < List < MessageSearchEntity > > findAllDocs ( Peer peer ) { return callback -> modules . getSearchModule ( ) . findAllDocs ( peer ) . then ( v -> callback . onResult ( v ) ) . failure ( e -> callback . onError ( e ) ) ; }
Finding all doc messages
27,757
@ ObjectiveCName ( "doCallWithUid:" ) public Command < Long > doCall ( int uid ) { return modules . getCallsModule ( ) . makeCall ( Peer . user ( uid ) , false ) ; }
Calling to user
27,758
@ ObjectiveCName ( "doVideoCallWithUid:" ) public Command < Long > doVideoCall ( int uid ) { return modules . getCallsModule ( ) . makeCall ( Peer . user ( uid ) , true ) ; }
Video Calling to user
27,759
@ ObjectiveCName ( "doCallWithGid:" ) public Command < Long > doGroupCall ( int gid ) { return modules . getCallsModule ( ) . makeCall ( Peer . group ( gid ) , false ) ; }
Starting new group call
27,760
@ ObjectiveCName ( "toggleCallMuteWithCallId:" ) public void toggleCallMute ( long callId ) { if ( modules . getCallsModule ( ) . getCall ( callId ) . getIsAudioEnabled ( ) . get ( ) ) { modules . getCallsModule ( ) . muteCall ( callId ) ; } else { modules . getCallsModule ( ) . unmuteCall ( callId ) ; } }
Toggle muting of call
27,761
@ ObjectiveCName ( "toggleVideoEnabledWithCallId:" ) public void toggleVideoEnabled ( long callId ) { if ( modules . getCallsModule ( ) . getCall ( callId ) . getIsVideoEnabled ( ) . get ( ) ) { modules . getCallsModule ( ) . disableVideo ( callId ) ; } else { modules . getCallsModule ( ) . enableVideo ( callId ) ; } }
Toggle video of call
27,762
@ ObjectiveCName ( "checkCall:withAttempt:" ) public void checkCall ( long callId , int attempt ) { if ( modules . getCallsModule ( ) != null ) { modules . getCallsModule ( ) . checkCall ( callId , attempt ) ; } }
Checking incoming call from push notification
27,763
@ ObjectiveCName ( "editMyNameCommandWithName:" ) public Command < Boolean > editMyName ( final String newName ) { return callback -> modules . getUsersModule ( ) . editMyName ( newName ) . then ( v -> callback . onResult ( true ) ) . failure ( e -> callback . onError ( e ) ) ; }
Edit current user s name
27,764
@ ObjectiveCName ( "editMyNickCommandWithNick:" ) public Command < Boolean > editMyNick ( final String newNick ) { return callback -> modules . getUsersModule ( ) . editNick ( newNick ) . then ( v -> callback . onResult ( true ) ) . failure ( e -> callback . onError ( e ) ) ; }
Edit current user s nick
27,765
@ ObjectiveCName ( "editMyAboutCommandWithNick:" ) public Command < Boolean > editMyAbout ( final String newAbout ) { return callback -> modules . getUsersModule ( ) . editAbout ( newAbout ) . then ( v -> callback . onResult ( true ) ) . failure ( e -> callback . onError ( e ) ) ; }
Edit current user s about
27,766
@ ObjectiveCName ( "editNameCommandWithUid:withName:" ) public Command < Boolean > editName ( final int uid , final String name ) { return callback -> modules . getUsersModule ( ) . editName ( uid , name ) . then ( v -> callback . onResult ( true ) ) . failure ( e -> callback . onError ( e ) ) ; }
Edit user s local name
27,767
@ ObjectiveCName ( "editGroupTitleWithGid:withTitle:" ) public Promise < Void > editGroupTitle ( final int gid , final String title ) { return modules . getGroupsModule ( ) . editTitle ( gid , title ) ; }
Edit group s title
27,768
@ ObjectiveCName ( "editGroupThemeCommandWithGid:withTheme:" ) public Command < Void > editGroupTheme ( final int gid , final String theme ) { return callback -> modules . getGroupsModule ( ) . editTheme ( gid , theme ) . then ( v -> callback . onResult ( v ) ) . failure ( e -> callback . onError ( e ) ) ; }
Edit group s theme
27,769
@ ObjectiveCName ( "editGroupAboutWithGid:withAbout:" ) public Promise < Void > editGroupAbout ( int gid , String about ) { return modules . getGroupsModule ( ) . editAbout ( gid , about ) ; }
Edit group s about
27,770
@ ObjectiveCName ( "editGroupShortNameWithGid:withAbout:" ) public Promise < Void > editGroupShortName ( int gid , String shortName ) { return modules . getGroupsModule ( ) . editShortName ( gid , shortName ) ; }
Edit group s short name
27,771
@ ObjectiveCName ( "loadGroupPermissionsWithGid:" ) public Promise < GroupPermissions > loadGroupPermissions ( int gid ) { return modules . getGroupsModule ( ) . loadAdminSettings ( gid ) ; }
Load Group s permissions
27,772
@ ObjectiveCName ( "saveGroupPermissionsWithGid:withSettings:" ) public Promise < Void > saveGroupPermissions ( int gid , GroupPermissions adminSettings ) { return modules . getGroupsModule ( ) . saveAdminSettings ( gid , adminSettings ) ; }
Save Group s permissions
27,773
@ ObjectiveCName ( "changeGroupAvatarWithGid:withDescriptor:" ) public void changeGroupAvatar ( int gid , String descriptor ) { modules . getGroupsModule ( ) . changeAvatar ( gid , descriptor ) ; }
Change group avatar
27,774
@ ObjectiveCName ( "leaveAndDeleteGroupWithGid:" ) public Promise < Void > leaveAndDeleteGroup ( int gid ) { return modules . getGroupsModule ( ) . leaveAndDeleteGroup ( gid ) ; }
Leave and delete group
27,775
@ ObjectiveCName ( "shareHistoryWithGid:" ) public Promise < Void > shareHistory ( int gid ) { return modules . getGroupsModule ( ) . shareHistory ( gid ) ; }
Share Group History
27,776
@ ObjectiveCName ( "inviteMemberPromiseWithGid:withUid:" ) public Promise < Void > inviteMemberPromise ( int gid , int uid ) { return modules . getGroupsModule ( ) . addMember ( gid , uid ) ; }
Adding member to group
27,777
@ ObjectiveCName ( "loadMembersWithGid:withLimit:withNext:" ) public Promise < GroupMembersSlice > loadMembers ( int gid , int limit , byte [ ] next ) { return modules . getGroupsModule ( ) . loadMembers ( gid , limit , next ) ; }
Load async members
27,778
@ ObjectiveCName ( "makeAdminCommandWithGid:withUid:" ) public Command < Void > makeAdmin ( final int gid , final int uid ) { return callback -> modules . getGroupsModule ( ) . makeAdmin ( gid , uid ) . then ( v -> callback . onResult ( v ) ) . failure ( e -> callback . onError ( e ) ) ; }
Make member admin of group
27,779
@ ObjectiveCName ( "transferOwnershipWithGid:withUid:" ) public Promise < Void > transferOwnership ( int gid , int uid ) { return modules . getGroupsModule ( ) . transferOwnership ( gid , uid ) ; }
Transfer ownership of group
27,780
@ ObjectiveCName ( "joinGroupViaLinkCommandWithToken:" ) public Command < Integer > joinGroupViaToken ( String token ) { return callback -> modules . getGroupsModule ( ) . joinGroupByToken ( token ) . then ( v -> callback . onResult ( v ) ) . failure ( e -> callback . onError ( e ) ) ; }
Join group using invite link
27,781
@ ObjectiveCName ( "requestIntegrationTokenCommandWithGid:" ) public Command < String > requestIntegrationToken ( int gid ) { return callback -> modules . getGroupsModule ( ) . requestIntegrationToken ( gid ) . then ( v -> callback . onResult ( v ) ) . failure ( e -> callback . onError ( e ) ) ; }
Request integration token for group
27,782
@ ObjectiveCName ( "isStartedWithUid:" ) public Promise < Boolean > isStarted ( int uid ) { return modules . getMessagesModule ( ) . chatIsEmpty ( Peer . user ( uid ) ) ; }
Check if chat with bot is started
27,783
@ ObjectiveCName ( "removeContactCommandWithUid:" ) public Command < Boolean > removeContact ( int uid ) { return modules . getContactsModule ( ) . removeContact ( uid ) ; }
Remove user from contact s list
27,784
@ ObjectiveCName ( "addContactCommandWithUid:" ) public Command < Boolean > addContact ( int uid ) { return modules . getContactsModule ( ) . addContact ( uid ) ; }
Add contact to contact s list
27,785
@ ObjectiveCName ( "bindFileWithReference:autoStart:withCallback:" ) public FileVM bindFile ( FileReference fileReference , boolean isAutoStart , FileVMCallback callback ) { return new FileVM ( fileReference , isAutoStart , modules , callback ) ; }
Bind File View Model
27,786
@ ObjectiveCName ( "bindUploadWithRid:withCallback:" ) public UploadFileVM bindUpload ( long rid , UploadFileVMCallback callback ) { return new UploadFileVM ( rid , callback , modules ) ; }
Bind Uploading File View Model
27,787
@ ObjectiveCName ( "bindRawFileWithReference:autoStart:withCallback:" ) public void bindRawFile ( FileReference fileReference , boolean isAutoStart , FileCallback callback ) { modules . getFilesModule ( ) . bindFile ( fileReference , isAutoStart , callback ) ; }
Raw Bind File
27,788
@ ObjectiveCName ( "unbindRawFileWithFileId:autoCancel:withCallback:" ) public void unbindRawFile ( long fileId , boolean isAutoCancel , FileCallback callback ) { modules . getFilesModule ( ) . unbindFile ( fileId , callback , isAutoCancel ) ; }
Unbind Raw File
27,789
@ ObjectiveCName ( "bindRawUploadFileWithRid:withCallback:" ) public void bindRawUploadFile ( long rid , UploadFileCallback callback ) { modules . getFilesModule ( ) . bindUploadFile ( rid , callback ) ; }
Raw Bind Upload File
27,790
@ ObjectiveCName ( "unbindRawUploadFileWithRid:withCallback:" ) public void unbindRawUploadFile ( long rid , UploadFileCallback callback ) { modules . getFilesModule ( ) . unbindUploadFile ( rid , callback ) ; }
Unbind Raw Upload File
27,791
@ ObjectiveCName ( "requestStateWithFileId:withCallback:" ) public void requestState ( long fileId , final FileCallback callback ) { modules . getFilesModule ( ) . requestState ( fileId , callback ) ; }
Request file state
27,792
@ ObjectiveCName ( "requestUploadStateWithRid:withCallback:" ) public void requestUploadState ( long rid , UploadFileCallback callback ) { modules . getFilesModule ( ) . requestUploadState ( rid , callback ) ; }
Request upload file state
27,793
@ ObjectiveCName ( "changeNotificationsEnabledWithPeer:withValue:" ) public void changeNotificationsEnabled ( Peer peer , boolean val ) { modules . getSettingsModule ( ) . changeNotificationsEnabled ( peer , val ) ; }
Change if notifications enabled for peer
27,794
@ ObjectiveCName ( "changeNotificationsSoundPeer:withValue:" ) public void changeNotificationsSound ( Peer peer , String val ) { modules . getSettingsModule ( ) . changeNotificationPeerSound ( peer , val ) ; }
Change notifications sound for peer
27,795
@ ObjectiveCName ( "loadSessionsCommand" ) public Command < List < ApiAuthSession > > loadSessions ( ) { return callback -> modules . getSecurityModule ( ) . loadSessions ( ) . then ( r -> callback . onResult ( r ) ) . failure ( e -> callback . onError ( e ) ) ; }
Loading active sessions
27,796
@ ObjectiveCName ( "terminateAllSessionsCommand" ) public Command < Void > terminateAllSessions ( ) { return callback -> modules . getSecurityModule ( ) . terminateAllSessions ( ) . then ( r -> callback . onResult ( r ) ) . failure ( e -> callback . onError ( e ) ) ; }
Terminate all other sessions
27,797
@ ObjectiveCName ( "startWebAction:" ) public Command < WebActionDescriptor > startWebAction ( final String webAction ) { return modules . getExternalModule ( ) . startWebAction ( webAction ) ; }
Command for starting web action
27,798
@ ObjectiveCName ( "completeWebActionWithHash:withUrl:" ) public Command < Boolean > completeWebAction ( final String actionHash , final String url ) { return modules . getExternalModule ( ) . completeWebAction ( actionHash , url ) ; }
Command for completing web action
27,799
@ ObjectiveCName ( "registerGooglePushWithProjectId:withToken:" ) public void registerGooglePush ( long projectId , String token ) { modules . getPushesModule ( ) . registerGooglePush ( projectId , token ) ; }
Register google push