Move retention tracking to TLA onCreate since startup service may not run if app has been living in background

pull/14/head
Sam Bosley 13 years ago
parent 89de6e9fde
commit 0a2ff5de4b

@ -26,6 +26,8 @@ import android.widget.PopupWindow.OnDismissListener;
import android.widget.TextView;
import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.sql.Functions;
import com.todoroo.andlib.sql.QueryTemplate;
import com.todoroo.andlib.utility.AndroidUtilities;
@ -45,6 +47,7 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.StatisticsConstants;
import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.service.ThemeService;
import com.todoroo.astrid.service.abtesting.ABTestEventReportingService;
import com.todoroo.astrid.tags.TagService;
import com.todoroo.astrid.ui.DateChangedAlerts;
import com.todoroo.astrid.ui.FragmentPopover;
@ -61,6 +64,8 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
/** token for indicating source of TLA launch */
public static final String TOKEN_SOURCE = "source"; //$NON-NLS-1$
@Autowired private ABTestEventReportingService abTestEventReportingService;
private View listsNav;
private ImageView listsNavDisclosure;
private TextView lists;
@ -136,6 +141,7 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
protected void onCreate(Bundle savedInstanceState) {
ThemeService.applyTheme(this);
super.onCreate(savedInstanceState);
DependencyInjectionService.getInstance().inject(this);
if (AndroidUtilities.isTabletSized(this)) {
setContentView(R.layout.task_list_wrapper_activity_3pane);
@ -198,6 +204,8 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
if (getIntent().hasExtra(TOKEN_SOURCE)) {
trackActivitySource();
}
abTestEventReportingService.trackUserRetention();
}
private boolean swipeIsEnabled() {

@ -35,7 +35,6 @@ import com.todoroo.astrid.actfm.sync.ActFmSyncService;
import com.todoroo.astrid.backup.BackupConstants;
import com.todoroo.astrid.backup.BackupService;
import com.todoroo.astrid.backup.TasksXmlImporter;
import com.todoroo.astrid.dao.ABTestEventDao;
import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.gtasks.GtasksPreferenceService;
import com.todoroo.astrid.gtasks.sync.GtasksSyncService;
@ -43,7 +42,6 @@ import com.todoroo.astrid.opencrx.OpencrxCoreUtils;
import com.todoroo.astrid.producteev.ProducteevUtilities;
import com.todoroo.astrid.reminders.ReminderStartupReceiver;
import com.todoroo.astrid.service.abtesting.ABChooser;
import com.todoroo.astrid.service.abtesting.ABTestEventReportingService;
import com.todoroo.astrid.service.abtesting.FeatureFlipper;
import com.todoroo.astrid.utility.AstridPreferences;
import com.todoroo.astrid.utility.Constants;
@ -90,10 +88,6 @@ public class StartupService {
@Autowired ABChooser abChooser;
@Autowired ABTestEventReportingService abTestEventReportingService;
@Autowired ABTestEventDao abTestEventDao;
/**
* bit to prevent multiple initializations
*/
@ -218,9 +212,6 @@ public class StartupService {
// Check for feature flips
featureFlipper.updateFeatures();
abTestEventDao.createRelativeDateEvents();
abTestEventReportingService.pushAllUnreportedABTestEvents();
}
}).start();

@ -36,6 +36,16 @@ public final class ABTestEventReportingService {
DependencyInjectionService.getInstance().inject(this);
}
public void trackUserRetention() {
new Thread(new Runnable() {
@Override
public void run() {
abTestEventDao.createRelativeDateEvents();
pushAllUnreportedABTestEvents();
}
}).start();
}
public void pushAllUnreportedABTestEvents() {
final TodorooCursor<ABTestEvent> unreported = abTestEventDao.query(Query.select(ABTestEvent.PROPERTIES)
.where(ABTestEvent.REPORTED.eq(0))

Loading…
Cancel
Save