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

Task/registration screen #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ruslan-fayzullin
Copy link

Sign up with avatar uploading feature (via amazon services), made by Ruslan's PDP

@ruslan-fayzullin ruslan-fayzullin force-pushed the task/registration-screen branch 5 times, most recently from 5eac33c to 85c7625 Compare April 2, 2021 06:21

fun registration(context: Context, clearStack: Boolean = false) {
context.startActivity(Intent(context, RegistrationActivity::class.java).apply {
if (clearStack) {

Choose a reason for hiding this comment

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

Не лучше shouldClearStack?

}

})
return isSuccessful

Choose a reason for hiding this comment

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

Тут вроде isSuccessful всегда будет true возвращаться. Запрос асинхронный и не успеет поменять isSuccesful

@@ -38,6 +39,10 @@ class ProfileActivity : AppCompatActivity(), KodeinAware, OnRefreshListener {
showProfile()
showFirstName(it.firstName)
showLastName(it.lastName)
if (it.avatarUrl.isEmpty()) {
print("EMPTY AVATAR URL!!!!!!!!!!!!!!!!!!!!!!!!!!")

Choose a reason for hiding this comment

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

лучше в лог вывести

var isSuccessful = false
okHttpClient
.newCall(request)
.enqueue(object : Callback {
Copy link

@nailshaykhraziev nailshaykhraziev Apr 5, 2021

Choose a reason for hiding this comment

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

Как вариант, ты весь метод можешь обернуть в suspendCancellableCoroutine

suspend fun uploadImageToAws(url: String, fields: Map<String, String>, file: File) : Boolean= suspendCancellableCoroutine {
... 
override fun onFailure(call: Call, e: IOException) {
                    continuation.resume(false)// or continuation.resumeWithException(e)
                }
                
  override fun onResponse(call: Call, response: Response) {
                    continuation.resume(true)
                }              

}

import org.kodein.di.KodeinAware
import org.kodein.di.android.kodein
import org.kodein.di.generic.instance

Choose a reason for hiding this comment

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

extra line

)
}

private fun navigateToProfile(context: Context) {

Choose a reason for hiding this comment

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

Context в делегате выглядит как-то не оч

@ruslan-fayzullin ruslan-fayzullin force-pushed the task/registration-screen branch 2 times, most recently from 68b4cc9 to 8bbe978 Compare May 18, 2021 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants