Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup push notifications #424

Merged
merged 84 commits into from
Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from 78 commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
3ce3814
setup airship in RN, iOS, Android
roryabraham Sep 2, 2020
deab109
port code from BrowserNotifications to Notification/index.js
roryabraham Sep 8, 2020
9ac89a5
export enableUserNotifications and call it in Expensify::componentDid…
roryabraham Sep 8, 2020
f4b3617
isClientTheLeader is a promise
roryabraham Sep 8, 2020
42ce96a
Merge branch 'master' into Rory-PushNotifications
roryabraham Sep 8, 2020
7714a1c
revert react-native-notification libary add and remove blank file
roryabraham Sep 16, 2020
9dbe08e
update browser notifications to match master
roryabraham Sep 16, 2020
f93400b
merge master into Rory-PushNotifications
roryabraham Sep 16, 2020
4a98da3
got it running on a physical device
roryabraham Sep 17, 2020
1572e4d
present notifications in the foreground on iOS
roryabraham Sep 22, 2020
4bae637
bump deployment target back to iOS 11, it was necessary
roryabraham Sep 24, 2020
6acfdc8
separate out browser notifications from push notifications
roryabraham Sep 24, 2020
8b8e20f
setup push notifications in separate module
roryabraham Sep 24, 2020
866d8dd
register/deregister for push notifications on signin/signout
roryabraham Sep 25, 2020
8103e06
Setup listeners and action binding for push notifications
roryabraham Sep 25, 2020
67820ac
rename browser notifications to localnotifications
roryabraham Sep 25, 2020
54f9cbc
ignore push notifications if app is in the foreground
roryabraham Sep 25, 2020
d2d20d2
Merge branch 'master' into Rory-PushNotifications
roryabraham Sep 25, 2020
5bf7eaf
merge master into Rory-PushNotifications
roryabraham Sep 25, 2020
cfed894
fix merge error
roryabraham Sep 25, 2020
d7292dd
fixed issues with Ion.clear()
roryabraham Sep 29, 2020
90f7a44
Merge branch 'master' into Rory-PushNotifications
roryabraham Sep 30, 2020
26b7b7c
fix Ion.clear to never pass object key to AsyncStorage
roryabraham Sep 30, 2020
16a9ef3
fix JS style
roryabraham Sep 30, 2020
b58ff7d
reconfigure iOS push notifications
roryabraham Sep 30, 2020
1d181ae
fix Ion.clear, for real this time
roryabraham Oct 1, 2020
28809b1
add console debug for subscribing/unsubscribing from push notifications
roryabraham Oct 1, 2020
29a4599
success, receiving push notifications through our API and cli tools
roryabraham Oct 1, 2020
e4016e7
setup callbacks for notificationResponse events as well as PushReceived
roryabraham Oct 2, 2020
2243eaf
only setNamedUser if accountID has changed
roryabraham Oct 2, 2020
e5477c8
update exports in index.js as well as index.native.js
roryabraham Oct 3, 2020
1326414
use multiRemove instead of clear
roryabraham Oct 3, 2020
ea04e7a
get rid of unnecessary second finally
roryabraham Oct 3, 2020
9f2cf11
clean up constants
roryabraham Oct 5, 2020
f1b7992
lift Ion.connect to module top-level
roryabraham Oct 5, 2020
a51a9d7
simplify Ion.clear()
roryabraham Oct 5, 2020
5976aef
merge master into Rory-PushNotifications
roryabraham Oct 5, 2020
c24ee99
use register and deregister instead of Ion.connect
roryabraham Oct 5, 2020
b069751
test and clean up push notification registration
roryabraham Oct 5, 2020
15bc4e5
rebuild project to fix bad merge
roryabraham Oct 5, 2020
93fb232
got basic android notificaitons showing up
roryabraham Oct 6, 2020
221ddb8
simplify promise chain and remove second call to AsyncStorage.clear
roryabraham Oct 6, 2020
70c1c33
merge master into Rory-PushNotifications
roryabraham Oct 6, 2020
1dd1ad4
Merge branch 'master' into Rory-PushNotifications
roryabraham Oct 6, 2020
e760d20
make android push notifications pretty
roryabraham Oct 7, 2020
ed2ef62
fix ion clear
roryabraham Oct 7, 2020
a7f8bbb
revert/simplify changes to BrowserNotifications
roryabraham Oct 7, 2020
3ecd752
clean up event binding
roryabraham Oct 7, 2020
e64fe75
clean up constants
roryabraham Oct 7, 2020
5ae956f
remove unnecessary call to PushNotification.register
roryabraham Oct 7, 2020
bea5156
clean up console debugs
roryabraham Oct 7, 2020
ffa7192
clean up callback handler
roryabraham Oct 7, 2020
22ca23c
add comments and nix Ion.clear changes
roryabraham Oct 7, 2020
4416772
remove unnecessary object copy in bind
roryabraham Oct 7, 2020
f783f3d
use lodashGet instead of optional chaining
roryabraham Oct 7, 2020
1ba6496
add note about callback overwriting
roryabraham Oct 7, 2020
95818a5
return promise from Ion.clear
roryabraham Oct 7, 2020
7645985
use || instead of ??, and add comment
roryabraham Oct 7, 2020
105fb11
update comment on opt-in status
roryabraham Oct 7, 2020
7f0915c
Merge branch 'master' into Rory-PushNotifications
roryabraham Oct 7, 2020
a226e40
move PushNotification.register, update comment, fix redirection
roryabraham Oct 7, 2020
e721350
Open to correct report
roryabraham Oct 8, 2020
7e1402e
Merge branch 'master' into Rory-PushNotifications
roryabraham Oct 8, 2020
3ddecd4
fix bad merge
roryabraham Oct 8, 2020
8d26246
refactor to use props instead of state
roryabraham Oct 10, 2020
c7ef42e
Merge branch 'master' into Rory-PushNotifications
roryabraham Oct 10, 2020
0c80e86
fix bad merge
roryabraham Oct 10, 2020
a6ef943
rename hamburgerShown prop to sidebarShown
roryabraham Oct 12, 2020
3aa3db9
use actions instead of ion
roryabraham Oct 12, 2020
e01231b
rename prop to match ion key
roryabraham Oct 12, 2020
0bcc2e9
get rid of unnecessary check in componentDidUpdate
roryabraham Oct 12, 2020
4048e53
Merge branch 'master' into Rory-PushNotifications
roryabraham Oct 13, 2020
7661304
get rid of isCompletedAnimation flag and fix issue with desktop load
roryabraham Oct 13, 2020
fd2a44a
add method doc and remove redundancies
roryabraham Oct 14, 2020
7321830
move setupEventListeners into register
roryabraham Oct 14, 2020
9eb0598
revert desktop changes and fix android bug
roryabraham Oct 14, 2020
479b045
fix desktop initial render bug and signin/signout bug
roryabraham Oct 14, 2020
6e0665c
improve debug logs and move deregister
roryabraham Oct 14, 2020
6b8b7d6
Merge branch 'master' into Rory-PushNotifications
roryabraham Oct 14, 2020
344343f
clean pods (but leave manual signing
roryabraham Oct 14, 2020
a1a1c35
Merge branch 'master' into Rory-PushNotifications
roryabraham Oct 15, 2020
b49e7d4
remove native import bug
roryabraham Oct 15, 2020
27553a9
allow notification response callbacks when app is in foreground
roryabraham Oct 20, 2020
60865d7
try to fix bad merge
roryabraham Oct 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,8 @@ task copyDownloadableDepsToLibs(type: Copy) {
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

def googleServicesFile = rootProject.file('app/google-services.json')
if (googleServicesFile.exists()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this check if we're adding google-services.json to the project?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is output by the RN build process - I wouldn't mess with it unnecessarily. Besides, Android push notifications won't work without google-services.json

apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
}
47 changes: 47 additions & 0 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"project_info": {
"project_number": "921154746561",
"firebase_url": "https://expensify-chat.firebaseio.com",
"project_id": "expensify-chat",
"storage_bucket": "expensify-chat.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:921154746561:android:4f04268f25f84eaf027c40",
"android_client_info": {
"package_name": "com.expensify.chat"
}
},
"oauth_client": [
{
"client_id": "921154746561-gpsoaqgqfuqrfsjdf8l7vohfkfj7b9up.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCVwQb9lBI06bDIwHOw10AkdJyquXoMngk"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "921154746561-gpsoaqgqfuqrfsjdf8l7vohfkfj7b9up.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "921154746561-s3uqn2oe4m85tufi6mqflbfbuajrm2i3.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.chat.expensify.chat"
}
}
]
}
}
}
],
"configuration_version": "1"
}
9 changes: 9 additions & 0 deletions android/app/src/main/assets/airshipconfig.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
developmentAppKey = uulSSfTDQJ2r0PMpjRrhmQ
developmentAppSecret = D4Bhf0HrQEehrPua74Tyiw

