Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Propagate Remote Config updates in real time
Search
d_date
November 14, 2018
Programming
1.9k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Propagate Remote Config updates in real time
d_date
November 14, 2018
More Decks by d_date
See All by d_date
TCA Practice in 5 min
d_date
2
1.9k
waiwai-swiftpm-part2
d_date
3
600
わいわいSwift PM part 1
d_date
2
490
What's new in Firebase 2021
d_date
2
1.6k
CI/CDをミニマルに構築する
d_date
1
630
Swift Package centered project - Build and Practice
d_date
20
17k
How to write Great Proposal
d_date
4
2.4k
Thinking about Architecture for SwiftUI
d_date
8
2.5k
Integrate your app to modern world in Niigata
d_date
0
760
Other Decks in Programming
See All in Programming
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
0
360
AIと壁打ちしながら進めるコスト管理
fufuhu
2
1.9k
PyO3 で既存 Python 評価器を Rust core 化する ー wasm-bindgen でブラウザにも配るための設計
kdash
1
390
初めての模倣学習とVLA
natsutan
0
470
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
4.3k
新卒PdEのリアル
ryu1013
1
390
新人はどこまで自力でやり、どこからAIに頼るべきか/エンジニア育成に向き合う_先輩たちの悩みと知見共有会
toppan_digital_dev
1
560
ソフトウェアラスタライザ
fadis
1
790
Kiroで創り、AgentCoreで繋ぐ!AWSで実践する「AI-DLC」から「AIエージェント統合」までの最新地図
licux
2
310
高専、大学編入、そして未踏へ〜プロダクト開発とキャリアの歩み - Technical College, University Transfer, and On to “Mitou” / My Journey in Product Development and Career
pkmiya
0
140
Seeing Through Serverless: Observability for AWS Lambda with ADOT and CloudWatch Application Signals
seike460
PRO
1
120
AIは賢い。でも実行環境は? CLIおじさんがAI時代に伝えたいこと ~ CLIおじさんがAI時代に伝えたいこと ~
curekoshimizu
1
150
Featured
See All Featured
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
530
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
560
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
410
Design in an AI World
tapps
1
300
The Cult of Friendly URLs
andyhume
79
7k
Heart Work Chapter 1 - Part 1
lfama
PRO
8
36k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
65k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
400
Transcript
1SPQBHBUF3FNPUF$POH VQEBUFTJOSFBMUJNF 2018/11/14 Firebase Summit 2018 ใࠂձ @Google Daiki Matsudate
/ @d_date
%BJLJ.BUTVEBUF @d_date
1SPQBHBUF3FNPUF$POH VQEBUFTJOSFBMUJNF
None
/&8 3FNPUF$POHUSJHHFST
functions.remoteConfig.onUpdate(versionMetadata => {});
exports.showConfigDiff = functions.remoteConfig.onUpdate(versionMetadata => { return admin.credential.applicationDefault().getAccessToken() .then(accessTokenObj => {
return accessTokenObj.access_token; }) .then(accessToken => { const currentVersion = versionMetadata.versionNumber; const templatePromises = []; templatePromises.push(getTemplate(currentVersion, accessToken)); templatePromises.push(getTemplate(currentVersion - 1, accessToken)); return Promise.all(templatePromises); }) .then(results => { const currentTemplate = results[0]; const previousTemplate = results[1]; const diff = jsonDiff.diffString(previousTemplate, currentTemplate); console.log(diff); return null; }).catch(error => { console.error(error); return null; }); });
1 4VCTDSJCFDMJFOUBQQ JOTUBODFTUPBO'$.UPQJD
extension AppDelegate : MessagingDelegate { func messaging(_ messaging: Messaging, didReceiveRegistrationToken
fcmToken: String) { Messaging.messaging().subscribe(toTopic: "PUSH_RC") { error in print("Subscribed to PUSH_RC topic") } } }
2 $SFBUFBGVODUJPOUPTFOEBO '$.QJOHPOUFNQMBUFVQEBUFT
import * as functions from 'firebase-functions'; import * as admin
from ‘firebase-admin'; admin.initializeApp(); exports.pushConfig = functions.remoteConfig.onUpdate(versionMetadata => { // Create FCM payload to send data message to PUSH_RC topic. const payload: admin.messaging.MessagingPayload = { data: { 'CONFIG_STATE': ‘STALE' } }; const options: admin.messaging.MessagingOptions = { contentAvailable: true } // Use the Admin SDK to send the ping via FCM. return admin.messaging() .sendToTopic('PUSH_RC', payload, options) .then(resp => { console.log(resp); return null; }); });
{ "aps" : { "content-available" : 1 }, }
None
None
None
None
3 4FUUIF3FNPUF$POH TUBUFPOUIFDMJFOU
// Silent push notification func application(_ application: UIApplication, didReceiveRemoteNotification userInfo:
[AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { print("Entire message \(userInfo)") if let _ = userInfo["CONFIG_STATE"] as? String { UserDefaults.standard.set(true, forKey: "CONFIG_STALE") } completionHandler(.newData) }
4 'FUDIUIF3FNPUF$POH VQEBUFTPOBQQTUBSUVQ
func fetchConfig() { welcomeLabel.text = remoteConfig[loadingPhraseConfigKey].stringValue var expirationDuration = 43200
if remoteConfig.configSettings.isDeveloperModeEnabled || UserDefaults.standard.bool(forKey: "CONFIG_STALE") { expirationDuration = 0 UserDefaults.standard.set(false, forKey: "CONFIG_STALE") } remoteConfig.fetch(withExpirationDuration: TimeInterval(expirationDuration)) { (status, error) -> Void in let alertAction: UIAlertAction = .init(title: "OK", style: .default, handler: nil) if status == .success { print("Config fetched!") self.remoteConfig.activateFetched() } else { print("Config not fetched") print("Error: \(error?.localizedDescription ?? "No error available.")") } self.displayWelcome() } }
%&.0
"OBQQDBOGFUDIBNBYJNVNPGUJNFTJOBNJOVUF $BDIJOHBOEUISPUUMJOH
٥3FNPUF$POHUSJHHFST/08"7"*-"#-& ٥4JMFOU1VTI/PUJDBUJPOXJUIˎDPOUFOUBWBJMBCMFˏ ٥&OBCMFSFBMUJNFVQEBUFXJUI3FNPUF$POHBOE'$. 3FDBQ
٥1VTIJOH6QEBUFTUP:PVS"QQ4JMFOUMZ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOVTFSOPUJDBUJPOTTFUUJOH@VQ@B@SFNPUF@OPUJDBUJPO@TFSWFS QVTIJOH@VQEBUFT@UP@ZPVS@BQQ@TJMFOUMZ ٥1SPQBHBUF3FNPUF$POHVQEBUFTJOSFBMUJNF IUUQTSFCBTFHPPHMFDPNEPDTSFNPUFDPOHQSPQBHBUFVQEBUFTSFBMUJNF 3FTPVSDFT
None