Skip to content

Commit 5b17a99

Browse files
authored
feat: firebase cloud messaging 추가 (#45)
1 parent 3b21b05 commit 5b17a99

File tree

7 files changed

+132
-13
lines changed

7 files changed

+132
-13
lines changed

frontend/ongi/android/app/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
plugins {
22
id("com.android.application")
3+
// START: FlutterFire Configuration
4+
id("com.google.gms.google-services")
5+
// END: FlutterFire Configuration
36
id("kotlin-android")
47
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
58
id("dev.flutter.flutter-gradle-plugin")

frontend/ongi/android/settings.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ pluginManagement {
1919
plugins {
2020
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
2121
id("com.android.application") version "8.7.3" apply false
22+
// START: FlutterFire Configuration
23+
id("com.google.gms.google-services") version("4.3.15") apply false
24+
// END: FlutterFire Configuration
2225
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
2326
}
2427

frontend/ongi/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
1616
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
1717
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
18+
A8998E2A164F3BCCFBEDB04D /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4ADEE7A686C07303D19FF51D /* GoogleService-Info.plist */; };
1819
B788B7E6EE0EF5DE363F711D /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 47223981BE607AF50A48BFC0 /* Pods_Runner.framework */; };
1920
/* End PBXBuildFile section */
2021

@@ -42,6 +43,7 @@
4243
/* End PBXCopyFilesBuildPhase section */
4344

4445
/* Begin PBXFileReference section */
46+
08C6BD6E2E2BCBC500112A28 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
4547
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
4648
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
4749
1D633D662E3EED698119D0A7 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
@@ -50,6 +52,7 @@
5052
3A531F336B22D00220EA5FBE /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
5153
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
5254
47223981BE607AF50A48BFC0 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
55+
4ADEE7A686C07303D19FF51D /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = "<group>"; };
5356
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
5457
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5558
77E32B61B2CFD4DE90F78F9E /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
@@ -115,6 +118,7 @@
115118
331C8082294A63A400263BE5 /* RunnerTests */,
116119
9818E94642CAA601EE6920D2 /* Pods */,
117120
A847178C50868CA9D4709D2D /* Frameworks */,
121+
4ADEE7A686C07303D19FF51D /* GoogleService-Info.plist */,
118122
);
119123
sourceTree = "<group>";
120124
};
@@ -130,6 +134,7 @@
130134
97C146F01CF9000F007C117D /* Runner */ = {
131135
isa = PBXGroup;
132136
children = (
137+
08C6BD6E2E2BCBC500112A28 /* Runner.entitlements */,
133138
97C146FA1CF9000F007C117D /* Main.storyboard */,
134139
97C146FD1CF9000F007C117D /* Assets.xcassets */,
135140
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
@@ -198,6 +203,7 @@
198203
9705A1C41CF9048500538489 /* Embed Frameworks */,
199204
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
200205
1383343F7821F83B92D1D54D /* [CP] Embed Pods Frameworks */,
206+
B60BBDCEAD89F15FE01F7FBC /* [CP] Copy Pods Resources */,
201207
);
202208
buildRules = (
203209
);
@@ -263,6 +269,7 @@
263269
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
264270
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
265271
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
272+
A8998E2A164F3BCCFBEDB04D /* GoogleService-Info.plist in Resources */,
266273
);
267274
runOnlyForDeploymentPostprocessing = 0;
268275
};
@@ -277,14 +284,10 @@
277284
inputFileListPaths = (
278285
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
279286
);
280-
inputPaths = (
281-
);
282287
name = "[CP] Embed Pods Frameworks";
283288
outputFileListPaths = (
284289
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
285290
);
286-
outputPaths = (
287-
);
288291
runOnlyForDeploymentPostprocessing = 0;
289292
shellPath = /bin/sh;
290293
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
@@ -321,6 +324,23 @@
321324
shellPath = /bin/sh;
322325
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
323326
};
327+
B60BBDCEAD89F15FE01F7FBC /* [CP] Copy Pods Resources */ = {
328+
isa = PBXShellScriptBuildPhase;
329+
buildActionMask = 2147483647;
330+
files = (
331+
);
332+
inputFileListPaths = (
333+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
334+
);
335+
name = "[CP] Copy Pods Resources";
336+
outputFileListPaths = (
337+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
338+
);
339+
runOnlyForDeploymentPostprocessing = 0;
340+
shellPath = /bin/sh;
341+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
342+
showEnvVarsInLog = 0;
343+
};
324344
D448974BA973E76DDE3A8DD5 /* [CP] Check Pods Manifest.lock */ = {
325345
isa = PBXShellScriptBuildPhase;
326346
buildActionMask = 2147483647;
@@ -474,6 +494,7 @@
474494
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
475495
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
476496
CLANG_ENABLE_MODULES = YES;
497+
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
477498
CURRENT_PROJECT_VERSION = 9;
478499
DEVELOPMENT_TEAM = KWQM9A8724;
479500
ENABLE_BITCODE = NO;
@@ -662,6 +683,7 @@
662683
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
663684
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
664685
CLANG_ENABLE_MODULES = YES;
686+
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
665687
CURRENT_PROJECT_VERSION = 9;
666688
DEVELOPMENT_TEAM = KWQM9A8724;
667689
ENABLE_BITCODE = NO;
@@ -690,6 +712,7 @@
690712
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
691713
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
692714
CLANG_ENABLE_MODULES = YES;
715+
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
693716
CURRENT_PROJECT_VERSION = 9;
694717
DEVELOPMENT_TEAM = KWQM9A8724;
695718
ENABLE_BITCODE = NO;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>aps-environment</key>
6+
<string>development</string>
7+
</dict>
8+
</plist>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// File generated by FlutterFire CLI.
2+
// ignore_for_file: type=lint
3+
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
4+
import 'package:flutter/foundation.dart'
5+
show defaultTargetPlatform, kIsWeb, TargetPlatform;
6+
7+
/// Default [FirebaseOptions] for use with your Firebase apps.
8+
///
9+
/// Example:
10+
/// ```dart
11+
/// import 'firebase_options.dart';
12+
/// // ...
13+
/// await Firebase.initializeApp(
14+
/// options: DefaultFirebaseOptions.currentPlatform,
15+
/// );
16+
/// ```
17+
class DefaultFirebaseOptions {
18+
static FirebaseOptions get currentPlatform {
19+
if (kIsWeb) {
20+
throw UnsupportedError(
21+
'DefaultFirebaseOptions have not been configured for web - '
22+
'you can reconfigure this by running the FlutterFire CLI again.',
23+
);
24+
}
25+
switch (defaultTargetPlatform) {
26+
case TargetPlatform.android:
27+
return android;
28+
case TargetPlatform.iOS:
29+
return ios;
30+
case TargetPlatform.macOS:
31+
throw UnsupportedError(
32+
'DefaultFirebaseOptions have not been configured for macos - '
33+
'you can reconfigure this by running the FlutterFire CLI again.',
34+
);
35+
case TargetPlatform.windows:
36+
throw UnsupportedError(
37+
'DefaultFirebaseOptions have not been configured for windows - '
38+
'you can reconfigure this by running the FlutterFire CLI again.',
39+
);
40+
case TargetPlatform.linux:
41+
throw UnsupportedError(
42+
'DefaultFirebaseOptions have not been configured for linux - '
43+
'you can reconfigure this by running the FlutterFire CLI again.',
44+
);
45+
default:
46+
throw UnsupportedError(
47+
'DefaultFirebaseOptions are not supported for this platform.',
48+
);
49+
}
50+
}
51+
52+
static const FirebaseOptions android = FirebaseOptions(
53+
apiKey: 'AIzaSyDaWIWnShmmPBo7moY3XBgwxGJCbs5b_S0',
54+
appId: '1:836191706644:android:aee724fe64fc84cbc1d101',
55+
messagingSenderId: '836191706644',
56+
projectId: 'ongi-3841c',
57+
storageBucket: 'ongi-3841c.firebasestorage.app',
58+
);
59+
60+
static const FirebaseOptions ios = FirebaseOptions(
61+
apiKey: 'AIzaSyCDSQ9TbI1ki9H4a7gnVSFvSe9hj0RnWzQ',
62+
appId: '1:836191706644:ios:ea2c1dc070183aa3c1d101',
63+
messagingSenderId: '836191706644',
64+
projectId: 'ongi-3841c',
65+
storageBucket: 'ongi-3841c.firebasestorage.app',
66+
iosBundleId: 'com.ongi.ongi',
67+
);
68+
}

frontend/ongi/lib/main.dart

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
1+
import 'package:firebase_messaging/firebase_messaging.dart';
12
import 'package:flutter/material.dart';
2-
import 'package:ongi/screens/health/health_home_screen.dart';
33
import 'package:ongi/screens/login/login_pw_screen.dart';
44
import 'package:ongi/screens/start_screen.dart';
5-
import 'package:ongi/screens/bottom_nav.dart';
65
import 'package:ongi/screens/signup/password_screen.dart';
6+
import 'package:firebase_core/firebase_core.dart';
7+
import 'firebase_options.dart';
8+
9+
void main() async {
10+
WidgetsFlutterBinding.ensureInitialized();
11+
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
12+
13+
FirebaseMessaging messaging = FirebaseMessaging.instance;
14+
messaging.requestPermission(
15+
alert: true,
16+
announcement: false,
17+
badge: true,
18+
carPlay: false,
19+
criticalAlert: false,
20+
provisional: false,
21+
sound: true,
22+
);
723

8-
void main() {
924
runApp(const OngiApp());
1025
}
1126

@@ -17,17 +32,14 @@ class OngiApp extends StatelessWidget {
1732
return MaterialApp(
1833
title: 'Ongi',
1934
debugShowCheckedModeBanner: false,
20-
theme: ThemeData(
21-
useMaterial3: true,
22-
fontFamily: 'Pretendard',
23-
),
35+
theme: ThemeData(useMaterial3: true, fontFamily: 'Pretendard'),
2436

25-
home: const BottomNavScreen(),
37+
home: const StartScreen(),
2638

2739
routes: {
2840
'/login': (context) => const LoginPwScreen(),
2941
'/signup': (context) => const PasswordScreen(),
30-
}
42+
},
3143
);
3244
}
3345
}

frontend/ongi/pubspec.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ dependencies:
1717
cupertino_icons: ^1.0.8
1818
shared_preferences: ^2.5.3
1919
align_positioned: ^5.0.1
20+
firebase_core: ^3.15.1
21+
firebase_messaging: ^15.2.9
2022

2123
dev_dependencies:
2224
flutter_test:

0 commit comments

Comments
 (0)