Skip to content
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.

Commit

Permalink
Merge pull request #141 from SURFnet/f/TIQR-210
Browse files Browse the repository at this point in the history
TIQR-210: Created Core module
  • Loading branch information
dima-ko authored Nov 9, 2021
2 parents b6ea991 + 9ff453a commit f9ff302
Show file tree
Hide file tree
Showing 156 changed files with 429 additions and 347 deletions.
52 changes: 3 additions & 49 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ plugins {
kotlin("android")
kotlin("kapt")
id("kotlin-parcelize")
id("dagger.hilt.android.plugin")
id("androidx.navigation.safeargs.kotlin")
}

android {
Expand Down Expand Up @@ -63,53 +61,9 @@ android {
}

dependencies {
implementation(libs.kotlin.stdlib)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.kotlinx.coroutines.playServices)

implementation(libs.androidx.activity)
implementation(libs.androidx.autofill)
implementation(libs.androidx.biometric)
implementation(libs.androidx.browser)
implementation(libs.androidx.camera.core)
implementation(libs.androidx.camera.camera2)
implementation(libs.androidx.camera.lifecycle)
implementation(libs.androidx.camera.view)
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.core)
implementation(libs.androidx.concurrent)
implementation(libs.androidx.lifecycle.common)
implementation(libs.androidx.lifecycle.livedata)
implementation(libs.androidx.localBroadcastManager)
implementation(libs.androidx.navigation.fragment)
implementation(libs.androidx.navigation.ui)
implementation(libs.androidx.recyclerview)
implementation(libs.androidx.splashscreen)
implementation(libs.google.android.material)
implementation(libs.google.mlkit.barcode)
implementation(libs.google.firebase.messaging)

implementation(project(":data"))

implementation(libs.dagger.hilt.android)
implementation(libs.dagger.hilt.fragment)
kapt(libs.dagger.hilt.compiler)

implementation(libs.permission)
implementation(libs.coil)
implementation(libs.betterLink)

testImplementation(libs.junit)
androidTestImplementation(libs.junit)
androidTestImplementation(libs.androidx.testing.core)
androidTestImplementation(libs.androidx.testing.junit)
androidTestImplementation(libs.androidx.testing.rules)
androidTestImplementation(libs.androidx.testing.epsresso)
androidTestImplementation(libs.androidx.testing.uiautomator)
androidTestImplementation(libs.kotlinx.coroutines.test)

androidTestImplementation(libs.dagger.hilt.testing)
kaptAndroidTest(libs.dagger.hilt.compiler)

implementation(project(":core"))

}

// Disable analytics
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</queries>

<application
android:name=".TiqrApplication"
android:name="org.tiqr.core.TiqrApplication"
android:allowBackup="true"
android:fullBackupContent="@xml/backup_descriptor"
android:dataExtractionRules="@xml/backup_descriptor_v31"
Expand All @@ -28,7 +28,7 @@
android:theme="@style/AppTheme">

<activity
android:name=".MainActivity"
android:name="org.tiqr.core.MainActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Splash"
android:windowSoftInputMode="adjustResize"
Expand All @@ -51,7 +51,7 @@
</activity>

<service
android:name=".messaging.TiqrMessagingService"
android:name="org.tiqr.core.messaging.TiqrMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
Expand Down
114 changes: 0 additions & 114 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,118 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools" tools:locale="en">
<string name="app_name" translatable="false">tiqr</string>

<!-- General buttons -->
<string name="button_ok">OK</string>
<string name="button_retry">Retry</string>
<string name="button_delete">Delete</string>
<string name="button_cancel">Cancel</string>

<!-- Main -->
<string name="button_info">About</string>
<string name="button_surfnet">Surfnet</string>

<!-- Start -->
<string name="start_welcome"><![CDATA[<b>Use tiqr on your smartphone to log in to websites easily and secure.</b><br/>
<br/>
Register your new tiqr account and follow the instructions for activation.<br/>
<br/>
Press <b>Scan</b> when asked.]]></string>
<string name="start_instructions"><![CDATA[<b>Use tiqr on your smartphone to log in</b> <br/>
<br/>
1. Press <b>Scan</b> and scan the QR-code on the website.<br/>
<br/>
<i>More than one ID? Select the relevant ID.</i> <br/>
<br/>
2. Scan your biometric or enter your PIN for tiqr and press <b>OK</b> <br/>
<br/>
3. You are logged in!]]></string>
<string name="start_blocked"><![CDATA[<b>Now what?</b><br/>
<br/>
Ask your identity provider(s) for a new activation code.
For a link to your identity provider(s) check your identities (accessible from the top right).<br/>
<br />
Together with your new activation code you will receive instructions for reactivating your account.
Press <b>Scan</b> if asked.]]></string>

