Use GA auto activity tracking

pull/437/head
Alex Baker 8 years ago
parent 113ffa31f9
commit 8cce1d60f2

@ -56,11 +56,6 @@ public class Tracker {
Thread.setDefaultUncaughtExceptionHandler(reporter);
}
public void showScreen(String screenName) {
tracker.setScreenName(screenName);
tracker.send(new HitBuilders.ScreenViewBuilder().build());
}
public void setTrackingEnabled(boolean enabled) {
analytics.setAppOptOut(!enabled);
}

@ -11,10 +11,6 @@ public class Tracker {
}
public void showScreen(String screenName) {
}
public void setTrackingEnabled(boolean enabled) {
}

@ -57,11 +57,6 @@ public class Tracker {
Thread.setDefaultUncaughtExceptionHandler(reporter);
}
public void showScreen(String screenName) {
tracker.setScreenName(screenName);
tracker.send(new HitBuilders.ScreenViewBuilder().build());
}
public void setTrackingEnabled(boolean enabled) {
analytics.setAppOptOut(!enabled);
}

@ -4,7 +4,6 @@ import android.os.Bundle;
import com.nononsenseapps.filepicker.FilePickerActivity;
import org.tasks.analytics.Tracker;
import org.tasks.injection.ActivityModule;
import org.tasks.injection.InjectingApplication;
import org.tasks.themes.Theme;
@ -14,7 +13,6 @@ import javax.inject.Inject;
public class MyFilePickerActivity extends FilePickerActivity {
@Inject Theme theme;
@Inject Tracker tracker;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -26,11 +24,4 @@ public class MyFilePickerActivity extends FilePickerActivity {
setTitle(null);
super.onCreate(savedInstanceState);
}
@Override
protected void onResume() {
super.onResume();
tracker.showScreen(getClass().getSimpleName());
}
}

