-
Notifications
You must be signed in to change notification settings - Fork 0
[FEAT] 연락처 작업 #31
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
Merged
Merged
[FEAT] 연락처 작업 #31
Changes from 10 commits
Commits
Show all changes
178 commits
Select commit
Hold shift + click to select a range
146331b
feat: 스플래쉬 화면 구현
stopstone c3f5233
feat: 로그인 상태 확인 로직 구현
stopstone fa77703
feat: 앱 아이콘 변경
stopstone c25aa6b
refactor: img_bg.png 이미지 dpi별 drawable 분리
stopstone 1ee5d34
refactor: 스플래시 화면 ViewModel 로직 수정
stopstone 9b25c62
feat: 온보딩 버튼 컴포넌트 추가
stopstone 172e602
feat: 온보딩 페이지 인디케이터 UI 구현
stopstone be8479c
feat: 온보딩 페이지 모델 구현
stopstone 61d1fd4
feat: 온보딩 화면 구현
stopstone 22c741b
feat: 온보딩 네비게이션 설정
stopstone 717b0d4
feat: 온보딩 페이지 이미지 추가
stopstone ad971ef
feat: 온보딩 화면 이미지 추가
stopstone c4ff3c9
feat: 온보딩 UI 이미지 영역 수정
stopstone 262ded3
feat: 온보딩 페이지 백그라운드 구성
stopstone 45513a1
feat: 온보딩 배경 추가
stopstone 7768d8f
refactor: 불필요한 패딩 제거
stopstone 846bbce
feat: 온보딩 백그라운드 색상 변경
stopstone a053f43
refactor: OnboardingScreen UI 레이아웃 조정
stopstone 18af35b
refactor: AnnotatedString.Builder 확장 함수 추가
stopstone 037f6d3
feat: DataStore 분리 및 Qualifier 적용
stopstone ffc32db
feat: 온보딩 DataStore 추가
stopstone 0e3ff5e
feat: 온보딩 완료 상태 저장 로직 추가
stopstone 98a8d85
feat: 온보딩 버튼 로딩 상태 추가
stopstone fa5cadc
feat: 온보딩 화면 UI 상태 및 사이드 이펙트 처리
stopstone 25f2f20
feat: 온보딩 버튼 텍스트 stirng.xml 리소스 추가
stopstone 22ec755
feat: 온보딩 레포지토리 추가 및 ViewModel 연동
stopstone a99de45
refactor: 온보딩 페이지 데이터 - remember로 성능 최적화
stopstone 2ae7148
refactor: 온보딩 Preferences 키 상수화
stopstone 1fa484d
refactor: 불필요한 코드 제거
stopstone 508f2d5
refactor: 온보딩 페이지 데이터 모델 변경
stopstone 5845e24
refactor: 디자인 가이드에 맞게 텍스트 수정
stopstone 588a6a3
feat: Color.kt 온보딩 배경 장식 색상 추가
stopstone 7360949
refactor: 불필요한 import문 제거
stopstone 02458a5
feat: 마이페이지 구성에 필요한 리소스 추가
stopstone 6510ade
feat: LoginType enum 추가
stopstone 6f5853b
feat: 마이프로필 컴포넌트 추가
stopstone ade3245
feat: 내 정보 화면 UI 및 ViewModel 구현
stopstone c76569d
refactor: LoginType model 패키지로 이동
stopstone b1dc0b3
feat: 내 프로필 화면 navigation 구현
stopstone 6cc6646
feat: Glide Compose 라이브러리 추가
stopstone 6e5b3d4
feat: 회원 정보 API 연동
stopstone 4beb928
feat: MyProfile 에러 핸들링 추가
stopstone 1e45366
feat: 프로필 이미지 로딩 구현
stopstone 0cc546e
feat: 멤버 정보 API 연동
stopstone 7fa85de
feat: 내 정보 화면 및 API 연동
stopstone 7ce6782
feat: 마이프로필 뒤로가기 기능 구현
stopstone ee361dd
refactor: 마이프로필 정보에 매퍼 적용 및 UI 연결
stopstone edcedd1
feat: 마이프로필 로그아웃 기능 구현
stopstone 58f927e
refactor: 로딩 화면 범위 수정
stopstone 175c29b
refactor: MyProfileScreen 부분별 코드 분리
stopstone 8748685
feat: 연락처 데이터 호출 로직 작업
rhkrwngud445 309ff01
feat: 연락처 권한 추가
rhkrwngud445 f43e836
feat: 연락처 데이처 호출 로직 적용
rhkrwngud445 7c3ccdf
feat: 연락처 기념일, 라벨 등 추가정보 적용
rhkrwngud445 4392caf
feat: 연락처 화면 파일 추가
rhkrwngud445 6e6b67a
feat: 회원탈퇴 화면 이동 로직 구현
stopstone 3e6ea19
feat: 회원탈퇴 API 연동
stopstone 3dd19fe
feat: 회원탈퇴 사유 모델 추가
stopstone 6418d94
feat: 회원탈퇴 화면 TopAppBar 구현
stopstone 761beb1
feat: 회원탈퇴 화면 및 기능 구현
stopstone b71d500
feat: NearOutlinedTextField 컴포넌트 추가
stopstone d515da3
refactor: NearOutlinedTextField 키보드 상호작용 개선
stopstone 6e24a77
feat: 연락처 상단바 추가
rhkrwngud445 28bb3c8
feat: Near 검색 TextField 추가
rhkrwngud445 37e03ee
feat: 화면 검색 컴포넌트 추가
rhkrwngud445 c59da14
feat: 연락처 리스트 화면 구성
rhkrwngud445 d56a591
fix: 연락처 리스트 마진 수정
rhkrwngud445 0afb0de
feat: 연락처 로딩 및 체크박스 인터렉션 적용
rhkrwngud445 3afbe18
fix: 쌍자음도 기본 자음에 포함되도록 수정
rhkrwngud445 648c33e
feat: navigation 화면 정의
rhkrwngud445 d8ee179
feat: 검색 인터렉션 구현
rhkrwngud445 39360fe
feat: 한글, 영어, 특수문자 순으로 연락처 정렬
rhkrwngud445 12eb9e6
fix: 이름만 검색되도록 수정
rhkrwngud445 2df8fe4
feat: 우측 자음 인덱스바 추가
rhkrwngud445 7eea373
feat: permission 요청 컴포저블 추가
rhkrwngud445 567636c
feat: 텍스트필드 에러 상태 및 관련 기능 추가
stopstone 5e1e55a
feat: 회원탈퇴 화면 UI 및 로직 개선
stopstone d7f9a59
style: 회원탈퇴 화면 앱바 패딩 수정
stopstone 18c3095
refactor: 의견 입력 에러 메시지 수정
stopstone abc4337
feat: 회원탈퇴 화면 뒤로가기 추가
stopstone 5c245f4
feat: 회원탈퇴 화면에 닉네임 전달 로직 추가
stopstone 427e766
chore: 탈퇴 화면 하단 패딩 수정
stopstone 5505311
chore: NearServiceInfoRow 클릭 범위 수정 및 리플효과 제거
stopstone 47c1b92
refactor: WithdrawTopAppBar → NearCancelTopAppBar로 이름 변경 및 이동
stopstone 634872a
chore: 미사용 import 제거
stopstone 08ad462
refactor: Modifier 파라미터 적용
stopstone 66a6488
chore: build.gradle.kts 약관 URL 정보 추가
stopstone b0fe6b1
feat: 약관 및 정책 웹뷰 화면 연동
stopstone 3917c00
refactor: 약관 및 정책 목록 표시 로직 개선
stopstone ad35f20
refactor: 약관 페이지 title 형식 수정
stopstone 59d478a
feat: MY 페이지, 탈퇴하기 화면 string.xml 리소스 적용
stopstone fddabb7
remove: 회원 탈퇴 사유 모델 제거
stopstone f2ab07f
refactor: LoginType의 프로퍼티명 수정
stopstone 32c70d8
Merge branch 'dev' into feat/splash-auto-login
stopstone 83e9aba
feat: 스플래시 화면 관련 파일 삭제
stopstone 90e1696
feat: 스플래시 화면 라이브러리 추가
stopstone d291865
feat: themes.xml에서 스플래시 화면 구현
stopstone 8fb3bfc
feat: 스플래시 로고 이미지 추가
stopstone a669663
feat: 스플래시 화면 API 적용 및 로그인 상태에 따른 화면 분기 처리
stopstone fb48a73
chore: 내 정보 화면 배경색 추가
stopstone 6165bff
Merge pull request #26 from near-Contact-Reminder/feat/splash-auto-login
stopstone 2fac627
feat: 온보딩 버튼 컴포넌트 추가
stopstone ea7a2e1
feat: 온보딩 페이지 인디케이터 UI 구현
stopstone 0c22958
feat: 온보딩 페이지 모델 구현
stopstone c536bf4
feat: 온보딩 화면 구현
stopstone dcfd9ca
feat: 온보딩 네비게이션 설정
stopstone 3396b74
feat: 온보딩 페이지 이미지 추가
stopstone 48834cf
feat: 온보딩 화면 이미지 추가
stopstone d3c08c5
feat: 온보딩 UI 이미지 영역 수정
stopstone d58d85d
feat: 온보딩 페이지 백그라운드 구성
stopstone 9d1453b
feat: 온보딩 배경 추가
stopstone 7b59095
refactor: 불필요한 패딩 제거
stopstone fc190f0
feat: 온보딩 백그라운드 색상 변경
stopstone 1577a75
refactor: OnboardingScreen UI 레이아웃 조정
stopstone 1596dab
refactor: AnnotatedString.Builder 확장 함수 추가
stopstone 2834cc6
feat: DataStore 분리 및 Qualifier 적용
stopstone b749fcb
feat: 온보딩 DataStore 추가
stopstone c19802b
feat: 온보딩 완료 상태 저장 로직 추가
stopstone e798851
feat: 온보딩 버튼 로딩 상태 추가
stopstone 5cf9a2f
feat: 온보딩 화면 UI 상태 및 사이드 이펙트 처리
stopstone dc46da1
feat: 온보딩 버튼 텍스트 stirng.xml 리소스 추가
stopstone 66ac5a1
feat: 온보딩 레포지토리 추가 및 ViewModel 연동
stopstone 93ab1c3
refactor: 온보딩 페이지 데이터 - remember로 성능 최적화
stopstone b6577d0
refactor: 온보딩 Preferences 키 상수화
stopstone f30d851
refactor: 불필요한 코드 제거
stopstone 4d59fef
refactor: 온보딩 페이지 데이터 모델 변경
stopstone d8a4c99
refactor: 디자인 가이드에 맞게 텍스트 수정
stopstone cd47e30
feat: Color.kt 온보딩 배경 장식 색상 추가
stopstone b29e18c
refactor: 불필요한 import문 제거
stopstone 38045f7
feat: 앱 시작 시 온보딩 및 로그인 상태에 따른 화면 분기 처리
stopstone 25b7bd9
Merge remote-tracking branch 'origin/feat/onboarding-pages' into feat…
stopstone a35fba3
refactor: 온보딩 관련 중복 문자열 제거
stopstone 3d9cb34
Merge branch 'dev' into feat/my-profile
stopstone 7be0ca9
refactor: 인증 헤더 삭제
stopstone 3c9719e
refactor: MyProfileUiState에서 사용하지 않는 error 필드 제거
stopstone a89f88e
refactor: RouteWebView에서 toRoute 사용하도록 수정
stopstone 00bb29d
feat: WebView 뒤로가기 기능 추가
stopstone c192e13
refactor: Glide의 contentScale 옵션 제거
stopstone c186b40
fix: `NearOutlinedTextField` 에러 상태 반영 오류 수정
stopstone 2b1acb2
refactor: 회원탈퇴 화면 에러 처리 방식 변경
stopstone ce51d82
chore: ci 워크플로우에 개인정보처리방침 URL 추가
stopstone c389154
Merge pull request #29 from near-Contact-Reminder/feat/onboarding-pages
stopstone 2b4c1d0
refactor: Glide에서 Coil로 이미지 로딩 라이브러리 변경
stopstone 4522d0f
refactor: API 응답 타입 수정
stopstone fc13f52
feat: flow를 간소화 한 apiCallFlow 추가
stopstone 5ecc798
refactor: API 호출 Flow 적용
stopstone b652c3e
refactor: 회원 탈퇴 API 에러 핸들링 수정
stopstone 9e6aad2
refactor: Member 관련 데이터 모델 네이밍 및 매퍼 구조 변경
stopstone dc3acc4
refactor: `WithdrawRequest` 모델의 위치 변경 및 관련 로직 수정
stopstone 96dec0a
fix: 중복된 NavGraph 정의 제거
stopstone 158ecc5
refactor: `MyProfileInfo`를 `MyProfileInfoUIModel`로 이름 변경
stopstone 2b53a2c
refactor: 불필요한 import 제거
stopstone 0494397
Merge branch 'feat/my-profile' into dev
stopstone 3522577
refactor: `NearNavHost` 시작 화면 `startDestination`으로 통합
stopstone d0ae5ce
feat: 로딩 인디케이터 색상 변경
rhkrwngud445 b70979a
Merge pull request #33 from near-Contact-Reminder/feat/my-profile
stopstone cfbbc4b
fix: 인덱스바 상단 마진 축소
rhkrwngud445 ee6145b
feat: 연락처 데이터 호출 로직 작업
rhkrwngud445 a47d238
feat: 연락처 권한 추가
rhkrwngud445 7b1828d
feat: 연락처 데이처 호출 로직 적용
rhkrwngud445 cd854b6
feat: 연락처 기념일, 라벨 등 추가정보 적용
rhkrwngud445 81da523
feat: 연락처 화면 파일 추가
rhkrwngud445 0da3c58
feat: 연락처 상단바 추가
rhkrwngud445 aefff08
feat: Near 검색 TextField 추가
rhkrwngud445 d6b4f59
feat: 화면 검색 컴포넌트 추가
rhkrwngud445 9d21859
feat: 연락처 리스트 화면 구성
rhkrwngud445 c582edd
fix: 연락처 리스트 마진 수정
rhkrwngud445 0acc37a
feat: 연락처 로딩 및 체크박스 인터렉션 적용
rhkrwngud445 96e03fc
fix: 쌍자음도 기본 자음에 포함되도록 수정
rhkrwngud445 db84722
feat: navigation 화면 정의
rhkrwngud445 9dd5e70
feat: 검색 인터렉션 구현
rhkrwngud445 fd603ed
feat: 한글, 영어, 특수문자 순으로 연락처 정렬
rhkrwngud445 b3eef63
fix: 이름만 검색되도록 수정
rhkrwngud445 c563b9d
feat: 우측 자음 인덱스바 추가
rhkrwngud445 7bea36d
feat: permission 요청 컴포저블 추가
rhkrwngud445 4d0853e
feat: 로딩 인디케이터 색상 변경
rhkrwngud445 4c95de4
fix: 인덱스바 상단 마진 축소
rhkrwngud445 0550298
Merge remote-tracking branch 'origin/feat/#27-contact_picker_data_lay…
rhkrwngud445 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
14 changes: 14 additions & 0 deletions
14
Near/app/src/main/java/com/alarmy/near/data/mapper/ContactMapper.kt
This file contains hidden or 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,14 @@ | ||
| package com.alarmy.near.data.mapper | ||
|
|
||
| import com.alarmy.near.local.entity.ContactEntity | ||
| import com.alarmy.near.model.contact.Contact | ||
|
|
||
| fun ContactEntity.toModel(): Contact = | ||
| Contact( | ||
| id = id, | ||
| name = name, | ||
| phones = phones, | ||
| photoUri = photoUri, | ||
| birthDay = birthDay, | ||
| memo = memo, | ||
| ) |
7 changes: 7 additions & 0 deletions
7
Near/app/src/main/java/com/alarmy/near/data/repository/ContactRepository.kt
This file contains hidden or 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,7 @@ | ||
| package com.alarmy.near.data.repository | ||
|
|
||
| import com.alarmy.near.model.contact.Contact | ||
|
|
||
| interface ContactRepository { | ||
| fun fetchAllContacts(): List<Contact> | ||
| } |
14 changes: 14 additions & 0 deletions
14
Near/app/src/main/java/com/alarmy/near/data/repository/DefaultContactRepository.kt
This file contains hidden or 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,14 @@ | ||
| package com.alarmy.near.data.repository | ||
|
|
||
| import com.alarmy.near.data.mapper.toModel | ||
| import com.alarmy.near.local.contact.ContactLocalDataSource | ||
| import com.alarmy.near.model.contact.Contact | ||
| import javax.inject.Inject | ||
|
|
||
| class DefaultContactRepository | ||
| @Inject | ||
| constructor( | ||
| private val contactDataSource: ContactLocalDataSource, | ||
| ) : ContactRepository { | ||
| override fun fetchAllContacts(): List<Contact> = contactDataSource.getAllContacts().map { it.toModel() } | ||
| } |
198 changes: 198 additions & 0 deletions
198
Near/app/src/main/java/com/alarmy/near/local/contact/ContactLocalDataSource.kt
This file contains hidden or 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,198 @@ | ||
| package com.alarmy.near.local.contact | ||
|
|
||
| import android.content.ContentResolver | ||
| import android.provider.ContactsContract | ||
| import com.alarmy.near.local.entity.ContactEntity | ||
| import com.alarmy.near.local.entity.ImportantDate | ||
| import javax.inject.Inject | ||
|
|
||
| class ContactLocalDataSource | ||
| @Inject | ||
| constructor( | ||
| private val contentResolver: ContentResolver, | ||
| ) { | ||
| fun getAllContacts(): List<ContactEntity> { | ||
| val contacts = mutableListOf<ContactEntity>() | ||
|
|
||
| val cursor = | ||
| contentResolver.query( | ||
| ContactsContract.Contacts.CONTENT_URI, | ||
| null, | ||
| null, | ||
| null, | ||
| "${ContactsContract.Contacts.DISPLAY_NAME} ASC", | ||
| ) | ||
|
|
||
| cursor?.use { | ||
| val idIndex = it.getColumnIndex(ContactsContract.Contacts._ID) | ||
| val nameIndex = it.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME) | ||
| val hasPhoneIndex = it.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER) | ||
| val photoIndex = it.getColumnIndex(ContactsContract.Contacts.PHOTO_URI) | ||
|
|
||
| while (it.moveToNext()) { | ||
| val id = it.getLong(idIndex) | ||
| val name = it.getString(nameIndex) ?: "" | ||
| val hasPhone = it.getInt(hasPhoneIndex) > 0 | ||
| val photoUri = it.getString(photoIndex) | ||
|
|
||
| // 전화번호 | ||
| val phones = mutableListOf<String>() | ||
| if (hasPhone) { | ||
| val phoneCursor = | ||
| contentResolver.query( | ||
| ContactsContract.CommonDataKinds.Phone.CONTENT_URI, | ||
| null, | ||
| "${ContactsContract.CommonDataKinds.Phone.CONTACT_ID} = ?", | ||
| arrayOf(id.toString()), | ||
| null, | ||
| ) | ||
| phoneCursor?.use { pc -> | ||
| val phoneIndex = | ||
| pc.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER) | ||
| while (pc.moveToNext()) { | ||
| phones.add(pc.getString(phoneIndex)) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // 메모 | ||
| var memo: String? = null | ||
| val noteCursor = | ||
| contentResolver.query( | ||
| ContactsContract.Data.CONTENT_URI, | ||
| arrayOf(ContactsContract.CommonDataKinds.Note.NOTE), | ||
| "${ContactsContract.Data.CONTACT_ID} = ? AND ${ContactsContract.Data.MIMETYPE} = ?", | ||
| arrayOf(id.toString(), ContactsContract.CommonDataKinds.Note.CONTENT_ITEM_TYPE), | ||
| null, | ||
| ) | ||
| noteCursor?.use { nc -> | ||
| if (nc.moveToFirst()) { | ||
| memo = nc.getString(0) | ||
| } | ||
| } | ||
|
|
||
| // 생일 | ||
| var birthDay: String? = null | ||
| val birthdayCursor = | ||
| contentResolver.query( | ||
| ContactsContract.Data.CONTENT_URI, | ||
| arrayOf(ContactsContract.CommonDataKinds.Event.START_DATE), | ||
| "${ContactsContract.Data.CONTACT_ID} = ? AND ${ContactsContract.Data.MIMETYPE} = ? AND ${ContactsContract.CommonDataKinds.Event.TYPE} = ?", | ||
| arrayOf( | ||
| id.toString(), | ||
| ContactsContract.CommonDataKinds.Event.CONTENT_ITEM_TYPE, | ||
| ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY | ||
| .toString(), | ||
| ), | ||
| null, | ||
| ) | ||
| birthdayCursor?.use { bc -> | ||
| if (bc.moveToFirst()) { | ||
| birthDay = bc.getString(0) | ||
| } | ||
| } | ||
|
|
||
| // 그룹 | ||
| val groups = mutableListOf<String>() | ||
| val groupCursor = | ||
| contentResolver.query( | ||
| ContactsContract.Data.CONTENT_URI, | ||
| arrayOf(ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID), | ||
| "${ContactsContract.Data.CONTACT_ID} = ? AND ${ContactsContract.Data.MIMETYPE} = ?", | ||
| arrayOf( | ||
| id.toString(), | ||
| ContactsContract.CommonDataKinds.GroupMembership.CONTENT_ITEM_TYPE, | ||
| ), | ||
| null, | ||
| ) | ||
| groupCursor?.use { gc -> | ||
| val groupIdIndex = | ||
| gc.getColumnIndex( | ||
| ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID, | ||
| ) | ||
| while (gc.moveToNext()) { | ||
| val groupId = gc.getLong(groupIdIndex) | ||
| val groupNameCursor = | ||
| contentResolver.query( | ||
| ContactsContract.Groups.CONTENT_URI, | ||
| arrayOf(ContactsContract.Groups.TITLE), | ||
| "${ContactsContract.Groups._ID} = ?", | ||
| arrayOf(groupId.toString()), | ||
| null, | ||
| ) | ||
| groupNameCursor?.use { gnc -> | ||
| if (gnc.moveToFirst()) { | ||
| groups.add(gnc.getString(0)) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // 중요한 날 (기념일) | ||
| val importantDates = mutableListOf<ImportantDate>() | ||
| val eventCursor = | ||
| contentResolver.query( | ||
| ContactsContract.Data.CONTENT_URI, | ||
| arrayOf( | ||
| ContactsContract.CommonDataKinds.Event.START_DATE, | ||
| ContactsContract.CommonDataKinds.Event.TYPE, | ||
| ContactsContract.CommonDataKinds.Event.LABEL, | ||
| ), | ||
| "${ContactsContract.Data.CONTACT_ID} = ? AND ${ContactsContract.Data.MIMETYPE} = ?", | ||
| arrayOf( | ||
| id.toString(), | ||
| ContactsContract.CommonDataKinds.Event.CONTENT_ITEM_TYPE, | ||
| ), | ||
| null, | ||
| ) | ||
| eventCursor?.use { ec -> | ||
| val dateIndex = | ||
| ec.getColumnIndex(ContactsContract.CommonDataKinds.Event.START_DATE) | ||
| val typeIndex = | ||
| ec.getColumnIndex(ContactsContract.CommonDataKinds.Event.TYPE) | ||
| val labelIndex = | ||
| ec.getColumnIndex(ContactsContract.CommonDataKinds.Event.LABEL) | ||
|
|
||
| while (ec.moveToNext()) { | ||
| val date = ec.getString(dateIndex) | ||
| val type = ec.getInt(typeIndex) | ||
| val customLabel = ec.getString(labelIndex) | ||
|
|
||
| val label = | ||
| when (type) { | ||
| ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY -> { | ||
| continue // 위에서 생일은 포함했으므로 스킵 | ||
| } | ||
|
|
||
| ContactsContract.CommonDataKinds.Event.TYPE_ANNIVERSARY -> "기념일" | ||
| ContactsContract.CommonDataKinds.Event.TYPE_OTHER -> | ||
| customLabel | ||
| ?: "기타" | ||
|
|
||
| else -> "알 수 없음" | ||
| } | ||
|
|
||
| if (date != null) { | ||
| importantDates.add(ImportantDate(label, date)) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| contacts.add( | ||
| ContactEntity( | ||
| id = id, | ||
| name = name, | ||
| phones = phones, | ||
| photoUri = photoUri, | ||
| birthDay = birthDay, | ||
| memo = memo, | ||
| groups = groups, | ||
| importantDates = importantDates, | ||
| ), | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| return contacts | ||
| } | ||
| } | ||
20 changes: 20 additions & 0 deletions
20
Near/app/src/main/java/com/alarmy/near/local/contact/di/ContactDataSourceModule.kt
This file contains hidden or 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,20 @@ | ||
| package com.alarmy.near.local.contact.di | ||
|
|
||
| import android.content.ContentResolver | ||
| import android.content.Context | ||
| import dagger.Module | ||
| import dagger.Provides | ||
| import dagger.hilt.InstallIn | ||
| import dagger.hilt.android.qualifiers.ApplicationContext | ||
| import dagger.hilt.components.SingletonComponent | ||
| import javax.inject.Singleton | ||
|
|
||
| @Module | ||
| @InstallIn(SingletonComponent::class) | ||
| object ContactDataSourceModule { | ||
| @Provides | ||
| @Singleton | ||
| fun provideContentResolver( | ||
| @ApplicationContext context: Context, | ||
| ): ContentResolver = context.contentResolver | ||
| } |
17 changes: 17 additions & 0 deletions
17
Near/app/src/main/java/com/alarmy/near/local/entity/ContactEntity.kt
This file contains hidden or 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,17 @@ | ||
| package com.alarmy.near.local.entity | ||
|
|
||
| data class ContactEntity( | ||
| val id: Long, | ||
| val name: String, | ||
| val phones: List<String>, | ||
| val photoUri: String?, // 사진 | ||
| val birthDay: String?, // 생일 | ||
| val memo: String?, // 메모 | ||
| val groups: List<String>, // 그룹 (ex. 가족, 친구, 회사) | ||
| val importantDates: List<ImportantDate>, | ||
| ) | ||
|
|
||
| data class ImportantDate( | ||
| val label: String, | ||
| val date: String, | ||
| ) |
10 changes: 10 additions & 0 deletions
10
Near/app/src/main/java/com/alarmy/near/model/contact/Contact.kt
This file contains hidden or 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,10 @@ | ||
| package com.alarmy.near.model.contact | ||
|
|
||
| data class Contact( | ||
| val id: Long, | ||
| val name: String, | ||
| val phones: List<String>, | ||
| val photoUri: String?, // 사진 | ||
| val birthDay: String?, // 생일 | ||
| val memo: String?, // 메모 | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getAllContacts함수는 연락처 목록을 가져오기 위해 메인 루프 안에서 각 연락처에 대해 여러 번의 추가 쿼리(전화번호, 메모, 생일, 그룹 등)를 실행하고 있습니다. 이는 "N+1 쿼리 문제"를 유발하여 연락처가 많은 사용자의 경우 심각한 성능 저하를 초래할 수 있습니다. 특히 그룹 이름을 가져오는 부분은 루프 안에서 또 다른 쿼리를 실행하여 성능을 더욱 악화시킵니다.이 문제를 해결하려면,
ContactsContract.Data.CONTENT_URI에 한 번의 쿼리를 실행하여 필요한 모든 데이터를 가져온 후, 애플리케이션 코드 내에서CONTACT_ID를 기준으로 데이터를 그룹화하는 방식으로 리팩토링하는 것을 강력히 권장합니다.