Switch from Google Analytics to Firebase (#247)

* Switch from Google Analytics to Firebase

* Fix google-services.json.enc path

* Fix google-services.json.enc path (try 2)

* Fix google-services.json.enc path (try 3)

* Fix google-services.json.enc path (try 4)

* Fix google-services.json.enc path (try 5)

* Fix google-services.json.enc path (try 6)

* Fix Android Build Tools version

* Fix BuildConfigField SWAD_APP_KEY
This commit is contained in:
Juan Miguel Boyero Corral 2019-05-02 18:38:45 +02:00 committed by GitHub
parent 6e6a2da771
commit 3a9ced6c9f
52 changed files with 179 additions and 402 deletions

1
.gitignore vendored
View File

@ -55,3 +55,4 @@ lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/
/SWADroid/src/debug/

View File

@ -16,6 +16,9 @@ cache:
- "$HOME/.gradle/wrapper/"
- "$HOME/.android/build-cache"
before_install:
- openssl aes-256-cbc -K $encrypted_b7f76037f2f7_key -iv $encrypted_b7f76037f2f7_iv
-in $TRAVIS_BUILD_DIR/SWADroid/src/prod/google-services.json.enc
-out $TRAVIS_BUILD_DIR/SWADroid/src/prod/google-services.json -d
- yes | sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}"
- yes | sdkmanager "platform-tools"
- yes | sdkmanager "tools"
@ -24,7 +27,7 @@ before_install:
- yes | sdkmanager --list
- chmod +x gradlew
script:
- "./gradlew clean test build connectedCheck"
- "./gradlew clean test build connectedCheck -Pbuild=prod"
after_failure: cat $TRAVIS_BUILD_DIR/SWADroid/build/reports/lint-results.xml
before_deploy:
- openssl aes-256-cbc -K $encrypted_855ad244b8b2_key -iv $encrypted_855ad244b8b2_iv

View File

