Build an App with Blindfold - Britt Barak
-
Upload
droidcontlv -
Category
Technology
-
view
94 -
download
0
Transcript of Build an App with Blindfold - Britt Barak
![Page 1: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/1.jpg)
Build An App With Blindfold
Britt BarakDroidcon TLV
26.9.16
![Page 2: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/2.jpg)
Britt Barak
Britt Barak
@BrittBarak
● Figure 8
● Android Academy TLV
![Page 3: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/3.jpg)
Largest Android Community
Android Academy - TLV
TLV - Android Academy
~ 1500 members Join Us:
![Page 4: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/4.jpg)
Upcoming Events
● Android Beginners - coming on 30/10 !
● Android UI / UX
● Community Hackathon
● Android Performance
● Mentors Program
![Page 5: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/5.jpg)
My First Startup
![Page 6: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/6.jpg)
“As You Like It” / W. Shakespeare
,All the world’s a stage״
And all the men and women merely players;
They have their exits and their entrances,
And one man in his time plays many parts:״
![Page 7: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/7.jpg)
His acts being seven ages. At first, the
infant,
Mewling and puking in the nurse’s arms.
Then the whining schoolboy, with his
satchel
And shining morning face, creeping like
snail
Unwillingly to school. And then the lover,
Sighing like furnace, with a woeful ballad
Made to his mistress’ eyebrow. Then a
soldier,
Full of strange oaths and bearded like the
pard,
Jealous in honor, sudden and quick in
quarrel,
Seeking the bubble reputation
Even in the cannon’s mouth. And then the
justice,
In fair round belly with good capon lined,
With eyes severe and beard of formal cut,
Full of wise saws and modern instances;
And so he plays his part. The sixth age
shifts
Into the lean and slippered pantaloon,
With spectacles on nose and pouch on side;
His youthful hose, well saved, a world too
wide
For his shrunk shank, and his big manly
voice,
Turning again toward childish treble, pipes
And whistles in his sound. Last scene of
all,
That ends this strange eventful history,
Is second childishness and mere oblivion,
Sans teeth, sans eyes, sans taste, sans
everything.
![Page 8: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/8.jpg)
“exits and entrances”
The part can change
But there’s always a defined part.
![Page 9: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/9.jpg)
File → New Project
![Page 10: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/10.jpg)
New Startups
● Uncertainty● Many changes● Low on resources
○ Time○ Developers○ Money
![Page 11: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/11.jpg)
We Want To Deliver Fast!
Premature optimizations are bad
1. Mess Grows2. Structure Stays
![Page 12: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/12.jpg)
Recipe
1. Big picture - who are the “players”?
2. Small use cases - what are the “parts”?
3. Choose POCs - order “exits and entrances”
![Page 13: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/13.jpg)
High Level Structure
Presentation Layer Data LayerDomain Layer
![Page 14: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/14.jpg)
High Level Structure
Presentation Layer
● View● ViewEntity● Presenter
→ Framework
Data Layer
● Repository● Entity
→ Java
Domain Layer
● Interactor● Use case
→ Java
![Page 15: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/15.jpg)
Example : Add Chat Feature To App
![Page 16: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/16.jpg)
Big Picture - The Players
● Add chat feature to the app● Chat between groups of members
![Page 17: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/17.jpg)
Separation
App Module
Chat Module
![Page 18: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/18.jpg)
Why New Module?
- Encapsulate implementation- Easy to replace- Easy to reuse
![Page 19: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/19.jpg)
Structure:
![Page 20: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/20.jpg)
Presentation Layer - App Module
![Page 21: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/21.jpg)
Data Layer - Chat Module
let‘s talk about the data structure.
![Page 22: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/22.jpg)
Firebase DB
- Easy. - noSQL- Flat- Get data by reference
- ref/messages/chat_one_id
![Page 23: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/23.jpg)
Don’t - Nest{
"chats": {
"chatOneId": {
"title": "As You Like It",
"messages": {
"msg1Id": { "sender": "melancholyJaques", "message": "All world’s a stage." },
"msg2Id": { ... },
// a very long list of messages
}
},
"chatTwoId": { ... } }}
![Page 24: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/24.jpg)
Do - Flat : Chats{
"chats": {
"chatOneId": {
"title": "As You Like It"
},
"chatTwoId": { ... },
"chatThreeId": { ... }
}
![Page 25: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/25.jpg)
Do - Flat : Members{
"members": {
"chatOneId": {
"melancholyJaques": true,
"dukeSenior": true,
},
"chatTwoId": { ... },
"chatThreeId": { ... }
},
![Page 26: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/26.jpg)
Do - Flat : Users{
"users": {
"melancholyJaques": {
"name": Melancholy Jaques",
"photoId": "23h42",
"chats": {
"chatOneId": true,
"chatTwoId": true
}
},
...
},
![Page 27: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/27.jpg)
Do - Flat : Messages "messages": {
"chatOneId": {
"msg1Id": {
"sender": "melancholyJaques",
"message": "All world’s a stage.",
"timestamp": 1459361875337
},
"msg2Id": { ... },
// a very long list of messages
},
"chatTwoId": { ... },
}
}
![Page 28: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/28.jpg)
On my code
Chat module: individual separate pieces:
- Chats Repository- Members Repository- Users Repository- Messages Repository
![Page 29: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/29.jpg)
Repository (Data Layer)
Part - provide and update data.
Encapsulates implementation.
![Page 30: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/30.jpg)
public class UsersRepo implements IUsersRepository {
MyFirebaseDBClient firebaseClient;
@Override public void getChatIDs(Callback callback) { firebaseClient.fetchChats(callback); }
![Page 31: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/31.jpg)
public class UsersRepo implements IUsersRepository {
MyFirebaseDBClient firebaseClient; MyCache cache;
@Override public void getChatIDs(Callback callback) { if (cache.hasChats()) { callback.success(cache.getChatIDs()); } else { firebaseClient.fetchChatIDs(callback); } }
![Page 32: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/32.jpg)
public class UsersRepo implements IUsersRepository {
MyFirebaseDBClient firebaseClient; MyCache cache; ChatsLocalDB localDB;
@Override public void getChatIDs(Callback callback) { if (cache.hasChatIDs()) { callback.success(cache.getChatIDs()); } else if (localDB.hasChatIDs()) { callback.success(localDB.getChatIDs()); } else { firebaseClient.fetchChatIDs(callback); } }
![Page 33: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/33.jpg)
public class UsersRepo implements IUsersRepository {
MyApiClient apiClient; MyCache cache; ChatsLocalDB localDB;
@Override public void getChatIDs(Callback callback) { if (cache.hasChatIDs()) { callback.success(cache.getChatIDs()); } else if (localDB.hasChatIDs()) { callback.success(localDB.getChatIDs()); } else { apiClient.fetchChatIDs(callback); } }
![Page 34: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/34.jpg)
Recipe
1. Big picture - who are the “players”?
2. Small use cases - what are the “parts”?
3. Choose POCs - order “exits and entrances”
![Page 35: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/35.jpg)
Domain layer - Use Cases
Use cases / interactors
What does the app do? What are its use cases?
![Page 36: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/36.jpg)
Example: getChatsPreviewList (use case)
![Page 37: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/37.jpg)
Get user’s chat IDs
Get chat’s info
Chats Repo
Get chats preview list
Chat list activity
Users Repo
Get Chat Preview List
![Page 38: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/38.jpg)
Get chats preview list
List<Chat>List<String>
ChatRaw
Get Chat Preview List
List<ChatRaw>
![Page 39: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/39.jpg)
Get Chat Preview Listpublic class GetChatPreviewListImpl implements GetChatsPreviewList {
public void execute(final Callback<List<Chat>> callback) {
usersRepo.getChatIDs(new Callback<List<String>>() {
@Override
public void success(List<String> chatIDs) {
chatsRepo.getChats(new Callback<List<RawChat>>() {
@Override
public void success(List<RawChat> rawChats) {
List<Chat> chats = proccessChats(rawChats);
callback.success(chats);
}
});
}
});
}
![Page 40: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/40.jpg)
Get chats preview list
Get chat members
Get chat messags ….
App Module Will Ask For More
Chat list activity
![Page 41: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/41.jpg)
Recipe
1. Big picture - who are the “players”?
2. Small use cases - what are the “parts”?
3. Choose POCs - order “exits and entrances”
![Page 42: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/42.jpg)
Choose POC
- Play the App Module Part:
- Forget the chat implementation!
- ChatClient - POC class
![Page 43: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/43.jpg)
Chat Client
Get chats preview list
Get chat members
Get chat messags ….
Choose POC
App Module
![Page 44: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/44.jpg)
Get Chat Preview List
Chat list activity
Chat Client
Users Repo
Chats Repo
userId chatIds
![Page 45: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/45.jpg)
Demand
On chats preview list:
show last message
![Page 46: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/46.jpg)
Get Chat Preview List 2
Too messy. Too many listeners and threads. Too much time.
Chat Client
Users Repo
Chat list activity
Chats Repo
userId chatIds
Msgs Repo
Get chats preview list
![Page 47: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/47.jpg)
Get Chat Preview List 3
Add data straight to chat Info node"chats": {
"chatOneId": {
"title": "As You Like It"
"lastMessage": "All world’s a stage" },
"chatTwoId": { ... },
"chatThreeId": { ... }
},
![Page 48: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/48.jpg)
Get Chat Preview List 3
Too messy. Too many listeners and threads. Too much time.
Chat Client
Users Repo
Chat list activity
Chats Repo
userId chatIdsGet chats preview list
![Page 49: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/49.jpg)
But now: more work when sending a message
![Page 50: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/50.jpg)
Send : Before
Chat activity
Chat Client
Msgs RepoSend
![Page 51: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/51.jpg)
Send : After
Chat activity
Chat Client
Msgs RepoSend
Chats Repo
![Page 52: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/52.jpg)
Demand
Message visibility per user.
“Last message”
isn’t general anymore.
![Page 53: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/53.jpg)
Structure - Message
"message1": {
...
"visibleTo": {
"userId1": true,
"userId2": true
},
}
![Page 54: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/54.jpg)
Structure - Personal Chat Info
Chats
General Info
Personal Info
title Last msg
![Page 55: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/55.jpg)
Personal Chat Info Node{
"personalInfo": {
"melancholyJaques": {
"lastMessage": All world’s a stage",
"timestamp": 1459361875337
},
...
},
![Page 56: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/56.jpg)
Get Chat Preview List 4
Too messy. Too many listeners and threads. Too much time.
Chat Client
Users Repo
Chat list activity
userId chatIdsGet chats preview list
personal Info Repo
general Info Repo
![Page 57: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/57.jpg)
Send : Update Per User
App Module
Chat Client
Msgs Repo
userId chatIds
personal Info Repo
Send
Is visible?
![Page 58: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/58.jpg)
But I have many recipients….
Takes long to update each user repo...
![Page 59: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/59.jpg)
Send :
Send
Message Repo
FCM
![Page 60: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/60.jpg)
Receive :
Send Receive
Personal Info Repo
Message Repo
FCM
![Page 61: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/61.jpg)
Give the part to a differenet Player
![Page 62: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/62.jpg)
Sum Up
- Small defined use cases:- Easy to maintain- Easy to change- Easy to test- Mix and match
- “Play the part” → create POC class- Encapsulate implementation- Organize code
- Be mindful to what needs a change
![Page 63: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/63.jpg)
Example changing the part
![Page 64: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/64.jpg)
![Page 65: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/65.jpg)
FCM Usages
- Notify user- Update DB- Update UI- Fetch new data- Start service- ……...
![Page 66: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/66.jpg)
How Does It Work?public class MyFCMService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
//...
}
}
![Page 67: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/67.jpg)
Remote Message Part
Notify about an event.
![Page 68: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/68.jpg)
FCM Handling
Type per message
RemoteMessage
Data….< “type” , “new_chat_message” >….
![Page 69: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/69.jpg)
FCM Handlingpublic class MyFCMService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
String type = data.get(StaticKeys.KEY_TYPE);
switch (type) {
//....
}
}
}
![Page 70: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/70.jpg)
It Worked Great...
We added up more and more events…..
- New chat message- New member added- Member removed- New data available- ………………..
![Page 71: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/71.jpg)
…for some time :-/
- Too many event types
- Too complex code
- Hard to change
- Hard to combine
- Sometimes one usecase represented multiple event types and forced few fcm messages
- The ugly switch-case...
![Page 72: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/72.jpg)
Demand
- Easily support new types- Change remotely
![Page 73: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/73.jpg)
Wait….
Take a step back.
What did we mean to do?
1. Notifying users2. Update data / ui3. Update DB
![Page 74: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/74.jpg)
Remote Message Part
Notify an event.
Notify about stuff that need to be done.
![Page 75: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/75.jpg)
Handle By Data Attributes
RemoteMessage
Data….<“notify” , “true” ><“title” , “New Message” ><“icon” , “ic_chat” ><“click_action”,
“com.figure8.app.action.OPEN_CHAT”><“refresh_members”, chat_id>….
![Page 76: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/76.jpg)
Handle By Data Attributes
Messaging Service
Notif Producer
Data Refresher
DB Updater
Remote Message
Remote Message
![Page 77: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/77.jpg)
Pros
- Flexible
- Update remotely
- Test:
- Test the data producer
- Test the data handler
![Page 78: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/78.jpg)
What Did We Do?
Gave the component a different part.
![Page 79: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/79.jpg)
“exits and entrances”
The part can change
But there’s always a defined part.
![Page 80: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/80.jpg)
Questions?
![Page 81: Build an App with Blindfold - Britt Barak](https://reader033.fdocuments.in/reader033/viewer/2022051502/58edf7cf1a28ab492c8b45e5/html5/thumbnails/81.jpg)
Thank you :)