productionAppKey = 55vypj0ARc6cN09MX7ogtQ
productionAppSecret = EsSaqbdLSvmyC6kSBFJCtQ

# Notification Customization
notificationIcon = ic_notification
notificationAccentColor = #2EAAE2
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ buildscript {
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
classpath("com.google.gms:google-services:4.2.0")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to use 4.3.4 here? Just asking b/c I'm also adding this in this PR

Copy link
Contributor Author

@roryabraham roryabraham Oct 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no opinion here - again, I didn't write any of this config stuff manually.


// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
16 changes: 16 additions & 0 deletions ios/AirshipConfig.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>detectProvisioningMode</key>
<true/>
<key>developmentAppKey</key>
<string>uulSSfTDQJ2r0PMpjRrhmQ</string>
<key>developmentAppSecret</key>
<string>D4Bhf0HrQEehrPua74Tyiw</string>
<key>productionAppKey</key>
<string>55vypj0ARc6cN09MX7ogtQ</string>
<key>productionAppSecret</key>
<string>EsSaqbdLSvmyC6kSBFJCtQ</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'
platform :ios, '11.0'
roryabraham marked this conversation as resolved.
Show resolved Hide resolved

target 'ReactNativeChat' do
config = use_native_modules!
Expand Down
23 changes: 22 additions & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
PODS:
- Airship (13.5.4):
- Airship/Automation (= 13.5.4)
- Airship/Core (= 13.5.4)
- Airship/ExtendedActions (= 13.5.4)
- Airship/MessageCenter (= 13.5.4)
- Airship/Automation (13.5.4):
- Airship/Core
- Airship/Core (13.5.4)
- Airship/ExtendedActions (13.5.4):
- Airship/Core
- Airship/MessageCenter (13.5.4):
- Airship/Core
marcaaron marked this conversation as resolved.
Show resolved Hide resolved
- boost-for-react-native (1.63.0)
- CocoaAsyncSocket (7.6.4)
- CocoaLibEvent (1.0.0)
Expand Down Expand Up @@ -312,6 +324,9 @@ PODS:
- React
- RNCPushNotificationIOS (1.5.0):
- React
- urbanairship-react-native (8.1.0):
- Airship (= 13.5.4)
- React
- Yoga (1.14.0)
- YogaKit (1.18.1):
- Yoga (~> 1.14)
Expand Down Expand Up @@ -370,10 +385,12 @@ DEPENDENCIES:
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- "RNCAsyncStorage (from `../node_modules/@react-native-community/async-storage`)"
- "RNCPushNotificationIOS (from `../node_modules/@react-native-community/push-notification-ios`)"
- urbanairship-react-native (from `../node_modules/urbanairship-react-native`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
trunk:
- Airship
- boost-for-react-native
- CocoaAsyncSocket
- CocoaLibEvent
Expand Down Expand Up @@ -452,10 +469,13 @@ EXTERNAL SOURCES:
:path: "../node_modules/@react-native-community/async-storage"
RNCPushNotificationIOS:
:path: "../node_modules/@react-native-community/push-notification-ios"
urbanairship-react-native:
:path: "../node_modules/urbanairship-react-native"
Yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
Airship: cbbd372a4ffc8dcfeacec01fd623155ec41f33ed
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
CocoaAsyncSocket: 694058e7c0ed05a9e217d1b3c7ded962f4180845
CocoaLibEvent: 2fab71b8bd46dd33ddb959f7928ec5909f838e3f
Expand Down Expand Up @@ -499,9 +519,10 @@ SPEC CHECKSUMS:
ReactCommon: 4167844018c9ed375cc01a843e9ee564399e53c3
RNCAsyncStorage: db711e29e5e0500d9bd21aa0c2e397efa45302b1
RNCPushNotificationIOS: 8025ff0b610d7b28d29ddc1b619cd55814362e4c
urbanairship-react-native: fa123940041a6a13ab7dac192e32833c53754f00
Yoga: 7d13633d129fd179e01b8953d38d47be90db185a
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: 7f6bb9c130ea13236f8249f800f75d671c1833fa
PODFILE CHECKSUM: d03a22d8299d9564ca7fc55d0a779f6fbf0d2b37

COCOAPODS: 1.9.3
Loading