Skip to content

Commit

Permalink
feat: notification 연동 (#2)
Browse files Browse the repository at this point in the history
* chore: image 관련 코드 제거

* fix: expo doctor fix

* chore: add lefthook hook

* chore: eas add

* chore: add eas.json

* feat: notification android setup

* feat: notification setting
  • Loading branch information
XionWCFM authored Feb 2, 2025
1 parent 2893dd9 commit b916a4c
Show file tree
Hide file tree
Showing 17 changed files with 383 additions and 234 deletions.
40 changes: 40 additions & 0 deletions .easignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files

# dependencies
node_modules/

# Expo
.expo/
dist/
web-build/
expo-env.d.ts

# Native
*.orig.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision

# Metro
.metro-health-check*

# debug
npm-debug.*
yarn-debug.*
yarn-error.*

# macOS
.DS_Store
*.pem

# local env files
.env*.local

# typescript
*.tsbuildinfo
firebase_adminsdk.json

/ios
/android
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ yarn-error.*

# typescript
*.tsbuildinfo
firebase_adminsdk.json
google-services.json

/ios
/android
59 changes: 37 additions & 22 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import * as Notifications from "expo-notifications";
import { useRef } from "react";
import type WebView from "react-native-webview";
import { Providers } from "~/app/Providers";
import { WebView as MercuryWebView } from "~/shared/bridge";
import { MercuryStatusBar } from "~/shared/bridge/status-bar";
import { RefreshProvider } from "~/shared/pull-to-refresh/RefreshProvider";
import { NotificationProvider } from "~/shared/pushNotifications/NotificationContext";

const BASE_URL = __DEV__
? "https://www.mercuryplanet.co.kr"
: "https://www.mercuryplanet.co.kr";

const BASE_URL = __DEV__ ? "http://localhost:5173" : "https://app.azito.kr";
const DECELERATION_RATE = 0.999;
const JAVASCRIPT_BEFORE_CONTENTLOADED = `window.__APP_DEV__="${
__DEV__ ? "development" : "production"
Expand All @@ -14,26 +19,36 @@ const JAVASCRIPT_BEFORE_CONTENTLOADED = `window.__APP_DEV__="${
export default function App() {
const webViewRef = useRef<WebView>(null);
return (
<Providers>
<MercuryStatusBar />
<RefreshProvider webViewRef={webViewRef}>
<MercuryWebView
ref={webViewRef}
source={{ uri: BASE_URL }}
style={{ flex: 1 }}
mixedContentMode={"always"}
webviewDebuggingEnabled={__DEV__}
javaScriptEnabled={true}
bounces={true}
allowsBackForwardNavigationGestures={true}
decelerationRate={DECELERATION_RATE}
overScrollMode={"never"}
scrollEnabled={true}
injectedJavaScriptBeforeContentLoaded={
JAVASCRIPT_BEFORE_CONTENTLOADED
}
/>
</RefreshProvider>
</Providers>
<NotificationProvider>
<Providers>
<MercuryStatusBar />
<RefreshProvider webViewRef={webViewRef}>
<MercuryWebView
ref={webViewRef}
source={{ uri: BASE_URL }}
style={{ flex: 1 }}
mixedContentMode={"always"}
webviewDebuggingEnabled={__DEV__}
javaScriptEnabled={true}
bounces={true}
allowsBackForwardNavigationGestures={true}
decelerationRate={DECELERATION_RATE}
overScrollMode={"never"}
scrollEnabled={true}
injectedJavaScriptBeforeContentLoaded={
JAVASCRIPT_BEFORE_CONTENTLOADED
}
/>
</RefreshProvider>
</Providers>
</NotificationProvider>
);
}

Notifications.setNotificationHandler({
handleNotification: async () => ({
shouldShowAlert: true,
shouldPlaySound: true,
shouldSetBadge: true,
}),
});
72 changes: 46 additions & 26 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,48 @@
{
"expo": {
"name": "Mercury",
"slug": "Mercury",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"newArchEnabled": true,
"splash": {
"image": "./assets/splash-icon.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#ffffff"
}
},
"web": {
"favicon": "./assets/favicon.png"
}
}
"expo": {
"name": "Mercury",
"slug": "mercury",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"newArchEnabled": true,
"splash": {
"image": "./assets/splash-icon.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"ios": {
"supportsTablet": false,
"bundleIdentifier": "kr.co.mercuryplanet.www"
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#ffffff"
},
"package": "kr.co.mercuryplanet.www",
"googleServicesFile": "./google-services.json"
},
"plugins": [
[
"expo-notifications",
{
"icon": "./assets/notification_icon.png",
"color": "#ffffff",
"defaultChannel": "default",
"enableBackgroundRemoteNotifications": false
}
]
],
"web": {
"favicon": "./assets/favicon.png"
},
"owner": "mercuryorganization",
"extra": {
"eas": {
"projectId": "2f8476ef-cef6-471c-88a0-12a322330cad"
}
}
}
}
Binary file modified assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/notification_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 14 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,20 @@
"quoteStyle": "double",
"attributePosition": "auto"
},
"globals": ["describe", "it", "test", "expect", "JSX", "React", "beforeEach", "afterEach", "vi", "afterAll", "beforeAll"]
"globals": [
"__DEV__",
"describe",
"it",
"test",
"expect",
"JSX",
"React",
"beforeEach",
"afterEach",
"vi",
"afterAll",
"beforeAll"
]
},
"files": {
"ignore": [
Expand Down
21 changes: 21 additions & 0 deletions eas.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"cli": {
"version": ">= 14.4.0",
"appVersionSource": "remote"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"production": {
"autoIncrement": true
}
},
"submit": {
"production": {}
}
}
6 changes: 6 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ pre-commit:
lint:
run: pnpm run check:biome
stage_fixed: true
test-type:
run: pnpm run test:type
stage_fixed: true
test-doctor:
run: pnpm run test:doctor
stage_fixed: true
Loading

0 comments on commit b916a4c

Please sign in to comment.