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
Mode offline Cocoaheads
Search
Mathieu Hausherr
May 17, 2018
Technology
100
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Mode offline Cocoaheads
Mathieu Hausherr
May 17, 2018
More Decks by Mathieu Hausherr
See All by Mathieu Hausherr
Mobilis In Mobile 2024 - iOS, Android et la voiture - État des lieux
mhausherr
0
100
FrenchKit - Contact Tracing & Exposure Notification
mhausherr
0
230
FRAUG StopCovid19 : Le point sur les applications de tracing Bluetooth
mhausherr
1
280
Swift Lille - CoreML / CreateML
mhausherr
0
120
Image classification in real world : Car rental damage report
mhausherr
0
110
Les surcouches constructeur sur Android
mhausherr
1
900
Mode offline : Notre application Android fonctionne au niveau -5 d’un parking
mhausherr
0
1.5k
Mode offline : Notre application mobile fonctionne au niveau -5 d’un parking
mhausherr
1
150
CocoaHeads : Apple Pay
mhausherr
0
86
Other Decks in Technology
See All in Technology
非定型なドキュメントを効率よくリファクタする 〜えぇ!?仕様書27本の移行が1日で終わったって!?〜
subroh0508
2
550
しぶいSRE: サーバから見えない障害にどう向き合うか。ラストワンマイルのデバッグ実践 / Shibui SRE
kanny
13
6.4k
個人開発で育てる「大規模設計の苗床」 - AI時代の1人開発から始める業務への知識接続 / The Seedbed for Large-Scale Design - From AI-Era Solo Projects to Professional Knowledge
bitkey
PRO
1
270
End-to-Endで考える信頼性 —LINEアプリにおけるクライアント開発×SRE連携の実践
maruloop
4
4.5k
Foxgloveについて 実際にExtensionを開発して公開するまでの話 / About Foxglove: The Story of Developing and Releasing an Extension
ry0_ka
0
290
しくみを学んで使いこなそう GitHub Copilot app
torumakabe
2
280
DatabricksにおけるMCPソリューション
taka_aki
1
270
AIレビューはどこまで任せられるのか?自動化と人が背負うレビューの境界
sansantech
PRO
3
1k
脱金融のフューチャー・デザイン / Future Design Beyond Finance
ks91
PRO
0
150
人を動かすのは時間ではなく、納得感 〜新任EMが入社3ヶ月、組織を2回変えた話〜
kakehashi
PRO
3
260
実践!既存 Project への AI-Driven Development 適用〜 一ヶ月で Project 唯一のフロントエンドエンジニアを作り出せ〜
lycorptech_jp
PRO
0
140
見守りエージェントを作ってみた(ローカルLLM + Hermes Agent)
happysamurai294
0
110
Featured
See All Featured
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
390
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
The Curse of the Amulet
leimatthew05
2
13k
Thoughts on Productivity
jonyablonski
76
5.2k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.6k
Done Done
chrislema
186
16k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
380
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
390
Speed Design
sergeychernyshev
33
1.9k
Transcript
CocoaHeads Mathieu Hausherr @mhausherr 1 https://www.youtube.com/watch?v=wc38XyAA43o
Mode offline Notre application fonctionne au niveau -5 d’un parking
2
3
4
5
6
7
8
9
10
X
12
13
14
X Version 0.0.1-alpha
16
17 Plus jamais ça !
X Cache all requests if !isNetworkReachable && readFromCache(handler) { return
} manager.request(baseURL + path, method: method, parameters: parameters, encoding: encoding) .validate() .responseJSON { response in switch response.result { case .failure(let error): self.readFromCache(handler) case .success: self.writeResponseToCache(response: response) } }
X Cache all requests if !isNetworkReachable && readFromCache(handler) { return
} manager.request(baseURL + path, method: method, parameters: parameters, encoding: encoding) .validate() .responseJSON { response in switch response.result { case .failure(let error): self.readFromCache(handler) case .success: self.writeResponseToCache(response: response) } }
X Cache all requests if !isNetworkReachable && readFromCache(handler) { return
} manager.request(baseURL + path, method: method, parameters: parameters, encoding: encoding) .validate() .responseJSON { response in switch response.result { case .failure(let error): self.readFromCache(handler) case .success: self.writeResponseToCache(response: response) } }
X Cache all requests if !isNetworkReachable && readFromCache(handler) { return
} manager.request(baseURL + path, method: method, parameters: parameters, encoding: encoding) .validate() .responseJSON { response in switch response.result { case .failure(let error): self.readFromCache(handler) case .success: self.writeResponseToCache(response: response) } }
X Cache strategies switch cacheMode { case .standard: if !isNetworkReachable
&& readFromCache(handler) { return } case .forceCache: readFromCache(handler); return case .twoStepLoading: readFromCache(handler) }
X Cache strategies switch cacheMode { case .standard: if !isNetworkReachable
&& readFromCache(handler) { return } case .forceCache: readFromCache(handler); return case .twoStepLoading: readFromCache(handler) }
X Cache strategies switch cacheMode { case .standard: if !isNetworkReachable
&& readFromCache(handler) { return } case .forceCache: readFromCache(handler); return case .twoStepLoading: readFromCache(handler) }
X cache before call call cache after call standard forceCache
noCache twoStepLoading
X Cache Swift func getData() -> Data? { try? Data(contentsOf:
cacheURL) } func set(data: Data) { try? data.write(to: cacheURL, options: [.atomic]) } var isCacheStillValid: Bool { guard let attributes = try? FileManager.default.attributesOfItem(atPath: pathForCacheFile) else { return false } guard let modificationDate = attributes[FileAttributeKey.modificationDate] as? Date else { return false } return self.cacheDuration - modificationDate.timeIntervalSinceNow > 0 }
X Cache Swift func getData() -> Data? { try? Data(contentsOf:
cacheURL) } func set(data: Data) { try? data.write(to: cacheURL, options: [.atomic]) } var isCacheStillValid: Bool { guard let attributes = try? FileManager.default.attributesOfItem(atPath: pathForCacheFile) else { return false } guard let modificationDate = attributes[FileAttributeKey.modificationDate] as? Date else { return false } return self.cacheDuration - modificationDate.timeIntervalSinceNow > 0 }
X
29 Bien joué les gars !
X Version 1.0.0
31
X Déclaration la plus rapide possible, image avec sha256 POST
/inspection [{ "created_at": …, "zone_id": …, "image_hash": … }]
33
X Notifications silencieuses iOS <key>UIBackgroundModes</key> <array> <string>remote-notification</string> </array>
X Version 1.1.0
36
X
X
X
X Image cache Swift class ImageCache { var inMemoryCache: [URL:
UIImage] = [:] func image(forURL url: URL) -> UIImage? { if let image = inMemoryCache[url] { return image } if let image = readImageFromCache(url) { inMemoryCache[urlString] = image; return image } else { return nil } } }
X Premiers retours utilisateurs
42
X
X
X
X Version 2.7.0
X 400 voitures 250 000 téléchargements
X Pour tester
49 Merci