Toggle navigation
Toggle navigation
This project
Loading...
Sign in
장연우
/
WELLO
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
신기성
2019-10-30 18:49:56 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
81735308827ce1a1da811a73bc266fabaf1869f5
81735308
1 parent
5b30a348
add pushing func
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
2 deletions
vip/app/build.gradle
vip/app/src/main/java/com/example/vip/SignUpActivity.kt
vip/app/src/main/res/values/strings.xml
vip/app/build.gradle
View file @
8173530
...
...
@@ -36,6 +36,8 @@ dependencies {
implementation
'com.android.support:appcompat-v7:27.1.1'
implementation
'com.android.support:design:27.1.1'
implementation
'com.google.firebase:firebase-analytics:17.2.0'
implementation
'com.google.firebase:firebase-messaging:20.0.0'
implementation
'com.google.firebase:firebase-database:17.0.0'
testImplementation
'junit:junit:4.12'
...
...
vip/app/src/main/java/com/example/vip/SignUpActivity.kt
View file @
8173530
...
...
@@ -7,6 +7,10 @@ import androidx.appcompat.app.AppCompatActivity
import
com.google.firebase.auth.FirebaseAuth
import
com.google.firebase.database.FirebaseDatabase
import
kotlinx.android.synthetic.main.activity_signup.*
import
android.util.Log
import
com.google.android.gms.tasks.OnCompleteListener
import
com.google.firebase.iid.FirebaseInstanceId
data class
User
(
val
u_token
:
String
=
""
,
...
...
@@ -14,7 +18,7 @@ data class User(
)
var
cnt
=
0
var
tkn
=
""
class
SignUpActivity
:
AppCompatActivity
()
{
private
val
firebaseAuth
=
FirebaseAuth
.
getInstance
()
...
...
@@ -25,9 +29,41 @@ class SignUpActivity : AppCompatActivity() {
setContentView
(
R
.
layout
.
activity_signup
)
signupBtn
.
setOnClickListener
{
sendToken
()
createEmail
()
}
//pushing code start
intent
.
extras
?.
let
{
for
(
key
in
it
.
keySet
())
{
val
value
=
intent
.
extras
?.
get
(
key
)
Log
.
d
(
TAG
,
"Key: $key Value: $value"
)
}
}
//pushing code end
}
//pushing code start 2
private
fun
sendToken
(){
FirebaseInstanceId
.
getInstance
().
instanceId
.
addOnCompleteListener
(
OnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
Log
.
w
(
TAG
,
"getInstanceId failed"
,
task
.
exception
)
return
@OnCompleteListener
}
// Get new Instance ID token
tkn
=
task
.
result
!!
.
token
// Log and toast
val
msg
=
getString
(
R
.
string
.
msg_token_fmt
,
tkn
)
Log
.
d
(
TAG
,
msg
)
Toast
.
makeText
(
baseContext
,
msg
,
Toast
.
LENGTH_SHORT
).
show
()
})
}
//pushing code end 2
private
fun
writeNewUser
(
u_id
:
String
,
u_token
:
String
,
Policy
:
String
?)
{
val
user
=
User
(
u_token
,
Policy
!!
)
...
...
@@ -41,7 +77,7 @@ class SignUpActivity : AppCompatActivity() {
// Sign in success, update UI with the signed-in user's information
val
user
=
firebaseAuth
?.
currentUser
Toast
.
makeText
(
this
,
"회원가입 완료!"
,
Toast
.
LENGTH_SHORT
).
show
()
writeNewUser
(
user
!!
.
uid
,
"
따큰$cnt
"
,
"NULL$cnt"
)
writeNewUser
(
user
!!
.
uid
,
"
$tkn
"
,
"NULL$cnt"
)
cnt
++
if
(
user
!=
null
){
...
...
@@ -54,4 +90,11 @@ class SignUpActivity : AppCompatActivity() {
}
}
}
//pushing code start 3
companion
object
{
private
const
val
TAG
=
"SignUpActivity"
}
//pushing code end 3
}
...
...
vip/app/src/main/res/values/strings.xml
View file @
8173530
...
...
@@ -17,4 +17,7 @@
<string
name=
"timer"
>
찜 목록
</string>
<string
name=
"stopwatch"
>
내 정보
</string>
<string
name=
"msg_token_fmt"
translatable=
"false"
>
InstanceID Token: %s
</string>
</resources>
...
...
Please
register
or
login
to post a comment