Skip to content

Commit 7c4f50c

Browse files
committed
spixi-0.9.9-rc
1 parent 7ffd1a5 commit 7c4f50c

File tree

2 files changed

+31
-34
lines changed

2 files changed

+31
-34
lines changed

Spixi/Meta/Config.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class Config
3333
public static readonly int packetDataSize = 102400; // 100 Kb per packet for file transfers
3434
public static readonly long packetRequestTimeout = 60; // Time in seconds to re-request packets
3535

36-
public static readonly string version = "spixi-0.9.9-dev"; // Spixi version
36+
public static readonly string version = "spixi-0.9.9-rc"; // Spixi version
3737

3838
public static readonly string checkVersionUrl = "https://resources.ixian.io/spixi-update.txt";
3939
public static readonly int checkVersionSeconds = 1 * 60 * 60; // 1 hour

Spixi/Pages/Chat/SingleChatPage.xaml.cs

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -545,51 +545,48 @@ public void onSend(string str)
545545
return;
546546
}
547547

548-
Task.Run(async () =>
548+
if (friend.bot)
549549
{
550-
if (friend.bot)
550+
if (friend.metaData.botInfo.cost > 0)
551551
{
552-
if (friend.metaData.botInfo.cost > 0)
552+
IxiNumber message_cost = friend.getMessagePrice(str.Length);
553+
if (message_cost > 0)
553554
{
554-
IxiNumber message_cost = friend.getMessagePrice(str.Length);
555-
if (message_cost > 0)
555+
Transaction tx = new Transaction((int)Transaction.Type.Normal, message_cost, ConsensusConfig.forceTransactionPrice, friend.walletAddress, IxianHandler.getWalletStorage().getPrimaryAddress(), null, new Address(IxianHandler.getWalletStorage().getPrimaryPublicKey()), IxianHandler.getHighestKnownNetworkBlockHeight());
556+
IxiNumber balance = IxianHandler.getWalletBalance(IxianHandler.getWalletStorage().getPrimaryAddress());
557+
if (tx.amount + tx.fee > balance)
556558
{
557-
Transaction tx = new Transaction((int)Transaction.Type.Normal, message_cost, ConsensusConfig.forceTransactionPrice, friend.walletAddress, IxianHandler.getWalletStorage().getPrimaryAddress(), null, new Address(IxianHandler.getWalletStorage().getPrimaryPublicKey()), IxianHandler.getHighestKnownNetworkBlockHeight());
558-
IxiNumber balance = IxianHandler.getWalletBalance(IxianHandler.getWalletStorage().getPrimaryAddress());
559-
if (tx.amount + tx.fee > balance)
560-
{
561-
string alert_body = String.Format(SpixiLocalization._SL("wallet-error-balance-text"), tx.amount + tx.fee, balance);
562-
await displaySpixiAlert(SpixiLocalization._SL("wallet-error-balance-title"), alert_body, SpixiLocalization._SL("global-dialog-ok"));
563-
return;
564-
}
559+
string alert_body = String.Format(SpixiLocalization._SL("wallet-error-balance-text"), tx.amount + tx.fee, balance);
560+
displaySpixiAlert(SpixiLocalization._SL("wallet-error-balance-title"), alert_body, SpixiLocalization._SL("global-dialog-ok"));
561+
return;
565562
}
566563
}
567564
}
565+
}
568566

569-
SpixiMessage spixi_message = new SpixiMessage(SpixiMessageCode.chat, Encoding.UTF8.GetBytes(str), selectedChannel);
570-
byte[] spixi_msg_bytes = spixi_message.getBytes();
571-
572-
// store the message and display it
573-
FriendMessage friend_message = Node.addMessageWithType(null, FriendMessageType.standard, friend.walletAddress, selectedChannel, str, true, null, 0, true, spixi_msg_bytes.Length);
567+
SpixiMessage spixi_message = new SpixiMessage(SpixiMessageCode.chat, Encoding.UTF8.GetBytes(str), selectedChannel);
568+
byte[] spixi_msg_bytes = spixi_message.getBytes();
574569

575-
// Finally, clear the input field
576-
Utils.sendUiCommand(this, "clearInput");
570+
// store the message and display it
571+
FriendMessage friend_message = Node.addMessageWithType(null, FriendMessageType.standard, friend.walletAddress, selectedChannel, str, true, null, 0, true, spixi_msg_bytes.Length);
577572

578-
StreamMessage message = new StreamMessage(friend.protocolVersion);
579-
message.type = StreamMessageCode.data;
580-
message.recipient = friend.walletAddress;
581-
message.sender = IxianHandler.getWalletStorage().getPrimaryAddress();
582-
message.data = spixi_msg_bytes;
583-
message.id = friend_message.id;
573+
// Finally, clear the input field
574+
Utils.sendUiCommand(this, "clearInput");
584575

585-
if (friend.bot)
586-
{
587-
message.encryptionType = StreamMessageEncryptionCode.none;
588-
message.sign(IxianHandler.getWalletStorage().getPrimaryPrivateKey());
589-
}
576+
StreamMessage message = new StreamMessage(friend.protocolVersion);
577+
message.type = StreamMessageCode.data;
578+
message.recipient = friend.walletAddress;
579+
message.sender = IxianHandler.getWalletStorage().getPrimaryAddress();
580+
message.data = spixi_msg_bytes;
581+
message.id = friend_message.id;
590582

591-
StreamProcessor.sendMessage(friend, message);
592-
});
583+
if (friend.bot)
584+
{
585+
message.encryptionType = StreamMessageEncryptionCode.none;
586+
message.sign(IxianHandler.getWalletStorage().getPrimaryPrivateKey());
587+
}
588+
589+
StreamProcessor.sendMessage(friend, message);
593590
}
594591

595592
public async Task onSendFile()

0 commit comments

Comments
 (0)