Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PM-connect id initial pr commit #2949

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/fcm_default_notification_channel" />
<receiver
android:name="org.commcare.connect.SMSBroadcastReceiver"
android:exported="true"
android:permission="com.google.android.gms.auth.api.phone.permission.SEND">
<intent-filter>
<action android:name="com.google.android.gms.auth.api.phone.SMS_RETRIEVED"/>
</intent-filter>
</receiver>

<activity
android:label="@string/application_name"
Expand All @@ -150,6 +158,9 @@
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
<activity
android:name="org.commcare.activities.connect.ConnectIdActivity"
android:exported="true" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it exported ?

<activity
android:label="@string/application_name"
android:name="org.commcare.activities.LoginActivity"
Expand Down
18 changes: 18 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply from: 'jacoco.gradle'
apply plugin: "androidx.navigation.safeargs"

repositories {
// for local aar inclusion
Expand Down Expand Up @@ -141,8 +142,23 @@ dependencies {

implementation 'com.appmattus.certificatetransparency:certificatetransparency-android:2.5.4'

implementation 'androidx.biometric:biometric:1.1.0'

implementation 'io.michaelrocks:libphonenumber-android:8.13.11'
implementation 'com.nulab-inc:zxcvbn:1.7.0'
// Dependency required for API desugaring
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_minimal:2.1.3'
implementation 'com.google.android.gms:play-services-auth:21.3.0'
implementation 'com.google.android.gms:play-services-auth-api-phone:18.1.0'
implementation 'com.google.android.gms:play-services-identity:18.1.0'
implementation 'com.google.android.gms:play-services-base:18.5.0'
def nav_version = '2.8.5'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this defined here and in top level build.gradle with different values. Instead we should define it only at one place and refer to the version from here.

implementation "androidx.navigation:navigation-fragment:$nav_version"
implementation "androidx.navigation:navigation-ui:$nav_version"
implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"
implementation "androidx.navigation:navigation-compose:$nav_version"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
}

ext {
Expand Down Expand Up @@ -249,6 +265,7 @@ android {

buildFeatures {
buildConfig true
dataBinding true
}

defaultConfig {
Expand Down Expand Up @@ -294,6 +311,7 @@ android {

buildFeatures {
viewBinding true
dataBinding true
}

applicationVariants.all { variant ->
Expand Down
11 changes: 11 additions & 0 deletions app/res/drawable/bottom_shadow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- bottom_shadow.xml -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:startColor="@color/connect_blue_color_50"
android:endColor="@android:color/transparent"
android:angle="270" />
</shape>
</item>
</layer-list>
15 changes: 15 additions & 0 deletions app/res/drawable/connect_edit_text_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<padding
android:bottom="@dimen/content_start"
android:left="@dimen/content_start"
android:right="@dimen/content_start"
android:top="@dimen/content_start"/>
<size android:height="48dp"/>
<solid android:color="@color/white"/>
<stroke
android:color="@color/connect_blue_color_10"
android:width="1dp"/>
<corners android:radius="5dp"/>
</shape>
9 changes: 9 additions & 0 deletions app/res/drawable/connect_right_arrow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="14dp"
android:height="14dp"
android:viewportWidth="14"
android:viewportHeight="14">
<path
android:pathData="M7,0.333L5.825,1.508L10.475,6.166H0.333V7.833H10.475L5.825,12.491L7,13.666L13.667,7L7,0.333Z"
android:fillColor="#ffffff"/>
</vector>
7 changes: 7 additions & 0 deletions app/res/drawable/connect_side_icon_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<solid android:color="@color/connect_blue_color_10"/>
<corners android:radius="5dp"/>
</shape>
Binary file added app/res/drawable/fingerprint.png
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we must not have generic drawables, this either need to be vector drawable or should be classified by screen densities.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions app/res/drawable/ic_connect_action_overflow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M12,19.269C11.587,19.269 11.234,19.122 10.941,18.828C10.647,18.535 10.5,18.181 10.5,17.769C10.5,17.357 10.647,17.003 10.941,16.709C11.234,16.416 11.587,16.269 12,16.269C12.413,16.269 12.766,16.416 13.059,16.709C13.353,17.003 13.5,17.357 13.5,17.769C13.5,18.181 13.353,18.535 13.059,18.828C12.766,19.122 12.413,19.269 12,19.269ZM12,13.5C11.587,13.5 11.234,13.353 10.941,13.059C10.647,12.765 10.5,12.412 10.5,12C10.5,11.587 10.647,11.234 10.941,10.941C11.234,10.647 11.587,10.5 12,10.5C12.413,10.5 12.766,10.647 13.059,10.941C13.353,11.234 13.5,11.587 13.5,12C13.5,12.412 13.353,12.765 13.059,13.059C12.766,13.353 12.413,13.5 12,13.5ZM12,7.73C11.587,7.73 11.234,7.584 10.941,7.29C10.647,6.996 10.5,6.643 10.5,6.23C10.5,5.818 10.647,5.465 10.941,5.171C11.234,4.877 11.587,4.73 12,4.73C12.413,4.73 12.766,4.877 13.059,5.171C13.353,5.465 13.5,5.818 13.5,6.23C13.5,6.643 13.353,6.996 13.059,7.29C12.766,7.584 12.413,7.73 12,7.73Z"
android:fillColor="#ffffff"/>
</group>
</vector>
13 changes: 13 additions & 0 deletions app/res/drawable/ic_connect_arrow_back.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M7.373,12.75L13.069,18.446L12,19.5L4.5,12L12,4.5L13.069,5.554L7.373,11.25H19.5V12.75H7.373Z"
android:fillColor="#ffffff"/>
</group>
</vector>
Binary file added app/res/drawable/ic_dimagi_logo.png
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to be vector drawable or should be classified by screen densities.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/res/drawable/ic_notifications_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.9,2 2,2zM18,16v-5c0,-3.07 -1.63,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.64,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2zM16,17L8,17v-6c0,-2.48 1.51,-4.5 4,-4.5s4,2.02 4,4.5v6z"/>
</vector>
5 changes: 5 additions & 0 deletions app/res/drawable/ic_outline_lock_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#3A42C7"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM9,6c0,-1.66 1.34,-3 3,-3s3,1.34 3,3v2L9,8L9,6zM18,20L6,20L6,10h12v10zM12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2z"/>
</vector>
5 changes: 5 additions & 0 deletions app/res/drawable/ic_outline_person_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#3A42C7"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,6c1.1,0 2,0.9 2,2s-0.9,2 -2,2 -2,-0.9 -2,-2 0.9,-2 2,-2m0,10c2.7,0 5.8,1.29 6,2L6,18c0.23,-0.72 3.31,-2 6,-2m0,-12C9.79,4 8,5.79 8,8s1.79,4 4,4 4,-1.79 4,-4 -1.79,-4 -4,-4zM12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/>
</vector>
5 changes: 5 additions & 0 deletions app/res/drawable/ic_outline_phone_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#3A42C7"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M6.54,5c0.06,0.89 0.21,1.76 0.45,2.59l-1.2,1.2c-0.41,-1.2 -0.67,-2.47 -0.76,-3.79h1.51m9.86,12.02c0.85,0.24 1.72,0.39 2.6,0.45v1.49c-1.32,-0.09 -2.59,-0.35 -3.8,-0.75l1.2,-1.19M7.5,3H4c-0.55,0 -1,0.45 -1,1 0,9.39 7.61,17 17,17 0.55,0 1,-0.45 1,-1v-3.49c0,-0.55 -0.45,-1 -1,-1 -1.24,0 -2.45,-0.2 -3.57,-0.57 -0.1,-0.04 -0.21,-0.05 -0.31,-0.05 -0.26,0 -0.51,0.1 -0.71,0.29l-2.2,2.2c-2.83,-1.45 -5.15,-3.76 -6.59,-6.59l2.2,-2.2c0.28,-0.28 0.36,-0.67 0.25,-1.02C8.7,6.45 8.5,5.25 8.5,4c0,-0.55 -0.45,-1 -1,-1z"/>
</vector>
Binary file added app/res/drawable/ic_primary_portrait.png
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to be vector drawable or should be classified by screen densities.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/res/drawable/pattern.png
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to be vector drawable or should be classified by screen densities.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/res/font/roboto_bold.ttf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My sense is that roboto is default Android OS font, as so curious why do we need to add these roboto files explicitly ?

Binary file not shown.
Binary file added app/res/font/roboto_italic.ttf
Binary file not shown.
Binary file added app/res/font/roboto_medium.ttf
Binary file not shown.
Binary file added app/res/font/roboto_regular.ttf
Binary file not shown.
20 changes: 20 additions & 0 deletions app/res/layout/activity_connect_id.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent">

<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment_connectid"
android:layout_height="0dp"
android:layout_width="0dp"
app:defaultNavHost="true"
android:name="androidx.navigation.fragment.NavHostFragment"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/nav_graph_connectid" />

</androidx.constraintlayout.widget.ConstraintLayout>
100 changes: 100 additions & 0 deletions app/res/layout/fragment_phone_available_bottom_sheet.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="@color/transparent"
tools:context="org.commcare.fragments.connectId.ConnectIdPhoneAvailableBottomSheet">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
android:padding="16dp">


<ImageView
android:id="@+id/imageView2"
android:layout_width="24dp"
android:layout_height="24dp"
android:contentDescription="@null"
android:src="@drawable/ic_primary_portrait" />

<org.commcare.views.connect.connecttextview.ConnectBoldTextView
android:id="@+id/connectBoldTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:fontFamily="@font/roboto_medium"
android:text="@string/connect_phone_unavailable"
android:textColor="@color/connect_warning_color"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/imageView2"
app:layout_constraintStart_toEndOf="@+id/imageView2"
app:layout_constraintTop_toTopOf="@+id/imageView2" />

<org.commcare.views.connect.connecttextview.ConnectMediumTextView
android:id="@+id/phone_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:fontFamily="@font/roboto_regular"
android:text="+91 7748962888"
android:textColor="@color/connect_secondary_text"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="@+id/connectBoldTextView"
app:layout_constraintTop_toBottomOf="@+id/connectBoldTextView" />

<org.commcare.views.connect.connecttextview.ConnectMediumTextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:fontFamily="@font/roboto_regular"
android:text="Do you want to recover your account? "
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="@+id/phone_number"
app:layout_constraintTop_toBottomOf="@+id/phone_number" />

<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView">

<com.google.android.material.button.MaterialButton
android:id="@+id/back_button"
style="@style/NegativeButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:text="@string/back" />

<com.google.android.material.button.MaterialButton
android:id="@+id/recover_button"
style="@style/CustomButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:gravity="start|center"
android:text="@string/recover"
android:drawableRight="@drawable/connect_right_arrow" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

</FrameLayout>
</layout>
Loading