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

Commit

Permalink
2020-04-16 Version 4.0.1: Updated resources and strings
Browse files Browse the repository at this point in the history
  • Loading branch information
fartem committed Apr 16, 2020
1 parent ed88102 commit 353236f
Show file tree
Hide file tree
Showing 20 changed files with 101 additions and 101 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ android {
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName '4.0.0'
versionName '4.0.1'

testInstrumentationRunner 'com.smlnskgmail.jaman.randomnotes.runner.AndroidJacocoTestRunner'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ open class BaseAuthTest {

fun openAuthScreen() {
try {
onView(withId(R.id.menu_login_action)).perform(click())
onView(withId(R.id.menu_auth_action)).perform(click())
} catch (e: NoMatchingViewException) {
openActionBarOverflowOrOptionsMenu(
activityTestRule.activity
)
onView(withId(R.id.menu_login_action)).perform(click())
onView(withId(R.id.menu_auth_action)).perform(click())
}
delay()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class EmailAuthTest : BaseAuthTest() {
)
delay()

onView(withId(R.id.login_action)).perform(click())
onView(withId(R.id.auth_action)).perform(click())
delay()
}

Expand All @@ -67,7 +67,7 @@ class EmailAuthTest : BaseAuthTest() {
}

@Test
fun logInWithEmail() {
fun signInWithEmail() {
whenever(cloudAuth.isValidEmail(any())).thenReturn(true)
whenever(cloudAuth.isValidPassword(any())).thenReturn(true)
whenever(cloudAuth.signInWithEmail(any(), any(), any())).thenAnswer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import org.junit.runner.RunWith
class FacebookAuthTest : BaseAuthTest() {

@Test
fun logInWithFacebook() {
whenever(cloudAuth.logInWithFacebook(any(), any())).thenAnswer {
fun signInWithFacebook() {
whenever(cloudAuth.signInWithFacebook(any(), any())).thenAnswer {
val callback = it.getArgument(1) as ((e: Exception?) -> Unit)
callback.invoke(
null
Expand All @@ -30,7 +30,7 @@ class FacebookAuthTest : BaseAuthTest() {

openAuthScreen()

onView(withId(R.id.facebook_login)).perform(scrollTo()).perform(click())
onView(withId(R.id.facebook_sign_in)).perform(scrollTo()).perform(click())
delay()

val fragmentManager = activityTestRule.activity.supportFragmentManager
Expand All @@ -46,7 +46,7 @@ class FacebookAuthTest : BaseAuthTest() {

@Test
fun authWithError() {
whenever(cloudAuth.logInWithFacebook(any(), any())).thenAnswer {
whenever(cloudAuth.signInWithFacebook(any(), any())).thenAnswer {
val callback = it.getArgument(1) as ((e: Exception?) -> Unit)
callback.invoke(
RuntimeException(
Expand All @@ -59,7 +59,7 @@ class FacebookAuthTest : BaseAuthTest() {

openAuthScreen()

onView(withId(R.id.facebook_login)).perform(scrollTo()).perform(click())
onView(withId(R.id.facebook_sign_in)).perform(scrollTo()).perform(click())
delay()

val fragmentManager = activityTestRule.activity.supportFragmentManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import org.junit.runner.RunWith
class GoogleAuthTest : BaseAuthTest() {

@Test
fun logInWithGoogle() {
whenever(cloudAuth.logInWithGoogle(any(), any())).thenAnswer {
fun signInWithGoogle() {
whenever(cloudAuth.signInWithGoogle(any(), any())).thenAnswer {
val callback = it.getArgument(1) as ((e: Exception?) -> Unit)
callback.invoke(
null
Expand All @@ -29,7 +29,7 @@ class GoogleAuthTest : BaseAuthTest() {

openAuthScreen()

onView(withId(R.id.google_login)).perform(click())
onView(withId(R.id.google_sign_in)).perform(click())
delay()

val fragmentManager = activityTestRule.activity.supportFragmentManager
Expand All @@ -45,7 +45,7 @@ class GoogleAuthTest : BaseAuthTest() {

@Test
fun authWithError() {
whenever(cloudAuth.logInWithGoogle(any(), any())).thenAnswer {
whenever(cloudAuth.signInWithGoogle(any(), any())).thenAnswer {
val callback = it.getArgument(1) as ((e: Exception?) -> Unit)
callback.invoke(
RuntimeException(
Expand All @@ -58,7 +58,7 @@ class GoogleAuthTest : BaseAuthTest() {

openAuthScreen()

onView(withId(R.id.google_login)).perform(click())
onView(withId(R.id.google_sign_in)).perform(click())
delay()

val fragmentManager = activityTestRule.activity.supportFragmentManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class MainActivity : AppCompatActivity() {
)
}

fun showLoginFragment() {
fun showAuthFragment() {
showBaseFragment(
CloudAuthFragment()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ interface CloudAuth {
username: String,
email: String,
password: String,
afterLogin: (e: Exception?) -> Unit
signUpResult: (e: Exception?) -> Unit
)

fun signInWithEmail(
username: String,
password: String,
afterRegister: (e: Exception?) -> Unit
signInResult: (e: Exception?) -> Unit
)

fun logInWithGoogle(
fun signInWithGoogle(
activity: Activity,
afterFacebookLogin: (e: Exception?) -> Unit
signInResult: (e: Exception?) -> Unit
)

fun logInWithFacebook(
fun signInWithFacebook(
activity: Activity,
afterFacebookLogin: (e: Exception?) -> Unit
signInResult: (e: Exception?) -> Unit
)

fun bindForAuth(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,40 @@ class FakeCloudAuth : CloudAuth {
username: String,
email: String,
password: String,
afterLogin: (e: Exception?) -> Unit
signUpResult: (e: Exception?) -> Unit
) {
handleAuth()
afterLogin(null)
signUpResult(null)
}

override fun signInWithEmail(
username: String,
password: String,
afterRegister: (e: Exception?) -> Unit
signInResult: (e: Exception?) -> Unit
) {
handleAuth()
afterRegister(null)
signInResult(null)
}


override fun logInWithFacebook(
override fun signInWithFacebook(
activity: Activity,
afterFacebookLogin: (e: Exception?) -> Unit
signInResult: (e: Exception?) -> Unit
) {
handleAuth()
afterFacebookLogin(null)
signInResult(null)
}

private fun handleAuth() {
isAuth = true
}

override fun logInWithGoogle(
override fun signInWithGoogle(
activity: Activity,
afterFacebookLogin: (e: Exception?) -> Unit
signInResult: (e: Exception?) -> Unit
) {
handleAuth()
afterFacebookLogin(null)
signInResult(null)
}

override fun bindForAuth(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,44 +31,44 @@ class ParseServerAuth : CloudAuth {
return ParseUser.getCurrentUser() != null
}

override fun logInWithFacebook(
override fun signInWithFacebook(
activity: Activity,
afterFacebookLogin: (e: Exception?) -> Unit
signInResult: (e: Exception?) -> Unit
) {
ParseFacebookUtils.logInWithReadPermissionsInBackground(
activity,
listOf("public_profile")
) { _, e -> afterFacebookLogin(e) }
) { _, e -> signInResult(e) }
}

override fun signUpWithEmail(
username: String,
email: String,
password: String,
afterLogin: (e: Exception?) -> Unit
signUpResult: (e: Exception?) -> Unit
) {
val parseUser = ParseUser()
parseUser.username = username
parseUser.email = email
parseUser.setPassword(password)
parseUser.signUpInBackground {
afterLogin(it)
signUpResult(it)
}
}

override fun signInWithEmail(
username: String,
password: String,
afterRegister: (e: Exception?) -> Unit
signInResult: (e: Exception?) -> Unit
) {
ParseUser.logInInBackground(username, password) { _, e ->
afterRegister(e)
signInResult(e)
}
}

override fun logInWithGoogle(
override fun signInWithGoogle(
activity: Activity,
afterFacebookLogin: (e: Exception?) -> Unit
signInResult: (e: Exception?) -> Unit
) {
val signInOptions = getGoogleSignInOptions(activity)
val signInClient = GoogleSignIn.getClient(
Expand All @@ -78,7 +78,7 @@ class ParseServerAuth : CloudAuth {

googleAuthCallback = object : GoogleAuthCallback {
override fun sendResult(exception: Exception?) {
afterFacebookLogin(exception)
signInResult(exception)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ interface CloudAuthPresenter {
email: String,
password: String
)
fun logInWithEmail(
fun signInWithEmail(
email: String,
password: String
)

fun logInWithGoogle(
fun signInWithGoogle(
activity: Activity
)
fun logInWithFacebook(
fun signInWithFacebook(
activity: Activity
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CloudAuthPresenterImpl : CloudAuthPresenter {
}
}

override fun logInWithEmail(
override fun signInWithEmail(
email: String,
password: String
) {
Expand All @@ -49,18 +49,18 @@ class CloudAuthPresenterImpl : CloudAuthPresenter {
) { handleAuthResult(it) }
}

override fun logInWithGoogle(
override fun signInWithGoogle(
activity: Activity
) {
cloudAuth.logInWithGoogle(
cloudAuth.signInWithGoogle(
activity
) { handleAuthResult(it) }
}

override fun logInWithFacebook(
override fun signInWithFacebook(
activity: Activity
) {
cloudAuth.logInWithFacebook(
cloudAuth.signInWithFacebook(
activity
) { handleAuthResult(it) }
}
Expand Down
Loading

0 comments on commit 353236f

Please sign in to comment.