Toggle navigation
Toggle navigation
This project
Loading...
Sign in
cse437_e
/
smartdoorlock-frontend
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
오윤석
2020-11-09 23:37:46 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fbd670219725a67726f02dd2eb55569ffa8975ff
fbd67021
1 parent
3f2f1873
연결이 안 되는 것과 입력이 잘못된 것 구분
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
app/src/main/java/com/sunnni/smartdoorlock/api/Api.java
app/src/main/java/com/sunnni/smartdoorlock/ui/SplashActivity.java
app/src/main/java/com/sunnni/smartdoorlock/api/Api.java
View file @
fbd6702
...
...
@@ -103,8 +103,7 @@ public class Api {
static
public
void
auth
(
String
doorId
,
final
Callback
callback
)
{
if
(
"123123123"
.
equals
(
doorId
))
{
// 테스트를 위한 super pass
callback
.
callbackMethod
(
true
);
Api
.
accessToken
=
"superpass"
;
callback
.
callbackMethod
(
new
Auth
(
true
,
"superpass"
));
return
;
}
...
...
@@ -118,10 +117,12 @@ public class Api {
JsonObject
resp
=
(
JsonObject
)
apiResult
.
getData
();
if
(
resp
.
get
(
"is_available"
).
getAsBoolean
())
{
callback
.
callbackMethod
(
new
Auth
(
true
,
resp
.
get
(
"access_token"
).
getAsString
()));
return
;
}
else
{
callback
.
callbackMethod
(
new
Auth
(
false
));
}
}
else
{
callback
.
callbackMethod
(
null
);
}
callback
.
callbackMethod
(
new
Auth
(
false
));
}
});
}
...
...
app/src/main/java/com/sunnni/smartdoorlock/ui/SplashActivity.java
View file @
fbd6702
...
...
@@ -81,6 +81,11 @@ public class SplashActivity extends AppCompatActivity {
@Override
public
void
callbackMethod
(
Object
obj
)
{
Auth
auth
=
(
Auth
)
obj
;
if
(
auth
==
null
)
{
Toast
.
makeText
(
getApplicationContext
(),
"연결 상태가 불안정합니다."
,
Toast
.
LENGTH_SHORT
).
show
();
return
;
}
if
(
auth
.
getIsAvailable
())
{
SharedPreferences
pref
=
getSharedPreferences
(
"gateway"
,
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
pref
.
edit
();
...
...
Please
register
or
login
to post a comment