Showing
2 changed files
with
18 additions
and
2 deletions
... | @@ -53,7 +53,7 @@ class SearchActivity : AppCompatActivity() { | ... | @@ -53,7 +53,7 @@ class SearchActivity : AppCompatActivity() { |
53 | // } | 53 | // } |
54 | // | 54 | // |
55 | // } | 55 | // } |
56 | - for(memoSnapshot in dataSnapshot.children){ | 56 | + for (memoSnapshot in dataSnapshot.children){ |
57 | val memo = memoSnapshot.getValue(MemoItem::class.java) | 57 | val memo = memoSnapshot.getValue(MemoItem::class.java) |
58 | Toast.makeText(this@SearchActivity, memo!!.Policy, Toast.LENGTH_SHORT).show() | 58 | Toast.makeText(this@SearchActivity, memo!!.Policy, Toast.LENGTH_SHORT).show() |
59 | } | 59 | } | ... | ... |
... | @@ -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