@ -1,4 +1,5 @@
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
import org.ajoberstar.grgit.Grgit
@ -24,9 +25,27 @@ def static getBuildConfigField(String property){
return value
}
def build_param = "${build}";
if (build_param != "prod") {
//exclude development build
android.variantFilter { variant ->
if (variant.buildType.name.equals('prod')) {
variant.setIgnore(true);
}
}
} else {
//exclude all except development build
android.variantFilter { variant ->
if (!variant.buildType.name.equals('prod')) {
variant.setIgnore(true);
}
}
}
android {
compileSdkVersion "android-28"
buildToolsVersion '28.0.3'
buildToolsVersion '29.0.0-rc2'
dexOptions {
maxProcessCount=2
@ -47,12 +66,14 @@ android {
testApplicationId "es.ugr.swad.swadroid.test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
buildConfigField "String", "SWAD_APP_KEY", getBuildConfigField("SWAD_APP_KEY")
}
buildTypes {
buildTypes.each {
it.buildConfigField "String", "SWAD_APP_KEY", getBuildConfigField("SWAD_APP_KEY")
it.buildConfigField "String", "ANALYTICS_API_KEY", getBuildConfigField("ANALYTICS_API_KEY")
prod {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
@ -60,11 +81,11 @@ android {
dependencies {
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.8'
implementation 'com.google.code.ksoap2-android:ksoap2-android:3.6.4'
implementation 'commons-io:commons-io:2.6'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.journeyapps:zxing-android-embedded:3.6.0@aar'
implementation 'com.google.zxing:core:3.3.3'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.google.firebase:firebase-core:16.0.8'
}

View File

@ -0,0 +1,51 @@
{
"project_info": {
"project_number": "",
"project_id": ""
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:123456789012:android:1234567890123456",
"android_client_info": {
"package_name": "es.ugr.swad.swadroid"
}
},
"oauth_client": [
{
"client_id": "",
"client_type": 3
},
{
"client_id": "",
"client_type": 1,
"android_info": {
"package_name": "es.ugr.swad.swadroid",
"certificate_hash": ""
}
}
],
"api_key": [
{
"current_key": ""
}
],
"services": {
"analytics_service": {
"status": 2,
"analytics_property": {
"tracking_id": ""
}
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 1
}
}
}
],
"configuration_version": "1"
}

View File

@ -28,8 +28,4 @@ public class Config {
* SWAD application key
*/
public static final String SWAD_APP_KEY = BuildConfig.SWAD_APP_KEY;
/**
* Google Analytics application key
*/
public static final String ANALYTICS_API_KEY = BuildConfig.ANALYTICS_API_KEY;
}

View File

@ -49,7 +49,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.database.DataBaseHelper;
import es.ugr.swad.swadroid.gui.DialogFactory;
import es.ugr.swad.swadroid.gui.MenuExpandableListActivity;
@ -159,8 +158,6 @@ public class SWADMain extends MenuExpandableListActivity {
public void onCreate(Bundle icicle) {
int lastVersion, currentVersion;
SWADroidTracker.initTracker(getApplicationContext());
//Initialize screen
super.onCreate(icicle);
@ -188,7 +185,7 @@ public class SWADMain extends MenuExpandableListActivity {
currentRole = -1;
} catch (Exception ex) {
error(ex.getMessage(), ex, true);
error(ex.getMessage(), ex);
}
}
@ -227,8 +224,6 @@ public class SWADMain extends MenuExpandableListActivity {
createSpinnerAdapter();
createMenu();
}
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
}
private void showBirthdayMessage() {

View File

@ -1,175 +0,0 @@
/*
*
* * This file is part of SWADroid.
* *
* * Copyright (C) 2010 Juan Miguel Boyero Corral <juanmi1982@gmail.com>
* *
* * SWADroid is free software: you can redistribute it and/or modify
* * it under the terms of the GNU General Public License as published by
* * the Free Software Foundation, either version 3 of the License, or
* * (at your option) any later version.
* *
* * SWADroid is distributed in the hope that it will be useful,
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* * GNU General Public License for more details.
* *
* * You should have received a copy of the GNU General Public License
* * along with SWADroid. If not, see <http://www.gnu.org/licenses/>.
*
*/
package es.ugr.swad.swadroid.analytics;
import android.content.Context;
import android.util.Log;
import com.google.android.gms.analytics.ExceptionReporter;
import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.StandardExceptionParser;
import com.google.android.gms.analytics.Tracker;
import java.util.HashMap;
import es.ugr.swad.swadroid.Config;
import es.ugr.swad.swadroid.Constants;
/**
* Tracker for Google Play
*
* @author Juan Miguel Boyero Corral <juanmi1982@gmail.com>
*/
public class SWADroidTracker {
/**
* SWADroidTracker tag name for Logcat
*/
private static final String TAG = Constants.APP_TAG + " SWADroidTracker";
/**
* Enum used to identify the tracker that needs to be used for tracking.
*
* A single tracker is usually enough for most purposes. In case you do need multiple trackers,
* storing them all in Application object helps ensure that they are created only once per
* application instance.
*/
public enum TrackerName {
APP_TRACKER, // Tracker used only in this app.
GLOBAL_TRACKER, // Tracker used by all the apps from a company. eg: roll-up tracking.
ECOMMERCE_TRACKER, // Tracker used by all ecommerce transactions from a company.
}
private static HashMap<TrackerName, Tracker> mTrackers = new HashMap<>();
private static boolean isTrackerEnabled() {
return (!Config.ANALYTICS_API_KEY.isEmpty());
}
private static synchronized Tracker getTracker(Context context) {
if (!mTrackers.containsKey(TrackerName.APP_TRACKER)) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(context);
Tracker t = analytics.newTracker(Config.ANALYTICS_API_KEY);
t.enableExceptionReporting(true);
t.enableAutoActivityTracking(true);
mTrackers.put(TrackerName.APP_TRACKER, t);
}
return mTrackers.get(TrackerName.APP_TRACKER);
}
public static void initTracker(Context context) {
// Initialize a tracker using a Google Analytics property ID.
if(isTrackerEnabled()) {
GoogleAnalytics.getInstance(context).newTracker(Config.ANALYTICS_API_KEY);
ExceptionReporter exceptionHandler =
new ExceptionReporter(
getTracker(context),
Thread.getDefaultUncaughtExceptionHandler(),
context);
StandardExceptionParser exceptionParser =
new StandardExceptionParser(context, null) {
@Override
public String getDescription(String threadName, Throwable t) {
return "{" + threadName + "} " + Log.getStackTraceString(t);
}
};
exceptionHandler.setExceptionParser(exceptionParser);
// Make myHandler the new default uncaught exception handler.
Thread.setDefaultUncaughtExceptionHandler(exceptionHandler);
Log.i(TAG, "Google Play Services available. SWADroidTracker enabled");
} else {
Log.w(TAG, "Google Play Services not available. SWADroidTracker disabled");
}
}
public static void sendScreenView(Context context, String path) {
if(isTrackerEnabled()) {
// Get tracker.
Tracker t = getTracker(context);
// Set screen name.
// Where path is a String representing the screen name.
t.setScreenName(path);
// Send a screen view.
t.send(new HitBuilders.ScreenViewBuilder().build());
Log.i(TAG, "ScreenView sent for screen " + path);
}
}
public static void sendScreenView(Context context, String path, String category, String action, String label) {
if(isTrackerEnabled()) {
// Get tracker.
Tracker t = getTracker(context);
// Set screen name.
// Where path is a String representing the screen name.
t.setScreenName(path);
// Send a screen view.
t.send(new HitBuilders.ScreenViewBuilder().build());
// This event will also be sent with &cd=Home%20Screen.
// Build and send an Event.
t.send(new HitBuilders.EventBuilder()
.setCategory(category)
.setAction(action)
.setLabel(label)
.build());
// Clear the screen name field when we're done.
t.setScreenName(null);
Log.i(TAG, "ScreenView sent for screen " + path);
}
}
public static void sendException(Context context, Exception e, boolean fatal) {
if(isTrackerEnabled()) {
// Get tracker.
Tracker t = getTracker(context);
StandardExceptionParser exceptionParser =
new StandardExceptionParser(context, null) {
@Override
public String getDescription(String threadName, Throwable t) {
return "{" + threadName + "} " + Log.getStackTraceString(t);
}
};
t.send(new HitBuilders.ExceptionBuilder()
.setDescription(exceptionParser.getDescription(Thread.currentThread().getName(), e))
.setFatal(fatal)
.build()
);
Log.e(TAG, e.getMessage(), e);
}
}
}

View File

@ -1,7 +0,0 @@
<html>
<head>
</head>
<body>
Analytics package.
</body>
</html>

View File

@ -38,7 +38,6 @@ import java.util.Collection;
import java.util.List;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.model.Course;
import es.ugr.swad.swadroid.model.Event;
import es.ugr.swad.swadroid.model.FrequentUser;
@ -417,8 +416,7 @@ public class DataBaseHelper {
null, //userBirthday
ent.getInt("userRole"));
} catch (ParseException e) {
//Send exception details to Google Analytics
SWADroidTracker.sendException(mCtx, e, false);
Log.e(TAG, e.getMessage(), e);
}
break;
case DataBaseHelper.DB_TABLE_USERS_ATTENDANCES:
@ -618,8 +616,7 @@ public class DataBaseHelper {
null,
ent.getInt("userRole"));
} catch (ParseException e) {
//Send exception details to Google Analytics
SWADroidTracker.sendException(mCtx, e, false);
Log.e(TAG, e.getMessage(), e);
}
}
@ -2315,7 +2312,6 @@ public class DataBaseHelper {
* Delete all tables from database
*/
public void clearDB() {
SWADroidTracker.sendScreenView(mCtx, TAG + " clearDB");
db.deleteTables();
Log.i(TAG, "All tables deleted");
}
@ -2324,7 +2320,6 @@ public class DataBaseHelper {
* Clean data of all tables from database. Removes users photos from external storage
*/
public void cleanTables() {
SWADroidTracker.sendScreenView(mCtx, TAG + " cleanTables");
db.emptyTables();
compactDB();
@ -2340,8 +2335,7 @@ public class DataBaseHelper {
try {
wait();
} catch (InterruptedException e) {
//Send exception details to Google Analytics
SWADroidTracker.sendException(mCtx, e, false);
Log.e(TAG, e.getMessage(), e);
}
}
@ -2365,8 +2359,8 @@ public class DataBaseHelper {
notifyAll();
} else {
//Send exception details to Google Analytics
SWADroidTracker.sendException(mCtx, new DataBaseHelperException("No active transactions"), false);
Exception e = new DataBaseHelperException("No active transactions");
Log.e(TAG, e.getMessage(), e);
}
}

View File

@ -19,7 +19,6 @@ import org.apache.commons.io.IOUtils;
import java.io.InputStream;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
/**
* Class for create dialogs.
@ -238,8 +237,6 @@ public class DialogFactory {
* @param tag Module tag
* @param message Error message string
* @param ex Exception thrown
* @param sendException true if the error report has to be sent
* false otherwise
* @param isDebuggable true if the application is debuggable (develop mode). Activates Logcat messages
* false otherwise
* @param onClickListener ClickListener associated to the neutral button
@ -247,7 +244,7 @@ public class DialogFactory {
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static AlertDialog createErrorDialog(Context context, String tag, String message, Exception ex,
boolean sendException, boolean isDebuggable, DialogInterface.OnClickListener onClickListener) {
boolean isDebuggable, DialogInterface.OnClickListener onClickListener) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context)
.setTitle(R.string.title_error_dialog)
@ -258,11 +255,6 @@ public class DialogFactory {
if (ex != null) {
Log.e(tag, ex.getMessage(), ex);
// Send exception details to Google Analytics
if (!isDebuggable && sendException) {
SWADroidTracker.sendException(context, ex, false);
}
}
return alertDialogBuilder.create();

View File

@ -138,14 +138,14 @@ public class MenuActivity extends AppCompatActivity {
*
* @param message Error message to show.
*/
protected void error(String message, Exception ex, boolean sendException) {
protected void error(String message, Exception ex) {
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
}
};
AlertDialog errorDialog = DialogFactory.createErrorDialog(this, TAG, message, ex, sendException,
AlertDialog errorDialog = DialogFactory.createErrorDialog(this, TAG, message, ex,
isDebuggable, onClickListener);
errorDialog.show();
@ -208,7 +208,7 @@ public class MenuActivity extends AppCompatActivity {
getPackageName(), 0);
isDebuggable = (ApplicationInfo.FLAG_DEBUGGABLE != 0);
} catch (Exception ex) {
error(ex.getMessage(), ex, true);
error(ex.getMessage(), ex);
}
}
@ -232,7 +232,7 @@ public class MenuActivity extends AppCompatActivity {
try {
dbHelper = new DataBaseHelper(this);
} catch (Exception ex) {
error(ex.getMessage(), ex, true);
error(ex.getMessage(), ex);
}
}
}

View File

@ -145,14 +145,14 @@ public class MenuExpandableListActivity extends AppCompatActivity {
*
* @param message Error message to show.
*/
protected void error(String message, Exception ex, boolean sendException) {
protected void error(String message, Exception ex) {
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
}
};
AlertDialog errorDialog = DialogFactory.createErrorDialog(this, TAG, message, ex, sendException,
AlertDialog errorDialog = DialogFactory.createErrorDialog(this, TAG, message, ex,
isDebuggable, onClickListener);
errorDialog.show();
@ -224,7 +224,7 @@ public class MenuExpandableListActivity extends AppCompatActivity {
isDebuggable = (ApplicationInfo.FLAG_DEBUGGABLE != 0);
isSWADMain = this instanceof SWADMain;
} catch (Exception ex) {
error(ex.getMessage(), ex, true);
error(ex.getMessage(), ex);
}
}
@ -248,7 +248,7 @@ public class MenuExpandableListActivity extends AppCompatActivity {
try {
dbHelper = new DataBaseHelper(this);
} catch (Exception ex) {
error(ex.getMessage(), ex, true);
error(ex.getMessage(), ex);
}
}

View File

@ -29,6 +29,8 @@ import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import com.google.firebase.analytics.FirebaseAnalytics;
import org.ksoap2.SoapFault;
import org.ksoap2.transport.HttpResponseException;
import org.kxml2.kdom.Element;
@ -63,6 +65,10 @@ public abstract class Module extends MenuActivity {
* Class Module's tag name for Logcat
*/
private static final String TAG = Constants.APP_TAG + " Module";
/**
* Obtain Firebase Analytics instance
*/
protected FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
/**
* Async Task for background jobs
*/
@ -332,7 +338,6 @@ public abstract class Module extends MenuActivity {
protected void onPostExecute(Void unused) {
String errorMsg;
int httpStatusCode;
boolean sendException = true;
if (e != null) {
/**
@ -345,11 +350,9 @@ public abstract class Module extends MenuActivity {
switch (es.faultstring) {
case "Bad log in":
errorMsg = getString(R.string.errorBadLoginMsg);
sendException = false;
break;
case "Bad web service key":
errorMsg = getString(R.string.errorBadLoginMsg);
sendException = false;
// Force logout and reset password (this will show again
// the login screen)
@ -365,7 +368,6 @@ public abstract class Module extends MenuActivity {
}
} else if ((e.getClass() == TimeoutException.class) || (e.getClass() == SocketTimeoutException.class)) {
errorMsg = getString(R.string.errorTimeoutMsg);
sendException = false;
} else if ((e.getClass() == CertificateException.class) || (e .getClass() == SSLException.class)) {
errorMsg = getString(R.string.errorServerCertificateMsg);
} else if (e.getClass() == HttpResponseException.class) {
@ -378,7 +380,6 @@ public abstract class Module extends MenuActivity {
break;
case 503: errorMsg = getString(R.string.errorServiceUnavailableMsg);
sendException = false;
break;
default: errorMsg = e.getMessage();
@ -396,7 +397,7 @@ public abstract class Module extends MenuActivity {
}
// Request finalized with errors
error(errorMsg, e, sendException);
error(errorMsg, e);
setResult(RESULT_CANCELED);
// Launch database rollback

View File

@ -21,6 +21,8 @@ package es.ugr.swad.swadroid.modules.account;
import android.os.Bundle;
import com.google.firebase.analytics.FirebaseAnalytics;
import org.ksoap2.SoapFault;
import org.ksoap2.serialization.SoapObject;
@ -122,6 +124,10 @@ public class CreateAccount extends Module {
//Request finalized without errors
setResult(RESULT_OK);
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.METHOD, "requestService");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SIGN_UP, bundle);
}
/* (non-Javadoc)

View File

@ -44,7 +44,6 @@ import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.gui.ProgressScreen;
import es.ugr.swad.swadroid.preferences.Preferences;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.gui.DialogFactory;
import es.ugr.swad.swadroid.utils.Utils;
@ -196,8 +195,6 @@ public class CreateAccountActivity extends AppCompatActivity implements AdapterV
* Creates a new account
*/
private void createAccount() {
SWADroidTracker.sendScreenView(getApplicationContext(), "SWADroid CreateAccount");
Intent intent;
// Values for text field at the time of the create account attempt.
@ -317,7 +314,7 @@ public class CreateAccountActivity extends AppCompatActivity implements AdapterV
}
errorDialog = DialogFactory.createErrorDialog(this, TAG,
errorMsg, null, false, false, new DialogInterface.OnClickListener() {
errorMsg, null, false, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {

View File

@ -31,7 +31,6 @@ import java.util.List;
import java.util.Vector;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.database.DataBaseHelper;
import es.ugr.swad.swadroid.model.Course;
import es.ugr.swad.swadroid.model.Model;
@ -90,8 +89,6 @@ public class Courses extends Module {
@Override
protected void onStart() {
super.onStart();
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
runConnection();
}
@ -210,12 +207,7 @@ public class Courses extends Module {
try {
dbHelper.emptyTable(DataBaseHelper.DB_TABLE_COURSES);
} catch (Exception e) {
e.printStackTrace();
//Send exception details to Google Analytics
if (!isDebuggable) {
SWADroidTracker.sendException(context, e, false);
}
Log.e(TAG, e.getMessage(), e);
}
}

View File

@ -19,13 +19,16 @@
package es.ugr.swad.swadroid.modules.downloads;
import android.content.Context;
import android.util.Log;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collections;
@ -33,8 +36,9 @@ import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.Constants;
/**
@ -60,6 +64,11 @@ public class DirectoryNavigator {
*/
private Context mContext;
/**
* Downloads tag name for Logcat
*/
private static final String TAG = Constants.APP_TAG + " DirectoryNavigator";
/**
* Constructor.
*
@ -278,9 +287,8 @@ public class DirectoryNavigator {
}
}
}
} catch (Exception e) {
//Send exception details to Google Analytics
SWADroidTracker.sendException(mContext, e, false);
} catch (ParserConfigurationException | IOException | SAXException ex) {
Log.e(TAG, ex.getMessage(), ex);
}
//If we don't find the entire path, we throw an exception.

View File

@ -56,7 +56,6 @@ import java.util.List;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.gui.FontManager;
import es.ugr.swad.swadroid.gui.MenuActivity;
import es.ugr.swad.swadroid.gui.ProgressScreen;
@ -190,7 +189,6 @@ public class DownloadsManager extends MenuActivity {
@Override
protected void onStart() {
super.onStart();
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
// check Android 6 permission
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)

View File

@ -27,7 +27,6 @@ import java.net.URL;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
/**
* Download the file located at the given URL, save it to a file.
@ -72,9 +71,6 @@ public class FileDownloaderAsyncTask extends AsyncTask<String, Integer, Boolean>
} catch (MalformedURLException e) {
Log.e(TAG, "Incorrect URL", e);
//Send exception details to Google Analytics
SWADroidTracker.sendException(mContext, e, false);
downloadSuccess = false;
}

View File

@ -29,7 +29,6 @@ import java.util.Vector;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.model.Group;
import es.ugr.swad.swadroid.modules.login.Login;
import es.ugr.swad.swadroid.modules.Module;
@ -73,14 +72,12 @@ public class GetFile extends Module {
@Override
protected void onStart() {
super.onStart();
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
try {
runConnection();
} catch (Exception e) {
String errorMsg = getString(R.string.errorServerResponseMsg);
error(errorMsg, e, true);
error(errorMsg, e);
}
}

View File

@ -13,7 +13,6 @@ import java.util.Vector;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.database.DataBaseHelper;
import es.ugr.swad.swadroid.model.GroupType;
import es.ugr.swad.swadroid.model.Model;
@ -59,14 +58,12 @@ public class GroupTypes extends Module {
@Override
protected void onStart() {
super.onStart();
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
try {
runConnection();
} catch (Exception e) {
String errorMsg = getString(R.string.errorServerResponseMsg);
error(errorMsg, e, true);
error(errorMsg, e);
}
}

View File

@ -31,7 +31,6 @@ import java.util.Vector;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.database.DataBaseHelper;
import es.ugr.swad.swadroid.model.Group;
import es.ugr.swad.swadroid.model.Model;
@ -79,14 +78,12 @@ public class Groups extends Module {
@Override
protected void onStart() {
super.onStart();
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
try {
runConnection();
} catch (Exception e) {
String errorMsg = getString(R.string.errorServerResponseMsg);
error(errorMsg, e, true);
error(errorMsg, e);
}
}

View File

@ -35,7 +35,6 @@ import java.util.List;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.database.DataBaseHelper;
import es.ugr.swad.swadroid.gui.DialogFactory;
import es.ugr.swad.swadroid.gui.MenuExpandableListActivity;
@ -93,8 +92,6 @@ public class MyGroupsManager extends MenuExpandableListActivity {
showProgressLoading();
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
List<Model> groupTypes = dbHelper.getAllRows(DataBaseHelper.DB_TABLE_GROUP_TYPES, "courseCode = " + courseCode, "groupTypeName");
List<Group> groups = dbHelper.getGroups(courseCode);
if ((!groupTypes.isEmpty()) && (!groups.isEmpty())) {

View File

@ -88,7 +88,7 @@ public class SendMyGroups extends Module {
runConnection();
} catch (Exception e) {
String errorMsg = getString(R.string.errorServerResponseMsg);
error(errorMsg, e, true);
error(errorMsg, e);
}
}

View File

@ -14,7 +14,6 @@ import org.ksoap2.serialization.SoapObject;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.gui.ProgressScreen;
import es.ugr.swad.swadroid.gui.WebViewFactory;
import es.ugr.swad.swadroid.model.User;
@ -149,12 +148,11 @@ public class Information extends Module {
protected void onStart() {
super.onStart();
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " " + infoTypeToAdd);
try {
runConnection();
} catch (Exception e) {
String errorMsg = getString(R.string.errorServerResponseMsg);
error(errorMsg, e, true);
error(errorMsg, e);
}
}

View File

@ -22,6 +22,8 @@ package es.ugr.swad.swadroid.modules.login;
import android.os.Bundle;
import android.util.Log;
import com.google.firebase.analytics.FirebaseAnalytics;
import org.ksoap2.SoapFault;
import org.ksoap2.serialization.SoapObject;
@ -173,6 +175,10 @@ public class Login extends Module {
//Request finalized without errors
setResult(RESULT_OK);
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.METHOD, "requestService");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.LOGIN, bundle);
}
/* (non-Javadoc)

View File

@ -43,7 +43,6 @@ import java.util.List;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.gui.DialogFactory;
import es.ugr.swad.swadroid.gui.ProgressScreen;
import es.ugr.swad.swadroid.modules.account.CreateAccountActivity;
@ -222,7 +221,6 @@ public class LoginActivity extends AppCompatActivity implements AdapterView.OnIt
* are presented and no actual login attempt is made.
*/
private void attemptLogin() {
SWADroidTracker.sendScreenView(getApplicationContext(), "SWADroid Login");
// Values for ID and password at the time of the login attempt.
String idValue;
@ -353,8 +351,6 @@ public class LoginActivity extends AppCompatActivity implements AdapterView.OnIt
}
private void whyMyPasswordNotWorkDialog() {
SWADroidTracker.sendScreenView(getApplicationContext(), "SWADroid WhyMyPasswordNotWork");
AlertDialog passwordNotWorkDialog =
DialogFactory.createNeutralDialog(this,
R.layout.dialog_why_password,
@ -373,8 +369,6 @@ public class LoginActivity extends AppCompatActivity implements AdapterView.OnIt
}
private void recoverPasswordDialog() {
SWADroidTracker.sendScreenView(getApplicationContext(), "SWADroid RecoverPassword");
AlertDialog.Builder builder = new AlertDialog.Builder(this);
final EditText user = new EditText(getApplicationContext());

View File

@ -26,7 +26,6 @@ import android.util.Log;
import org.ksoap2.serialization.SoapObject;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.model.User;
import es.ugr.swad.swadroid.modules.Module;
import es.ugr.swad.swadroid.modules.login.Login;
@ -73,8 +72,6 @@ public class GetMarks extends Module {
protected void onStart() {
super.onStart();
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
fileCode = this.getIntent().getLongExtra("fileCode", 0);
runConnection();

View File

@ -11,7 +11,6 @@ import android.webkit.WebView;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.gui.MenuActivity;
import es.ugr.swad.swadroid.gui.WebViewFactory;
import es.ugr.swad.swadroid.modules.courses.Courses;
@ -49,8 +48,6 @@ public class Marks extends MenuActivity {
protected void onStart() {
super.onStart();
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
String content = this.getIntent().getStringExtra("content");
content = Utils.fixLinks(content);

View File

@ -46,7 +46,6 @@ import java.util.Vector;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.database.DataBaseHelper;
import es.ugr.swad.swadroid.gui.ImageFactory;
import es.ugr.swad.swadroid.gui.ProgressScreen;
@ -231,12 +230,6 @@ public class Messages extends Module {
setMETHOD_NAME("sendMessage");
}
@Override
protected void onStart() {
super.onStart();
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
}
/**
* Reads user input
*/
@ -463,7 +456,7 @@ public class Messages extends Module {
}
} catch (Exception e) {
String errorMsg = getString(R.string.errorServerResponseMsg);
error(errorMsg, e, true);
error(errorMsg, e);
}
return true;
case android.R.id.home:

View File

@ -28,7 +28,6 @@ import java.util.List;
import java.util.Vector;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.database.DataBaseHelper;
import es.ugr.swad.swadroid.gui.ProgressScreen;
import es.ugr.swad.swadroid.model.FrequentUser;
@ -199,12 +198,6 @@ public class SearchUsers extends Module implements SearchView.OnQueryTextListene
setMETHOD_NAME("findUsers");
}
@Override
protected void onStart() {
super.onStart();
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
}
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public boolean onCreateOptionsMenu(Menu menu) {

View File

@ -33,7 +33,6 @@ import android.widget.Toast;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.gui.DialogFactory;
import es.ugr.swad.swadroid.model.User;
import es.ugr.swad.swadroid.modules.courses.Courses;
@ -84,7 +83,7 @@ public class Notices extends Module {
}
} catch (Exception e) {
String errorMsg = getString(R.string.errorServerResponseMsg);
error(errorMsg, e, true);
error(errorMsg, e);
}
}
};
@ -189,7 +188,7 @@ public class Notices extends Module {
@Override
protected void onStart() {
super.onStart();
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
selectedCourseCode = Courses.getSelectedCourseCode();
launchNoticeDialog();
}

View File

@ -30,7 +30,6 @@ import android.widget.TextView;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.gui.ImageFactory;
import es.ugr.swad.swadroid.gui.MenuActivity;
import es.ugr.swad.swadroid.gui.WebViewFactory;
@ -122,7 +121,6 @@ public class NotificationItem extends MenuActivity {
Log.w(TAG, "Not connected: Marking the notification " + notifCode + " as read in SWAD was deferred");
}
}
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
}
/* (non-Javadoc)

View File

@ -50,7 +50,6 @@ import java.util.Vector;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.database.DataBaseHelper;
import es.ugr.swad.swadroid.gui.AlertNotificationFactory;
import es.ugr.swad.swadroid.model.Model;
@ -341,7 +340,6 @@ public class Notifications extends Module implements
@Override
protected void onResume() {
super.onResume();
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(NotificationsSyncAdapterService.START_SYNC);
@ -543,7 +541,7 @@ public class Notifications extends Module implements
try {
dbHelper.emptyTable(DataBaseHelper.DB_TABLE_NOTIFICATIONS);
} catch (Exception e) {
error(e.getMessage(), e, true);
error(e.getMessage(), e);
}
}
@ -570,7 +568,7 @@ public class Notifications extends Module implements
notifCount = intent.getIntExtra("notifCount", 0);
errorMessage = intent.getStringExtra("errorMessage");
if ((errorMessage != null) && !errorMessage.equals("")) {
error(errorMessage, null, true);
error(errorMessage, null);
} else if (notifCount == 0) {
Toast.makeText(context, R.string.NoNotificationsMsg,
Toast.LENGTH_LONG).show();

View File

@ -24,7 +24,6 @@ import android.util.Log;
import org.ksoap2.serialization.SoapPrimitive;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.modules.Module;
import es.ugr.swad.swadroid.modules.login.Login;
import es.ugr.swad.swadroid.utils.Utils;
@ -53,13 +52,6 @@ public class NotificationsMarkAllAsRead extends Module {
getSupportActionBar().hide();
runConnection();
}
@Override
protected void onStart() {
super.onStart();
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
}
/* (non-Javadoc)
* @see es.ugr.swad.swadroid.modules.Module#requestService()

View File

@ -52,7 +52,6 @@ import javax.net.ssl.SSLException;
import es.ugr.swad.swadroid.Config;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.database.DataBaseHelper;
import es.ugr.swad.swadroid.gui.AlertNotificationFactory;
import es.ugr.swad.swadroid.model.Model;
@ -106,7 +105,6 @@ public class NotificationsSyncAdapterService extends Service {
@Override
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) {
boolean sendException = true;
int httpStatusCode;
try {
@ -121,11 +119,9 @@ public class NotificationsSyncAdapterService extends Service {
switch (es.faultstring) {
case "Bad log in":
errorMessage = mContext.getString(R.string.errorBadLoginMsg);
sendException = false;
break;
case "Bad web service key":
errorMessage = mContext.getString(R.string.errorBadLoginMsg);
sendException = false;
// Force logout and reset password (this will show again
// the login screen)
@ -141,7 +137,6 @@ public class NotificationsSyncAdapterService extends Service {
}
} else if ((e.getClass() == TimeoutException.class) || (e.getClass() == SocketTimeoutException.class)) {
errorMessage = mContext.getString(R.string.errorTimeoutMsg);
sendException = false;
} else if ((e.getClass() == CertificateException.class) || (e .getClass() == SSLException.class)) {
errorMessage = mContext.getString(R.string.errorServerCertificateMsg);
} else if (e.getClass() == HttpResponseException.class) {
@ -154,7 +149,6 @@ public class NotificationsSyncAdapterService extends Service {
break;
case 503: errorMessage = mContext.getString(R.string.errorServiceUnavailableMsg);
sendException = false;
break;
default: errorMessage = e.getMessage();
@ -176,12 +170,7 @@ public class NotificationsSyncAdapterService extends Service {
dbHelper.endTransaction(false);
}
//Send exception details to Google Analytics
if(sendException) {
SWADroidTracker.sendException(mContext, e, false);
} else {
Log.e(TAG, errorMessage, e);
}
Log.e(TAG, errorMessage, e);
//Notify synchronization stop
Intent stopIntent = new Intent();
@ -215,9 +204,6 @@ public class NotificationsSyncAdapterService extends Service {
webserviceClient = null;
} catch (Exception e) {
Log.e(TAG, "Error initializing database and preferences", e);
//Send exception details to Google Analytics
SWADroidTracker.sendException(mCtx, e, false);
}
super.onCreate();

View File

@ -18,7 +18,6 @@ import java.util.Map;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.gui.MenuActivity;
import es.ugr.swad.swadroid.modules.login.Login;
@ -65,8 +64,6 @@ public class GenerateQR extends MenuActivity {
protected void onStart() {
super.onStart();
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
if (!Login.isLogged() || (Login.getLoggedUser() == null)) {
Intent activity = new Intent(getApplicationContext(), Login.class);
startActivityForResult(activity, Constants.LOGIN_REQUEST_CODE);
@ -116,7 +113,7 @@ public class GenerateQR extends MenuActivity {
qrCode = barcodeEncoder.encodeBitmap(qrContents, BarcodeFormat.QR_CODE, CODE_WIDTH, CODE_HEIGHT, hintMap);
qr_image.setImageBitmap(qrCode);
} catch (WriterException e) {
error(e.getMessage(), e, true);
error(e.getMessage(), e);
}
}
}

View File

@ -80,7 +80,7 @@ public class EventsDownload extends Module {
runConnection();
} catch (Exception e) {
String errorMsg = getString(R.string.errorServerResponseMsg);
error(errorMsg, e, true);
error(errorMsg, e);
}
}

View File

@ -39,7 +39,6 @@ import java.lang.ref.WeakReference;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.gui.DialogFactory;
import es.ugr.swad.swadroid.gui.MenuExpandableListActivity;
import es.ugr.swad.swadroid.gui.ProgressScreen;
@ -180,7 +179,6 @@ public class Rollcall extends MenuExpandableListActivity implements
@Override
protected void onStart() {
super.onStart();
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
//Refresh ListView of events
refreshAdapter();

View File

@ -49,7 +49,6 @@ import java.util.List;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.database.DataBaseHelper;
import es.ugr.swad.swadroid.gui.DialogFactory;
import es.ugr.swad.swadroid.gui.MenuExpandableListActivity;
@ -158,7 +157,6 @@ public class UsersActivity extends MenuExpandableListActivity implements
@Override
protected void onStart() {
super.onStart();
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
//Refresh ListView of users
refreshAdapter();
@ -298,7 +296,7 @@ public class UsersActivity extends MenuExpandableListActivity implements
}
} else {
//If the device has no rear camera available show error message
error(getString(R.string.noCameraFound), null, false);
error(getString(R.string.noCameraFound), null);
}
return true;

View File

@ -81,7 +81,7 @@ public class UsersDownload extends Module {
runConnection();
} catch (Exception e) {
String errorMsg = getString(R.string.errorServerResponseMsg);
error(errorMsg, e, true);
error(errorMsg, e);
}
}

View File

@ -91,7 +91,7 @@ public class UsersSend extends Module {
runConnection();
} catch (Exception e) {
String errorMsg = getString(R.string.errorServerResponseMsg);
error(errorMsg, e, true);
error(errorMsg, e);
}
}

View File

@ -30,7 +30,6 @@ import java.util.List;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.gui.ImageListItem;
import es.ugr.swad.swadroid.gui.MenuActivity;
import es.ugr.swad.swadroid.gui.ProgressScreen;
@ -71,8 +70,6 @@ public class Tests extends MenuActivity implements OnItemClickListener {
mProgressScreen = new ProgressScreen(mProgressScreenView, mTestsMenuLayoutView,
getString(R.string.syncronizingMsg), this);
SWADroidTracker.sendScreenView(getApplicationContext(), TAG);
for (int i = 0; i < titles.length; i++) {
ImageListItem item = new ImageListItem(images[i], titles[i]);
imageListItems.add(item);

View File

@ -81,7 +81,7 @@ public class TestsConfigDownload extends Module {
runConnection();
} catch (Exception e) {
String errorMsg = getString(R.string.errorServerResponseMsg);
error(errorMsg, e, true);
error(errorMsg, e);
}
}

View File

@ -51,7 +51,6 @@ import java.util.List;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.database.DataBaseHelper;
import es.ugr.swad.swadroid.gui.MenuActivity;
import es.ugr.swad.swadroid.gui.WebViewFactory;
@ -152,8 +151,6 @@ public class TestsMake extends MenuActivity {
numberPicker.setMinValue(test.getMin());
numberPicker.setValue(test.getDef());
numberPicker.setVisibility(View.VISIBLE);
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " NumQuestions");
}
/**
@ -214,8 +211,6 @@ public class TestsMake extends MenuActivity {
checkBoxesList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
checkBoxesList.setOnItemClickListener(tagsAnswersTypeItemClickListener);
checkBoxesList.setDividerHeight(0);
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " Tags");
}
/**
@ -275,8 +270,6 @@ public class TestsMake extends MenuActivity {
checkBoxesList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
checkBoxesList.setOnItemClickListener(tagsAnswersTypeItemClickListener);
checkBoxesList.setDividerHeight(0);
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " AnswerTypes");
}
/**
@ -632,8 +625,6 @@ public class TestsMake extends MenuActivity {
});
showQuestion(0);
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " Question");
}
/**
@ -658,8 +649,6 @@ public class TestsMake extends MenuActivity {
//Shows the test
showTest();
} else {
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " No questions criteria");
Toast.makeText(this, R.string.testNoQuestionsMeetsSpecifiedCriteriaMsg, Toast.LENGTH_LONG).show();
finish();
}
@ -701,8 +690,6 @@ public class TestsMake extends MenuActivity {
} else {
textView = (TextView) findViewById(R.id.testResultsText);
textView.setText(R.string.testNoResultsMsg);
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " Feedback " + Test.FEEDBACK_NONE);
}
}
@ -794,8 +781,6 @@ public class TestsMake extends MenuActivity {
if (test != null) {
selectNumQuestions();
} else {
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " No questions");
Toast.makeText(this, R.string.testNoQuestionsCourseMsg, Toast.LENGTH_LONG).show();
finish();
}
@ -845,7 +830,6 @@ public class TestsMake extends MenuActivity {
return true;
case R.id.action_show_details:
if (test.getFeedback().equals(Test.FEEDBACK_MIN)) {
SWADroidTracker.sendScreenView(getApplicationContext(), TAG + " Feedback " + Test.FEEDBACK_MIN);
Toast.makeText(this, R.string.testNoDetailsMsg, Toast.LENGTH_LONG).show();
} else {
//Show totals button only

View File

@ -32,7 +32,6 @@ import java.security.NoSuchAlgorithmException;
import java.util.List;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.database.DataBaseHelper;
import es.ugr.swad.swadroid.model.LoginInfo;
import es.ugr.swad.swadroid.modules.courses.Courses;
@ -186,7 +185,6 @@ public class Preferences {
dbHelper = new DataBaseHelper(ctx);
} catch (Exception e) {
Log.e(TAG, e.getMessage());
SWADroidTracker.sendException(ctx, e, false);
}
}
}

View File

@ -24,7 +24,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
@ -33,12 +33,11 @@ import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.google.firebase.analytics.FirebaseAnalytics;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Date;
@ -46,13 +45,11 @@ import java.util.List;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
import es.ugr.swad.swadroid.gui.DialogFactory;
import es.ugr.swad.swadroid.modules.login.Login;
import es.ugr.swad.swadroid.modules.login.LoginActivity;
import es.ugr.swad.swadroid.sync.SyncUtils;
import es.ugr.swad.swadroid.utils.Crypto;
import es.ugr.swad.swadroid.utils.NotificationUtils;
import es.ugr.swad.swadroid.utils.Utils;
/**
@ -65,6 +62,10 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
* PreferencesActivity tag name for Logcat
*/
private static final String TAG = Constants.APP_TAG + " PreferencesActivity";
/**
* Obtain Firebase Analytics instance
*/
protected FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
/**
* Application context
*/
@ -130,11 +131,6 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
* Synchronization preferences changed flag
*/
private boolean syncPrefsChanged = false;
/**
* SWAD server to use
*/
//private String mServer;
/**
* User password preference changed flag
@ -146,14 +142,14 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
*
* @param message Error message to show.
*/
private void error(String message, Exception ex, boolean sendException) {
private void error(String message, Exception ex) {
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
}
};
AlertDialog errorDialog = DialogFactory.createErrorDialog(this, TAG, message, ex, sendException,
AlertDialog errorDialog = DialogFactory.createErrorDialog(this, TAG, message, ex,
isDebuggable, onClickListener);
errorDialog.show();
@ -178,7 +174,7 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
getPackageName(), 0);
isDebuggable = (ApplicationInfo.FLAG_DEBUGGABLE != 0);
} catch (Exception ex) {
error(ex.getMessage(), ex, true);
error(ex.getMessage(), ex);
}
logOutPref = findPreference(Preferences.LOGOUTPREF);
@ -304,6 +300,12 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.app_name));
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, getString(R.string.shareBodyMsg));
startActivity(Intent.createChooser(sharingIntent, getString(R.string.shareTitle_menu)));
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "1");
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "text");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SHARE, bundle);
return true;
}
});
@ -319,11 +321,11 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
return true;
}
});
try {
currentVersionPref.setSummary(getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
} catch (NameNotFoundException e) {
SWADroidTracker.sendException(getApplicationContext(), e, false);
} catch (PackageManager.NameNotFoundException ex) {
error(ex.getMessage(), ex);
}
}
@ -369,7 +371,7 @@ public class PreferencesActivity extends PreferenceActivity implements OnPrefere
}
} catch (NoSuchAlgorithmException ex) {
error(ex.getMessage(), ex, true);
error(ex.getMessage(), ex);
}
} else if(Preferences.SYNCENABLEPREF.equals(key)) {
boolean syncEnabled = (Boolean) newValue;

View File

@ -21,6 +21,7 @@
package es.ugr.swad.swadroid.utils;
import android.content.Context;
import android.util.Log;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@ -34,7 +35,6 @@ import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.PBEParameterSpec;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
/**
* Cryptographic class for encryption purposes.
@ -80,8 +80,7 @@ public class Crypto {
ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
} catch (Exception e) {
//Send exception details to Google Analytics
SWADroidTracker.sendException(mContext, e, false);
Log.e(TAG, e.getMessage());
}
}
@ -99,8 +98,7 @@ public class Crypto {
} catch (Exception e) {
rVal = "Error encrypting: " + e.getMessage();
//Send exception details to Google Analytics
SWADroidTracker.sendException(mContext, e, false);
Log.e(TAG, e.getMessage());
}
return rVal;
}
@ -119,8 +117,7 @@ public class Crypto {
} catch (Exception e) {
rVal = "Error encrypting: " + e.getMessage();
//Send exception details to Google Analytics
SWADroidTracker.sendException(mContext, e, false);
Log.e(TAG, e.getMessage());
}
return rVal;
}

View File

@ -20,6 +20,7 @@
package es.ugr.swad.swadroid.utils;
import android.content.Context;
import android.util.Log;
import java.security.MessageDigest;
import java.security.SecureRandom;
@ -30,7 +31,6 @@ import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.analytics.SWADroidTracker;
/**
* Cryptographic class for encryption purposes.
@ -49,8 +49,7 @@ public class OldCrypto {
byte[] result = encrypt(rawKey, cleartext.getBytes("UTF-8"));
return Base64.encodeBytes(result);
} catch (Exception e) {
//Send exception details to Google Analytics
SWADroidTracker.sendException(ctx, e, false);
Log.e(TAG, e.getMessage());
}
return "error";
}
@ -62,8 +61,7 @@ public class OldCrypto {
byte[] result = decrypt(rawKey, enc);
return new String(result, "UTF-8");
} catch (Exception e) {
//Send exception details to Google Analytics
SWADroidTracker.sendException(ctx, e, false);
Log.e(TAG, e.getMessage());
}
return "error";
}
@ -107,8 +105,7 @@ public class OldCrypto {
}
return hexString.toString();
} catch (Exception e) {
//Send exception details to Google Analytics
SWADroidTracker.sendException(ctx, e, false);
Log.e(TAG, e.getMessage());
}
return "error";
}

Binary file not shown.

View File

@ -5,8 +5,9 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'org.ajoberstar:grgit:2.1.1'
classpath 'com.google.gms:google-services:4.2.0'
}
}

View File

@ -1,6 +1,6 @@
#Mon Jan 14 20:17:20 CET 2019
#Fri Apr 19 12:17:14 CEST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip