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

WIP: feature Push Notification #75

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:theme="@style/AppTheme">
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:exported="true">
<intent-filter>
Expand Down
95 changes: 39 additions & 56 deletions assets/images/Bg_asset.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions ios/EphemeraMobileChat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
5709B34CF0A7D63546082F79 /* Pods-EphemeraMobileChat.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EphemeraMobileChat.release.xcconfig"; path = "Target Support Files/Pods-EphemeraMobileChat/Pods-EphemeraMobileChat.release.xcconfig"; sourceTree = "<group>"; };
5B7EB9410499542E8C5724F5 /* Pods-EphemeraMobileChat-EphemeraMobileChatTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EphemeraMobileChat-EphemeraMobileChatTests.debug.xcconfig"; path = "Target Support Files/Pods-EphemeraMobileChat-EphemeraMobileChatTests/Pods-EphemeraMobileChat-EphemeraMobileChatTests.debug.xcconfig"; sourceTree = "<group>"; };
5DCACB8F33CDC322A6C60F78 /* libPods-EphemeraMobileChat.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-EphemeraMobileChat.a"; sourceTree = BUILT_PRODUCTS_DIR; };
68B9EB672BF7DE32006398E1 /* EphemeraMobileChat.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = EphemeraMobileChat.entitlements; path = EphemeraMobileChat/EphemeraMobileChat.entitlements; sourceTree = "<group>"; };
78611DF31EED3FF745D00249 /* ExpoModulesProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExpoModulesProvider.swift; path = "Pods/Target Support Files/Pods-EphemeraMobileChat/ExpoModulesProvider.swift"; sourceTree = "<group>"; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = EphemeraMobileChat/LaunchScreen.storyboard; sourceTree = "<group>"; };
89C6BE57DB24E9ADA2F236DE /* Pods-EphemeraMobileChat-EphemeraMobileChatTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EphemeraMobileChat-EphemeraMobileChatTests.release.xcconfig"; path = "Target Support Files/Pods-EphemeraMobileChat-EphemeraMobileChatTests/Pods-EphemeraMobileChat-EphemeraMobileChatTests.release.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -90,6 +91,7 @@
13B07FAE1A68108700A75B9A /* EphemeraMobileChat */ = {
isa = PBXGroup;
children = (
68B9EB672BF7DE32006398E1 /* EphemeraMobileChat.entitlements */,
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
13B07FB01A68108700A75B9A /* AppDelegate.mm */,
13B07FB51A68108700A75B9A /* Images.xcassets */,
Expand Down Expand Up @@ -539,8 +541,9 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = EphemeraMobileChat/EphemeraMobileChat.entitlements;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = QB5WFHTRW9;
DEVELOPMENT_TEAM = FY4NZR34Z3;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = EphemeraMobileChat/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
Expand All @@ -555,7 +558,7 @@
"-lc++",
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = org.ephemera.EphemeraMobileChat;
PRODUCT_NAME = EphemeraMobileChat;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand All @@ -569,8 +572,9 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = EphemeraMobileChat/EphemeraMobileChat.entitlements;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = QB5WFHTRW9;
DEVELOPMENT_TEAM = FY4NZR34Z3;
INFOPLIST_FILE = EphemeraMobileChat/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -584,7 +588,7 @@
"-lc++",
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = org.ephemera.EphemeraMobileChat;
PRODUCT_NAME = EphemeraMobileChat;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
Expand Down
3 changes: 2 additions & 1 deletion ios/EphemeraMobileChat/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#import <RCTAppDelegate.h>
#import <Expo/Expo.h>
#import <UIKit/UIKit.h>
#import <UserNotifications/UNUserNotificationCenter.h>

@interface AppDelegate : EXAppDelegateWrapper
@interface AppDelegate : EXAppDelegateWrapper <UNUserNotificationCenterDelegate>

@end
34 changes: 34 additions & 0 deletions ios/EphemeraMobileChat/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#import <React/RCTBundleURLProvider.h>
#import <React/RCTLinkingManager.h>
#import <UserNotifications/UserNotifications.h>
#import <RNCPushNotificationIOS.h>

@implementation AppDelegate

Expand All @@ -11,6 +13,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
self.initialProps = @{};
// Define UNUserNotificationCenter
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;

return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
Expand All @@ -33,4 +38,33 @@ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(N
return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options];
}

// Required for the register event.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
[RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
// Required for the notification event. You must call the completion handler after handling the remote notification.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
[RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
// Required for the registrationError event.
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
[RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error];
}
// Required for localNotification event
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void (^)(void))completionHandler
{
[RNCPushNotificationIOS didReceiveNotificationResponse:response];
}
//Called when a notification is delivered to a foreground app.
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);
}

@end
8 changes: 8 additions & 0 deletions ios/EphemeraMobileChat/EphemeraMobileChat.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>aps-environment</key>
<string>development</string>
</dict>
</plist>
6 changes: 5 additions & 1 deletion ios/EphemeraMobileChat/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>xmtp-chat</string>
<string>ephemera-chat</string>
</array>
</dict>
</array>
Expand All @@ -42,6 +42,10 @@
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
Expand Down
43 changes: 37 additions & 6 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,45 @@
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
)', __dir__]).strip
def node_require(script)
# Resolve script with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
"require.resolve(
'#{script}',
{paths: [process.argv[1]]},
)", __dir__]).strip
end

node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')

platform :ios, '16.0'
prepare_react_native_project!

setup_permissions([
# 'AppTrackingTransparency',
# 'Bluetooth',
# 'Calendars',
# 'CalendarsWriteOnly',
# 'Camera',
# 'Contacts',
# 'FaceID',
# 'LocationAccuracy',
# 'LocationAlways',
# 'LocationWhenInUse',
# 'MediaLibrary',
# 'Microphone',
# 'Motion',
'Notifications',
# 'PhotoLibrary',
# 'PhotoLibraryAddOnly',
# 'Reminders',
# 'Siri',
# 'SpeechRecognition',
# 'StoreKit',
])

# node_require('react-native/scripts/react_native_pods.rb')
# node_require('react-native-permissions/scripts/setup.rb')

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
Expand Down
48 changes: 33 additions & 15 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ PODS:
- CoinbaseWalletSDKExpo (1.0.10):
- CoinbaseWalletSDK/CrossPlatform (= 1.0.4)
- ExpoModulesCore
- Connect-Swift (0.3.0):
- SwiftProtobuf (~> 1.20.3)
- Connect-Swift (0.12.0):
- SwiftProtobuf (~> 1.25.2)
- DoubleConversion (1.1.6)
- EXApplication (5.8.3):
- ExpoModulesCore
Expand Down Expand Up @@ -122,7 +122,7 @@ PODS:
- libwebp/sharpyuv (1.3.2)
- libwebp/webp (1.3.2):
- libwebp/sharpyuv
- LibXMTP (0.4.2-beta5)
- LibXMTP (0.4.4-beta5)
- Logging (1.0.0)
- MessagePacker (0.4.7)
- MMKV (1.3.5):
Expand Down Expand Up @@ -1202,6 +1202,8 @@ PODS:
- React-Core
- RNCClipboard (1.13.2):
- React-Core
- RNCPushNotificationIOS (1.11.0):
- React-Core
- RNDeviceInfo (10.12.0):
- React-Core
- RNFastImage (8.6.3):
Expand All @@ -1210,6 +1212,10 @@ PODS:
- SDWebImageWebPCoder (~> 0.8.4)
- RNLocalize (3.0.6):
- React-Core
- RNPermissions (4.1.5):
- React-Core
- RNReactNativeHapticFeedback (2.2.0):
- React-Core
- RNReanimated (3.6.2):
- glog
- RCT-Folly (= 2022.05.16.00)
Expand All @@ -1230,7 +1236,7 @@ PODS:
- secp256k1.swift (0.1.4)
- simdjson (3.1.0-wmelon1)
- SocketRocket (0.6.1)
- SwiftProtobuf (1.20.3)
- SwiftProtobuf (1.25.2)
- WatermelonDB (0.27.1):
- React
- simdjson
Expand All @@ -1239,16 +1245,16 @@ PODS:
- GenericJSON (~> 2.0)
- Logging (~> 1.0.0)
- secp256k1.swift (~> 0.1)
- XMTP (0.8.15):
- Connect-Swift (= 0.3.0)
- XMTP (0.10.11):
- Connect-Swift (= 0.12.0)
- GzipSwift
- LibXMTP (= 0.4.2-beta5)
- LibXMTP (= 0.4.4-beta5)
- web3.swift
- XMTPReactNative (1.28.0-beta.13):
- XMTPReactNative (1.33.1-beta.1):
- ExpoModulesCore
- MessagePacker
- secp256k1.swift
- XMTP (= 0.8.15)
- XMTP (= 0.10.11)
- Yoga (1.14.0)

DEPENDENCIES:
Expand Down Expand Up @@ -1348,9 +1354,12 @@ DEPENDENCIES:
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
- "RNCClipboard (from `../node_modules/@react-native-clipboard/clipboard`)"
- "RNCPushNotificationIOS (from `../node_modules/@react-native-community/push-notification-ios`)"
- RNDeviceInfo (from `../node_modules/react-native-device-info`)
- RNFastImage (from `../node_modules/react-native-fast-image`)
- RNLocalize (from `../node_modules/react-native-localize`)
- RNPermissions (from `../node_modules/react-native-permissions`)
- RNReactNativeHapticFeedback (from `../node_modules/react-native-haptic-feedback`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`)
- RNSVG (from `../node_modules/react-native-svg`)
Expand Down Expand Up @@ -1537,12 +1546,18 @@ EXTERNAL SOURCES:
:path: "../node_modules/@react-native-async-storage/async-storage"
RNCClipboard:
:path: "../node_modules/@react-native-clipboard/clipboard"
RNCPushNotificationIOS:
:path: "../node_modules/@react-native-community/push-notification-ios"
RNDeviceInfo:
:path: "../node_modules/react-native-device-info"
RNFastImage:
:path: "../node_modules/react-native-fast-image"
RNLocalize:
:path: "../node_modules/react-native-localize"
RNPermissions:
:path: "../node_modules/react-native-permissions"
RNReactNativeHapticFeedback:
:path: "../node_modules/react-native-haptic-feedback"
RNReanimated:
:path: "../node_modules/react-native-reanimated"
RNScreens:
Expand All @@ -1565,7 +1580,7 @@ SPEC CHECKSUMS:
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
CoinbaseWalletSDK: ea1f37512bbc69ebe07416e3b29bf840f5cc3152
CoinbaseWalletSDKExpo: c79420eb009f482f768c23b6768fc5b2d7c98777
Connect-Swift: d38eedc1907d440314f8d26d5a038a00cbb0f6f1
Connect-Swift: 1de2ef4a548c59ecaeb9120812dfe0d6e07a0d47
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
EXApplication: 137189a3f149b4e8e546884629392c3efc94cbd3
EXConstants: 988aa430ca0f76b43cd46b66e7fae3287f9cc2fc
Expand Down Expand Up @@ -1594,7 +1609,7 @@ SPEC CHECKSUMS:
hermes-engine: b12d9bb1b7cee546f5e48212e7ea7e3c1665a367
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009
LibXMTP: 3cbd1d0dd44ae3648f571a0e81bbe73565759e67
LibXMTP: e2fb601691981900099551ff3e05621bd73dccf1
Logging: 9ef4ecb546ad3169398d5a723bc9bea1c46bef26
MessagePacker: ab2fe250e86ea7aedd1a9ee47a37083edd41fd02
MMKV: 506311d0494023c2f7e0b62cc1f31b7370fa3cfb
Expand Down Expand Up @@ -1653,9 +1668,12 @@ SPEC CHECKSUMS:
ReactCommon: 1da3fc14d904883c46327b3322325eebf60a720a
RNCAsyncStorage: 618d03a5f52fbccb3d7010076bc54712844c18ef
RNCClipboard: 60fed4b71560d7bfe40e9d35dea9762b024da86d
RNCPushNotificationIOS: 64218f3c776c03d7408284a819b2abfda1834bc8
RNDeviceInfo: db5c64a060e66e5db3102d041ebe3ef307a85120
RNFastImage: 5c9c9fed9c076e521b3f509fe79e790418a544e8
RNLocalize: 4222a3756cdbe2dc9a5bdf445765a4d2572107cb
RNPermissions: 5b96247c15864f9d89d7f51eeb0f2b736a2b212d
RNReactNativeHapticFeedback: ec56a5f81c3941206fd85625fa669ffc7b4545f9
RNReanimated: 4f0931c29b1535a3a40a6c06797b1d9d39f50754
RNScreens: 17e2f657f1b09a71ec3c821368a04acbb7ebcb46
RNSVG: d00c8f91c3cbf6d476451313a18f04d220d4f396
Expand All @@ -1664,13 +1682,13 @@ SPEC CHECKSUMS:
secp256k1.swift: a7e7a214f6db6ce5db32cc6b2b45e5c4dd633634
simdjson: e6bfae9ce4bcdc80452d388d593816f1ca2106f3
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
SwiftProtobuf: b02b5075dcf60c9f5f403000b3b0c202a11b6ae1
SwiftProtobuf: 407a385e97fd206c4fbe880cc84123989167e0d1
WatermelonDB: 842d22ba555425aa9f3ce551239a001200c539bc
web3.swift: 2263d1e12e121b2c42ffb63a5a7beb1acaf33959
XMTP: 00fe090825e6bc5991870c1925befc06b1a30b78
XMTPReactNative: cf4227bf733870dc0331f3925cea852cafd43928
XMTP: 1deb40ac712ba315dcfdecd590a9b924d8c2241a
XMTPReactNative: 6f6d54c67a140a5abaf70b2f3ec1757561edc9f5
Yoga: 2a16e58450c48e110211dae1159fb114bbcdcfc0

PODFILE CHECKSUM: 605f5beea10db7b4d01fe2949787bef356832da3
PODFILE CHECKSUM: 47641fd2f7a6fc6169785131e7615d136e56edd8

COCOAPODS: 1.15.2
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@react-native-clipboard/clipboard": "^1.13.2",
"@react-native-community/blur": "^4.3.2",
"@react-native-community/netinfo": "^11.2.1",
"@react-native-community/push-notification-ios": "^1.11.0",
"@react-navigation/native": "^6.1.9",
"@react-navigation/native-stack": "^6.9.17",
"@tanstack/query-sync-storage-persister": "^5.36.1",
Expand All @@ -30,7 +31,7 @@
"@thirdweb-dev/react-native": "^0.5.4",
"@thirdweb-dev/react-native-compat": "^0.5.4",
"@xmtp/frames-client": "^0.5.1",
"@xmtp/react-native-sdk": "1.28.0-beta.13",
"@xmtp/react-native-sdk": "1.33.1-beta.1",
"aws-sdk": "^2.1540.0",
"ethers": "^5",
"expo": ">=50.0.0-0 <51.0.0",
Expand All @@ -46,11 +47,14 @@
"react-native-encrypted-storage": "^4.0.3",
"react-native-fast-image": "^8.6.3",
"react-native-get-random-values": "^1.10.0",
"react-native-haptic-feedback": "^2.2.0",
"react-native-image-picker": "^7.1.0",
"react-native-linear-gradient": "^2.8.3",
"react-native-localize": "^3.0.4",
"react-native-mmkv": "^2.11.0",
"react-native-modal": "^13.0.1",
"react-native-permissions": "^4.1.5",
"react-native-push-notification": "^8.1.1",
"react-native-qrcode-svg": "^6.2.0",
"react-native-randombytes": "^3.6.1",
"react-native-reanimated": "^3.6.1",
Expand All @@ -72,6 +76,7 @@
"@react-native/typescript-config": "^0.73.1",
"@types/jest": "^29.5.11",
"@types/react": "^18.2.6",
"@types/react-native-push-notification": "^8.1.4",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"detox": "^20.17.0",
Expand Down
Loading
Loading