Skip to content

Commit

Permalink
Merge pull request #12 from SecUSo/development
Browse files Browse the repository at this point in the history
Update to current sdk and remove broken activities
  • Loading branch information
udenr authored Oct 4, 2024
2 parents 919eb15 + cceac87 commit c98b0e8
Show file tree
Hide file tree
Showing 26 changed files with 414 additions and 193 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/android-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Android Emulator Tests
on: [ push, pull_request ]

jobs:
check-if-tests-exist:
runs-on: ubuntu-latest
outputs:
status: ${{ steps.check-androidTest.outputs.NOT_EMPTY }}
min-sdk-version: ${{ steps.get-sdk-version.outputs.MIN_SDK_VERSION }}
target-sdk-version: ${{ steps.get-sdk-version.outputs.TARGET_SDK_VERSION }}
app-id: ${{ steps.get-app-id.outputs.APP_ID }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "recursive"
- name: Check if androidTest folder is not empty
run: |
echo "NOT_EMPTY=$([ "$(ls -A app/src/androidTest)" ] && echo 'true' || echo 'false')"
echo "NOT_EMPTY=$([ "$(ls -A app/src/androidTest)" ] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
id: check-androidTest
- name: Get min and target sdk
if: steps.check-androidTest.outputs.NOT_EMPTY == 'true'
id: get-sdk-version
run: |
echo "MIN_SDK_VERSION=$(cat app/build.gradle | grep minSdkVersion | rev | cut -d' ' -f 1 | rev)" >> $GITHUB_OUTPUT
echo "TARGET_SDK_VERSION=$(cat app/build.gradle | grep targetSdkVersion | rev | cut -d' ' -f 1 | rev)" >> $GITHUB_OUTPUT
- name: Get app ID
id: get-app-id
run: |
echo "APP_ID=$(cat app/build.gradle | grep applicationId | rev | cut -d' ' -f 1 | rev | tr -d '"')" >> $GITHUB_OUTPUT
test:
needs: check-if-tests-exist
if: needs.check-if-tests-exist.outputs.status == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [34, "${{ needs.check-if-tests-exist.outputs.min-sdk-version }}", "${{ needs.check-if-tests-exist.outputs.target-sdk-version }}"]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Gradle cache
uses: gradle/gradle-build-action@v3

- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}

- name: Set up JDK environment
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17

- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.api-level >= 30 && 'google_apis' || 'default' }}
arch: ${{ matrix.api-level < 21 && 'x86' || 'x86_64' }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."

- name: Run connected tests
uses: ReactiveCircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.api-level >= 30 && 'google_apis' || 'default' }}
arch: ${{ matrix.api-level < 21 && 'x86' || 'x86_64' }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: |
adb uninstall ${{needs.check-if-tests-exist.outputs.app-id}} || true
adb uninstall ${{needs.check-if-tests-exist.outputs.app-id}}.test || true
adb uninstall ${{needs.check-if-tests-exist.outputs.app-id}}.androidTest || true
chmod +x gradlew
./gradlew :app:connectedCheck --stacktrace
adb uninstall ${{needs.check-if-tests-exist.outputs.app-id}} || true
adb uninstall ${{needs.check-if-tests-exist.outputs.app-id}}.test || true
adb uninstall ${{needs.check-if-tests-exist.outputs.app-id}}.androidTest || true
24 changes: 24 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Changelog Generation

on:
release:
types: [published]
workflow_dispatch:

jobs:
changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
ref: master
- uses: rhysd/changelog-from-release/action@v3
with:
file: CHANGELOG.md
pull_request: true
github_token: ${{ secrets.GITHUB_TOKEN }}
commit_summary_template: 'update changelog for %s changes'
args: -l 2
header: |
# Changelog
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Continuous Integration
on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "recursive"

- name: Set up JDK environment
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: 17

- name: Make gradlew executable
run: chmod +x ./gradlew

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run local unit tests
run: bash ./gradlew test --stacktrace

build:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "recursive"

- name: Set up JDK environment
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: 17

- name: Make gradlew executable
run: chmod +x ./gradlew

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run lint check
run: bash ./gradlew lint

- name: Upload lint result
uses: actions/upload-artifact@v4
with:
name: lint-results-debug
path: app/build/reports/lint-results-debug.html

- name: Build the app
run: bash ./gradlew build --stacktrace

- name: Build debug apk
run: bash ./gradlew assembleDebug

- name: Upload debug apk
uses: actions/upload-artifact@v4
with:
name: debug-apk
path: app/build/outputs/apk/debug/*.apk
13 changes: 7 additions & 6 deletions BaseGameUtils/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'android-library'
apply plugin: 'com.android.library'

repositories {
mavenCentral()
Expand All @@ -11,17 +11,18 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
classpath 'com.android.tools.build:gradle:7.4.2'
}
}

dependencies {
compile 'com.android.support:appcompat-v7:20.0.+'
compile 'com.android.support:support-v4:20.0.+'
api 'androidx.appcompat:appcompat:1.6.1'
}

android {
compileSdkVersion 20
buildToolsVersion '27.0.3'
defaultConfig{
minSdkVersion 14
compileSdk 33
}
}

8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# NoPish

[<img src="https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png"
alt="Get it on Google Play"
height="80">](https://play.google.com/store/apps/details?id=de.tudarmstadt.informatik.secuso.phishedu2)
> :warning: **Please note:** This project has not been updated in a long time. The content within the app is no longer up-to-date with our [NoPhish](https://secuso.aifb.kit.edu/english/Education_and_Training_Materials.php) material.
Phishing is a major issue of the Internet where users are tricked into disclosing their confidential data, such as login or credit card information, usually via fraudulent websites. The gained information is exploited by the phishers with the purpose of impersonating their victims for financial benefits.

Expand All @@ -16,8 +14,8 @@ Further development requires Android Studio, we recommend to use at least versio

### API Reference

- Mininum SDK: 10
- Target SDK: 19
- Mininum SDK: 14
- Target SDK: 33

## License

Expand Down
33 changes: 22 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion '25.0.0'
defaultConfig {
applicationId 'de.tudarmstadt.informatik.secuso.phishedu2'
minSdkVersion 10
targetSdkVersion 19
versionCode 31
versionName "1.4.0"
minSdkVersion 19
compileSdk 33
targetSdkVersion 33
versionCode 32
versionName "1.5.0"
}
buildTypes {
release {
Expand All @@ -18,12 +17,24 @@ android {
}
productFlavors {
}
lint {
lintConfig = file("lint.xml")
}
}

dependencies {
compile 'com.android.support:support-v4:21.0.2'
compile project(':BaseGameUtils')
compile 'com.google.code.gson:gson:2.3'
compile files('libs/android-json-rpc-0.2.jar')
compile 'com.android.support:appcompat-v7:21.0.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation project(':BaseGameUtils')
implementation 'com.google.code.gson:gson:2.3'
implementation files('libs/android-json-rpc-0.2.jar')
implementation 'androidx.appcompat:appcompat:1.6.1'

constraints {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version") {
because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib")
}
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version") {
because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib")
}
}
}
14 changes: 12 additions & 2 deletions app/lint.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<lint>
</lint>
<!-- Disable the NotificationPermission check for glide -->
<issue id="NotificationPermission">
<ignore regexp="com.bumptech.glide.request.target.NotificationTarget" />
</issue>

<!-- Set the severity of missing onClick method to warning as it is a false positive -->
<issue id="OnClick" severity="warning"/>

<!-- Set the severity of missing translations to warning instead of error -->
<issue id="MissingTranslation" severity="warning" />
</lint>
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
android:theme="@style/AppTheme" >

<activity
android:exported="true"
android:name="de.tudarmstadt.informatik.secuso.phishedu2.MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void sendEmail(View view) {
} else {
// Input is OK send email
// invoke Backendcontroller
BackendControllerImpl.getInstance().sendMail(from, to, userMessage);
//BackendControllerImpl.getInstance().sendMail(from, to, userMessage);

// Pop up with go to E-Mail on your Smartphone
showAlertDialog();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void setShowSignIn(boolean showsignin){

void updateUI(Activity v){
// show sign-out button, hide the sign-in button
v.findViewById(R.id.sign_in_button).setVisibility(showSignIn ? View.VISIBLE : View.GONE);
//v.findViewById(R.id.sign_in_button).setVisibility(showSignIn ? View.VISIBLE : View.GONE);
v.findViewById(R.id.sign_out_button).setVisibility(showSignIn ? View.GONE : View.VISIBLE);

// findViewById(R.id.button_show_leaderboard_rate).setVisibility(View.VISIBLE);
Expand Down Expand Up @@ -89,7 +89,7 @@ public int getLayout() {
@Override
public int[] getClickables() {
return new int[] {
R.id.sign_in_button,
//R.id.sign_in_button,
R.id.sign_out_button,
R.id.button_show_online_achievement,
R.id.button_show_leaderboard_rate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,12 @@ protected void onStartClick() {
Class next_activity = URLTaskActivity.class;
if (this.getLevel() == 0) {
BackendControllerImpl.getInstance().skipLevel0();
next_activity = AwarenessActivity.class;
BackendControllerImpl.getInstance().startLevel(1);
next_activity = LevelIntroActivity.class;
} else if (this.getLevel() == 1) {
next_activity = FindAddressBarActivity.class;
BackendControllerImpl.getInstance().skipLevel1();
BackendControllerImpl.getInstance().startLevel(2);
next_activity = LevelIntroActivity.class;
} else if (this.getLevel() == BackendControllerImpl.getInstance()
.getLevelCount() - 1) {
next_activity = AppEndActivity.class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
package de.tudarmstadt.informatik.secuso.phishedu2;

import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.viewpager.widget.ViewPager;

import de.tudarmstadt.informatik.secuso.phishedu2.backend.BackendControllerImpl;
import de.tudarmstadt.informatik.secuso.phishedu2.backend.NoPhishLevelInfo;

Expand Down
Loading

0 comments on commit c98b0e8

Please sign in to comment.