# iOS 이벤트 수집
# 버그
delete 업넥스트 비었을때 ispresented = false 주기
# Event API 건의
- 저장
```javascript
{
event: 'save',
userId: string,
page: String,
componentId: String,
data: {
type: String,
id: int
},
timestamp: String
}
```
- 공유
```javascript
{
event: 'share',
userId: string,
page: String,
componentId: String,
data: {
type: String,
id: int
},
timestamp: String
}
```
- 재생 모드 이벤트
```javascript
{
event: 'repeatOff'/'repeatTrack'/'repeatList'/'shuffle'/'shuffleOff',
userId: string,
componentId: String,
timestamp: String
}
```
- 앱 생명 주기 이벤트
```javascript
{
event: 'active'/ 'background' / 'terminate',
userId: string,
componentId: String,
timestamp: String
}
```
- 결제 이벤트
```javascript
{
event: 'membership',
userId: string,
componentId: String,
timestamp: String
}
```
## 화면 전환
#### TabView
- 바인딩 된 tabItemSelection으로 감지
- didSet 내부에서 처리하면 될 듯
#### NavigationLink
- PUSH의 경우 onAppear 에서 현재 나타난 페이지만
- linked list로 할 것인가, 아니면 그냥 onAppear 에서 불리는 형태로 할 것인가
### Search
### Transition: onAppear & onDisappear
* linked-list로 구현하려고 했으나 navigation으로 push 될 때 이전 화면에 disappear 가 계속 불리는 바람에 제대로 노드가 구현이 안됨
* 개선 여지가 있는가?
* 시간이 있다면...?
* 화면전환을 탭뷰 간 전환 / 각 탭에서 화면 전환 경우를 구분
# 구현된 부분
#### 화면 전환
- appear
- disAppear
- tabViewTransition
- : 탭에서 화면 전환하는 경우
```json=
{
event: 'appear' / 'disAppear' / 'tabTransition'
userId: number,
page: String,
componentId: String, // 어느 섹션에서 눌렸는지 정도만?****
timestamp: String
}
```
#### 현재재생목록에 추가
```javascript
{
event: 'addToUpnext',
userId: string,
componentId: String,
trackId: [int],
timestamp: String
}
```
#### 재생 / 정지 ▶️ ⏸
-> 클릭 이벤트를 없애면 컴포넌트 ID 추가?
```javascript
{
event: 'play'
userId: string,
componentId: string,
trackId: Int
}
```
current, total이 필요한가?
필요없으면 재생이벤트 하나로 다 커버 가능
```javascript
{
event: 'stop'
userId: string,
componentId: string,
trackId: Int
}
```
#### 곡 변경 (⏩ / 중간에 변경)
```javascript
{
event: 'playNow'
userId: string,
componentId: string
trackId: int,
targetTrackId: int,
currentPlayTime: int (sec 단위로), // 슬라이더 위치
totalPlayTime: int (sec 단위로) // 전체 길이
}
```
#### 현재 재생 목록에서 제거
```javascript
{
event: 'removeFromUpNext',
userId: string,
trackId: [int]
}
```
#### mp3 구매
```javascript
{
event: 'buyMP3'
userId: string,
trackId: int
}
```
#### 좋아요(보관함)
```javascript
{
event: 'like',
userId: string,
page: String,
componentId: String,
data: {
type: String,
id: int
},
timestamp: String
}
```
#### 좋아요 취소(보관함)
```javascript
{
event: 'unlike',
userId: string,
page: String,
componentId: String,
data: {
type: String,
id: int
},
timestamp: String
}
```
#### 플레이리스트에 트랙/앨범/플레이리스트 등록
```javascript
{
event: 'addToPlaylist',
userId: string,
data: {
type: String (노래, 앨범 등),
id: Int
},
playlistId: Int
}
```