Skip to content

Commit

Permalink
Remove posibility to add own SSIDs.
Browse files Browse the repository at this point in the history
  • Loading branch information
WIStudent committed Oct 23, 2015
1 parent 14700c0 commit 77beb67
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 91 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
### Fixed
- Fixed a problem where new SSIDs weren't shown when the filter function was used right after the list of SSIDs was updated.

### Removed
- The feature to add own SSIDs was removed. There should be a folder named "freifunkautoconnect" containing the file "user_ssids.csv" on your SD card if version <= 0.5 was installed on your device. You can remove this folder, it is no longer needed.

## [0.5] 2015-08-31
### Added
- The app will check on start up, if an updated list of SSIDs is available. If the check didn't fail, the next check will not be started until 24 hours have passed.
Expand Down
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.view.MenuItemCompat;
import android.util.Log;
Expand Down Expand Up @@ -60,9 +57,6 @@ public class AddRemoveNetworksFragment extends Fragment implements AdapterView.O

private static final String TAG = AddRemoveNetworksFragment.class.getSimpleName();

public static String DIRECTORY = "freifunkautoconnect";
public static String USER_SSIDS_FILE = "user_ssids.csv";

private OnFragmentInteractionListener mListener;

// ListView stuff
Expand Down Expand Up @@ -365,73 +359,9 @@ private void getSSIDs() throws IOException {
e.printStackTrace();
}


// Read user defined ssids
// Check if external storage is available
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
File user_ssids = new File(Environment.getExternalStorageDirectory() + File.separator + DIRECTORY + File.separator + USER_SSIDS_FILE );
// Check if file exists
if(!user_ssids.exists()){
// If not, create the file
Log.i(TAG, "Start creation of user_ssids.csv file");
user_ssids = createUserSSIDFile();
}
else{
Log.i(TAG, "user_ssids.csv already exists");
}
// If the file was found/created:
if(user_ssids != null){
is = new InputStreamReader(new FileInputStream(user_ssids));
reader = new BufferedReader(is);
while ((line = reader.readLine()) != null) {
allNetworks.add(new Network(line));
}
}
else{
Log.w(TAG, "Could not find or create user_ssids file.");
}
}
Collections.sort(allNetworks);
}

private File createUserSSIDFile(){
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
File directory = new File(Environment.getExternalStorageDirectory() + File.separator + DIRECTORY);
if(!directory.exists()){
// Create directory
Log.i(TAG, "Create freifunkautoconnect directory");
directory.mkdir();
}
File user_ssids = new File(directory, USER_SSIDS_FILE);
try {
// Create empty file
Log.i(TAG, "Create empty user_ssids.csv file");
user_ssids.createNewFile();
}
catch (IOException e) {
Log.w(TAG, "Could not create user_ssids.csv file.");
return null;
}

// Make sure that the new file will be visible if the device is connected to a pc over USB cable.
Log.i(TAG, "Scan for user_ssids.csv file");
MediaScannerConnection.scanFile(
getActivity(),
new String[]{directory.getAbsolutePath(), user_ssids.getAbsolutePath(),},
null,
new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(String path, Uri uri) {
Log.i(TAG, "Scanned " + path + ":");
Log.i(TAG, "-> uri=" + uri);
}
}
);
}
return null;
}

private void checkActiveNetworks(){
// Check which Network is already added to the network configuration
List<WifiConfiguration> wifiConf = wm.getConfiguredNetworks();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import android.net.NetworkInfo;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.os.Environment;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.provider.Settings;
Expand Down Expand Up @@ -237,25 +236,6 @@ private void getSSIDs() throws IOException {
e.printStackTrace();
}


// Read user defined ssids
// Check if external storage is available
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
File user_ssids = new File(Environment.getExternalStorageDirectory() + File.separator + AddRemoveNetworksFragment.DIRECTORY + File.separator + AddRemoveNetworksFragment.USER_SSIDS_FILE );
// Check if file exists
// If the file was found/created:
if(user_ssids.exists()){
is = new InputStreamReader(new FileInputStream(user_ssids));
reader = new BufferedReader(is);
while ((line = reader.readLine()) != null) {
networks.add(new Network(line));
}
}
else{
Log.w(TAG, "Could not find.");
}
}
Collections.sort(networks);
}
}

0 comments on commit 77beb67

Please sign in to comment.