-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from INFRAcp/seungmin
[feat] #119 Splash & My Project Apply List API Connection
- Loading branch information
Showing
16 changed files
with
387 additions
and
205 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
app/src/main/java/com/example/infraandroid/category/model/ProjectService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...main/java/com/example/infraandroid/myinfo/myideamanage/model/ResponseModifyProjectData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.example.infraandroid.myinfo.myideamanage.model | ||
|
||
data class ResponseModifyProjectData( | ||
val code: Int, | ||
val isSuccess: Boolean, | ||
val message: String, | ||
val result: Result | ||
){ | ||
data class Result( | ||
val pj_string: String | ||
) | ||
} |
16 changes: 16 additions & 0 deletions
16
...n/java/com/example/infraandroid/myinfo/myideamanage/model/ResponseViewProjectApplyData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.example.infraandroid.myinfo.myideamanage.model | ||
|
||
data class ResponseViewProjectApplyData( | ||
val code: Int, | ||
val isSuccess: Boolean, | ||
val message: String, | ||
val result: ArrayList<Result> | ||
){ | ||
data class Result( | ||
val pj_inviteStatus: String, | ||
val user_id: String, | ||
val user_nickname: String, | ||
val user_prphoto: String, | ||
val user_grade: String | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 11 additions & 1 deletion
12
app/src/main/java/com/example/infraandroid/myinfo/scrap/view/ScrapFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
package com.example.infraandroid.myinfo.scrap.view | ||
|
||
import android.util.Log | ||
import android.widget.Toast | ||
import androidx.navigation.fragment.findNavController | ||
import com.example.infraandroid.R | ||
import com.example.infraandroid.databinding.FragmentScrapBinding | ||
import com.example.infraandroid.id.model.RequestLoginData | ||
import com.example.infraandroid.id.model.ResponseLoginData | ||
import com.example.infraandroid.util.BaseFragment | ||
import com.example.infraandroid.util.InfraApplication | ||
import com.example.infraandroid.util.ServiceCreator | ||
import retrofit2.Call | ||
import retrofit2.Callback | ||
import retrofit2.Response | ||
|
||
class ScrapFragment : BaseFragment<FragmentScrapBinding>(R.layout.fragment_scrap){ | ||
override fun FragmentScrapBinding.onCreateView(){ | ||
|
||
} | ||
|
||
override fun FragmentScrapBinding.onViewCreated(){ | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
app/src/main/java/com/example/infraandroid/util/SplashFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.example.infraandroid.util | ||
|
||
import android.util.Log | ||
import android.widget.Toast | ||
import androidx.fragment.app.Fragment | ||
import androidx.navigation.fragment.findNavController | ||
import com.example.infraandroid.R | ||
import com.example.infraandroid.databinding.FragmentSplashBinding | ||
import com.example.infraandroid.id.model.RequestLoginData | ||
import com.example.infraandroid.id.model.ResponseLoginData | ||
import retrofit2.Call | ||
import retrofit2.Callback | ||
import retrofit2.Response | ||
|
||
class SplashFragment : BaseFragment<FragmentSplashBinding>(R.layout.fragment_splash){ | ||
override fun FragmentSplashBinding.onCreateView() { | ||
|
||
} | ||
|
||
override fun FragmentSplashBinding.onViewCreated(){ | ||
if(InfraApplication.prefs.getUserId().isNotEmpty() | ||
and InfraApplication.prefs.getUserPW().isNotEmpty()){ | ||
|
||
val requestLoginData = RequestLoginData( | ||
userId = InfraApplication.prefs.getUserId(), | ||
userPw = InfraApplication.prefs.getUserPW(), | ||
) | ||
|
||
val call: Call<ResponseLoginData> = ServiceCreator.loginService | ||
.postLogin(requestLoginData) | ||
|
||
call.enqueue(object : Callback<ResponseLoginData> { | ||
override fun onResponse( | ||
call: Call<ResponseLoginData>, | ||
response: Response<ResponseLoginData> | ||
) { | ||
if(response.isSuccessful){ | ||
when(response.body()?.code){ | ||
1000 -> { | ||
InfraApplication.prefs.setString("jwt", response.body()?.result?.jwt.toString()) | ||
InfraApplication.prefs.setString("refreshToken", response.body()?.result?.refreshToken.toString()) | ||
InfraApplication.prefs.setString("userId", response.body()?.result?.userId.toString()) | ||
InfraApplication.prefs.setString("userNickName", response.body()?.result?.userNickName.toString()) | ||
Toast.makeText(requireActivity(),"요청에 성공하셨습니다.", Toast.LENGTH_SHORT).show() | ||
// 로그인 버튼을 누르면 home_fragment로 이동 | ||
findNavController().navigate(R.id.action_splashFragment_to_home_fragment) | ||
} | ||
2001 -> { | ||
Toast.makeText(requireActivity(),"id가 비어있습니다.", Toast.LENGTH_SHORT).show()} | ||
3014 -> { | ||
Toast.makeText(requireActivity(),"없는 아이디거나 비밀번호가 틀렸습니다.", Toast.LENGTH_SHORT).show()} | ||
4000 -> { | ||
Toast.makeText(requireActivity(),"데이터베이스 연결에 실패하였습니다.", Toast.LENGTH_SHORT).show()} | ||
} | ||
} | ||
} | ||
|
||
override fun onFailure(call: Call<ResponseLoginData>, t: Throwable) { | ||
Log.e("login_server_test", "fail") | ||
} | ||
}) | ||
} | ||
|
||
else{ | ||
findNavController().navigate(R.id.action_splashFragment_to_login_fragment) | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.