Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

현재 선택된 학교 가져오는 기능 만들기 #26

Open
BoxResin opened this issue Dec 23, 2018 · 7 comments
Open

현재 선택된 학교 가져오는 기능 만들기 #26

BoxResin opened this issue Dec 23, 2018 · 7 comments
Assignees
Labels
blocked 다른 이슈로 인해 작업 중단됨 system 내부적인
Projects

Comments

@BoxResin
Copy link
Owner

BoxResin commented Dec 23, 2018

이름 후보

CurrentSchool

필요 기능

  • 현재 선택된 학교 가져오기
  • 현재 선택된 학교의 변화 관찰하기

기타 생각

구현하는데 RecentSchools 를 재사용하면 좋을 듯 (사용자가 최근 검색한 학교를 삭제할 수도 있으므로 RecentSchools 를 재사용하는 건 위험)

@BoxResin BoxResin added the system 내부적인 label Dec 23, 2018
@BoxResin BoxResin self-assigned this Dec 23, 2018
@BoxResin BoxResin added this to To do in v3.0.0 via automation Dec 23, 2018
@BoxResin
Copy link
Owner Author

BoxResin commented Dec 23, 2018

  • 예상 인터페이스
interface CurrentSchool : Observable<School>

Observable 로는 null 을 보낼 수 없으니 대안 필요

@BoxResin
Copy link
Owner Author

School.Empty 처럼 빈 상태를 갖는 오브젝트 만들기

@BoxResin BoxResin moved this from To do to In progress in v3.0.0 Dec 23, 2018
@BoxResin
Copy link
Owner Author

Observable<Optional<School>> 처럼 쓰면 nullable 타입을 표현할 수 있음

@BoxResin
Copy link
Owner Author

Channel 을 사용했을 때 바뀌는 인터페이스 (예상):

interface CurrentSchool {
    fun observe(): ReceiveChannel<School?>
}

사용 예 1:

launch {
    CurrentSchool.observe().forEach { school: School? ->
        // 코드
    }
}

사용 예 2:

launch {
    CurrentSchool.observe()
        .filter { it.course != School.Course.INFANT } // 유치원이 아닌 것만 걸러내기
        .forEach { school: School? ->
            // 코드
        }
}

코루틴이 완료되거나 취소되었을 때 ReceiveChannelclose 하는 유틸이 필요함.

@BoxResin
Copy link
Owner Author

RxJava 기준, RecentSchoolsCurrentSchool 의 관계를 표현하는 코드

val CurrentSchool: Observable<School> =
    RecentSchools.map { schools: List<School> -> schools.firstOrNull() }

@BoxResin
Copy link
Owner Author

BoxResin commented Jan 5, 2019

#34 이슈를 먼저 해결해야 함

@BoxResin BoxResin added the blocked 다른 이슈로 인해 작업 중단됨 label Jan 5, 2019
@BoxResin
Copy link
Owner Author

BoxResin commented Jan 5, 2019

현재 선택된 학교를 프리퍼런스에 JSON 형태로 저장하기

@BoxResin BoxResin moved this from In progress to To do in v3.0.0 Jan 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked 다른 이슈로 인해 작업 중단됨 system 내부적인
Projects
v3.0.0
  
To do
Development

No branches or pull requests

1 participant