@ -3,16 +3,11 @@ package org.tasks.injection;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import org.tasks.analytics.Tracker;
import org.tasks.locale.Locale;
import javax.inject.Inject;
public abstract class InjectingAppCompatActivity extends AppCompatActivity implements InjectingActivity {
private ActivityComponent activityComponent;
@Inject Tracker tracker;
public InjectingAppCompatActivity() {
Locale.getInstance(this).applyOverrideConfiguration(this);
}
@ -25,13 +20,6 @@ public abstract class InjectingAppCompatActivity extends AppCompatActivity imple
super.onCreate(savedInstanceState);
}
@Override
protected void onResume() {
super.onResume();
tracker.showScreen(getClass().getSimpleName());
}
@Override
public ActivityComponent getComponent() {
return activityComponent;

@ -12,7 +12,6 @@ import android.view.ViewGroup;
import android.widget.LinearLayout;
import org.tasks.R;
import org.tasks.analytics.Tracker;
import org.tasks.locale.Locale;
import org.tasks.preferences.AppCompatPreferenceActivity;
import org.tasks.themes.Theme;
@ -29,7 +28,6 @@ public abstract class InjectingPreferenceActivity extends AppCompatPreferenceAct
protected Toolbar toolbar;
@Inject Theme theme;
@Inject Tracker tracker;
public InjectingPreferenceActivity() {
Locale.getInstance(this).applyOverrideConfiguration(this);
@ -78,13 +76,6 @@ public abstract class InjectingPreferenceActivity extends AppCompatPreferenceAct
return activityComponent;
}
@Override
protected void onResume() {
super.onResume();
tracker.showScreen(getClass().getSimpleName());
}
protected void requires(int prefGroup, boolean passesCheck, int... resIds) {
if (!passesCheck) {
remove((PreferenceCategory) findPreference(getString(prefGroup)), resIds);

@ -3,7 +3,6 @@ package org.tasks.injection;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import org.tasks.analytics.Tracker;
import org.tasks.locale.Locale;
import org.tasks.themes.Theme;
@ -12,7 +11,6 @@ import javax.inject.Inject;
public abstract class ThemedInjectingAppCompatActivity extends AppCompatActivity implements InjectingActivity {
private ActivityComponent activityComponent;
@Inject Tracker tracker;
@Inject Theme theme;
public ThemedInjectingAppCompatActivity() {
@ -29,13 +27,6 @@ public abstract class ThemedInjectingAppCompatActivity extends AppCompatActivity
super.onCreate(savedInstanceState);
}
@Override
protected void onResume() {
super.onResume();
tracker.showScreen(getClass().getSimpleName());
}
@Override
public ActivityComponent getComponent() {
return activityComponent;

@ -41,6 +41,10 @@ public class Preferences {
private final SharedPreferences prefs;
private final SharedPreferences publicPrefs;
public Preferences(Context context) {
this(context, new PermissionChecker(context));
}
@Inject
public Preferences(@ForApplication Context context, PermissionChecker permissionChecker) {
this.context = context;

@ -1,9 +1,11 @@
package org.tasks.scheduling;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import org.tasks.injection.InjectingIntentService;
import org.tasks.preferences.PermissionChecker;
import org.tasks.preferences.Preferences;
import javax.inject.Inject;
@ -20,9 +22,6 @@ public abstract class MidnightIntentService extends InjectingIntentService {
private static final long PADDING = SECONDS.toMillis(1);
@Inject Preferences preferences;
@Inject AlarmManager alarmManager;
private final String name;
public MidnightIntentService(String name) {
@ -34,6 +33,10 @@ public abstract class MidnightIntentService extends InjectingIntentService {
protected void onHandleIntent(Intent intent) {
super.onHandleIntent(intent);
Context context = getApplicationContext();
Preferences preferences = new Preferences(context);
AlarmManager alarmManager = new AlarmManager(context, preferences);
long lastRun = preferences.getLong(getLastRunPreference(), 0);
long nextRun = nextMidnight(lastRun);
long now = currentTimeMillis();

@ -1,4 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="ga_trackingId">UA-43015607-3</string>
<bool name="ga_autoActivityTracking">true</bool>
<screenName name="com.todoroo.astrid.activity.TaskEditActivity">TaskEditActivity</screenName>
<screenName name="com.todoroo.astrid.files.AACRecordingActivity">AACRecordingActivity</screenName>
<screenName name="org.tasks.activities.AddAttachmentActivity">AddAttachmentActivity</screenName>
<screenName name="org.tasks.widget.ShortcutConfigActivity">ShortcutConfigActivity</screenName>
<screenName name="com.todoroo.astrid.activity.ShareLinkActivity">ShareLinkActivity</screenName>
<screenName name="org.tasks.reminders.NotificationActivity">NotificationActivity</screenName>
<screenName name="org.tasks.files.MyFilePickerActivity">MyFilePickerActivity</screenName>
<screenName name="org.tasks.reminders.MissedCallActivity">MissedCallActivity</screenName>
<screenName name="com.todoroo.astrid.gtasks.auth.GtasksLoginActivity">GtasksLoginActivity</screenName>
<screenName name="org.tasks.activities.ImportTaskActivity">ImportTaskActivity</screenName>
<screenName name="org.tasks.voice.VoiceCommandActivity">VoiceCommandActivity</screenName>
<screenName name="org.tasks.locale.ui.activity.TaskerSettingsActivity">TaskerSettingsActivity</screenName>
<screenName name="com.todoroo.astrid.activity.TaskListActivity">TaskListActivity</screenName>
<screenName name="com.todoroo.astrid.actfm.TagSettingsActivity">TagSettingsActivity</screenName>
<screenName name="org.tasks.reminders.SnoozeActivity">SnoozeActivity</screenName>
<screenName name="com.todoroo.astrid.core.CustomFilterActivity">CustomFilterActivity</screenName>
<screenName name="org.tasks.activities.ClearGtaskDataActivity">ClearGtaskDataActivity</screenName>
<screenName name="org.tasks.activities.CameraActivity">CameraActivity</screenName>
<screenName name="org.tasks.activities.CalendarSelectionActivity">CalendarSelectionActivity</screenName>
<screenName name="com.todoroo.astrid.gcal.CalendarReminderActivity">CalendarReminderActivity</screenName>
<screenName name="com.todoroo.astrid.activity.BeastModePreferences">BeastModePreferences</screenName>
<screenName name="com.todoroo.astrid.actfm.FilterSettingsActivity">FilterSettingsActivity</screenName>
<screenName name="org.tasks.activities.ColorPickerActivity">ColorPickerActivity</screenName>
<screenName name="org.tasks.activities.DateAndTimePickerActivity">DateAndTimePickerActivity</screenName>
<screenName name="org.tasks.activities.DatePickerActivity">DatePickerActivity</screenName>
<screenName name="org.tasks.activities.ExportTaskActivity">ExportTaskActivity</screenName>
<screenName name="org.tasks.activities.FilterSelectionActivity">FilterSelectionActivity</screenName>
<screenName name="org.tasks.activities.TimePickerActivity">TimePickerActivity</screenName>
<screenName name="org.tasks.files.FileExplore">FileExplore</screenName>
<screenName name="com.todoroo.astrid.gtasks.GtasksPreferences">GtasksPreferences</screenName>
<screenName name="org.tasks.dashclock.DashClockSettings">DashClockSettings</screenName>
<screenName name="com.todoroo.astrid.core.DefaultsPreferences">DefaultsPreferences</screenName>
<screenName name="com.todoroo.astrid.core.OldTaskPreferences">OldTaskPreferences</screenName>
<screenName name="com.todoroo.astrid.reminders.ReminderPreferences">ReminderPreferences</screenName>
<screenName name="org.tasks.preferences.AppearancePreferences">AppearancePreferences</screenName>
<screenName name="org.tasks.preferences.BackupPreferences">BackupPreferences</screenName>
<screenName name="org.tasks.preferences.BasicPreferences">BasicPreferences</screenName>
<screenName name="org.tasks.preferences.DateShortcutPreferences">DateShortcutPreferences</screenName>
<screenName name="org.tasks.preferences.HelpAndFeedbackActivity">HelpAndFeedbackActivity</screenName>
<screenName name="org.tasks.preferences.MiscellaneousPreferences">MiscellaneousPreferences</screenName>
<screenName name="org.tasks.widget.WidgetConfigActivity">WidgetConfigActivity</screenName>
</resources>
Loading…
Cancel
Save