mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-11-04 19:32:17 +08:00 
			
		
		
		
	* fix: repeated modification session notification * fix: repeated modification session notification * fix: jpush return a nil pointer panic * fix: push redis pkg * fix: OANotification * feat: add rpc GetConversationNeedOfflinePushUserIDs * update pkg * cicd: robot automated Change * offlinePushMsg * conversation * conversation * cicd: robot automated Change * conversation * cicd: robot automated Change * conversation * url 2 im s3 * url 2 im s3 * cicd: robot automated Change * url 2 im s3 --------- Co-authored-by: withchao <withchao@users.noreply.github.com>
		
			
				
	
	
		
			42 lines
		
	
	
		
			697 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			697 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package pkg
 | 
						|
 | 
						|
import (
 | 
						|
	"bufio"
 | 
						|
	"os"
 | 
						|
	"strconv"
 | 
						|
 | 
						|
	"github.com/kelindar/bitmap"
 | 
						|
)
 | 
						|
 | 
						|
func ReadProgress(path string) (*Progress, error) {
 | 
						|
	file, err := os.Open(path)
 | 
						|
	if err != nil {
 | 
						|
		if os.IsNotExist(err) {
 | 
						|
			return &Progress{}, nil
 | 
						|
		}
 | 
						|
		return nil, err
 | 
						|
	}
 | 
						|
	defer file.Close()
 | 
						|
	scanner := bufio.NewScanner(file)
 | 
						|
	var upload bitmap.Bitmap
 | 
						|
	for scanner.Scan() {
 | 
						|
		index, err := strconv.Atoi(scanner.Text())
 | 
						|
		if err != nil || index < 0 {
 | 
						|
			continue
 | 
						|
		}
 | 
						|
		upload.Set(uint32(index))
 | 
						|
	}
 | 
						|
	return &Progress{upload: upload}, nil
 | 
						|
}
 | 
						|
 | 
						|
type Progress struct {
 | 
						|
	upload bitmap.Bitmap
 | 
						|
}
 | 
						|
 | 
						|
func (p *Progress) IsUploaded(index int) bool {
 | 
						|
	if p == nil {
 | 
						|
		return false
 | 
						|
	}
 | 
						|
	return p.upload.Contains(uint32(index))
 | 
						|
}
 |