Showing
2 changed files
with
29 additions
and
1 deletions
| ... | @@ -50,7 +50,19 @@ class SearchActivity : AppCompatActivity() { | ... | @@ -50,7 +50,19 @@ class SearchActivity : AppCompatActivity() { |
| 50 | Toast.makeText(this@SearchActivity, "실패부분 : $query", Toast.LENGTH_SHORT).show() | 50 | Toast.makeText(this@SearchActivity, "실패부분 : $query", Toast.LENGTH_SHORT).show() |
| 51 | } | 51 | } |
| 52 | override fun onDataChange(dataSnapshot: DataSnapshot) { | 52 | override fun onDataChange(dataSnapshot: DataSnapshot) { |
| 53 | +<<<<<<< HEAD | ||
| 53 | for(memoSnapshot in dataSnapshot.children){ | 54 | for(memoSnapshot in dataSnapshot.children){ |
| 55 | +======= | ||
| 56 | + | ||
| 57 | +// 타겟 1개 if (dataSnapshot.exists()){ | ||
| 58 | +// val memo = dataSnapshot.getValue(MemoItem::class.java) | ||
| 59 | +// if (memo != null){ | ||
| 60 | + // Toast.makeText(this@SearchActivity, memo!!.Policy, Toast.LENGTH_SHORT).show() | ||
| 61 | + // } | ||
| 62 | +// | ||
| 63 | +// } | ||
| 64 | + for (memoSnapshot in dataSnapshot.children){ | ||
| 65 | +>>>>>>> makeUserDB | ||
| 54 | val memo = memoSnapshot.getValue(MemoItem::class.java) | 66 | val memo = memoSnapshot.getValue(MemoItem::class.java) |
| 55 | 67 | ||
| 56 | searchList.add( | 68 | searchList.add( | ... | ... |
| ... | @@ -5,12 +5,20 @@ import android.os.Bundle | ... | @@ -5,12 +5,20 @@ import android.os.Bundle |
| 5 | import android.widget.Toast | 5 | import android.widget.Toast |
| 6 | import androidx.appcompat.app.AppCompatActivity | 6 | import androidx.appcompat.app.AppCompatActivity |
| 7 | import com.google.firebase.auth.FirebaseAuth | 7 | import com.google.firebase.auth.FirebaseAuth |
| 8 | +import com.google.firebase.database.FirebaseDatabase | ||
| 8 | import kotlinx.android.synthetic.main.activity_signup.* | 9 | import kotlinx.android.synthetic.main.activity_signup.* |
| 9 | 10 | ||
| 11 | +data class User( | ||
| 12 | + val u_token : String = "", | ||
| 13 | + val Policy : String = "" | ||
| 14 | +) | ||
| 15 | + | ||
| 16 | +var cnt = 0 | ||
| 17 | + | ||
| 10 | class SignUpActivity : AppCompatActivity() { | 18 | class SignUpActivity : AppCompatActivity() { |
| 11 | 19 | ||
| 12 | - private val RC_SIGN_IN = 9001 | ||
| 13 | private val firebaseAuth = FirebaseAuth.getInstance() | 20 | private val firebaseAuth = FirebaseAuth.getInstance() |
| 21 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
| 14 | 22 | ||
| 15 | override fun onCreate(savedInstanceState: Bundle?) { | 23 | override fun onCreate(savedInstanceState: Bundle?) { |
| 16 | super.onCreate(savedInstanceState) | 24 | super.onCreate(savedInstanceState) |
| ... | @@ -21,6 +29,11 @@ class SignUpActivity : AppCompatActivity() { | ... | @@ -21,6 +29,11 @@ class SignUpActivity : AppCompatActivity() { |
| 21 | } | 29 | } |
| 22 | } | 30 | } |
| 23 | 31 | ||
| 32 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
| 33 | + val user = User(u_token, Policy!!) | ||
| 34 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
| 35 | + } | ||
| 36 | + | ||
| 24 | private fun createEmail(){ | 37 | private fun createEmail(){ |
| 25 | firebaseAuth!!.createUserWithEmailAndPassword(edit_email_sign_up.text.toString(), edit_password_sign_up.text.toString()) | 38 | firebaseAuth!!.createUserWithEmailAndPassword(edit_email_sign_up.text.toString(), edit_password_sign_up.text.toString()) |
| 26 | .addOnCompleteListener(this) { | 39 | .addOnCompleteListener(this) { |
| ... | @@ -28,6 +41,9 @@ class SignUpActivity : AppCompatActivity() { | ... | @@ -28,6 +41,9 @@ class SignUpActivity : AppCompatActivity() { |
| 28 | // Sign in success, update UI with the signed-in user's information | 41 | // Sign in success, update UI with the signed-in user's information |
| 29 | val user = firebaseAuth?.currentUser | 42 | val user = firebaseAuth?.currentUser |
| 30 | Toast.makeText(this, "회원가입 완료!", Toast.LENGTH_SHORT).show() | 43 | Toast.makeText(this, "회원가입 완료!", Toast.LENGTH_SHORT).show() |
| 44 | + writeNewUser(user!!.uid, "따큰$cnt", "NULL$cnt") | ||
| 45 | + cnt ++ | ||
| 46 | + | ||
| 31 | if(user!=null){ | 47 | if(user!=null){ |
| 32 | var intent = Intent(this, MainActivity::class.java) | 48 | var intent = Intent(this, MainActivity::class.java) |
| 33 | startActivity(intent) | 49 | startActivity(intent) | ... | ... |
-
Please register or login to post a comment