From dd8e3d475a7d38c8bedc0c2a2aacbe8a2b733c6e Mon Sep 17 00:00:00 2001 From: ligi Date: Tue, 17 Nov 2015 03:35:21 +0100 Subject: [PATCH] WIP --- .../java/org/ligi/passandroid/TestModule.java | 1 + .../java/org/ligi/passandroid/model/Settings.java | 5 +++++ .../org/ligi/passandroid/ui/PassListActivity.java | 13 +++++++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/android/src/androidTest/java/org/ligi/passandroid/TestModule.java b/android/src/androidTest/java/org/ligi/passandroid/TestModule.java index e94c70d8..53a4e003 100644 --- a/android/src/androidTest/java/org/ligi/passandroid/TestModule.java +++ b/android/src/androidTest/java/org/ligi/passandroid/TestModule.java @@ -54,6 +54,7 @@ public class TestModule { Settings provideSettings() { final Settings mock = mock(Settings.class); when(mock.getSortOrder()).thenReturn(PassStore.SortOrder.DATE); + when(mock.doTraceDroidEmailSend()).thenReturn(false); return mock; } diff --git a/android/src/main/java/org/ligi/passandroid/model/Settings.java b/android/src/main/java/org/ligi/passandroid/model/Settings.java index c81674d5..ef6ba0a0 100644 --- a/android/src/main/java/org/ligi/passandroid/model/Settings.java +++ b/android/src/main/java/org/ligi/passandroid/model/Settings.java @@ -28,4 +28,9 @@ public class Settings { } return PassStore.SortOrder.DATE; } + + public boolean doTraceDroidEmailSend() { + // will be overridden in test-module + return true; + } } diff --git a/android/src/main/java/org/ligi/passandroid/ui/PassListActivity.java b/android/src/main/java/org/ligi/passandroid/ui/PassListActivity.java index 11a99159..934037d6 100644 --- a/android/src/main/java/org/ligi/passandroid/ui/PassListActivity.java +++ b/android/src/main/java/org/ligi/passandroid/ui/PassListActivity.java @@ -16,14 +16,13 @@ import android.view.MenuItem; import android.view.View; import android.view.Window; import android.widget.TextView; -import butterknife.Bind; -import butterknife.ButterKnife; -import butterknife.OnClick; import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; + import net.i2p.android.ext.floatingactionbutton.FloatingActionButton; import net.i2p.android.ext.floatingactionbutton.FloatingActionsMenu; + import org.ligi.axt.AXT; import org.ligi.passandroid.App; import org.ligi.passandroid.R; @@ -42,6 +41,10 @@ import org.ligi.tracedroid.sending.TraceDroidEmailSender; import javax.inject.Inject; +import butterknife.Bind; +import butterknife.ButterKnife; +import butterknife.OnClick; + public class PassListActivity extends AppCompatActivity { private static final int OPEN_FILE_READ_REQUEST_CODE = 1000; @@ -171,7 +174,9 @@ public class PassListActivity extends AppCompatActivity { // don't want too many windows in worst case - so check for errors first if (TraceDroid.getStackTraceFiles().length > 0) { Tracker.get().trackEvent("ui_event", "send", "stacktraces", null); - TraceDroidEmailSender.sendStackTraces("ligi@ligi.de", this); + if (settings.doTraceDroidEmailSend()) { + TraceDroidEmailSender.sendStackTraces("ligi@ligi.de", this); + } } else { // if no error - check if there is a new version of the app Tracker.get().trackEvent("ui_event", "processFile", "updatenotice", null);