質問編集履歴
1
DB構造について追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -343,3 +343,41 @@
|
|
343
343
|
(こちらはカスタムクラスに友達別に情報を分けずに、全友達との全メッセージを入れています。)
|
344
344
|
|
345
345
|

|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
20190727以下追記
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
各メッセージはListened変数を有します。
|
356
|
+
|
357
|
+

|
358
|
+
|
359
|
+
Collection View内で該当のセルをタップしたら、Firebase上の変数が未読から既読に変わるようにしています。
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
```Swift
|
364
|
+
|
365
|
+
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
let newValuesForProfile = ["listened": true]
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
//タップしたセルが自分に送られたメールであれば、既読に変更
|
376
|
+
|
377
|
+
if messages[indexPath.row].senderId == self.toID {
|
378
|
+
|
379
|
+
DBProvider.Instance.dbRef.child("Media_Messages").child(messages[indexPath.row].childkey!).updateChildValues(newValuesForProfile)
|
380
|
+
|
381
|
+
}
|
382
|
+
|
383
|
+
```
|