コード例 #1
0
        // Retrieve the friend's connected S2 node address. Returns null if not found
        public string searchForRelay()
        {
            relayIP     = null;
            relayWallet = null;

            string hostname = FriendList.getRelayHostname(walletAddress);

            if (hostname != null && hostname != "")
            {
                // Store the last relay ip and wallet for this friend
                relayIP = hostname;
            }
            // Finally, return the ip address of the node
            return(relayIP);
        }
コード例 #2
0
        public CustomAppPage(byte[] host_user_address, byte[][] user_addresses, string app_entry_point)
        {
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);

            sessionId = Guid.NewGuid().ToByteArray();

            hostUserAddress = host_user_address;
            userAddresses   = user_addresses;

            node_ip = FriendList.getRelayHostname(host_user_address);

            // Load the app entry point
            var source = new UrlWebViewSource();

            source.Url     = string.Format("{0}html/{1}", DependencyService.Get <IBaseUrl>().Get(), app_entry_point);
            webView.Source = source;
        }
コード例 #3
0
        public void onRequest(byte[] wal)
        {
            if (Address.validateChecksum(wal) == false)
            {
                DisplayAlert("Invalid checksum", "Please make sure you typed the address correctly.", "OK");
                return;
            }


            byte[] pubkey = FriendList.findContactPubkey(wal);
            if (pubkey == null)
            {
                DisplayAlert("Contact does not exist", "Try again later.", "OK");
                NetworkClientManager.broadcastData(new char[] { 'M' }, ProtocolMessageCode.syncPresenceList, new byte[1], null);
                return;
            }

            string relayip = FriendList.getRelayHostname(wal);

            // TODOSPIXI
            //FriendList.addFriend(wal, pubkey, "Unknown");

            // Connect to the contact's S2 relay first
            //  StreamClientManager.connectToStreamNode(relayip);

            // Send the message to the S2 nodes
            byte[] recipient_address = wal;

            SpixiMessage spixi_message = new SpixiMessage(SpixiMessageCode.requestAdd, new byte[1]);


            StreamMessage message = new StreamMessage();

            message.type        = StreamMessageCode.info;
            message.recipient   = recipient_address;
            message.sender      = Node.walletStorage.getPrimaryAddress();
            message.data        = spixi_message.getBytes();
            message.transaction = new byte[1];
            message.sigdata     = new byte[1];

            StreamProcessor.sendMessage(message, relayip);

            Navigation.PopAsync(Config.defaultXamarinAnimations);
        }