<!-- Scan -->
<string name="scan_button">Scan</string>
<string name="scan_permission_required_title">Camera permission required</string>
<string name="scan_permission_required_message">For scanning a QR code, tiqr needs access to the camera.</string>
<string name="scan_permission_required_settings">Settings</string>
<string name="scan_permission_required_dismiss">Cancel</string>

<!-- Browser -->
<string name="browser_error_launch">Failed to launch the default browser</string>

<!-- About -->
<string name="about_label_version" translatable="false">%1s &#8226; v%2s</string>
<string name="about_label_provided_by">Provided by:</string>
<string name="about_label_developed_by">Developed by:</string>
<string name="about_label_interaction_by">Interaction design:</string>

<!-- Enroll (Confirm) -->
<string name="enroll_confirm_title">Confirm account activation</string>
<string name="enroll_confirm_subtitle">Do you want to activate the following account?</string>
<string name="enroll_confirm_details">Account details</string>
<string name="enroll_confirm_domain">You will enroll to the following domain:</string>

<!-- Enroll (PIN) -->
<string name="enroll_pin_title">Choose a unique PIN for tiqr</string>
<string name="enroll_pin_subtitle">Enter the PIN:</string>
<string name="enroll_pin_notice">Please remember this PIN, it cannot be changed!</string>

<!-- Enroll (PIN Verify) -->
<string name="enroll_pin_verify_title">Verify the unique PIN</string>
<string name="enroll_pin_verify_subtitle">Re-enter the PIN:</string>
<string name="enroll_pin_verify_no_match_title">PINs don\'t match</string>
<string name="enroll_pin_verify_no_match_message">The entered PINs don\'t match. Try again.\nChoose a PIN you can remember.</string>

<!-- Account -->
<string name="account_full_name">Full name</string>
<string name="account_id">Tiqr account id</string>
<string name="account_information">Information</string>
<string name="account_activated">Account activated!</string>
<string name="account_upgrade_biometric_title">Upgrade account</string>
<string name="account_upgrade_biometric_message">Do you want to use biometrics instead of PIN to log in with this account?</string>

<!-- Authentication (Confirm) -->
<string name="auth_confirm_title">Are you sure you want to log in?</string>
<string name="auth_confirm_subtitle">You will be logged in as:</string>
<string name="auth_confirm_to">to:</string>
<string name="auth_confirm_select_identity">Select identity</string>

<!-- Authentication (Biometric) -->
<string name="auth_biometric_title">Use your biometric</string>
<string name="auth_biometric_dialog_title">Do you want to use biometric to log in?</string>
<string name="auth_biometric_dialog_cancel">Use PIN</string>

<!-- Authentication (Pin) -->
<string name="auth_pin_title">Enter your PIN for tiqr</string>
<string name="auth_pin_subtitle">Enter the PIN and press OK:</string>

<!-- Authentication (Fallback) -->
<string name="auth_fallback_title">You appear to be offline</string>
<string name="auth_fallback_subtitle">Don\'t worry! Click the QR code on the website. You will be asked to enter the following one-time credentials:</string>
<string name="auth_fallback_id">Your ID is:</string>
<string name="auth_fallback_otp">One-time password:</string>
<string name="auth_fallback_pin_unverified_title">Note: your PIN has not been verified yet.</string>
<string name="auth_fallback_pin_unverified">If you can\'t login with the credentials above, scan again and enter the correct PIN code.</string>

<!-- Authentication (Summary) -->
<string name="auth_summary_title">You have successfully logged in!</string>
<string name="auth_summary_to">to:</string>

