Skip to content

Commit

Permalink
adding in EULA with UI dialog. closes #40.
Browse files Browse the repository at this point in the history
  • Loading branch information
n8fr8 committed Oct 27, 2011
1 parent 4834dc7 commit eeaeac9
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 1 deletion.
29 changes: 29 additions & 0 deletions assets/EULA
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
TERMS OF USE

WHO WE ARE
We are The Guardian Project, an Open Source software project creating easy to use mobile applications and developer tools that help users more effectively protect their identity. We've developed ObscuraCam, an application for your Android mobile device, and we also maintain a website located at https://guardianproject.info. We will refer to the application hereafter as “App” and the website as “Site.”

THE APP
The App is designed to enable simple and straightforward redacting and anonymizing of mobile photos. To that end the App provides utilities for the user to automatically scan for faces and redact regions using methods such as solid color fill, pixelation and 'masking.' The tools we use for facial recognition are open source utilities developed by third parties and in no way do we claim that they will be 100% effective in facial detection.

USAGE GUIDELINES
The App is designed to protect the identity of users and bystanders. Please use it in accordance with this design. While we recognize that your mobile device is your own and you may take whatever pictures you see fit, we encourage you to use the App in socially responsible ways.

SOURCE CODE & LICENSING
The App source code is hosted publicly at https://github.com/guardianproject/SecureSmartCam/ and is licensed under the GNU General Public License v3 (GPLv3). The GPL is a copyleft license for general use, meaning that derived works can only be distributed under the same license terms. In other words, you're more than welcome to use the project's code in your own projects, but they must be similarly licensed. Please reference https://github.com/guardianproject/SecureSmartCam/blob/master/LICENSE for relevant

MINORS
THIS SERVICE IS NOT MEANT FOR MINORS. We are committed to protecting the privacy needs of children and we encourage parents and guardians to take an active role in their children’s online activities and interests. The Service is not intended for and may not be used by children under the age of 13. Minors over the age of 13 should seek permission from their parents to use the App.

CONTENT OWNERSHIP
YOU OWN THE CONTENT YOU CREATE. Whatever pictures you create using our App are yours to do with what you wish. Any pictures you take will also be saved to your Device’s native Image folder and you can download those images to your computer according to the software your Device uses.

YOU DON’T OWN ALL THE CONTENT YOU SEE. If you didn’t create the Content, you don’t own it. This includes images you may have downloaded from the Internet or by other means. That means you cannot use it without permission from the original content owner, in accordance with their wishes. If you did create the Content, and you want to give someone permission to use it, that is your right.

And now for some boring legalese…

INDEMNIFICATION AND RELEASE
You will indemnify, defend and hold us and our investors, officers, directors, affiliates, subsidiaries, licensors, partners, licensees, consultants, contractors, agents, attorneys, advertisers and employees (collectively, the “Indemnified Parties”) harmless from and against any and all actual or threatened suits, actions, proceedings (at law or in equity), claims (groundless or otherwise), damages, payments, deficiencies, fines, judgments, settlements, liabilities, losses, costs and expenses (including, but not limited to, reasonable attorney and expert fees, costs, penalties, interest and disbursements) resulting from any claim (including third party claims), suit, action, or proceeding against a Indemnified Party, whether successful or not, resulting from or arising in connection with: (i) your use of the Site, the Mobile applications, the Materials and/or the Service; (ii) your conduct; (iii) any breach by you of these Terms (including, but not limited to, any breach of any of your representations or warranties); and/or (iii) any Content you upload to, posted on, create on, transmitted through or linked from the Site.

UPDATES TO TERMS OF USE
We reserve the right to change or modify any provisions of these Terms and any policies or guidelines governing your use of the Service, at any time in our sole discretion and without liability to you. Any such changes or modifications will be effective immediately upon posting of revisions on the Service. Your continued use of the Service following the posting of such changes or modifications constitutes your acceptance thereof. Therefore, you should frequently review these Terms and all applicable policies or guidelines on the Site in order to understand the terms and conditions applicable to your use of the Service. If you do not agree to any changes or modifications to these Terms or to any applicable policies or guidelines, your sole recourse is to stop using the Service.
5 changes: 5 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,9 @@

<string name="yes">Yes</string>
<string name="no">No</string>


