github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/libkb/homestate.go (about)

     1  package libkb
     2  
     3  import (
     4  	"github.com/keybase/client/go/protocol/keybase1"
     5  )
     6  
     7  type HomeTodoMap map[keybase1.HomeScreenTodoType]int
     8  type HomeItemMap map[keybase1.HomeScreenItemType]HomeTodoMap
     9  
    10  type HomeStateBody struct {
    11  	Version              int           `json:"version"`
    12  	BadgeCountMap        HomeItemMap   `json:"badge_count_map"`
    13  	LastViewedTime       keybase1.Time `json:"last_viewed_time"`
    14  	AnnouncementsVersion int           `json:"announcements_version"`
    15  }
    16  
    17  func (a *HomeStateBody) LessThan(b HomeStateBody) bool {
    18  	if a == nil {
    19  		return true
    20  	}
    21  	if a.Version < b.Version {
    22  		return true
    23  	}
    24  	if a.Version == b.Version && a.LastViewedTime < b.LastViewedTime {
    25  		return true
    26  	}
    27  	if a.AnnouncementsVersion < b.AnnouncementsVersion {
    28  		return true
    29  	}
    30  	return false
    31  }