Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
linenive committed Jun 20, 2021
2 parents aab7a8a + 1993ba3 commit 78bf81f
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class AddArticleActivity : AppCompatActivity() {

lateinit var articleId: String

lateinit var writerId: String

private lateinit var writerName:String

private lateinit var searchResult: SearchResultEntity
Expand All @@ -88,6 +90,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 @@ -116,7 +122,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 @@ -158,10 +163,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 78bf81f

Please sign in to comment.