✨ Refreshed account presences system
This commit is contained in:
		@@ -10,21 +10,31 @@ public enum StatusAttitude
 | 
			
		||||
{
 | 
			
		||||
    Positive,
 | 
			
		||||
    Negative,
 | 
			
		||||
    Neutral
 | 
			
		||||
    Neutral,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
public class SnAccountStatus : ModelBase
 | 
			
		||||
{
 | 
			
		||||
    public Guid Id { get; set; } = Guid.NewGuid();
 | 
			
		||||
    public StatusAttitude Attitude { get; set; }
 | 
			
		||||
    [NotMapped] public bool IsOnline { get; set; }
 | 
			
		||||
    [NotMapped] public bool IsCustomized { get; set; } = true;
 | 
			
		||||
 | 
			
		||||
    [NotMapped]
 | 
			
		||||
    public bool IsOnline { get; set; }
 | 
			
		||||
 | 
			
		||||
    [NotMapped]
 | 
			
		||||
    public bool IsCustomized { get; set; } = true;
 | 
			
		||||
    public bool IsInvisible { get; set; }
 | 
			
		||||
    public bool IsNotDisturb { get; set; }
 | 
			
		||||
    [MaxLength(1024)] public string? Label { get; set; }
 | 
			
		||||
    [Column(TypeName = "jsonb")] public Dictionary<string, object>? Meta { get; set; }
 | 
			
		||||
 | 
			
		||||
    [MaxLength(1024)]
 | 
			
		||||
    public string? Label { get; set; }
 | 
			
		||||
 | 
			
		||||
    [Column(TypeName = "jsonb")]
 | 
			
		||||
    public Dictionary<string, object>? Meta { get; set; }
 | 
			
		||||
    public Instant? ClearedAt { get; set; }
 | 
			
		||||
    [MaxLength(4096)] public string? AppIdentifier { get; set; }
 | 
			
		||||
 | 
			
		||||
    [MaxLength(4096)]
 | 
			
		||||
    public string? AppIdentifier { get; set; }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Indicates this status is created based on running process or rich presence
 | 
			
		||||
@@ -44,7 +54,7 @@ public class SnAccountStatus : ModelBase
 | 
			
		||||
                StatusAttitude.Positive => Shared.Proto.StatusAttitude.Positive,
 | 
			
		||||
                StatusAttitude.Negative => Shared.Proto.StatusAttitude.Negative,
 | 
			
		||||
                StatusAttitude.Neutral => Shared.Proto.StatusAttitude.Neutral,
 | 
			
		||||
                _ => Shared.Proto.StatusAttitude.Unspecified
 | 
			
		||||
                _ => Shared.Proto.StatusAttitude.Unspecified,
 | 
			
		||||
            },
 | 
			
		||||
            IsOnline = IsOnline,
 | 
			
		||||
            IsCustomized = IsCustomized,
 | 
			
		||||
@@ -53,7 +63,7 @@ public class SnAccountStatus : ModelBase
 | 
			
		||||
            Label = Label ?? string.Empty,
 | 
			
		||||
            Meta = GrpcTypeHelper.ConvertObjectToByteString(Meta),
 | 
			
		||||
            ClearedAt = ClearedAt?.ToTimestamp(),
 | 
			
		||||
            AccountId = AccountId.ToString()
 | 
			
		||||
            AccountId = AccountId.ToString(),
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        return proto;
 | 
			
		||||
@@ -69,7 +79,7 @@ public class SnAccountStatus : ModelBase
 | 
			
		||||
                Shared.Proto.StatusAttitude.Positive => StatusAttitude.Positive,
 | 
			
		||||
                Shared.Proto.StatusAttitude.Negative => StatusAttitude.Negative,
 | 
			
		||||
                Shared.Proto.StatusAttitude.Neutral => StatusAttitude.Neutral,
 | 
			
		||||
                _ => StatusAttitude.Neutral
 | 
			
		||||
                _ => StatusAttitude.Neutral,
 | 
			
		||||
            },
 | 
			
		||||
            IsOnline = proto.IsOnline,
 | 
			
		||||
            IsCustomized = proto.IsCustomized,
 | 
			
		||||