<!-- Identity -->
<string name="identity_title">Identities</string>
<string name="identity_blocked">Blocked</string>
<string name="identity_blocked_message">Warning: this account is blocked\nand needs to be reactivated.</string>
<string name="identity_delete_title">Are you sure?</string>
<string name="identity_delete_message">This account can no longer be used when deleted.</string>
<string name="identity_biometric_usage">Use biometrics</string>
<string name="identity_biometric_upgrade">Upgrade to biometrics usage</string>

<!-- Notification channel -->
<string name="notification_channel_name">Messages</string>
<string name="notification_channel_description">Notifications for messages from tiqr</string>
</resources>
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ buildscript {
classpath(libs.dagger.hilt.gradle)
classpath(libs.androidx.navigation.gradle)
classpath(libs.google.gms.gradle)
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21")
}
}

Expand Down
1 change: 1 addition & 0 deletions core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
102 changes: 102 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
plugins {
id("com.android.library")
kotlin("android")
kotlin("kapt")
id("kotlin-parcelize")
id("dagger.hilt.android.plugin")
id("androidx.navigation.safeargs.kotlin")
}

android {
compileSdk = libs.versions.android.sdk.compile.get().toInt()
buildToolsVersion = libs.versions.android.buildTools.get()

defaultConfig {
minSdk = libs.versions.android.sdk.min.get().toInt()
targetSdk = libs.versions.android.sdk.target.get().toInt()

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
getByName("release") {
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}

buildFeatures {
dataBinding = true
}

kapt {
correctErrorTypes = true
useBuildCache = true

javacOptions {
option("-Xmaxerrs", 1000)
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

}
kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {
implementation(libs.kotlin.stdlib)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.androidx.core)
implementation(libs.kotlinx.coroutines.playServices)

implementation(libs.androidx.activity)
implementation(libs.androidx.autofill)
implementation(libs.androidx.biometric)
implementation(libs.androidx.browser)
implementation(libs.androidx.camera.core)
implementation(libs.androidx.camera.camera2)
implementation(libs.androidx.camera.lifecycle)
implementation(libs.androidx.camera.view)
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.core)
implementation(libs.androidx.concurrent)
implementation(libs.androidx.lifecycle.common)
implementation(libs.androidx.lifecycle.livedata)
implementation(libs.androidx.localBroadcastManager)
implementation(libs.androidx.navigation.fragment)
implementation(libs.androidx.navigation.ui)
implementation(libs.androidx.recyclerview)
implementation(libs.androidx.splashscreen)
implementation(libs.google.android.material)
implementation(libs.google.mlkit.barcode)
implementation(libs.google.firebase.messaging)

implementation(project(":data"))

implementation(libs.dagger.hilt.android)
implementation(libs.dagger.hilt.fragment)
kapt(libs.dagger.hilt.compiler)

implementation(libs.permission)
implementation(libs.coil)
implementation(libs.betterLink)

testImplementation(libs.junit)
androidTestImplementation(libs.junit)
androidTestImplementation(libs.androidx.testing.core)
androidTestImplementation(libs.androidx.testing.junit)
androidTestImplementation(libs.androidx.testing.rules)
androidTestImplementation(libs.androidx.testing.epsresso)
androidTestImplementation(libs.androidx.testing.uiautomator)
androidTestImplementation(libs.kotlinx.coroutines.test)

androidTestImplementation(libs.dagger.hilt.testing)
kaptAndroidTest(libs.dagger.hilt.compiler)
}
}
Empty file added core/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions core/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.tiqr.authenticator.util.AnimationsRule
import org.tiqr.authenticator.util.matchNavHost
import org.tiqr.core.MainActivity
import org.tiqr.core.R

@LargeTest
@HiltAndroidTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.tiqr.authenticator.util.AnimationsRule
import org.tiqr.core.MainActivity

@LargeTest
@HiltAndroidTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,23 @@ package org.tiqr.authenticator

import android.content.Intent
import android.net.Uri
import androidx.test.core.app.ActivityScenario
import androidx.test.core.app.ApplicationProvider
import androidx.test.core.app.launchActivity
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.RootMatchers.isDialog
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.rule.ActivityTestRule
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.tiqr.authenticator.util.AnimationsRule
import org.tiqr.core.MainActivity

@LargeTest
@HiltAndroidTest
Expand Down
Loading

0 comments on commit f9ff302

Please sign in to comment.