Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Firestoreを利用したMAPアプリの開発について

DaikiOKA
August 22, 2019

 Firestoreを利用したMAPアプリの開発について

DaikiOKA

August 22, 2019
Tweet

More Decks by DaikiOKA

Other Decks in Programming

Transcript

  1. 5XJUUFS*% !OPSJOPSJ@PLB Ԭେو • ৽ଔͰZERO TO ONEʹೖࣾ͠ɺ nori-naʹδϣΠϯ͢Δɻ • ࣾձਓ̏೥໨ࣾ಺།ҰͷΞϓϦΤ

    ϯδχΞ • iOS(Objective-CɺSwift)ɺ Android(JavaɺKotlin)ɺWebͱ αʔόʔ(CakePHPɺTypeScript) Ͱ։ൃ ࣗݾ঺հ DBSBRVSJ5FDI/JHIU
  2. ࢖༻ͨ͠MAP .BQ,JU (PPHMF.BQ ਌࿨ੑ σϑΥϧτ αʔυύʔςΟʔ ྉۚ ແྉ ैྔ੍ ܦ࿏දࣔ

    ͋Γ ͳ͠ ϝϞϦ গͳ͍ ଟ͍ MapKitͷศརͳ఺ ɾٯGeocodingɿҢ౓ܦ౓͔ΒॅॴΛऔಘՄೳ GoogleMapͷศརͳ఺ ɾετϦʔτϏϡʔ ɾ༗໊ͳ؍ޫ஍ͷ৘ใΛදࣔՄೳ DBSBRVSJ5FDI/JHIU
  3. ຖճϢʔβʔΛಡΈࠐΉ JGMFUMBTU$FOUFS-PDBUJPOTFMGMBTU$FOUFS-PDBUJPO  MBTU$FOUFS-PDBUJPOEJTUBODF UBSHFUMPDBUJPO TFMGNPWJOH5ISFTIPVME SPVUF%JTQMBZGBMTF\ NҎ্Ҡಈͨ͠Βɺߋ৽ TFMGSFMPBE"OOPUBUJPO MPDBUJPOMPDBUJPO

    SBEJVTNBQ6TFS*O  ^FMTFJGTFMGMBTU$FOUFS-PDBUJPOOJMSPVUF%JTQMBZGBMTF\ ࠷ॳͷϩʔυ TFMGSFMPBE"OOPUBUJPO MPDBUJPOMPDBUJPO SBEJVTNBQ6TFS*O  ^FMTFJGTFMGNBQ7JFXBOOPUBUJPOTDPNQBDU.BQ \BT 6TFS"OOPUBUJPO^ JT&NQUZ\ TFMGSFMPBE"OOPUBUJPO MPDBUJPOMPDBUJPO SBEJVTNBQ6TFS*O  ^ DBSBRVSJ5FDI/JHIU
  4. දࣔ͢ΔϢʔβʔΛ·ͱΊΔ JGNBQ7JFX[PPN-FWFMTFMGNBQ;PPN-FWFM5ISFTIPVME\ NBQ7JFXBOOPUBUJPOTGPS&BDI\BOOPUBUJPOJO JGMFUDMVTUFSBOOPUBUJPOBT .,$MVTUFS"OOPUBUJPO\ NBQ7JFXSFNPWF"OOPUBUJPO DMVTUFS  DMVTUFSNFNCFS"OOPUBUJPOTGPS&BDI\ BOOPUBUJPO

    JO JGMFUBOOPUBUJPOBOOPUBUJPOBT %SJWFS"OOPUBUJPO\ NBQ7JFXSFNPWF"OOPUBUJPO BOOPUBUJPO  ^ ^ NBQ7JFXBEE"OOPUBUJPOT DMVTUFSNFNCFS"OOPUBUJPOT  ^ ^ ^ DBSBRVSJ5FDI/JHIU
  5. ϓογϡ௨஌ onCreate export const pushRideshareRequest = functions.firestore .document(commonUtil.makePath('ridesharerequest/{requestId}')) .onCreate((snap, context)

    => { const newValue = new firestoreModels.RideShareRequest(snap.data()); const to = newValue.to; console.log(`push start ridesharerequest : ${context.params.requestId}`); return pushMessageByUserId(to, '૬৐Γґཔ͕ಧ͖·ͨ͠ɻ಺༰Λ֬ೝͯ͠ڐՄ͠·͠ΐ͏ɻ'); }); DBSBRVSJ5FDI/JHIU
  6. ϓογϡ௨஌ onUpdate export const pushLikeComment = functions.firestore .document(commonUtil.makePath('mapcomment/{mapcommentId}')) .onUpdate((change, context)

    => { const afterData = new firestoreModels.MapComment(change.after.data()); const afterLike = afterData.likeMembers.length; const beforeData = new firestoreModels.MapComment(change.before.data()); const beforeLike = beforeData.likeMembers.length; const toUserId = afterData.user; if (!toUserId) return null; if (beforeLike < afterLike) { return pushMessageByUserId(toUserId, '͍͍Ͷ͕ԡ͞Ε·ͨ͠ʂ'); } return null; }); DBSBRVSJ5FDI/JHIU
  7. ςετίʔυ QVTI%FTUJOBUJPO6QEBUF  \ CFGPSF\ TDSFFO/BNFVTF  MPDBUJPO\ MBUJUVEF 

    MPOHJUVEF ^  EFTUJOBUJPO\ OBNF5  HFP-PDBUJPO\ MBUJUVEF  MPOHJUVEF ^ ^ ^  BGUFS\ TDSFFO/BNFVTFS  MPDBUJPO\ MBUJUVEF  MPOHJUVEF ^  EFTUJOBUJPO\ OBNF5PLZP5PXFS  HFP-PDBUJPO\ MBUJUVEF  MPOHJUVEF ^ ^ ^ ^  \ QBSBNT\ VTFS*EVTFS ^ ^  DBSBRVSJ5FDI/JHIU • beforeͱafterʹͦΕͧ ΕσʔλΛهड़ • params͸ඞཁͳ࣌ͷ Έ
  8. Cloud Functionͷ৽ػೳ Scheduler export const cronRemindShare = functions.pubsub //.schedule("0 18

    * * *")//ຖ೔18࣌ʹ࣮ߦ .schedule("every 5 minutes")//̑෼͓͖ .timeZone("Asia/Tokyo") .onRun(async context => { console.log("͜͜Ͱఆظ࣮ߦ") });