{"id":4161,"date":"2025-02-23T20:56:52","date_gmt":"2025-02-23T11:56:52","guid":{"rendered":"https:\/\/www.elehobby.fun\/?p=4161"},"modified":"2025-02-23T20:56:52","modified_gmt":"2025-02-23T11:56:52","slug":"jetpack-compose-%e3%82%a2%e3%83%97%e3%83%aa%e3%81%ab-cloud-firestore-%e3%82%92%e8%bf%bd%e5%8a%a0%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.elehobby.fun\/?p=4161","title":{"rendered":"Jetpack Compose \u30a2\u30d7\u30ea\u306b Cloud Firestore \u3092\u8ffd\u52a0\u3059\u308b"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p>\u3053\u308c\u306f\u3001\u30e6\u30fc\u30b6\u30fc \u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306b<em>Jetpack Compose\u3092\u4f7f\u7528\u3057\u3001&nbsp;<\/em><a href=\"https:\/\/firebase.google.com\/docs\/auth\">Firebase Authentication<\/a>\u3001<a href=\"https:\/\/firebase.google.com\/docs\/crashlytics\">Crashlytics<\/a>\u3001<a href=\"https:\/\/firebase.google.com\/docs\/firestore\">Cloud Firestore<\/a>\u3001<a href=\"https:\/\/firebase.google.com\/docs\/perf-mon\">Performance Monitoring<\/a>\u3001<a href=\"https:\/\/firebase.google.com\/docs\/remote-config\">Remote Config<\/a>\u3001<a href=\"https:\/\/firebase.google.com\/docs\/extensions\">Firebase Extensions<\/a>\u3001<a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\">Firebase Cloud Messaging<\/a>\u3001<a href=\"https:\/\/developer.android.com\/training\/dependency-injection\/hilt-android\">Hilt<\/a>\u306a\u3069\u3001Google \u304c\u63d0\u4f9b\u3059\u308b\u305d\u306e\u4ed6\u306e\u30c4\u30fc\u30eb\u3092\u4f7f\u7528\u3057\u3066\u3001\u65b0\u3057\u3044 Android \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30bc\u30ed\u304b\u3089\u4f5c\u6210\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3059\u308b\u4e00\u9023\u306e\u8a18\u4e8b\u306e\u7b2c 4 \u90e8\u3067\u3059\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/firebase.blog\/posts\/2022\/04\/building-an-app-android-jetpack-compose-firebase\">\u3053\u306e\u30b7\u30ea\u30fc\u30ba\u306e\u30d1\u30fc\u30c8 1<\/a>\u3067\u306f\u3001\u3053\u306e\u30a2\u30d7\u30ea\u3067\u4f55\u304c\u3067\u304d\u308b\u306e\u304b\u3001\u307e\u305f\u305d\u306e\u69cb\u9020\u306b\u3064\u3044\u3066\u6982\u8981\u3092\u8aac\u660e\u3057\u307e\u3059\u3002<a href=\"https:\/\/firebase.blog\/posts\/2022\/05\/adding-firebase-auth-to-jetpack-compose-app\">\u30d1\u30fc\u30c8 2 \u3067\u306f<\/a>\u3001Firebase Authentication \u3092\u4f7f\u7528\u3057\u3066\u30ed\u30b0\u30a4\u30f3\u304a\u3088\u3073\u30b5\u30a4\u30f3\u30a2\u30c3\u30d7 \u30d5\u30ed\u30fc\u3092\u5b9f\u88c5\u3059\u308b\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3059\u3002<a href=\"https:\/\/firebase.blog\/posts\/2022\/06\/adding-crashlytics-to-jetpack-compose-app\">\u30d1\u30fc\u30c8 3 \u3067\u306f<\/a>\u3001\u30af\u30e9\u30c3\u30b7\u30e5\u3092\u51e6\u7406\u3057\u3066\u30e6\u30fc\u30b6\u30fc\u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306b Firebase Crashlytics \u3092\u8ffd\u52a0\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u7b2c 4 \u90e8\u3067\u306f\u3001Cloud Firestore \u306b\u3064\u3044\u3066\u5b66\u3073\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u8ffd\u52a0\u3057\u3066\u3001\u30af\u30e9\u30a6\u30c9\u306b ToDo \u30a2\u30a4\u30c6\u30e0\u3092\u4fdd\u5b58\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3057\u59cb\u3081\u308b\u65b9\u6cd5\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002\u307e\u305f\u3001\u4fdd\u5b58\u3055\u308c\u305f\u30a2\u30a4\u30c6\u30e0\u306e\u5909\u66f4\u3092\u76e3\u8996\u3057\u3001\u3053\u308c\u3089\u306e\u30a4\u30d9\u30f3\u30c8\u306b\u57fa\u3065\u3044\u3066 UI \u3092\u66f4\u65b0\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u3082\u8aac\u660e\u3057\u307e\u3059\u3002\u30c7\u30fc\u30bf\u3092\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u540c\u671f\u3067\u304d\u308b\u3053\u3068\u306f\u3001Firestore \u306e\u6700\u3082\u9b45\u529b\u7684\u306a\u6a5f\u80fd\u306e 1 \u3064\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"creating-and-editing-tasks\">\u30bf\u30b9\u30af\u306e\u4f5c\u6210\u3068\u7de8\u96c6<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"tasks-screen-flow\">\u30bf\u30b9\u30af\u753b\u9762\u306e\u30d5\u30ed\u30fc<\/h4>\n\n\n\n<p>\u30b3\u30fc\u30c9\u306b\u9032\u3080\u524d\u306b\u3001\u30bf\u30b9\u30af\u753b\u9762 (\u4e0b\u306e\u6700\u521d\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u306b\u8868\u793a) \u306e\u30d5\u30ed\u30fc\u3092\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002\u3053\u306e\u753b\u9762\u304b\u3089\u3001\u6b21\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u65b0\u3057\u3044\u30bf\u30b9\u30af\u3092\u4f5c\u6210\u3059\u308b: \u53f3\u4e0b\u9685\u306b\u3042\u308b\u8ffd\u52a0\u30dc\u30bf\u30f3\u3092\u30bf\u30c3\u30d7\u3059\u308b\u3068\u3001\u30bf\u30b9\u30af\u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002\u30e6\u30fc\u30b6\u30fc\u306f\u30bf\u30b9\u30af\u7de8\u96c6\u753b\u9762\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u3001\u65b0\u3057\u3044\u30bf\u30b9\u30af\u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002\u3059\u3079\u3066\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3067\u521d\u671f\u5316\u3055\u308c\u307e\u3059\u3002<\/li>\n\n\n\n<li>\u30bf\u30b9\u30af \u30e1\u30cb\u30e5\u30fc\u3092\u5c55\u958b\u3057\u307e\u3059\u3002\u5404\u30bf\u30b9\u30af\u306b\u306f 3 \u3064\u306e\u30c9\u30c3\u30c8\u306e\u30e1\u30cb\u30e5\u30fc\u304c\u3042\u308a\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u30bf\u30c3\u30d7\u3059\u308b\u3068 3 \u3064\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002\n<ul class=\"wp-block-list\">\n<li>\u30bf\u30b9\u30af\u306e\u7de8\u96c6: \u4e0a\u8a18\u3068\u540c\u3058\u30bf\u30b9\u30af\u7de8\u96c6\u753b\u9762\u304c\u958b\u304d\u307e\u3059\u304c\u3001\u7a7a\u306e\u30bf\u30b9\u30af\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3067\u306f\u306a\u304f\u3001\u9078\u629e\u3057\u305f\u9805\u76ee\u306e\u5024\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/li>\n\n\n\n<li>\u30d5\u30e9\u30b0\u306e\u5207\u308a\u66ff\u3048: \u30d5\u30e9\u30b0\u306e\u72b6\u614b\u3092\u30aa\u30f3\u304b\u3089\u30aa\u30d5\u306b\u3001\u307e\u305f\u306f\u305d\u306e\u9006\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li>\u30bf\u30b9\u30af\u306e\u524a\u9664: \u30bf\u30b9\u30af\u3092\u524a\u9664\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u8a2d\u5b9a\u753b\u9762\u3092\u958b\u304d\u307e\u3059\u3002\u53f3\u4e0a\u9685\u306e\u6b6f\u8eca\u30a2\u30a4\u30b3\u30f3\u3092\u30bf\u30c3\u30d7\u3059\u308b\u3068\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002\u8a2d\u5b9a\u753b\u9762\u3067\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u306f\u65e2\u5b58\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u305f\u308a\u3001\u65b0\u3057\u3044\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u305f\u308a\u3067\u304d\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"task-editing-screen-flow\">\u30bf\u30b9\u30af\u7de8\u96c6\u753b\u9762\u306e\u6d41\u308c<\/h4>\n\n\n\n<p>\u30bf\u30b9\u30af\u7de8\u96c6\u753b\u9762\u306f\u3001\u4e0b\u306e 2 \u756a\u76ee\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u3067\u308f\u304b\u308b\u3088\u3046\u306b\u3001\u975e\u5e38\u306b\u5206\u304b\u308a\u3084\u3059\u3044\u3067\u3059\u3002\u5404\u30bf\u30b9\u30af\u306b\u306f\u3001<code>TextFields<\/code>\u753b\u9762\u4e0a\u90e8\u306b\u8868\u793a\u3055\u308c\u308b 3 \u3064\u306e\u5834\u6240\u306b\u5165\u529b\u3067\u304d\u308b\u30bf\u30a4\u30c8\u30eb\u3001\u8aac\u660e\u3001URL \u304c\u3042\u308a\u307e\u3059\u3002\u307e\u305f\u3001\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 3 \u3068 4 \u306b\u793a\u3059\u3088\u3046\u306b\u3001\u65e5\u4ed8\u3068\u6642\u523b\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u30bf\u30c3\u30d7\u3057\u3001\u30ab\u30ec\u30f3\u30c0\u30fc\u3068\u6642\u8a08\u3092\u4f7f\u7528\u3057\u3066\u5024\u3092\u9078\u629e\u3059\u308b\u3053\u3068\u3067\u3001\u5404\u30bf\u30b9\u30af\u306e\u671f\u9650\u3068\u6642\u523b\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6700\u5f8c\u306b\u3001\u512a\u5148\u5ea6\u3068\u30d5\u30e9\u30b0\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u5404\u30bf\u30b9\u30af\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u512a\u5148\u5ea6 \u3067\u521d\u671f\u5316\u3055\u308c<code>None<\/code>\u307e\u3059\u304c\u3001<code>Low<\/code>\u3001<code>Medium<\/code>\u307e\u305f\u306f\u306b\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059<code>High<\/code>\u3002\u30d5\u30e9\u30b0\u306b\u3064\u3044\u3066\u306f\u3001\u521d\u671f\u5024\u306f \u3067\u3059<code>Off<\/code>\u304c\u3001 \u306b\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059<code>On<\/code>\u3002\u30e6\u30fc\u30b6\u30fc\u306f\u30bf\u30b9\u30af\u306e\u8a2d\u5b9a\u304c\u5b8c\u4e86\u3057\u305f\u3089\u3001\u753b\u9762\u306e\u53f3\u4e0a\u9685\u306b\u3042\u308b\u78ba\u8a8d\u30a2\u30a4\u30b3\u30f3\u3092\u30bf\u30c3\u30d7\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/firebasestorage.googleapis.com\/v0\/b\/first-class-blog.appspot.com\/o\/posts%2Ftask-and-task-editing-screens_1600x800.png?alt=media&amp;token=26604da9-8aae-4b7e-9aed-e6bc75e42106\" alt=\"\u30bf\u30b9\u30af\u3068\u30bf\u30b9\u30af\u7de8\u96c6\u753b\u9762\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"cloud-firestore\">\u30af\u30e9\u30a6\u30c9 \u30d5\u30a1\u30a4\u30a2\u30b9\u30c8\u30a2<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"what-is-cloud-firestore\">Cloud Firestore \u3068\u306f\u4f55\u3067\u3059\u304b?<\/h4>\n\n\n\n<p><a href=\"https:\/\/firebase.google.com\/docs\/firestore\">Cloud Firestore\u306f<\/a><em>NoSQL<\/em>\u30af\u30e9\u30a6\u30c9 \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3067\u3059\u3002\u3064\u307e\u308a\u3001\u60c5\u5831\u306e\u4fdd\u5b58\u65b9\u6cd5\u306f SQL \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3068\u306f\u7570\u306a\u308a\u307e\u3059\u3002\u30c6\u30fc\u30d6\u30eb\u3068\u5217\u3092\u4f7f\u7528\u3059\u308b\u4ee3\u308f\u308a\u306b\u3001\u60c5\u5831\u306f\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3068\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u4fdd\u5b58\u3055\u308c\u307e\u3059\u3002\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3068\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f<em>JSON<\/em>\u306b\u975e\u5e38\u306b\u4f3c\u305f\u69cb\u9020\u306b\u306a\u3063\u3066\u3044\u307e\u3059 (\u5404\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u306f\u5024\u306b\u30de\u30c3\u30d4\u30f3\u30b0\u3055\u308c\u305f\u30d5\u30a3\u30fc\u30eb\u30c9\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059)\u3002<\/p>\n\n\n\n<p>\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u5185\u306e\u3053\u308c\u3089\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306f\u3055\u307e\u3056\u307e\u306a\u30bf\u30a4\u30d7 (&nbsp;<code>String<\/code>\u3001<code>Integer<\/code>\u3001<code>Array<\/code>\u3001<code>Date<\/code>\u304a\u3088\u3073\u4ed6\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3078\u306e\u53c2\u7167) \u306b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u6700\u9069\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u3092\u9078\u629e\u3067\u304d\u307e\u3059\u3002\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u4fdd\u5b58\u3055\u308c\u307e\u3059\u3002\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u3001\u500b\u3005\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u53d6\u5f97\u3059\u308b\u304b\u3001\u30af\u30a8\u30ea\u6761\u4ef6\u306b\u4e00\u81f4\u3059\u308b\u8907\u6570\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3067\u30af\u30a8\u30ea\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>Cloud Firestore \u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0 \u30ea\u30b9\u30ca\u30fc\u3092\u901a\u3058\u3066\u3001\u3055\u307e\u3056\u307e\u306a\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3084\u30c7\u30d0\u30a4\u30b9\u9593\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 \u30c7\u30fc\u30bf\u3092\u540c\u671f\u3055\u305b\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306b\u3064\u3044\u3066\u306f\u3001\u3053\u306e\u8a18\u4e8b\u3067\u3055\u3089\u306b\u8a73\u3057\u304f\u8aac\u660e\u3057\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u5229\u70b9\u3084\u305d\u306e\u4ed6\u306e\u591a\u304f\u306e\u5229\u70b9\u306e\u8a73\u7d30\u306b\u3064\u3044\u3066\u306f\u3001<a href=\"https:\/\/firebase.google.com\/docs\/firestore#key_capabilities\">\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092<\/a>\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"adding-cloud-firestore-to-your-project\">\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b Cloud Firestore \u3092\u8ffd\u52a0\u3059\u308b<\/h4>\n\n\n\n<p>Cloud Firestore \u3092 Android \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u8ffd\u52a0\u3059\u308b\u306b\u306f\u3001<code>app\/build.gradle<\/code>\u30d5\u30a1\u30a4\u30eb\u306b\u6b21\u306e\u4f9d\u5b58\u95a2\u4fc2\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dependencies {\n    \/\/ Import the BoM for the Firebase platform\n    implementation platform('com.google.firebase:firebase-bom:31.0.0')\n\n    \/\/ Declare the dependency for the Firestore library\n    implementation 'com.google.firebase:firebase-firestore-ktx'\n}\n<\/pre>\n\n\n\n<p><a href=\"https:\/\/console.firebase.google.com\/\">Firebase \u30b3\u30f3\u30bd\u30fc\u30eb<\/a>\u3067\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u7528\u306e Cloud Firestore \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3092\u5fd8\u308c\u306a\u3044\u3067\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30b3\u30fc\u30c9\u3067\u3053\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u30b3\u30f3\u30bd\u30fc\u30eb\u306e Firestore \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9 \u30bb\u30af\u30b7\u30e7\u30f3\u306b\u79fb\u52d5\u3057\u3001[Firestore \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210] \u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7 \u30d5\u30ed\u30fc\u306e\u8a73\u7d30\u306b\u3064\u3044\u3066\u306f\u3001\u516c\u5f0f\u306e<a href=\"https:\/\/firebase.google.com\/docs\/firestore\/quickstart#create\">Get Started \u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"creating-the-storage-service\">\u30b9\u30c8\u30ec\u30fc\u30b8\u30b5\u30fc\u30d3\u30b9\u306e\u4f5c\u6210<\/h4>\n\n\n\n<p>\u6b21\u306e\u30b9\u30c6\u30c3\u30d7\u306f\u3001\u3053\u306e\u30b7\u30ea\u30fc\u30ba\u306e<a href=\"https:\/\/firebase.blog\/posts\/2022\/04\/building-an-app-android-jetpack-compose-firebase\">\u30d1\u30fc\u30c8 1<\/a><code>StorageService<\/code>\u3067\u8aac\u660e\u3057\u305f\u30b5\u30fc\u30d3\u30b9 \u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u3068\u5b9f\u88c5\u30d1\u30bf\u30fc\u30f3\u3092\u4f7f\u7528\u3057\u3066\u3001\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3067\u3059\u3002\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<a href=\"https:\/\/firebase.blog\/posts\/2022\/04\/building-an-app-android-jetpack-compose-firebase\"><\/a><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">interface StorageService {\n    fun addListener(\n        userId: String,\n        onDocumentEvent: (Boolean, Task) -> Unit,\n        onError: (Throwable) -> Unit\n    )\n\n    fun removeListener()\n    fun getTask(taskId: String, onError: (Throwable) -> Unit, onSuccess: (Task) -> Unit)\n    fun saveTask(task: Task, onResult: (Throwable?) -> Unit)\n    fun updateTask(task: Task, onResult: (Throwable?) -> Unit)\n    fun deleteTask(taskId: String, onResult: (Throwable?) -> Unit)\n}\n<\/pre>\n\n\n\n<p>\u76e3\u8996\u3057\u305f\u3044\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u5185\u306e\u30a4\u30d9\u30f3\u30c8\u3092\u30ea\u30c3\u30b9\u30f3\u3059\u308b\u30ea\u30b9\u30ca\u30fc\u3092\u767b\u9332\u304a\u3088\u3073\u767b\u9332\u89e3\u9664\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u306e\u4ed6\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u30a2\u30a4\u30c6\u30e0\u3092\u53d6\u5f97\u3001\u4fdd\u5b58\u3001\u66f4\u65b0\u3001\u304a\u3088\u3073\u524a\u9664\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u3059\u3002\u4e0a\u8a18\u306e\u3088\u3046\u306b\u3001\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f \u3068\u547c\u3070\u308c\u308b\u30c7\u30fc\u30bf\u69cb\u9020\u3067\u8868\u3055\u308c\u307e\u3059<code>Task<\/code>\u3002\u3053\u308c\u306f\u6b21\u306e<code>data class<\/code>\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">data class Task(\n    val id: String = \"\",\n    val title: String = \"\",\n    val priority: String = \"\",\n    val dueDate: String = \"\",\n    val dueTime: String = \"\",\n    val description: String = \"\",\n    val url: String = \"\",\n    val flag: Boolean = false,\n    val completed: Boolean = false,\n    val userId: String = \"\"\n)\n<\/pre>\n\n\n\n<p>\u30e6\u30fc\u30b6\u30fc\u306b\u8868\u793a\u3055\u308c\u308b\u3059\u3079\u3066\u306e\u60c5\u5831\u306b\u52a0\u3048\u3066\u3001\u5404\u30a2\u30a4\u30c6\u30e0\u306b\u306f<code>userId<\/code>(\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u306b\u57fa\u3065\u3044\u3066\u30bf\u30b9\u30af\u3092\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081) \u3068\u3001<code>id&nbsp;<\/code>\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u4f5c\u6210\u6642\u306b Firestore \u306b\u3088\u3063\u3066\u81ea\u52d5\u751f\u6210\u3055\u308c\u308b \u3082\u3042\u308a\u307e\u3059\u3002\u5f8c\u8005\u306f\u3001<code>LazyColumn<\/code>(Compose \u3067\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u308b UI \u8981\u7d20) \u3067\u306f\u5404\u30a2\u30a4\u30c6\u30e0\u306b\u4e00\u610f\u306e\u30ad\u30fc\u304c\u5fc5\u8981\u3067\u3042\u308b\u305f\u3081\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"implementing-the-tasks-screen-flow\">\u30bf\u30b9\u30af\u753b\u9762\u30d5\u30ed\u30fc\u306e\u5b9f\u88c5<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"adding-listeners\">\u30ea\u30b9\u30ca\u30fc\u306e\u8ffd\u52a0<\/h4>\n\n\n\n<p>\u30e9\u30a4\u30d6 \u30c7\u30fc\u30bf\u3092\u8868\u793a\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u305f\u3044\u3068\u8003\u3048\u3066\u3044\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u5225\u306e\u30c7\u30d0\u30a4\u30b9\u3067\u30bf\u30b9\u30af \u30ea\u30b9\u30c8\u3092\u5909\u66f4\u3059\u308b\u305f\u3073\u306b\u3001\u4ed6\u306e\u3059\u3079\u3066\u306e\u30c7\u30d0\u30a4\u30b9\u306b\u540c\u3058\u30c7\u30fc\u30bf\u304c\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002Firestore \u306b\u306f<a href=\"https:\/\/firebase.google.com\/docs\/firestore\/query-data\/listen\">\u30b9\u30ca\u30c3\u30d7\u30b7\u30e7\u30c3\u30c8 \u30ea\u30b9\u30ca\u30fc<\/a>\u3068\u547c\u3070\u308c\u308b\u30e1\u30ab\u30cb\u30ba\u30e0\u304c\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u3001\u6570\u884c\u306e\u30b3\u30fc\u30c9\u3067\u3053\u308c\u3092\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305f\u3060\u3057\u3001\u3053\u306e\u30b9\u30ca\u30c3\u30d7\u30b7\u30e7\u30c3\u30c8 \u30ea\u30b9\u30ca\u30fc\u304c\u753b\u9762\u306e\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u306b\u6e96\u62e0\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u3001\u30a4\u30d9\u30f3\u30c8\u3092\u53d7\u4fe1\u3057\u3066\u200b\u200b\u3082\u610f\u5473\u304c\u3042\u308a\u307e\u305b\u3093\u3002\u305d\u306e\u305f\u3081\u3001\u30d3\u30e5\u30fc\u304c\u8868\u793a\u3055\u308c\u305f\u3068\u304d\u306b\u30ea\u30b9\u30ca\u30fc\u3092\u767b\u9332\u3057\u3001\u30d3\u30e5\u30fc\u304c\u6d88\u3048\u305f\u3068\u304d\u306b\u767b\u9332\u3092\u89e3\u9664\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u3092\u5b9f\u73fe\u3059\u308b\u306b\u306f\u3001\u6700\u4e0a\u4f4d\u306e composable \u95a2\u6570\u306b<a href=\"https:\/\/developer.android.com\/jetpack\/compose\/side-effects#disposableeffect\">DisposableEffect<\/a>\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u30af\u30ea\u30fc\u30f3\u30a2\u30c3\u30d7\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u526f\u4f5c\u7528 (\u30ea\u30b9\u30ca\u30fc\u306e\u767b\u9332\u3068\u767b\u9332\u89e3\u9664\u306a\u3069\u3001\u307e\u3055\u306b\u305d\u306e\u901a\u308a\u3067\u3059) \u306b\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">DisposableEffect(viewModel) {\n    viewModel.addListener()\n    onDispose { viewModel.removeListener() }\n}\n<\/pre>\n\n\n\n<p><code>add<\/code>\u4e0a\u8a18\u306e\u30b9\u30cb\u30da\u30c3\u30c8\u3067\u306f\u3001 \u30e1\u30bd\u30c3\u30c9\u3068<code>remove<\/code>\u30e1\u30bd\u30c3\u30c9\u304c\u4e92\u3044\u306b\u4e0b\u306b\u3042\u308a\u307e\u3059\u304c\u3001\u3053\u308c\u3089\u306f\u9806\u756a\u306b\u5b9f\u884c\u3055\u308c\u308b\u308f\u3051\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<code>addListener<\/code>\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u30b3\u30f3\u30dd\u30fc\u30ba\u53ef\u80fd\u306a\u95a2\u6570\u304c\u958b\u59cb\u3055\u308c\u308b\u3068\u3059\u3050\u306b\u547c\u3073\u51fa\u3055\u308c\u3001<code>removeListener<\/code>\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u95a2\u6570\u304c\u7834\u68c4\u3055\u308c\u308b\u3068\u3059\u3050\u306b\u547c\u3073\u51fa\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u5185\u306e\u3053\u308c\u3089\u306e\u30e1\u30bd\u30c3\u30c9<code>addListener<\/code>\u3068\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8 \u30a4\u30d9\u30f3\u30c8\u3092\u53d7\u4fe1\u3059\u308b\u305f\u3073\u306b\u5b9f\u884c\u3055\u308c\u308b\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u6e21\u3057\u3066 \u3092\u547c\u3073\u51fa\u3057\u307e\u3059\u3002<code>removeListener&nbsp;<\/code><code>TasksViewModel<\/code><code>StorageService<\/code><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">fun addListener() {\n    viewModelScope.launch(showErrorExceptionHandler) {\n        storageService.addListener(accountService.getUserId(), ::onDocumentEvent, ::onError)\n    }\n}\n\nfun removeListener() {\n    viewModelScope.launch(showErrorExceptionHandler) { storageService.removeListener() }\n}\n<\/pre>\n\n\n\n<p>\u30af\u30e9\u30b9\u306b\u30b5\u30fc\u30d3\u30b9 \u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u5b9f\u88c5\u3057\u307e\u3059<code>StorageServiceImpl<\/code>\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">override fun addListener(\n    userId: String,\n    onDocumentEvent: (Boolean, Task) -> Unit,\n    onError: (Throwable) -> Unit\n) {\n    val query = Firebase.firestore.collection(TASK_COLLECTION).whereEqualTo(USER_ID, userId)\n\n    listenerRegistration = query.addSnapshotListener { value, error ->\n        if (error != null) {\n            onError(error)\n            return@addSnapshotListener\n        }\n\n        value?.documentChanges?.forEach {\n            val wasDocumentDeleted = it.type == REMOVED\n            val task = it.document.toObject&lt;Task>().copy(id = it.document.id)\n            onDocumentEvent(wasDocumentDeleted, task)\n        }\n    }\n}\n\noverride fun removeListener() {\n    listenerRegistration?.remove()\n}\n<\/pre>\n\n\n\n<p>\u306f<code>listenerRegistration<\/code>\u3001 \u3078\u306e\u53c2\u7167\u3092\u4fdd\u6301\u3059\u308b\u30b5\u30fc\u30d3\u30b9\u5b9f\u88c5\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3059<code>snapshotListener<\/code>\u3002\u3053\u306e\u53c2\u7167\u306f\u4fdd\u6301\u3057\u3066\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u767b\u9332\u89e3\u9664\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<code>forEach<\/code>\u30d6\u30ed\u30c3\u30af\u5185\u3067\u306f\u3001\u5404\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8 \u30a4\u30d9\u30f3\u30c8\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3001\u5909\u66f4\u304c \u578b\u3067\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u3053\u308c\u3092\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3068\u3057\u3066\u6e21\u3057\u3066\u30b3\u30fc\u30eb\u30d0\u30c3\u30af<code>REMOVED<\/code>\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<code>onDocumentEvent<\/code><code>boolean<\/code><\/p>\n\n\n\n<p>\u30d1\u30e9\u30e1\u30fc\u30bf\u306b\u52a0\u3048\u3066\u3001\u9001\u4fe1\u3059\u308b\u5fc5\u8981\u306e\u3042\u308b\u30d1\u30e9\u30e1\u30fc\u30bf<code>boolean<\/code>\u3082\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u30bf\u30b9\u30af \u30ea\u30b9\u30c8\u306b\u5fc5\u8981\u306a\u5909\u66f4\u3092\u9069\u7528\u3059\u308b\u305f\u3081\u306b\u3001\u3069\u306e\u30bf\u30b9\u30af\u304c\u5909\u66f4\u3055\u308c\u305f\u304b\u3092 \u304c\u6b63\u78ba\u306b\u77e5\u308b\u5fc5\u8981\u304c\u3042\u308b\u305f\u3081\u3067\u3059\u3002API\u306b\u3088\u3063\u3066\u63d0\u4f9b\u3055\u308c\u308b \u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u3001\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u30b3\u30fc\u30c9\u30d9\u30fc\u30b9\u304c\u8a8d\u8b58\u3059\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8 (\u3053\u306e\u5834\u5408\u306f ) \u306b\u30de\u30c3\u30d4\u30f3\u30b0\u3067\u304d\u307e\u3059\u3002\u30de\u30c3\u30d4\u30f3\u30b0\u306b\u3064\u3044\u3066\u306f<a href=\"https:\/\/firebase.blog\/posts\/2022\/07\/adding-cloud-firestore-to-jetpack-compose-app#saving-a-task\">\u3001\u3053\u306e\u8a18\u4e8b\u306e\u5f8c\u534a\u3067<\/a>\u8aac\u660e\u3057\u307e\u3059\u3002<code>Task<\/code><code>TasksViewModel<\/code><code>toObject<\/code><code>Task<\/code><a href=\"https:\/\/firebase.blog\/posts\/2022\/07\/adding-cloud-firestore-to-jetpack-compose-app#saving-a-task\"><\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"calling-service-methods-from-viewmodel\">ViewModel \u304b\u3089\u30b5\u30fc\u30d3\u30b9 \u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059<\/h4>\n\n\n\n<p><code>TasksViewModel<\/code>\u30e6\u30fc\u30b6\u30fc\u304c\u5b8c\u4e86\u3068\u3057\u3066\u30de\u30fc\u30af\u3057\u305f\u308a\u30de\u30fc\u30af\u3092\u89e3\u9664\u3057\u305f\u308a\u3057\u305f\u3068\u304d\u3001\u307e\u305f\u306f\u30d5\u30e9\u30b0\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u304c\u5909\u66f4\u3055\u308c\u305f\u3068\u304d\u306b\u3001Firestore \u306e\u3092\u66f4\u65b0\u3059\u308b\u306e\u3082 \u306e\u5f79\u5272\u3067\u3059<code>Task<\/code>\u3002\u30e6\u30fc\u30b6\u30fc\u304c\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8 \u30e1\u30cb\u30e5\u30fc\u3067\u9805\u76ee\u3092\u30bf\u30c3\u30d7\u3057\u3066\u524a\u9664\u3057\u305f\u3068\u304d\u3082\u540c\u3058\u3053\u3068\u304c\u8d77\u3053\u308a\u307e\u3059\u3002 \u306f\u3001\u30b5\u30fc\u30d3\u30b9\u304b\u3089 \u30e1\u30bd\u30c3\u30c9<code>TasksViewModel&nbsp;<\/code>\u3092\u547c\u3073\u51fa\u3059\u5f79\u5272\u3092\u62c5\u3063\u3066\u3044\u307e\u3059\u3002<code>deleteTask<\/code><\/p>\n\n\n\n<p><code>Exception<\/code>\u30b5\u30fc\u30d3\u30b9 \u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3057\u305f\u5f8c\u3001\u6b21\u306e 2 \u3064\u306e\u3053\u3068\u304c\u767a\u751f\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u306f\u3001\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3067\u3092\u53d7\u3051\u53d6\u308a\u3001<code>onError<\/code>\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9 \u30b9\u30cb\u30da\u30c3\u30c8\u306b\u793a\u3059\u3088\u3046\u306b\u3001\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3057\u307e\u3059\u3002\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u3053\u306e\u30b7\u30ea\u30fc\u30ba\u306e<a href=\"https:\/\/firebase.blog\/posts\/2022\/06\/adding-crashlytics-to-jetpack-compose-app\">\u30d1\u30fc\u30c8 3<\/a><code>onError<\/code>\u3067\u8aac\u660e\u3057\u305f\u3088\u3046\u306b\u3001Crashlytics \u3092\u4f7f\u7528\u3057\u3066\u30a8\u30e9\u30fc\u3092\u30ed\u30b0\u306b\u8a18\u9332\u3057\u307e\u3059\u3002\u6210\u529f\u3059\u308b\u3068\u3001Firestore \u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3067\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u304c\u66f4\u65b0\u3055\u308c\u3001\u767b\u9332\u3055\u308c\u305f\u30ea\u30b9\u30ca\u30fc\u3092\u901a\u3058\u3066\u30a4\u30d9\u30f3\u30c8\u304c\u53d7\u4fe1\u3055\u308c\u3001\u30ed\u30fc\u30ab\u30eb \u30ea\u30b9\u30c8\u304c\u66f4\u65b0\u3055\u308c\u307e\u3059\u3002<a href=\"https:\/\/firebase.blog\/posts\/2022\/06\/adding-crashlytics-to-jetpack-compose-app\"><\/a><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">private fun onDeleteTaskClick(task: Task) {\n    viewModelScope.launch(showErrorExceptionHandler) {\n        storageService.deleteTask(task.id) { error ->\n            if (error != null) onError(error)\n        }\n    }\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"updating-the-composable-screen\">\u69cb\u6210\u53ef\u80fd\u306a\u753b\u9762\u306e\u66f4\u65b0<\/h4>\n\n\n\n<p>ToDo \u30ea\u30b9\u30c8\u753b\u9762\u3067\u306f\u3001 \u306e\u30ea\u30b9\u30c8\u3060\u3051\u3092\u78ba\u8a8d\u3059\u308c\u3070\u3088\u3044\u305f\u3081\u3001\u3068 \u306e<code>UiState<\/code>\u9593\u3067\u60c5\u5831\u3092\u4ea4\u63db\u3059\u308b\u305f\u3081\u306b\u3092\u4f5c\u6210\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u4ed6\u306e\u753b\u9762\u3067\u898b\u3066\u304d\u305f\u3088\u3046\u306b \u3092\u4f7f\u7528\u3059\u308b\u4ee3\u308f\u308a\u306b\u3001 \u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<code>TasksViewModel<\/code><code>TasksScreen<\/code><code>Tasks<\/code><code>MutableState<\/code><code>MutableStateMap<\/code><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">var tasks = mutableStateMapOf&lt;String, Task>()\n    private set\n<\/pre>\n\n\n\n<p>\u30bf\u30b9\u30af\u306e ID \u3092\u30de\u30c3\u30d7\u306e\u30ad\u30fc\u3068\u3057\u3066\u4f7f\u7528\u3057\u3001\u30bf\u30b9\u30af\u3092\u305d\u306e\u30ad\u30fc\u306e\u5024\u3068\u3057\u3066\u4fdd\u5b58\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u4e00\u610f\u306e ID \u306b\u57fa\u3065\u3044\u3066\u30a2\u30a4\u30c6\u30e0\u306b\u975e\u5e38\u306b\u8fc5\u901f\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u5909\u66f4\u3092\u52a0\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u305f\u3068\u3048\u3070\u3001<code>TasksViewModel<\/code>\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8 \u30a4\u30d9\u30f3\u30c8\u3092\u30ea\u30c3\u30b9\u30f3\u3059\u308b\u3068\u304d\u306b \u304c\u884c\u3046\u3053\u3068\u306f\u3053\u308c\u3060\u3051\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">private fun onDocumentEvent(wasDocumentDeleted: Boolean, task: Task) {\n    if (wasDocumentDeleted) tasks.remove(task.id) else tasks[task.id] = task\n}\n<\/pre>\n\n\n\n<p>\u6b21\u306b\u3001\u3053\u306e\u30de\u30c3\u30d7\u3092\u76e3\u8996\u3059\u308b\u30b3\u30f3\u30dd\u30fc\u30b6\u30d6\u30eb\u95a2\u6570\u304c<a href=\"https:\/\/developer.android.com\/jetpack\/compose\/mental-model#recomposition\">\u518d\u69cb\u6210\u3055\u308c<\/a>\u3001\u66f4\u65b0\u3055\u308c\u305f\u9805\u76ee\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">LazyColumn {\n    items(viewModel.tasks.values.toList(), key = { it.id }) { item ->\n        [...]\n    }\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"implementing-the-task-editing-screen-flow\">\u30bf\u30b9\u30af\u7de8\u96c6\u753b\u9762\u30d5\u30ed\u30fc\u306e\u5b9f\u88c5<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"calling-service-methods-from-viewmodel-1\">ViewModel \u304b\u3089\u30b5\u30fc\u30d3\u30b9 \u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059<\/h4>\n\n\n\n<p><code>StorageService<\/code>\u3067\u306f\u3001\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u30e1\u30bd\u30c3\u30c9\u304c3 \u3064\u3042\u308a\u307e\u3059<code>EditTaskViewModel<\/code>\u3002\u6700\u521d\u306e\u30e1\u30bd\u30c3\u30c9\u306f \u3068\u547c\u3070\u308c<code>getTask<\/code>\u3001 \u3092\u30d1\u30e9\u30e1\u30fc\u30bf\u3068\u3057\u3066\u53d7\u3051\u53d6\u308a\u307e\u3059<code>taskId<\/code>\u3002\u3053\u306e ID \u3092\u4f7f\u7528\u3057\u3066\u3001\u3053\u306e\u753b\u9762\u3067\u7de8\u96c6\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b \u3092\u53d6\u5f97\u3067\u304d\u307e\u3059<code>Task<\/code>\u3002\u30d1\u30e9\u30e1\u30fc\u30bf\u3068\u3057\u3066 ID \u304c\u9001\u4fe1\u3055\u308c\u306a\u3044\u5834\u5408\u306f\u3001\u7a7a\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u542b\u3080\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u3001\u30e6\u30fc\u30b6\u30fc\u306f<code>Task<\/code>\u6700\u521d\u304b\u3089\u65b0\u3057\u3044 \u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4f7f\u7528\u3059\u308b 2 \u756a\u76ee\u3068 3 \u756a\u76ee\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u3001<code>saveTask<\/code>(\u65b0\u3057\u3044\u30bf\u30b9\u30af\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528) \u3068<code>updateTask<\/code>(\u65e2\u5b58\u306e\u30bf\u30b9\u30af\u3092\u66f4\u65b0\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528) \u3068\u547c\u3070\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">fun onDoneClick(popUpScreen: () -> Unit) {\n    viewModelScope.launch(showErrorExceptionHandler) {\n        val editedTask = task.value.copy(userId = accountService.getUserId())\n\n        if (editedTask.id.isBlank()) saveTask(editedTask, popUpScreen)\n        else updateTask(editedTask, popUpScreen)\n    }\n}\n\nprivate fun saveTask(task: Task, popUpScreen: () -> Unit) {\n    storageService.saveTask(task) { error ->\n        if (error == null) popUpScreen() else onError(error)\n    }\n}\n\nprivate fun updateTask(task: Task, popUpScreen: () -> Unit) {\n    storageService.updateTask(task) { error ->\n        if (error == null) popUpScreen() else onError(error)\n    }\n}\n<\/pre>\n\n\n\n<p><code>onDoneClick<\/code>\u30e6\u30fc\u30b6\u30fc\u304c \u3092\u4fdd\u5b58\u3059\u308b\u305f\u3081\u306b\u30dc\u30bf\u30f3\u3092\u30bf\u30c3\u30d7\u3059\u308b\u3068\u3001 \u30e1\u30bd\u30c3\u30c9\u304c\u547c\u3073\u51fa\u3055\u308c\u307e\u3059\u3002<code>Task<\/code>\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u5185\u3067\u306f\u3001 \u304c<code>Task<\/code>\u3059\u3067\u306b\u5b58\u5728\u3059\u308b\u304b\u3069\u3046\u304b (ID \u304c\u7a7a\u767d\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\u3053\u3068\u306b\u3088\u3063\u3066) \u3092\u78ba\u8a8d\u3057\u3001 \u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3057\u3066 \u3092\u4fdd\u5b58\u307e\u305f\u306f\u66f4\u65b0\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u6c7a\u5b9a\u3057\u307e\u3059<code>Task<\/code>\u3002\u7e70\u308a\u8fd4\u3057\u307e\u3059\u304c\u3001\u3053\u308c\u3089\u306e\u30b5\u30fc\u30d3\u30b9 \u30e1\u30bd\u30c3\u30c9\u306e\u3044\u305a\u308c\u304b\u304c\u547c\u3073\u51fa\u3055\u308c\u308b\u3068\u30012 \u3064\u306e\u3053\u3068\u304c\u767a\u751f\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\u30a8\u30e9\u30fc\u306e\u5834\u5408\u306f\u3001<code>Exception<\/code>\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3067 \u3092\u53d7\u3051\u53d6\u308a\u3001 \u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3057\u307e\u3059<code>onError<\/code>\u3002\u6210\u529f\u3057\u305f\u5834\u5408\u306f\u3001 \u3092\u9589\u3058\u3066<code>EditTaskScreen<\/code>\u30e6\u30fc\u30b6\u30fc\u3092 \u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3057<code>TasksScreen<\/code>\u3001\u66f4\u65b0\u3055\u308c\u305f\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u306f\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u5185\u306e\u5909\u66f4\u3092\u30ea\u30c3\u30b9\u30f3\u3059\u308b\u3088\u3046\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u3092 \u306b<code>TasksViewModel<\/code>\u4fdd\u5b58\u3059\u308b\u3068\u3059\u3050\u306b\u3001\u3053\u306e\u66f4\u65b0\u3092\u542b\u3080\u30a4\u30d9\u30f3\u30c8\u304c Firestore \u304b\u3089\u9001\u4fe1\u3055\u308c\u3001 \u306f\u81ea\u8eab\u306e\u30bf\u30b9\u30af \u30ea\u30b9\u30c8\u3092\u81ea\u52d5\u7684\u306b\u66f4\u65b0\u3059\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<code>Task<\/code><code>EditTaskViewModel<\/code><code>TasksViewModel<\/code><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"saving-a-task\">\u30bf\u30b9\u30af\u306e\u4fdd\u5b58<\/h4>\n\n\n\n<p>\u4e0a\u3067\u898b\u305f\u3088\u3046\u306b\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u4fdd\u5b58\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3059\u3050\u306b\u3001\u30b3\u30f3\u30dd\u30fc\u30b6\u30d6\u30eb\u95a2\u6570&nbsp;<code>onDoneClick<\/code>\u304c \u304b\u3089 \u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3057\u3001\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u5185\u3067\u304b\u3089\u307e\u305f\u306f\u3092<code>EditTaskViewModel<\/code>\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u30e1\u30bd\u30c3\u30c9\u306f \u3092\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u8ffd\u52a0\u3059\u308b\u3060\u3051\u3067\u3059\uff08\u305d\u306e\u5f8c\u3001Firestore \u306f\u3053\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e ID \u3092\u81ea\u52d5\u7684\u306b\u751f\u6210\u3057\u307e\u3059\uff09\u3002\u30e1\u30bd\u30c3\u30c9\u306f ID \u3092\u4f7f\u7528\u3057\u3066Firestore \u5185\u3067\u3053\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u898b\u3064\u3051\u3001\u65b0\u3057\u3044\u5024\u3067\u66f4\u65b0\u3057\u307e\u3059\u3002<code>saveTask<\/code><code>updateTask<\/code><code>StorageService<\/code><code>saveTask<\/code><code>Task<\/code><code>updateTask<\/code><code>Task<\/code><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">override fun saveTask(task: Task, onResult: (Throwable?) -> Unit) {\n    Firebase.firestore\n        .collection(TASK_COLLECTION)\n        .add(task)\n        .addOnCompleteListener { onResult(it.exception) }\n}\n<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">override fun updateTask(task: Task, onResult: (Throwable?) -> Unit) {\n    Firebase.firestore\n        .collection(TASK_COLLECTION)\n        .document(task.id)\n        .set(task)\n        .addOnCompleteListener { onResult(it.exception) }\n}\n<\/pre>\n\n\n\n<p>\u4e0a\u8a18\u306e\u4e21\u65b9\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u3001<code>onResult<\/code>\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3068\u3057\u3066 Firestore API \u306b\u6e21\u3057\u307e\u3059\u3002\u3053\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u306f\u3001API \u30e1\u30bd\u30c3\u30c9\u304c\u7d42\u4e86\u3059\u308b\u3068\u3059\u3050\u306b\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\u3053\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3067\u5fc5\u8981\u306a\u60c5\u5831\u306f\u3001\u30bf\u30b9\u30af\u306e\u4fdd\u5b58\u30d7\u30ed\u30bb\u30b9\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u304b\u3069\u3046\u304b\u3060\u3051\u3067\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u753b\u9762\u306b\u30a8\u30e9\u30fc\u3092\u30e6\u30fc\u30b6\u30fc\u306b\u8868\u793a\u3067\u304d\u307e\u3059 (\u30bf\u30b9\u30af\u3092\u524a\u9664\u3059\u308b\u3068\u304d\u306b\u4ee5\u524d\u306b\u898b\u305f\u65b9\u6cd5\u3068\u540c\u69d8)\u3002<\/p>\n\n\n\n<p><code>Task<\/code>\u4fdd\u5b58\u3059\u308b\u524d\u306b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5909\u63db\u3057\u3066\u3044\u306a\u3044\u3053\u3068\u306b\u304a\u6c17\u3065\u304d\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u3053\u308c\u306f\u3001Firestore \u304c<code>data class<\/code>\u30ea\u30d5\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3057\u3066\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u81ea\u52d5\u7684\u306b\u5909\u63db\u3067\u304d\u308b\u305f\u3081\u3067\u3059\u3002\u3064\u307e\u308a\u3001Firestore \u3092\u4f7f\u7528\u3059\u308b\u3068\u304d\u306b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30b7\u30ea\u30a2\u30eb\u5316\u307e\u305f\u306f\u9006\u30b7\u30ea\u30a2\u30eb\u5316\u3059\u308b\u5fc5\u8981\u304c\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u5927\u91cf\u306e\u5b9a\u578b\u30b3\u30fc\u30c9\u3092\u66f8\u304b\u306a\u304f\u3066\u6e08\u3080\u3060\u3051\u3067\u306a\u304f\u3001\u30b3\u30fc\u30c9\u306e\u4fdd\u5b88\u6027\u3082\u5411\u4e0a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u53d6\u5f97\u3059\u308b\u5834\u5408\u3082\u540c\u3058\u3053\u3068\u304c\u8d77\u3053\u308a\u307e\u3059\u3002Firestore \u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u8a8d\u8b58\u3067\u304d\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u30de\u30c3\u30d4\u30f3\u30b0\u3059\u308b\u306e\u306f\u975e\u5e38\u306b\u7c21\u5358\u3067\u3001<code>toObject<\/code>API \u304c\u63d0\u4f9b\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3060\u3051\u3067\u3001\u30de\u30c3\u30d4\u30f3\u30b0\u304c\u81ea\u52d5\u7684\u306b\u884c\u308f\u308c\u307e\u3059\u3002\u305f\u3068\u3048\u3070\u3001Firestore \u304b\u3089\u53d6\u5f97\u3057\u305f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092 \u578b\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u5909\u63db\u3059\u308b\u306b\u306f<code>Task<\/code>\u3001\u6b21\u306e\u64cd\u4f5c\u3092\u884c\u3046\u3060\u3051\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">val task = document.toObject&lt;Task>()\n<\/pre>\n\n\n\n<p><code>Task<\/code>\u30e1\u30bd\u30c3\u30c9\u306b\u578b\u3092\u6e21\u3059\u3068<code>toObject<\/code>\u3001\u30ea\u30d5\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3057\u3066\u3001\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u5024\u304c\u3067\u898b\u305f\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u5909\u63db\u3055\u308c\u307e\u3059<code>data class Task<\/code>\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"updating-the-composable-screen-1\">\u69cb\u6210\u53ef\u80fd\u306a\u753b\u9762\u306e\u66f4\u65b0<\/h4>\n\n\n\n<p>\u3082\u3046\u4e00\u5ea6\u8a00\u3044\u307e\u3059\u304c\u3001\u30bf\u30b9\u30af\u7de8\u96c6\u753b\u9762\u3067\u306f\u3001 \u3092\u4f5c\u6210\u3057\u3066\u3068 \u306e<code>UiState<\/code>\u9593\u3067\u60c5\u5831\u3092\u4ea4\u63db\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u78ba\u8a8d\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u306f 1 \u3064\u306e(\u30e6\u30fc\u30b6\u30fc\u304c\u4f5c\u6210\u307e\u305f\u306f\u7de8\u96c6\u3057\u3066\u3044\u308b\u30bf\u30b9\u30af) \u3060\u3051\u3060\u304b\u3089\u3067\u3059\u3002<code>EditTaskViewModel<\/code><code>EditTaskScreen<\/code><code>Task<\/code><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">var task = mutableStateOf(Task())\n    private set\n<\/pre>\n\n\n\n<p>\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u30d5\u30a3\u30fc\u30eb\u30c9\u3067\u7de8\u96c6\u3059\u308b\u3068\u30d7\u30ed\u30d1\u30c6\u30a3\u3092<code>EditTaskViewModel<\/code>\u66f4\u65b0\u3057\u3001\u5909\u66f4\u3054\u3068\u306b\u30b3\u30f3\u30dd\u30fc\u30ba\u53ef\u80fd\u306a\u95a2\u6570\u304c\u518d\u69cb\u6210\u3055\u308c\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u5165\u529b\u3057\u305f\u65b0\u3057\u3044\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u8868\u793a\u3057\u307e\u3059\u3002\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u3092 \u306b\u6e21\u3059\u65b9\u6cd5\u3068\u3001\u65b0\u3057\u3044\u5024\u3092 \u306b\u30dd\u30b9\u30c8\u30d0\u30c3\u30af\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u306f\u3001\u3053\u306e\u30b7\u30ea\u30fc\u30ba\u306e<a href=\"https:\/\/firebase.blog\/posts\/2022\/05\/adding-firebase-auth-to-jetpack-compose-app\">\u30d1\u30fc\u30c8 2<\/a>\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<code>Task<\/code><code>ViewModels<\/code><code>Screens<\/code><a href=\"https:\/\/firebase.blog\/posts\/2022\/05\/adding-firebase-auth-to-jetpack-compose-app\"><\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"future-improvements\">\u4eca\u5f8c\u306e\u6539\u5584<\/h3>\n\n\n\n<p>\u30e6\u30fc\u30b6\u30fc\u304c\u5f53\u793e\u306e\u30a2\u30d7\u30ea\u3092\u6c17\u306b\u5165\u3063\u3066\u304f\u308c\u308b\u3053\u3068\u3092\u9858\u3046\u4e00\u65b9\u3067\u3001\u7d0d\u5f97\u3067\u304d\u305a\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u524a\u9664\u3057\u305f\u3044\u3068\u3044\u3046\u30e6\u30fc\u30b6\u30fc\u3082\u3044\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u307e\u305f\u73fe\u5730\u306e\u898f\u5236\u306b\u6e96\u62e0\u3059\u308b\u305f\u3081\u306b\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u3059\u3079\u3066\u306e\u30c7\u30fc\u30bf\u3092\u524a\u9664\u3067\u304d\u308b\u65b9\u6cd5\u3092\u63d0\u4f9b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p><code>StorageService<\/code>\u30e6\u30fc\u30b6\u30fc\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092 1 \u3064\u305a\u3064\u8abf\u3079\u3066\u3059\u3079\u3066\u306e\u30c7\u30fc\u30bf\u3092\u524a\u9664\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3092\u691c\u8a0e\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u30e1\u30bd\u30c3\u30c9\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ DO NOT USE THIS - ANTIPATTERN!\noverride fun deleteAllForUser(userId: String, onResult: (Throwable?) -> Unit) {\n    Firebase.firestore\n        .collection(TASK_COLLECTION)\n        .whereEqualTo(USER_ID, userId)\n        .get()\n        .addOnFailureListener { error -> onResult(error) }\n        .addOnSuccessListener { result ->\n            for (document in result) document.reference.delete()\n            onResult(null)\n        }\n}\n<\/pre>\n\n\n\n<p>\u3053\u306e\u65b9\u6cd5\u306f\u3001\u30c7\u30fc\u30bf\u306e\u30bb\u30c3\u30c8\u304c\u5c0f\u3055\u3044\u5834\u5408\u306b\u306f\u554f\u984c\u306a\u304f\u6a5f\u80fd\u3057\u307e\u3059\u304c\u3001\u3044\u304f\u3064\u304b\u306e\u554f\u984c\u304c\u767a\u751f\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\u305f\u3068\u3048\u3070\u3001\u30bf\u30b9\u30af\u306e\u524a\u9664\u4e2d\u306b\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u63a5\u7d9a\u304c\u5931\u6557\u3059\u308b\u3068\u3001\u4e00\u90e8\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u304c\u524a\u9664\u3055\u308c\u305a\u306b\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u6b8b\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u7406\u60f3\u7684\u306b\u306f\u3001\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u524a\u9664\u3059\u308b\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u306b\u4efb\u305b\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u524a\u9664\u3057\u305f\u3089\u3059\u3079\u3066\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u4e00\u62ec\u524a\u9664\u3059\u308b\u5358\u4e00\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u305f\u3081\u306b\u72ec\u81ea\u306e<a href=\"https:\/\/cloud.google.com\/functions\">Cloud Functions<\/a>\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3082\u3001\u6642\u9593\u3092\u7bc0\u7d04\u3057\u3066<a href=\"https:\/\/firebase.google.com\/products\/extensions\/firebase-delete-user-data\">Delete User Data Extension<\/a>\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306b\u3064\u3044\u3066\u306f\u3001\u3053\u306e\u30b7\u30ea\u30fc\u30ba\u306e\u6b21\u56de\u306e\u8a18\u4e8b\u3067\u53d6\u308a\u4e0a\u3052\u308b\u4e88\u5b9a\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"whats-next\">\u6b21\u306f\u4f55\u304b<\/h3>\n\n\n\n<p>Android \u7528\u306e Make it So \u306e\u30bd\u30fc\u30b9 \u30b3\u30fc\u30c9\u306f\u3001<a href=\"https:\/\/github.com\/FirebaseExtended\/make-it-so-android\">\u3053\u306e Github \u30ea\u30dd\u30b8\u30c8\u30ea<\/a>\u3067\u5165\u624b\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3067\u7d39\u4ecb\u3057\u305f\u3059\u3079\u3066\u306e\u30b3\u30fc\u30c9\u306f\u3001<code>v1<\/code>\u30d5\u30a9\u30eb\u30c0\u30fc\u3067\u5165\u624b\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p><code>Services<\/code>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u4f7f\u7528\u3057\u3066\u3068\u306e\u9593\u3067\u7d50\u679c\u3092\u6e21\u3059\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3059<code>ViewModels<\/code>\u304c\u3001\u3053\u306e\u30d1\u30bf\u30fc\u30f3\u306f Make it So \u30a2\u30d7\u30ea\u306e\u7279\u5b9a\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u306e\u307f\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002\u3057\u305f\u304c\u3063\u3066\u3001<code>v1.0.0 tag<\/code>\u3053\u306e\u30b3\u30fc\u30c9\u306b\u5177\u4f53\u7684\u306b\u30a2\u30af\u30bb\u30b9\u3057\u305f\u3044\u5834\u5408\u306f \u3092\u30c1\u30a7\u30c3\u30af\u30a2\u30a6\u30c8\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3088\u308a\u65b0\u3057\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u306f\u3001\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u306e\u4ee3\u308f\u308a\u306b<a href=\"https:\/\/kotlinlang.org\/docs\/multiplatform-mobile-concurrency-and-coroutines.html\">Kotlin Coroutines<\/a>\u3068<a href=\"https:\/\/kotlinlang.org\/api\/kotlinx.coroutines\/kotlinx-coroutines-core\/kotlinx.coroutines.flow\/-flow\/\">Kotlin Flow<\/a><code>Task<\/code>\u3092\u4f7f\u7528\u3057\u3066\u30e2\u30c7\u30eb\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>iOS\/Mac \u958b\u767a\u306b\u3082\u8208\u5473\u304c\u3042\u308b\u5834\u5408\u306f\u3001\u540c\u3058\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u3053\u308c\u3089\u306e\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3067\u3082\u5229\u7528\u3067\u304d\u307e\u3059\u3002iOS\/Mac \u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u306f\u3001\u30e6\u30fc\u30b6\u30fc \u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u306e\u69cb\u7bc9\u306b SwiftUI \u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u3001Compose \u3067 UI \u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5\u3068\u540c\u69d8\u306b\u3001\u5ba3\u8a00\u578b UI \u30e2\u30c7\u30eb\u306b\u5f93\u3044\u307e\u3059\u3002\u30bd\u30fc\u30b9 \u30b3\u30fc\u30c9\u306f\u3001<a href=\"https:\/\/github.com\/peterfriese\/MakeItSo\">\u3053\u306e Github \u30da\u30fc\u30b8<\/a>\u306b\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3054\u8cea\u554f\u3084\u3054\u63d0\u6848\u304c\u3054\u3056\u3044\u307e\u3057\u305f\u3089\u3001\u30ea\u30dd\u30b8\u30c8\u30ea\u306e<a href=\"https:\/\/github.com\/FirebaseExtended\/make-it-so-android\/discussions\/\">\u30c7\u30a3\u30b9\u30ab\u30c3\u30b7\u30e7\u30f3 \u30da\u30fc\u30b8<\/a>\u304b\u3089\u304a\u6c17\u8efd\u306b\u304a\u554f\u3044\u5408\u308f\u305b\u304f\u3060\u3055\u3044\u3002<\/p>\n<div class=\"veu_socialSet veu_socialSet-position-after veu_contentAddSection\"><script>window.twttr=(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src=\"https:\/\/platform.twitter.com\/widgets.js\";fjs.parentNode.insertBefore(js,fjs);t._e=[];t.ready=function(f){t._e.push(f);};return t;}(document,\"script\",\"twitter-wjs\"));<\/script><ul><li class=\"sb_facebook sb_icon\"><a class=\"sb_icon_inner\" href=\"\/\/www.facebook.com\/sharer.php?src=bm&u=https%3A%2F%2Fwww.elehobby.fun%2F%3Fp%3D4161&amp;t=%E5%AE%9F%E8%B7%B5%E3%81%A7%E3%81%8D%E3%81%9F%E9%9B%BB%E5%AD%90%E5%B7%A5%E4%BD%9C%E3%81%A8%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E9%96%8B%E7%99%BA\" target=\"_blank\" onclick=\"window.open(this.href,'FBwindow','width=650,height=450,menubar=no,toolbar=no,scrollbars=yes');return false;\"><span class=\"vk_icon_w_r_sns_fb icon_sns\"><\/span><span class=\"sns_txt\">Facebook<\/span><span class=\"veu_count_sns_fb\"><\/span><\/a><\/li><li class=\"sb_twitter sb_icon\"><a class=\"sb_icon_inner\" href=\"\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.elehobby.fun%2F%3Fp%3D4161&amp;text=%E5%AE%9F%E8%B7%B5%E3%81%A7%E3%81%8D%E3%81%9F%E9%9B%BB%E5%AD%90%E5%B7%A5%E4%BD%9C%E3%81%A8%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E9%96%8B%E7%99%BA\" target=\"_blank\" ><span class=\"vk_icon_w_r_sns_twitter icon_sns\"><\/span><span class=\"sns_txt\">twitter<\/span><\/a><\/li><li class=\"sb_hatena sb_icon\"><a class=\"sb_icon_inner\" href=\"\/\/b.hatena.ne.jp\/add?mode=confirm&url=https%3A%2F%2Fwww.elehobby.fun%2F%3Fp%3D4161&amp;title=%E5%AE%9F%E8%B7%B5%E3%81%A7%E3%81%8D%E3%81%9F%E9%9B%BB%E5%AD%90%E5%B7%A5%E4%BD%9C%E3%81%A8%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E9%96%8B%E7%99%BA\" target=\"_blank\"  onclick=\"window.open(this.href,'Hatenawindow','width=650,height=450,menubar=no,toolbar=no,scrollbars=yes');return false;\"><span class=\"vk_icon_w_r_sns_hatena icon_sns\"><\/span><span class=\"sns_txt\">Hatena<\/span><span class=\"veu_count_sns_hb\"><\/span><\/a><\/li><li class=\"sb_pocket sb_icon\"><a class=\"sb_icon_inner\"  href=\"\/\/getpocket.com\/edit?url=https%3A%2F%2Fwww.elehobby.fun%2F%3Fp%3D4161&title=%E5%AE%9F%E8%B7%B5%E3%81%A7%E3%81%8D%E3%81%9F%E9%9B%BB%E5%AD%90%E5%B7%A5%E4%BD%9C%E3%81%A8%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E9%96%8B%E7%99%BA\" target=\"_blank\"  onclick=\"window.open(this.href,'Pokcetwindow','width=650,height=450,menubar=no,toolbar=no,scrollbars=yes');return false;\"><span class=\"vk_icon_w_r_sns_pocket icon_sns\"><\/span><span class=\"sns_txt\">Pocket<\/span><span class=\"veu_count_sns_pocket\"><\/span><\/a><\/li><li class=\"sb_copy sb_icon\"><button class=\"copy-button sb_icon_inner\"data-clipboard-text=\"\u5b9f\u8df5\u3067\u304d\u305f\u96fb\u5b50\u5de5\u4f5c\u3068\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u958b\u767a https:\/\/www.elehobby.fun\/?p=4161\"><span class=\"vk_icon_w_r_sns_copy icon_sns\"><i class=\"fas fa-copy\"><\/i><\/span><span class=\"sns_txt\">Copy<\/span><\/button><\/li><\/ul><\/div><!-- [ \/.socialSet ] -->","protected":false},"excerpt":{"rendered":"<p>\u3053\u308c\u306f\u3001\u30e6\u30fc\u30b6\u30fc \u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306bJetpack Compose\u3092\u4f7f\u7528\u3057\u3001&nbsp;Firebase Authentication\u3001Crashlytics\u3001Cloud Firestore\u3001Performance Mo [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"vkexunit_cta_each_option":"","footnotes":""},"categories":[16],"tags":[],"class_list":["post-4161","post","type-post","status-publish","format-standard","hentry","category-electronicswork"],"_links":{"self":[{"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=\/wp\/v2\/posts\/4161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4161"}],"version-history":[{"count":1,"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=\/wp\/v2\/posts\/4161\/revisions"}],"predecessor-version":[{"id":4162,"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=\/wp\/v2\/posts\/4161\/revisions\/4162"}],"wp:attachment":[{"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}