Skip to content

Commit

Permalink
경로 변수 전부 lazy로 통일
Browse files Browse the repository at this point in the history
  • Loading branch information
easyhooon committed Jun 20, 2021
1 parent be82098 commit 44e702e
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class AddArticleActivity : AppCompatActivity() {

lateinit var articleId: String

lateinit var writerId: String

private lateinit var writerName:String

private lateinit var searchResult: SearchResultEntity
Expand All @@ -87,6 +89,10 @@ class AddArticleActivity : AppCompatActivity() {
private val storage: FirebaseStorage by lazy {
Firebase.storage
}

private val currentUserRef: DatabaseReference by lazy {
userRef.child(firebaseUser.uid)
}
private val articleRef: DatabaseReference by lazy {
Firebase.database.reference.child(DB_ARTICLES)
}
Expand Down Expand Up @@ -115,7 +121,6 @@ class AddArticleActivity : AppCompatActivity() {
}

private fun initDB() {
val currentUserRef = userRef.child(auth.currentUser?.uid.toString())
currentUserRef.addListenerForSingleValueEvent(object: ValueEventListener{
override fun onDataChange(snapshot: DataSnapshot) {
val userModel: UserModel? = snapshot.getValue(UserModel::class.java)
Expand Down Expand Up @@ -156,10 +161,10 @@ class AddArticleActivity : AppCompatActivity() {
}

binding.submitButton.setOnClickListener {
writerId = firebaseUser.uid
articleId = articleRef.push().key.toString()
val articleTitle = binding.titleEditText.text.toString()
val articleContent = binding.contentEditText.text.toString()
val writerId = auth.currentUser?.uid.orEmpty()
val recruitmentNumberText = binding.recruitmentNumberEditText.text.toString()
val recruitmentNumber = recruitmentNumberText.toInt()

Expand Down

0 comments on commit 44e702e

Please sign in to comment.