Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Commit

Permalink
Fixes for release (#251)
Browse files Browse the repository at this point in the history
* Fixed mapping deploy to firebase
* Removed “ask for help translating” dialog
* Fixed screenshot automation
* Disabled location for ui tests
* Added Galaxy S8 compatibility
* Fixed concurrent modification crash
* Removed useless imports
  • Loading branch information
DreierF authored Mar 30, 2017
1 parent 794d13c commit 896755d
Show file tree
Hide file tree
Showing 24 changed files with 112 additions and 161 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ after_success:
- |
if [[ "$TRAVIS_TAG" ]]; then
./gradlew publishRegularRelease
./gradlew -PFirebaseServiceAccountFilePath=$PWD/app/src/main/google-services.json :app:firebaseUploadRegularReleaseProguardMapping
./gradlew -PFirebaseServiceAccountFilePath=$PWD/app/src/release/google-services.json :app:firebaseUploadRegularReleaseProguardMapping
./dropbox_uploader.sh upload app/build/outputs/apk/app-regular-release.apk /Release/$TRAVIS_TAG/MyTargets.apk
./dropbox_uploader.sh upload app/build/outputs/mapping/regular/release/mapping.txt /Release/$TRAVIS_TAG/mapping.txt
fi
Expand Down
12 changes: 6 additions & 6 deletions Screengrabfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
app_package_name 'de.dreier.mytargets'
app_package_name 'de.dreier.mytargets.debug'
use_tests_in_packages ['de.dreier.mytargets.screengrab']

output_directory 'build'
output_directory 'build/screengrab'

app_apk_path 'app/build/outputs/apk/app-screengrab-debug.apk'
tests_apk_path 'app/build/outputs/apk/app-screengrab-debug-androidTest-unaligned.apk'
tests_apk_path 'app/build/outputs/apk/app-screengrab-debug-androidTest.apk'

locales ['ca-ES', 'cs-CZ', 'de-DE', 'en-US', 'es-ES', 'fr-FR', 'hu-HU', 'it-IT', 'iw-IL', 'ja-JP', 'nl-NL', 'no-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sk-SK', 'sl-SI', 'sv-SE', 'tr-TR', 'zh-CN', 'zh-TW']
locales ['ca-ES', 'cs-CZ', 'da-DK', 'de-DE', 'en-US', 'es-ES', 'fr-FR', 'hu-HU', 'id-ID', 'it-IT', 'iw-IL', 'ja-JP', 'nl-NL', 'no-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sk-SK', 'sl-SI', 'sv-SE', 'tr-TR', 'zh-CN', 'zh-TW']

clear_previous_screenshots true
skip_open_summary true
# clear_previous_screenshots true
skip_open_summary true
5 changes: 2 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ if (CROWDIN_API_KEY != null && !CROWDIN_API_KEY.isEmpty()) {
}

task generateLocalizedScreenshots(type: Exec, group: 'play store', dependsOn: [':crowdinDownload', 'assembleScreengrabDebugAndroidTest', 'assembleScreengrabDebug']) {
workingDir '..'
commandLine './make_screenshots.sh'
commandLine '../make_screenshots.sh'
}

if (new File('googlePlayAndroidDeveloper.json').exists()) {
Expand Down Expand Up @@ -191,4 +190,4 @@ dependencies {
}

// Must be at the bottom
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.gms.google-services'
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private void arrowSelectionTest(String type) {
Intent intent = new Intent();
intent.setAction(type);
activityTestRule.launchActivity(intent);
allowPermissionsIfNeeded(activityTestRule.getActivity(), ACCESS_FINE_LOCATION);
//allowPermissionsIfNeeded(activityTestRule.getActivity(), ACCESS_FINE_LOCATION);

onView(withText(R.string.add_arrow)).perform(nestedScrollTo(), click());
intended(hasComponent(EditArrowActivity.class.getName()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private void bowSelectionTest(String type) {
Intent intent = new Intent();
intent.setAction(type);
activityTestRule.launchActivity(intent);
allowPermissionsIfNeeded(activityTestRule.getActivity(), ACCESS_FINE_LOCATION);
//allowPermissionsIfNeeded(activityTestRule.getActivity(), ACCESS_FINE_LOCATION);

onView(withText(R.string.add_bow)).perform(nestedScrollTo(), click());
intended(hasComponent(EditBowActivity.class.getName()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ public void introActivityTest() {
onView(withId(R.id.toolbar)).check(matches(hasDescendant(withText(R.string.my_targets))));

onView(matchFabMenu()).perform(click());
allowPermissionsIfNeeded(activityTestRule.getActivity(), ACCESS_FINE_LOCATION);
//allowPermissionsIfNeeded(activityTestRule.getActivity(), ACCESS_FINE_LOCATION);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,6 @@ public void setEndCount() {
assertThat(SettingsManager.getEndCount()).isEqualTo(10);
}

@Test
public void setTranslationDialogWasShown() {
SettingsManager.setTranslationDialogShown(true);
assertThat(SettingsManager.isTranslationDialogShown()).isEqualTo(true);
}

@Test
public void setInputMethod() {
SettingsManager.setInputMethod(KEYBOARD);
Expand Down Expand Up @@ -300,4 +294,4 @@ public void setScoreConfiguration() {
SettingsManager.setScoreConfiguration(config);
assertThat(SettingsManager.getScoreConfiguration()).isEqualTo(config);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void createFreeTraining() {
intent.setAction(CREATE_FREE_TRAINING_ACTION);
activityTestRule.launchActivity(intent);

allowPermissionsIfNeeded(activityTestRule.getActivity(), ACCESS_FINE_LOCATION);
//allowPermissionsIfNeeded(activityTestRule.getActivity(), ACCESS_FINE_LOCATION);

// Select distance 20m
onView(withId(R.id.distance)).perform(nestedScrollTo(), click());
Expand Down Expand Up @@ -150,7 +150,7 @@ public void createTrainingWithStandardRound() {
intent.setAction(CREATE_TRAINING_WITH_STANDARD_ROUND_ACTION);
activityTestRule.launchActivity(intent);

allowPermissionsIfNeeded(activityTestRule.getActivity(), ACCESS_FINE_LOCATION);
//allowPermissionsIfNeeded(activityTestRule.getActivity(), ACCESS_FINE_LOCATION);

// Has last used standard round been restored
onView(withId(R.id.standardRound))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void editStandardRoundActivity() {
intent.setAction(CREATE_TRAINING_WITH_STANDARD_ROUND_ACTION);
activityTestRule.launchActivity(intent);

allowPermissionsIfNeeded(activityTestRule.getActivity(), ACCESS_FINE_LOCATION);
//allowPermissionsIfNeeded(activityTestRule.getActivity(), ACCESS_FINE_LOCATION);

onView(withId(R.id.standardRound)).perform(scrollTo(), click());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@
import android.support.test.espresso.action.Tap;

public class TargetViewActions {
protected static ViewAction clickTarget(final float x, final float y) {
public static ViewAction clickTarget(final float x, final float y) {
return new GeneralClickAction(
Tap.SINGLE,
view -> LowLevelActions.getTargetCoordinates(view, new float[]{x, y}),
Press.FINGER);
}

protected static ViewAction holdTapTarget(final float x, final float y) {
public static ViewAction holdTapTarget(final float x, final float y) {
return LowLevelActions.pressAndHold(new float[]{x, y});
}

protected static ViewAction releaseTapTarget(final float x, final float y) {
public static ViewAction releaseTapTarget(final float x, final float y) {
return LowLevelActions.release(new float[]{x, y});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;

import org.hamcrest.CoreMatchers;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.ClassRule;
Expand All @@ -18,28 +17,29 @@
import org.junit.runner.RunWith;

import de.dreier.mytargets.R;
import de.dreier.mytargets.UITestBase;
import de.dreier.mytargets.base.activities.MainActivity;
import de.dreier.mytargets.managers.SettingsManager;
import de.dreier.mytargets.features.main.MainActivity;
import de.dreier.mytargets.features.settings.SettingsManager;
import de.dreier.mytargets.shared.models.Dimension;
import de.dreier.mytargets.shared.models.Target;
import de.dreier.mytargets.shared.targets.models.WAField;
import de.dreier.mytargets.utils.rules.SimpleDbTestRule;
import de.dreier.mytargets.shared.targets.models.WAFull;
import de.dreier.mytargets.test.base.UITestBase;
import de.dreier.mytargets.test.utils.rules.SimpleDbTestRule;
import tools.fastlane.screengrab.Screengrab;
import tools.fastlane.screengrab.UiAutomatorScreenshotStrategy;
import tools.fastlane.screengrab.locale.LocaleTestRule;

import static android.Manifest.permission.ACCESS_FINE_LOCATION;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.Espresso.pressBack;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.isRoot;
import static android.support.test.espresso.matcher.ViewMatchers.withContentDescription;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withParent;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static de.dreier.mytargets.PermissionGranter.allowPermissionsIfNeeded;
import static de.dreier.mytargets.test.utils.actions.TargetViewActions.clickTarget;
import static de.dreier.mytargets.test.utils.actions.TargetViewActions.holdTapTarget;
import static de.dreier.mytargets.test.utils.actions.TargetViewActions.releaseTapTarget;
import static de.dreier.mytargets.test.utils.matchers.ViewMatcher.matchFabMenu;
import static org.hamcrest.core.AllOf.allOf;

@SdkSuppress(minSdkVersion = 18)
Expand All @@ -60,7 +60,7 @@ public void setUp() {
Screengrab.setDefaultScreenshotStrategy(new UiAutomatorScreenshotStrategy());
SettingsManager.setArrowNumbersEnabled(false);
SettingsManager.setShotsPerEnd(6);
SettingsManager.setTarget(new Target(WAField.ID, 1,
SettingsManager.setTarget(new Target(WAFull.ID, 2,
new Dimension(60, Dimension.Unit.CENTIMETER)));
SettingsManager.setTimerEnabled(true);
}
Expand All @@ -86,22 +86,20 @@ public void takeScreenshots() {
Screengrab.screenshot("6_statistics");
navigateUp();
navigateUp();
onView(matchFab()).perform(click());
onView(CoreMatchers.allOf(withId(R.id.fab1), withParent(withId(R.id.fab))))
.perform(click());
allowPermissionsIfNeeded(activityTestRule.getActivity(), ACCESS_FINE_LOCATION);
onView(matchFabMenu()).perform(click());
onView(withId(R.id.fab1)).perform(click());
Screengrab.screenshot("2_enter_training");
onView(withContentDescription(R.string.save)).perform(click());
save();
onView(isRoot()).perform(click());
onView(isRoot()).perform(click());
Screengrab.screenshot("8_timer");
pressBack();
onView(withId(R.id.targetViewContainer)).perform(
clickTarget(0.1f, 0.05f),
clickTarget(-0.45f, 0.5f),
clickTarget(-0.5f, -0.6f),
holdTapTarget(0.5f, 0.4f));
clickTarget(-0.15f, 0.3f),
clickTarget(-0.24f, -0.06f),
holdTapTarget(0.0f, 0.0f));
Screengrab.screenshot("1_enter_end");
onView(withId(R.id.targetViewContainer)).perform(releaseTapTarget(0.5f, 0.4f));
onView(withId(R.id.targetViewContainer)).perform(releaseTapTarget(0.0f, 0.0f));
}
}
}
12 changes: 12 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.any"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
Expand All @@ -46,6 +49,12 @@
<uses-feature
android:name="android.hardware.location"
android:required="false" />
<uses-feature
android:name="android.hardware.location.network"
android:required="false"/>
<uses-feature
android:name="android.hardware.location.gps"
android:required="false"/>

<application
android:name=".app.ApplicationInstance"
Expand All @@ -58,6 +67,9 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:name">
<meta-data
android:name="android.max_aspect"
android:value="2.1" />
<meta-data
android:name="com.google.android.backup.api_key"
android:value="AEdPqrEAAAAIy_jZMyyGuh5M-ICvUll4H1WyF1R9M8cUcN5wVw" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import de.dreier.mytargets.R;
import de.dreier.mytargets.base.activities.SimpleFragmentActivityBase;
import de.dreier.mytargets.features.settings.SettingsManager;
import de.dreier.mytargets.utils.TranslationUtils;

/**
* Shows an overview over all training days
Expand All @@ -37,8 +36,6 @@ public void onCreate(Bundle savedInstanceState) {
SettingsManager.setShouldShowIntroActivity(false);
Intent intent = new Intent(this, IntroActivity.class);
startActivity(intent);
} else {
TranslationUtils.askForHelpTranslating(this);
}
}

Expand All @@ -47,4 +44,4 @@ public Fragment instantiateFragment() {
return new MainFragment();
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public class SettingsManager {
private static final String KEY_NUMBERING_ENABLED = "numbering";
private static final String KEY_INDOOR = "indoor";
private static final String KEY_END_COUNT = "rounds";
private static final String KEY_TRANSLATION_DIALOG_SHOWN = "translation_dialog_shown";
private static final String KEY_INPUT_MODE = "target_mode";
private static final String KEY_SHOW_MODE = "show_mode";
private static final SharedPreferences lastUsed = ApplicationInstance
Expand Down Expand Up @@ -210,17 +209,6 @@ public static void setEndCount(int endCount) {
.apply();
}

public static boolean isTranslationDialogShown() {
return preferences.getBoolean(KEY_TRANSLATION_DIALOG_SHOWN, false);
}

public static void setTranslationDialogShown(boolean shown) {
preferences
.edit()
.putBoolean(KEY_TRANSLATION_DIALOG_SHOWN, shown)
.apply();
}

public static TargetViewBase.EInputMethod getInputMethod() {
return preferences
.getBoolean(KEY_INPUT_MODE, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ private void updateEnd() {
updateWearNotification();
}

private void startWearNotification() {
private void updateWearNotification() {
NotificationInfo info = buildInfo();
if (manager == null) {
manager = new WearMessageManager(this, info);
Expand Down Expand Up @@ -442,11 +442,6 @@ private void updateNavigationButtons() {
updateNextButton();
}

private void updateWearNotification() {
// Send message to wearable app, that we are starting an end
new Thread(InputActivity.this::startWearNotification).start();
}

private void updatePreviousButton() {
final boolean isFirstEnd = data.endIndex == 0;
final boolean isFirstRound = data.roundIndex == 0;
Expand Down
65 changes: 0 additions & 65 deletions app/src/main/java/de/dreier/mytargets/utils/TranslationUtils.java

This file was deleted.

Loading

0 comments on commit 896755d

Please sign in to comment.