Skip to content

Commit

Permalink
iOS 消息,增加对角标控制的逻辑接口,fix #2
Browse files Browse the repository at this point in the history
  • Loading branch information
uwei committed Aug 20, 2018
1 parent 6afe661 commit 7553caf
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 2 deletions.
Binary file modified SDK.Test/bin/Debug/netcoreapp2.1/XingeApp.dll
Binary file not shown.
Binary file modified SDK.Test/bin/Debug/netcoreapp2.1/XingeApp.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
37 changes: 35 additions & 2 deletions SDK/MessageiOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ public class MessageiOS
private string m_subtitle;

private int m_pushID;

/// -1,表示角标不变;
/// -2,表示角标自动加+;
/// n,(n >= 0)表示自定义角标数值
private int m_badgeType;

public MessageiOS()
{
Expand All @@ -40,6 +45,7 @@ public MessageiOS()
this.m_title = "";
this.m_subtitle = "";
this.m_pushID = 0;
this.m_badgeType = -1;
}

public void setType(string type)
Expand Down Expand Up @@ -109,10 +115,12 @@ public void setAlert(Dictionary<string,object> alert)
m_alertJo = alert;
}

[Obsolete("方法已经停用,请使用setBadgeType")]
public void setBadge(int badge)
{
m_badge = badge;
}

public void setTitle(string title)
{
this.m_title = title;
Expand Down Expand Up @@ -162,6 +170,31 @@ public int getPushID()
return m_pushID;
}

/// <summery> 设置角标下发的逻辑
/// <list type="int">
/// <item>
/// <term>-1</term>
/// <description>表示角标不变;</description>
/// </item>
/// <item>
/// <term>-2</term>
/// <description>表示角标自动加1;</description>
/// </item>
/// <item>
/// <term>n</term>
/// <description>(n>=0)表示自定义下发角标数字.</description>
/// </item>
/// </list>
/// </summery>
public void setBadgeType(int type)
{
m_badgeType = type;
}

public int badgeType()
{
return m_badgeType;
}

public Boolean isValid()
{
Expand Down Expand Up @@ -195,8 +228,8 @@ public object toJson()
{
Dictionary<string, object> alert = new Dictionary<string, object>();
aps.Add("alert",alert);
aps.Add("badge",m_badge);

// aps.Add("badge",m_badge);
aps.Add("badge_type", m_badgeType);
if(m_sound.Length != 0)
{
aps.Add("sound",m_sound);
Expand Down
Binary file modified SDK/bin/Debug/netstandard2.0/XingeApp.dll
Binary file not shown.
Binary file modified SDK/bin/Debug/netstandard2.0/XingeApp.pdb
Binary file not shown.
Binary file modified SDK/obj/Debug/netstandard2.0/XingeApp.dll
Binary file not shown.
Binary file modified SDK/obj/Debug/netstandard2.0/XingeApp.pdb
Binary file not shown.

0 comments on commit 7553caf

Please sign in to comment.