track all successful peers, and remove all unsuccessful peers
Since it is possible to connect to a peer via NFC, "Swap back", QR Code, etc. once a peer is successfully used, it can show up in the StartSwapView list of peers.
This commit is contained in:
		
							parent
							
								
									0727787713
								
							
						
					
					
						commit
						18a7690758
					
				@ -230,6 +230,14 @@ public class SwapService extends Service {
 | 
			
		||||
        this.peer = peer;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void addCurrentPeerToActive() {
 | 
			
		||||
        activePeers.add(peer);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void removeCurrentPeerFromActive() {
 | 
			
		||||
        activePeers.remove(peer);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isConnectingWithPeer() {
 | 
			
		||||
        return peer != null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -659,7 +659,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
 | 
			
		||||
            //       can or cannot be in STEP_INTRO with a full blown repo ready to swap.
 | 
			
		||||
            swapWith(peer);
 | 
			
		||||
        } else {
 | 
			
		||||
            getSwapService().swapWith(repoConfig.toPeer());
 | 
			
		||||
            getSwapService().swapWith(peer);
 | 
			
		||||
            startSwappingWithPeer();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@ -1286,10 +1286,12 @@ public class SwapWorkflowActivity extends AppCompatActivity {
 | 
			
		||||
                    status == UpdateService.STATUS_ERROR_LOCAL_SMALL) {
 | 
			
		||||
                progressBar.setVisibility(View.GONE);
 | 
			
		||||
                tryAgainButton.setVisibility(View.VISIBLE);
 | 
			
		||||
                getSwapService().removeCurrentPeerFromActive();
 | 
			
		||||
                return;
 | 
			
		||||
            } else {
 | 
			
		||||
                progressBar.setVisibility(View.VISIBLE);
 | 
			
		||||
                tryAgainButton.setVisibility(View.GONE);
 | 
			
		||||
                getSwapService().addCurrentPeerToActive();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (status == UpdateService.STATUS_COMPLETE_AND_SAME
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user