Skip to content

Commit

Permalink
Prepared for third release
Browse files Browse the repository at this point in the history
  • Loading branch information
onero authored May 11, 2018
2 parents ce4f09d + c12e11f commit f1a4ce6
Show file tree
Hide file tree
Showing 40 changed files with 1,337 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ captures/
.idea/gradle.xml
.idea/dictionaries
.idea/libraries
.idea/caches

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
Expand Down
18 changes: 15 additions & 3 deletions .idea/assetWizardSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed .idea/caches/build_file_checksums.ser
Binary file not shown.
13 changes: 10 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ android {
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
Expand All @@ -22,10 +24,15 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-firestore:15.0.0'
implementation 'com.google.firebase:firebase-firestore:16.0.0'
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:support-vector-drawable:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:cardview-v7:26.1.0'
}

Expand Down
18 changes: 17 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,37 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dk.adamino.rehabilitation">

<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.READ_PROFILE"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<receiver
android:name=".GUI.Utils.NotificationService"
android:enabled="true"/>

<activity android:name=".GUI.ProfileActivity">
</activity>
<activity android:name=".GUI.ContactActivity">
</activity>
<activity android:name=".GUI.LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".GUI.ContactActivity">
<activity
android:name=".GUI.Settings.SettingsActivity"
android:label="@string/title_activity_settings"
android:parentActivityName=".GUI.ProfileActivity">
</activity>
</application>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package dk.adamino.rehabilitation.Callbacks;

/**
* Created by Adamino.
*/
public interface IFirebaseAuthenticationCallback {

/***
* Handle client uid from login
* @param clientUid
*/
void onClientLoggedIn(String clientUid);

/**
* Handle failed login
* @param error
*/
void onFailedLogin(String error);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package dk.adamino.rehabilitation.DAL;

import android.support.annotation.NonNull;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;

import dk.adamino.rehabilitation.Callbacks.IFirebaseAuthenticationCallback;

/**
* Created by Adamino.
*/
public class FirebaseAuthenticate implements IFirebaseAuthenticate {

private static final String TAG = "FirebaseAuth";

private FirebaseAuth mAuth;

public FirebaseAuthenticate() {
mAuth = FirebaseAuth.getInstance();
}

@Override
public void signInWithEmailAndPassword(String email, String password, final IFirebaseAuthenticationCallback callback) {
mAuth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
callback.onClientLoggedIn(mAuth.getCurrentUser().getUid());
} else {
callback.onFailedLogin(task.getException().getMessage());
}
}
});
}

@Override
public void signout() {
mAuth.signOut();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package dk.adamino.rehabilitation.DAL;

import dk.adamino.rehabilitation.Callbacks.IFirebaseAuthenticationCallback;

/**
* Created by Adamino.
*/
public interface IFirebaseAuthenticate {

/***
* Sign in with provided email and password
* @param email
* @param password
* @param callback
*/
void signInWithEmailAndPassword(String email, String password, IFirebaseAuthenticationCallback callback);

/**
* Signout client
*/
void signout();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,21 @@
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;

import dk.adamino.rehabilitation.GUI.Model.FirebaseClientModel;
import dk.adamino.rehabilitation.R;

public class ContactActivity extends AppCompatActivity {

private FirebaseClientModel mFirebaseClientModel;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_contact);

mFirebaseClientModel = FirebaseClientModel.getInstance();
}

@Override
Expand All @@ -34,6 +40,12 @@ public boolean onOptionsItemSelected(MenuItem item) {
Intent contactIntent = ProfileActivity.newIntent(this);
startActivity(contactIntent);
return true;
case R.id.signout:
mFirebaseClientModel.logout();
Toast.makeText(this, "You're logged out", Toast.LENGTH_SHORT).show();
Intent logoutIntent = LoginActivity.newIntent(this);
startActivity(logoutIntent);
return true;
default:
return super.onOptionsItemSelected(item);
}
Expand Down
Loading

0 comments on commit f1a4ce6

Please sign in to comment.