[tor-commits] [orbot/master] fix bridge append value from qrcode scan

n8fr8 at torproject.org n8fr8 at torproject.org
Thu Jun 5 15:15:59 UTC 2014


commit d3924396e3c89707309013fa4e33a50b777a4f1b
Author: Nathan Freitas <nathan at freitas.net>
Date:   Wed Jun 4 23:52:37 2014 -0400

    fix bridge append value from qrcode scan
---
 src/org/torproject/android/Orbot.java |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index bc95961..17b80b3 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -621,9 +621,23 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
 		
 					showAlert("Bridges Updated","Restart Orbot to use this bridge: " + newBridgeValue,false);	
 					SharedPreferences mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
+					
+					String bridges = mPrefs.getString(TorConstants.PREF_BRIDGES_LIST, null);
+					
 					Editor pEdit = mPrefs.edit();
 					
-					pEdit.putString(TorConstants.PREF_BRIDGES_LIST,newBridgeValue); //set the string to a preference
+					if (bridges != null && bridges.trim().length() > 0)
+					{
+						if (bridges.indexOf('\n')!=-1)
+							bridges += '\n' + newBridgeValue;
+						else
+							bridges += ',' + newBridgeValue;
+					}
+					else
+						bridges = newBridgeValue;
+					
+					pEdit.putString(TorConstants.PREF_BRIDGES_LIST,bridges); //set the string to a preference
+					pEdit.putBoolean(TorConstants.PREF_BRIDGES_ENABLED,true);
 				
 					pEdit.commit();
 				}





More information about the tor-commits mailing list