@@ -78,7 +88,7 @@ public class SnAccountStatus : ModelBase
 | 
			
		||||
            Label = proto.Label,
 | 
			
		||||
            Meta = GrpcTypeHelper.ConvertByteStringToObject<Dictionary<string, object>>(proto.Meta),
 | 
			
		||||
            ClearedAt = proto.ClearedAt?.ToInstant(),
 | 
			
		||||
            AccountId = Guid.Parse(proto.AccountId)
 | 
			
		||||
            AccountId = Guid.Parse(proto.AccountId),
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        return status;
 | 
			
		||||
@@ -92,7 +102,7 @@ public enum CheckInResultLevel
 | 
			
		||||
    Normal,
 | 
			
		||||
    Better,
 | 
			
		||||
    Best,
 | 
			
		||||
    Special
 | 
			
		||||
    Special,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
public class SnCheckInResult : ModelBase
 | 
			
		||||
@@ -101,7 +111,9 @@ public class SnCheckInResult : ModelBase
 | 
			
		||||
    public CheckInResultLevel Level { get; set; }
 | 
			
		||||
    public decimal? RewardPoints { get; set; }
 | 
			
		||||
    public int? RewardExperience { get; set; }
 | 
			
		||||
    [Column(TypeName = "jsonb")] public ICollection<CheckInFortuneTip> Tips { get; set; } = new List<CheckInFortuneTip>();
 | 
			
		||||
 | 
			
		||||
    [Column(TypeName = "jsonb")]
 | 
			
		||||
    public ICollection<CheckInFortuneTip> Tips { get; set; } = new List<CheckInFortuneTip>();
 | 
			
		||||
 | 
			
		||||
    public Guid AccountId { get; set; }
 | 
			
		||||
    public SnAccount Account { get; set; } = null!;
 | 
			
		||||
@@ -125,3 +137,38 @@ public class DailyEventResponse
 | 
			
		||||
    public SnCheckInResult? CheckInResult { get; set; }
 | 
			
		||||
    public ICollection<SnAccountStatus> Statuses { get; set; } = new List<SnAccountStatus>();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
public enum PresenceType
 | 
			
		||||
{
 | 
			
		||||
    Unknown,
 | 
			
		||||
    Gaming,
 | 
			
		||||
    Music,
 | 
			
		||||
    Workout,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
public class SnPresenceActivity : ModelBase
 | 
			
		||||
{
 | 
			
		||||
    public Guid Id { get; set; } = Guid.NewGuid();
 | 
			
		||||
    public PresenceType Type { get; set; } = PresenceType.Unknown;
 | 
			
		||||
 | 
			
		||||
    [MaxLength(4096)]
 | 
			
		||||
    public string? ManualId { get; set; }
 | 
			
		||||
 | 
			
		||||
    [MaxLength(4096)]
 | 
			
		||||
    public string? Title { get; set; }
 | 
			
		||||
 | 
			
		||||
    [MaxLength(4096)]
 | 
			
		||||
    public string? Subtitle { get; set; }
 | 
			
		||||
 | 
			
		||||
    [MaxLength(4096)]
 | 
			
		||||
    public string? Caption { get; set; }
 | 
			
		||||
 | 
			
		||||
    [Column(TypeName = "jsonb")]
 | 
			
		||||
    public Dictionary<string, object>? Meta { get; set; }
 | 
			
		||||
 | 
			
		||||
    public int LeaseMinutes { get; set; } = 5; // Lease period in minutes (1-60)
 | 
			
		||||
    public Instant LeaseExpiresAt { get; set; }
 | 
			
		||||
 | 
			
		||||
    public Guid AccountId { get; set; }
 | 
			
		||||
    public SnAccount Account { get; set; } = null!;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user