<string name="eula_title">You agree to:</string>
<string name="eula_accept">Accept</string>
<string name="eula_refuse">Refuse</string>
</resources>
128 changes: 128 additions & 0 deletions src/org/witness/sscphase1/Eula.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.witness.sscphase1;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;

import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.Closeable;

/**
* Displays an EULA ("End User License Agreement") that the user has to accept before
* using the application. Your application should call {@link Eula#show(android.app.Activity)}
* in the onCreate() method of the first activity. If the user accepts the EULA, it will never
* be shown again. If the user refuses, {@link android.app.Activity#finish()} is invoked
* on your activity.
*/
class Eula {
public static final String ASSET_EULA = "EULA";
public static final String PREFERENCE_EULA_ACCEPTED = "eula.accepted";
public static final String PREFERENCES_EULA = "eula";

/**
* callback to let the activity know when the user has accepted the EULA.
*/
static interface OnEulaAgreedTo {

/**
* Called when the user has accepted the eula and the dialog closes.
*/
void onEulaAgreedTo();
}

/**
* Displays the EULA if necessary. This method should be called from the onCreate()
* method of your main Activity.
*
* @param activity The Activity to finish if the user rejects the EULA.
* @return Whether the user has agreed already.
*/
static boolean show(final Activity activity) {
final SharedPreferences preferences = activity.getSharedPreferences(PREFERENCES_EULA,
Activity.MODE_PRIVATE);
if (!preferences.getBoolean(PREFERENCE_EULA_ACCEPTED, false)) {
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(R.string.eula_title);
builder.setCancelable(true);
builder.setPositiveButton(R.string.eula_accept, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
accept(preferences);
if (activity instanceof OnEulaAgreedTo) {
((OnEulaAgreedTo) activity).onEulaAgreedTo();
}
}
});
builder.setNegativeButton(R.string.eula_refuse, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
refuse(activity);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
public void onCancel(DialogInterface dialog) {
refuse(activity);
}
});
builder.setMessage(readEula(activity));
builder.create().show();
return false;
}
return true;
}

private static void accept(SharedPreferences preferences) {
preferences.edit().putBoolean(PREFERENCE_EULA_ACCEPTED, true).commit();
}

private static void refuse(Activity activity) {
activity.finish();
}

private static CharSequence readEula(Activity activity) {
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(activity.getAssets().open(ASSET_EULA)));
String line;
StringBuilder buffer = new StringBuilder();
while ((line = in.readLine()) != null) buffer.append(line).append('\n');
return buffer;
} catch (IOException e) {
return "";
} finally {
closeStream(in);
}
}

/**
* Closes the specified stream.
*
* @param stream The stream to close.
*/
private static void closeStream(Closeable stream) {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
// Ignore
}
}
}
}
21 changes: 20 additions & 1 deletion src/org/witness/sscphase1/ObscuraApp.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
package org.witness.sscphase1;



import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;

import org.witness.securesmartcam.ImageEditor;
import org.witness.sscphase1.Eula.OnEulaAgreedTo;
import org.witness.sscphase1.R;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.ContentValues;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.net.Uri;
Expand All @@ -29,7 +32,7 @@
import android.widget.Button;
import android.widget.Toast;

public class ObscuraApp extends Activity implements OnClickListener {
public class ObscuraApp extends Activity implements OnClickListener, OnEulaAgreedTo {

public final static String TAG = "SSC";

Expand Down Expand Up @@ -75,12 +78,22 @@ public void onCreate(Bundle savedInstanceState) {

setLayout();
deleteTmpFile();

Eula.show(this);

}

@Override
protected void onResume() {

super.onResume();

final SharedPreferences preferences = getSharedPreferences(Eula.PREFERENCES_EULA,
Activity.MODE_PRIVATE);

if (preferences.getBoolean(Eula.PREFERENCE_EULA_ACCEPTED, false)) {

}


}
Expand Down Expand Up @@ -290,5 +303,11 @@ public void onConfigurationChanged(Configuration conf)
// Reset the layout to use the landscape config
setLayout();
}

@Override
public void onEulaAgreedTo() {
// TODO Auto-generated method stub

}

}

0 comments on commit eeaeac9

Please sign in to comment.