Every week, we’ll give you an overview of the best deals for designers, make sure you don’t miss any by subscribing to our deals feed. You can also follow the recently launched website Type Deals if you are looking for free fonts or font deals.
30+ Professional Font Families
Here’s a chance to instantly beef up your typeface toolbox. With this Mighty Deal, you’ll get more than 30 professional full font families at one crazy low price. That’s a wide variety of styles to work with, meaning you can deliver pure success to any of your clients, as well as attract plenty of new ones.
250+ Smoke Effects Including Shapes, Brushes, Patterns and More
There’s nothing like a misty, smoky effect to set the mood. With this Smoke Toolkit from Cruzine, you’ll get everything you could possibly need to set the tone! Smoke shapes, brushes, patterns, effects, backgrounds and more, are all at your fingertips. That’s more than 250 smoky tools, provided in fully customizable, layered PSD files. Remember, where there’s smoke, there’s fire. And where there’s fire… there’s a red hot deal!
A value of $1800+ Now get 109 fonts with super low price for $18 only. Do not miss, get today! Also includes many alternative characters.Is coded with PUA Unicode, which allows full access to all the extra characters without having special designing software. Mac users can use Font Book. Windows users can use Character Map to view and copy any of the extra characters to paste into your favourite text editor. For folks who have opentype capable software : The alternates are accessible by turning on “Stylistic Alternates” and “Ligatures” buttons on in Photoshop’s Character panel, or via any software with a glyphs panel, e.g. Adobe Illustrator, Photoshop CC, Inkscape.
The Mila Script Pro Font Family: Script, Sans & Ornaments
It’s time to meet the Mila Script Pro Font Family! This amazing collection of handmade script and sans typefaces includes a handmade brush script with round and soft letterforms, as well as a sans style for easy reading. Besides a slew of helpful OpenType features to really create flexibility in your work, you’ll get an Ornaments style of more than 50 useful swashes and symbols to tie it all together.
I received a really wonderful question from Bryan Braun the other day during a workshop I was giving at Sparkbox. He asked if, over the years, if there were opinions about web design and development I strongly held that I don’t anymore.
I really didn’t have a great answer at the time, even though surely if I could rewind my brain there would be some embarrassing ones in there.
At the risk of some heavy self-back-patting, this is exactly the reason I try and be pretty open-minded. If you aren’t, you end up eating crow. And for what? When you crap on an idea, you sound like a jerk at the time, and likely cause more harm than good. If you end up right, you were still a jerk. If you end up wrong, you were a jerk and a fool.
I like the sentiment the web is a big place. It’s a quick way of saying there are no hard and fast right answers in a playground this big with loose rules, diversity of everything, and economic overlords.
I don’t want to completely punt on this question though.
I’ve heard Trent Walton say a number of times that, despite him being all-in on Responsive Web Design now, at first it seemed like a very bad idea to him.
I remember feeling very late to the CSS preprocessing world, because I spent years rolling my eyes at it. I thought it the result of back end nerds sticking their noses into something and bringing programming somewhere that didn’t need it. Looking back, it was mostly me being afraid to learn the tools needed to bring it into a workflow.
It’s not to find industry-wide holy wars these days, where strongly held opinions duke it over time, and probably end up giving ground to each other in the end.
But what of those internal personal battles? I’d be very interested to hear people’s answers on this…
What strongly-help opinion did you used to have about web design and development, but not anymore?
You know those those „introduction” emails? Someone thinks you should meet someone else, and emails happen about it. Or it’s you doing the introducing, either by request or because you think it’s a good idea. Cutting to the chase here, those emails could be done better. Eight years ago, Fred Wilson coined the term „double opt-in intro”.
This is how it can work.
You’re doing the vetting
Since you’re writing the emails here, it’s your reputation at stake here. If you do an introduction that is obnoxious for either side, they’ll remember. Make sure you’re introducing people that you really do think should know each other. Like a bizdev cupid.
You’re gonna do two (or three) times writing
The bad way to do an intro is to email both people at once. Even if this introduction has passed your vetting, you have no idea how it’s going to turn out. There is a decent chance either of them or both aren’t particularly interested in this, which makes you look like a dolt. It doesn’t respect either of their time, puts your reputation at risk, and immediately puts everyone into an awkward position (if they ignore it they look like an asshole).
Instead, you’re going to write two emails, one to each person you’re trying to introduce. And you’re not going to reveal who the other person is, except with non-identifying relevant details and your endorsement.
They do the opt-ing in
If either of the folks are interested in this introduction, they can email you back. Give them an easy out though, I’d say something like „if for any reason you aren’t into it, just tell me so or ignore this, I promise I understand”. If you don’t make it easy to blow you off, it’s your just transferring the awkward situation to yourself.
If either of them isn’t into it, it doesn’t matter. They don’t know who the other is and there is no awkwardness or burnt bridge.
If both are into it, great, now it’s time for the third email actually introducing them. Get out of the way quickly.
It’s about more than awkwardness and reputation, it’s about saftey
See:
It's also why double opt-in intros are *a must*. Please please please don't go intro'ing people to each other without asking first.
Just because you have someone’s email address in your book doesn’t mean you should be giving it out to anyone that asks. Better to just assume any contact info you have for someone else is extremely private and only to be shared with their permission.
Pandas are cute and very easy to draw, because of their plump body
and characteristic pattern. In this tutorial I will lead you step by
step to help you draw your own giant panda. It will be simple and fun!
What You Will Need
If you’re drawing digitally, you have all you need in your program. If you prefer traditional tools, I suggest:
Pencil
Black marker pen/felt-tip pen
1. How to Sketch a Panda’s Body
Step 1
Sketch an oval for the main body.
Step 2
Add a circle for the head.
Step 3
Connect both parts with gentle lines.
Step 4
Draw two slanting lines to sketch the distance between the legs.
Step 5
Attach the legs to the ends of those lines. Make them slightly curved towards the ground.
2. How to Draw a Panda’s Legs
Step 1
Attach ovals to the legs to create a base for the feet.
Step 2
Draw ovals on them. This will make the joints look thicker.
Step 3
Outline the limbs. They should be big and fluffy.
Step 4
Add volume to the arms.
Step 5
Sketch the line of the shoulders.
Step 6
Sketch five claws on every foot.
3. How to Draw a Panda’s Face
Step 1
Draw a cross on the face to find its center. Keep in mind the head is spherical, not as flat as it seems.
Step 2
Draw a circle to create the muzzle.
Step 3
Draw circles on the sides of the muzzle, in the upper part.
Step 4
Draw smaller circles inside. These will be the actual eyes.
Step 5
Draw two bigger circles below. This will help us create the shape of the panda’s eye patch.
Step 6
Draw the nose.
Step 7
Draw the smile under the nose.
Step 8
Draw two big circles for the cheeks.
Step 9
Draw the place for the ears.
Step 10
Draw the rounded ears.
4. How to Finish the Drawing of a Panda
If you’re drawing digitally, do this part on a new layer. If you’re drawing traditionally, this is the time to take the darker, thicker tool.
Step 1
Outline the legs. Make them smooth on one side and fluffy on the other.
Step 2
Outline the fluffy ears and the face details.
Step 3
Outline the whole head.
Step 4
Outline the rest of the body.
Step 5
Outline the claws.
Step 6
Add some detail to the muzzle.
Step 7
Draw the borders of the black-and-white pattern.
Step 8
Darken the patterns. If you want, you can leave white shine dots in the eyes.
So Cute!
That’s a beautiful panda! If you liked this tutorial, you may also enjoy these:
Led by the hashtag #GoodImpressionsLiveOn, the spot features a heart-warming boy-girl story of separation, and how they eventually reunited as a result of their circumstances, thus driving home the message of how it is the smallest of impressions that truly matter.
Passion for Life – that’s what GARDENA stands for. Therefor all of GARDENA’s products aim to inspire humans to go out and re-connect with nature and life.
Idea: Twitter is one of the most known and used Apps and a terminal, when it comes to fake news. But in fact its name refers to a thing, one can only experience offline, in “real” nature.
When the Original GARDENA System (OGS) came out in 1968 it changed watering forever.
Idea: The reliability and versatility of the OGS enables gardeners to bring any kind of rain – and therefor is the real cause, why rain became one of the most common issues in popular music in the last 50 years.
Combining 2D and 3D styles in different creative ways has been a part of multiple design trends over the years. This tutorial will show you how to use Photoshop’s 3D tools and settings to create an abstract 3D displaced text effect, with a touch of a Retro/Memphis Style feel. Let’s get started!
1. How to Create the Background and 3D Elements Layers
Step 1
Create a new 1000 x 1000 px document, click the Create new fill or adjustment layer icon at the bottom of the Layers panel, and choose Gradient.
Create the gradient fill using the Colors#d99c9c to the left, #b294c5 in the center, and #72a9be to the right, and change the Angle to -120.
Step 2
Create the text in All Caps, each word in a separate layer, using the font Bahn Pro. Set the Size to 200 and the Tracking value to 100.
Step 3
Create three new layers, fill them with any color you like, and name them from bottom to top: Sphere, Pyramid, and Cylinder.
2. How to Create 3D Layers
Step 1
For each text layer you have, select it and go to 3D > New 3D Extrusion from Selected Layer.
Then, select the Sphere layer and go to 3D > New Mesh from Layer > Mesh Preset > Sphere, select the Pyramid layer and go to 3D > New Mesh from Layer > Mesh Preset > Pyramid, and select the Cylinder layer and go to 3D > New Mesh from Layer > Mesh Preset > Cylinder.
Step 2
Select all the 3D layers, go to 3D > Merge 3D Layers, and rename the merged layer 3D Scene.
Step 3
To access the 3D mesh settings and properties, you’ll need to open two panels: the 3D panel and the Properties panel (both found under the Window menu).
The 3D panel has all the components of the 3D scene, and when you click the name of any of those, you’ll be able to access its settings in the Properties panel. So make sure to always select the tab of the element you want to modify in the 3D panel before you change its settings in the Properties panel.
Step 4
If you select the Move Tool, you’ll find a set of 3D Modes for it to the right of the Options bar. When you choose one of those, you can then click and drag to perform changes (on the selected element in the 3D panel).
Use those modes to change the Current View into an angle you like.
Step 5
Click the eye icon next to the Sphere, Pyramid, and Cylinder tabs to hide them.
3. How to Adjust the 3D Mesh Settings
Step 1
Select all the text mesh tabs in the 3D panel, and change their Extrusion Depth in the Properties panel to 0.
Step 2
Select each text mesh tab separately, click the 3D panel menu icon, and choose Move Object to Ground Plane.
Step 3
What we’re going to do next is assign values to the Z Position of each of the text meshes to set them apart from each other evenly.
So, for example, if you have three text meshes, you can change the one in the middle’s Z Position to 0, the one in the front’s to 300, and the one in the back’s to -300.
To assign the Z Position values, click the text mesh tab, and click the Coordinates icon at the top of the Properties panel to make the changes.
Step 4
You can use any values you think look best for your text and number of meshes, but just make sure to keep an equal distance between them.
4. How to Transform 3D Meshes
Step 1
Show the Sphere mesh and select its tab, pick the Move Tool, and use the 3D Axis to scale it up or down.
The arrows at the ends of the axis move the mesh, the part below them is used for rotation, and the cubes are used for scaling. The cube in the center is used to scale the object uniformly. All you need to do is click and drag the part you want to use.
Step 2
You can also use the Coordinates values for that, and if you click the Scale icon, you can check or uncheck the Uniform Scaling option depending on the result you want.
Step 3
Move the Sphere to the Ground Plane, and use the 3D Axis to move it to the final position.
Step 4
Repeat the same steps for the Pyramid and Cylinder meshes.
Notice how when scaling the Cylinder you might need to uncheck the Uniform Scaling box if you’re using the Coordinates values.
Make sure to always move the objects to the Ground Plane once you’re done transforming them.
5. How to Create Basic 3D Materials
Step 1
Select all the text Material tabs, and use these settings in the Properties panel (the color values used are in RGB):
Diffuse: 255, 255, 255
Specular: 183, 183, 183
Shine: 20%
Step 2
Select the Sphere_Material tab, click the Diffuse icon in the Properties panel, and choose Remove Texture.
Step 3
Keep in mind that you can use any other values for the material settings, but the ones used here are:
Diffuse: 163, 216, 236
Specular: 121, 114, 114
Shine: 30%
Reflection: 3%
Roughness: 30%
Step 4
Select all the Pyramid Material tabs, remove the Diffuse texture, and use these settings:
Diffuse: 241, 155, 93
Specular: 221, 199, 147
Shine: 30%
Reflection: 3%
Roughness: 30%
Step 5
Select the Cylinder’s Top_Material and Bottom_Material tabs, remove the Diffuse texture, and use these settings:
Diffuse: 17, 17, 17
Specular: 75, 72, 75
Shine: 50%
Reflection: 10%
Roughness: 30%
Step 6
Select the Cylinder_Material tab, remove the Diffuse texture, and use these settings:
Diffuse: 141, 128, 179
Specular: 190, 194, 220
Shine: 80%
Reflection: 30%
Roughness: 30%
6. How to Create a Simple Vertical Stripes Pattern
Step 1
Create a new 50 x 10pxWhite filled document, use the Rectangular Marquee Tool to select the left half, and fill it with Black.
Step 2
Press Command-D to deselect, go to Edit > Define Pattern, type Stripes Pattern in the Name field, and click OK.
7. How to Create a Bump Texture
Step 1
Select the Cylinder_Material tab, click its Bump icon in the Properties panel, and choose New Texture.
Step 2
Set both the Width and Height values to 500 and click OK.
Step 3
This will open the new file; if not, select the Bump texture icon and choose Edit Texture.
Create a new layer and fill it with White.
Step 4
Double-click the new layer to apply a Pattern Overlay effect using the Stripes Pattern.
Step 5
Save and close the file.
8. How to Edit the UV Properties
Step 1
Click the Bump texture icon and choose Edit UV Properties.
Step 2
Change the Tile’s V/Y value to 1 and the U/X value to whatever looks best on your Cylinder mesh, and click OK.
9. How to Add a Mesh Environment Texture
Step 1
With the Cylinder_Material tab still selected, click the Environment folder icon at the bottom of the Properties panel, and choose New Texture.
Step 2
Change both the Width and Height values to 1000 and click OK.
Step 3
Duplicate the Background layer, and double-click the copy to apply a Gradient Overlay effect using the Stainless Steel 166c gradient fill.
Step 4
Save and close the file when you’re done.
Step 5
You can try other gradient fills as well to get different lighting results.
10. How to Adjust Miscellaneous 3D Settings
Step 1
Select all text mesh tabs, and uncheck the Cast Shadows box in the Properties panel.
Step 2
Select the Scene tab, and under the Remove Hidden option in the Properties panel, check the Backfaces option.
Step 3
Click the Current View tab, and click the Orthographic icon in the Properties panel.
What this does is maintain parallel lines without convergence, which means displaying the meshes in accurate scale view without any perspective distortion.
Step 4
Now is a good time to choose a final camera angle, so that you can make any final changes to the scene.
Step 5
After you choose the final view, you can use the 3D Axis to move the meshes around, or scale them as needed.
11. How to Adjust a 3D Scene’s Lighting
Step 1
Select the Infinite Light 1 tab, and change its Intensity to 20% and its Shadow Softness to 50%.
Step 2
Move the light to an angle that best suits your final view, and you can use the Coordinates values if needed to do so.
Step 3
Select the Environment tab, click the IBL texture icon, and choose Edit Texture.
Step 4
Add a Solid Color fill layer, and use the Color fill (100, 100, 100). Save and close the file when done.
Step 5
Go to 3D > Render 3D Layer. The rendering might take a while, but you can stop it any time by pressing the Esc key.
Step 6
Once the rendering is done, right-click the 3D Scene layer and choose Convert to Smart Object to avoid making any accidental changes.
12. How to Create a Basic Paper Shape
Step 1
Use the Rectangle Tool to create a rectangle shape behind the 3D Scene.
Step 2
Pick the Direct Selection Tool, and use it to select and move the anchor points, to get a parallelogram-like shape.
Use the 3D Scene as a reference to make the shape look like a part of it.
Step 3
Use the Add Anchor Point Tool to add an anchor point on each of the two vertical sides.
Step 4
Use the Direct Selection Tool to nudge each of the added points to make the vertical sides a little bit curved in the same direction.
Step 5
Add two more points, one on each of the sides next to the top right corner’s anchor point. These will be used to create the corner fold, so keep that in mind when placing them.
13. How to Work With Anchor Points
Step 1
Rename the shape layer you have to Back, duplicate it, rename the copy to Front, and change its Fill Color to #ea6b9b.
Step 2
Select the Front layer, and use the Direct Selection Tool to click-drag the top right corner’s anchor point inwards to the center, creating a basic folded shape.
You can then adjust the shape by moving the surrounding anchor points and their handles.
Any adjustments should be very minimum and subtle, and should not affect the part of the shape that’s outside the two points around the corner.
Step 3
Pick the Delete Anchor Point Tool, select the Back layer, and click the top right corner’s anchor point to delete it.
This will create the outer curve of the fold, which you can subtly adjust if necessary as well.
Step 4
Change the Back layer’s Fill Color to #8b8b8b, and duplicate each of the Back and Front layers.
14. How to Create a Folded Shape
Step 1
Select both copy layers and move them on top of the 3D Scene layer.
Step 2
With both copy layers still selected, go to Layer > Combine Shapes > Subtract Front Shape. Rename the resulting layer to Fold, and change its Fill Color to #ee90b3.
Step 3
Pick the Direct Selection Tool, click the Path operations icon in the Options bar, and choose Merge Shape Components.
15. How to Add Gradient Overlays
Step 1
Double-click the Fold layer to apply a Gradient Overlay with these settings:
Check the Dither box
Blend Mode: Soft Light
Opacity: 35%
Angle: -157
Use the Black, White gradient fill
Step 2
While the Layer Style box is still open, you can click-drag the gradient inside the shape to adjust its Angle if you like.
Step 3
When you’re done, right-click the Fold layer, choose Copy Layer Style, right-click the Front layer, and choose Paste Layer Style.
16. How to Add Shadows
Step 1
Select the Back layer, and use the Direct Selection Tool to drag the bottom anchor points of the shape and create a shadow shape, which should follow the 3D Scene’s shadow direction.
Step 2
Right-click the Back layer, choose Convert to Smart Object, and change its layer’s Blend Mode to Multiply and its Opacity to 50%.
Step 3
Go to Filter > Blur > Gaussian Blur, and set the Radius to a value around 20.
Step 4
Command-click the Front layer’s thumbnail to create a selection.
Step 5
Create a new layer below the Fold layer, name it Shadow, change its Opacity to 35%, and pick the Brush Tool.
Set the Foreground Color to Black, and use a soft round tip to add some shadow underneath the fold.
You can change the brush tip’s Opacity value in the Options bar to get subtler results.
17. How to Create Zigzag Lines
Step 1
Create a new layer on top of all layers, name it Lines, and pick the Pen Tool.
Choose the Path option in the Options bar, and click once to add anchor points that create zigzag shapes around the text.
When you’re done creating a path, Command-click outside it to separate it from the next one.
Step 2
Pick the Brush Tool, choose a hard round 4 px tip, and hit the Return key to stroke the paths you have.
Pick the Direct Selection Tool and hit the Return key again to get rid of the work path.
Step 3
Double-click the Lines layer to apply a Gradient Overlay effect with these settings:
Check the Dither box
Angle: 157
Create the Gradient using the Colors#f5cd2c to the left and #f1e48b to the right.
18. How to Apply Global Adjustments
Step 1
Create a new layer on top of all layers, name it High Pass, and press the Command-Option-Shift-E keys to create a stamp.
Convert the layer into a Smart Object, and change its Blend Mode to Soft Light.
Step 2
Go to Filter > Other > High Pass, and change the Radius to 1.5.
Step 3
Add a Vibrance adjustment layer on top of all layers, and change the Vibrance value to 10.
Step 4
Add a Curves adjustment layer on top of all layers, and click-drag the center of the curve a little bit upwards to brighten up the image.
Step 5
Double-click the Curves layer to get its Blending Options.
We will use the Blend If’s Underlying Layer’s sliders to control how the Curves effect is applied.
So Option-click the Shadows slider to split it, and drag each of its ends to the right to exclude or protect the shadows from being affected by the Curves layer.
Splitting the slider will help create a gradual effect instead of a harsh one. So the right side will determine the amount of shadows protected, and the left side will fade the effect.
After adjusting the slider, change the Blend Mode to Soft Light, and the Opacity to 30%.
Step 6
Add another Curves adjustment layer, but this time, drag the curve’s center downwards to darken the image.
Step 7
Double-click the second Curves layer to repeat the same steps, only this time you’ll be excluding the Highlights, which means you’ll be adjusting the Highlights slider.
So make sure to split it and drag its sides until you get a result you like, and change the Blend Mode and Opacity values when done.
19. How to Add Noise
Step 1
Create a new layer on top of all layers, and name it Noise.
Step 2
Go to Edit > Fill, and change the Contents to 50% Gray.
Step 3
Convert the Noise layer into a Smart Object, and change its Blend Mode to Soft Light.
Step 4
Go to Filter > Noise > Add Noise, and change the Amount to 7 and the Distribution to Uniform.
You can use any other values you prefer as well.
Awesome Work, You’re Done!
In this tutorial, we created a couple of text and shape layers, and converted them to 3D meshes. Then, we adjusted the meshes’ settings and created their materials, as well as adjusting the scene’s lighting to render it. After that, we used shape tools and options to create a folded paper shape and some zigzag lines. Finally, we added global adjustments to finish off the effect.
Please feel free to leave your comments, suggestions, and outcomes below.
You know those the little notification windows that pop up in the top right (Mac) or bottom right (Windows) corner when, for example, a new article on our favorite blog or a new video on YouTube was uploaded? Those are push notifications.
Part of the magic of these notifications is that they can appear even when we’re not currently on that website to give us that information (after you’ve approved it). On mobile devices, where supported, you can even close the browser and still get them.
Article Series:
Setting Up & Firebase (You are here!)
The Back End (Coming soon!)
Push notification on a Mac in Chrome
A notification consists of the browser logo so the user knows from which software it comes from, a title, the website URL it was sent from, a short description, and a custom icon.
We are going to explore how to implement push notifications. Since it relies on Service Workers, check out these starting points if you are not familiar with it or the general functionality of the Push API:
You are free to choose the back-end system which suits you best. I went with Firebase since it offers a special API which makes implementing a push notification service relatively easy.
In this part, we’ll only focus on the front end, including the Service Worker and manifest, but to use Firebase, you will also need to register and create a new project.
Implementing Subscription Logic
HTML
We have a button to subscribe which gets enabled if 'serviceWorker' in navigator. Below that, a simple form and a list of posts:
Now we can initialize Firebase using the credentials given under Project Settings → General. The sender ID can be found under Project Settings → Cloud Messaging. The settings are hidden behind the cog icon in the top left corner.
Firebase offers its own service worker setup by creating a file called `firebase-messaging-sw.js` which holds all the functionality to handle push notifications. But usually, you need your Service Worker to do more than just that. So with the useServiceWorker method we can tell Firebase to use our own `service-worker.js` file as well.
Now we can create a userToken and a isSubscribed variable which will be used later on.
Notice the function initializePush() after the Service Worker registration. It checks if the current user is already subscribed by looking up a token in localStorage. If there is a token, it changes the button text and saves the token in a variable.
Here we also handle the click event on the subscription button. We disable the button on click to avoid multiple triggers of it.
Update the Subscription Button
To reflect the current subscription state, we need to adjust the button’s text and style. We can also check if the user did not allow push notifications when prompted.
Let’s say the user visits us for the first time in a modern browser, so he is not yet subscribed. Plus, Service Workers and Push API are supported. When he clicks the button, the subscribeUser() function is fired.
Here we ask permission to send push notifications to the user by writing messaging.requestPermission().
The browser asking permission to send push notifications.
If the user blocks this request, the button is adjusted the way we implemented it in the updateBtn() function. If the user allows this request, a new token is generated, saved in a variable as well as in localStorage. The token is being saved in our database by updateSubscriptionOnServer().
Save Subscription in our Database
If the user was already subscribed, we target the right database reference where we saved the tokens (in this case device_ids), look for the token the user already has provided before, and remove it.
Otherwise, we want to save the token. With .once('value'), we receive the key values and can check if the token is already there. This serves as second protection to the lookup in localStorage in initializePush() since the token might get deleted from there due to various reasons. We don’t want the user to receive multiple notifications with the same content.
function updateSubscriptionOnServer(token) {
if (isSubscribed) {
return database.ref('device_ids')
.equalTo(token)
.on('child_added', snapshot => snapshot.ref.remove())
}
database.ref('device_ids').once('value')
.then(snapshots => {
let deviceExists = false
snapshots.forEach(childSnapshot => {
if (childSnapshot.val() === token) {
deviceExists = true
return console.log('Device already registered.');
}
})
if (!deviceExists) {
console.log('Device subscribed');
return database.ref('device_ids').push(token)
}
})
}
Unsubscribe User
If the user clicks the button after subscribing again, their token gets deleted. We reset our userToken and isSubscribed variables as well as remove the token from localStorage and update our button again.
Below that we add all events around handling the notification window. In this example, we close the notification and open a website after clicking on it.
Another example would be synchronizing data in the background. Read Google’s article about that.
Show Messages when on Site
When we are subscribed to notifications of new posts but are already visiting the blog at the same moment a new post is published, we don’t receive a notification.
A way to solve this is by showing a different kind of message on the site itself like a little snackbar at the bottom.
To intercept the payload of the message, we call the onMessage method on Firebase Messaging.
The last step for this part of the series is adding the Google Cloud Messaging Sender ID to the `manifest.json` file. This ID makes sure Firebase is allowed to send messages to our app. If you don’t already have a manifest, create one and add the following. Do not change the value.
{
"gcm_sender_id": "103953800507"
}
Now we are all set up on the front end. What’s left is creating our actual database and the functions to watch database changes in the next article.