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

Add: Firebase Dynamic Links #32

Draft
wants to merge 55 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
d915962
Add: Firebase Dynamic Links Handler
happycastle114 Feb 28, 2023
d3f6746
Add: TaxiView Dynamic Links
happycastle114 Feb 28, 2023
ca7f143
Fix: Add FileProvider and Permission
happycastle114 Feb 28, 2023
653e087
Refactor: Remove Unused Library
happycastle114 Feb 28, 2023
30378c5
Fix: 탈출 조건 추가
happycastle114 Feb 28, 2023
1827b2d
Style: Add Taxi Dialog
happycastle114 Feb 28, 2023
7d57998
Merge pull request #35 from sparcs-kaist/#33-bug-프로필-사진-선택-시-앱-강제종료
happycastle114 Mar 4, 2023
84950b7
Refactor: Remove duplicated codes
happycastle114 Mar 7, 2023
e15a24f
Refactor: flutter notification version up
happycastle114 Mar 7, 2023
9c8991d
Merge pull request #37 from sparcs-kaist/36-bug-백-버튼이-계속-넘어감
happycastle114 Mar 14, 2023
08eae1d
Style: Taxi Dialog Style Add
happycastle114 Mar 14, 2023
b68f7d4
Add: Firebase Remote Config
happycastle114 Mar 14, 2023
5bdeb99
Add: Market Launcher
happycastle114 Mar 14, 2023
0115374
Docs: Change Package Name
happycastle114 Mar 21, 2023
7fa95ab
Style: Button Style
happycastle114 Mar 21, 2023
04f5064
Merge branch 'main' into #31-add-사용자에게-업데이트-요구
happycastle114 Mar 21, 2023
3a1ac9a
Refactor: Remove Unused Library
happycastle114 Mar 21, 2023
88f6d8f
Merge branch '#31-add-사용자에게-업데이트-요구' of https://github.com/sparcs-kai…
happycastle114 Mar 21, 2023
8d9b4fd
Merge branch 'main' into #34-add-push-navigation
happycastle114 Mar 21, 2023
7fc6ae0
Fix: Change Bundle ID
happycastle114 Mar 21, 2023
a5d270b
Add: FCM message handler
happycastle114 Mar 21, 2023
42d7dbc
Add: Push Navigation
happycastle114 Mar 21, 2023
0fb8ef2
Fix: Init App Uri
happycastle114 Mar 21, 2023
7eae9f8
Try Fix Navigation
happycastle114 Mar 21, 2023
ff4b70e
Fix: 롤백
happycastle114 Mar 21, 2023
03f1d68
Refactor: Dream
happycastle114 Mar 21, 2023
3b800df
Add: Push State
happycastle114 Mar 21, 2023
9037678
Fix: fix state
happycastle114 Mar 21, 2023
e0d4c84
Refactor & Fix : inappwebview version up and state fix
happycastle114 Mar 21, 2023
096c215
Refactor&Fix&Add: handler 분리, foreground 상태 대응,
happycastle114 Mar 22, 2023
0e7b831
Fix: foreground 상태에서 onBackground 실행 문제 해결 / Firebase 14.1.0 이상 버전 발생 이슈
happycastle114 Mar 22, 2023
a17f3f1
Docs: messaging library version up
happycastle114 Mar 22, 2023
2f7b9ed
Fix: disable default notification system
happycastle114 Mar 22, 2023
650912a
Docs: add material library
happycastle114 Mar 28, 2023
05cd245
Fix: Virtual Keyboard Resize issue
happycastle114 Apr 3, 2023
8c4d21c
Refactor: remove unused libraries
happycastle114 Apr 3, 2023
edb96dd
Refactor: Remove and constants
happycastle114 Apr 3, 2023
5ae2274
Fix: iOS Environment Setting
happycastle114 Apr 3, 2023
4597221
Style: Font Size Down
happycastle114 Apr 3, 2023
ec93cae
Refactor: remove Unused imports and add pubspec.yaml
happycastle114 Apr 3, 2023
977257b
Refactor: Upgrade Libraries Version
happycastle114 Apr 4, 2023
f2212f1
Fix: Change Package Name
happycastle114 Apr 4, 2023
0851f02
Fix: Flutter InAppWebView Version Rollback to 5.x Because of iOS issue
happycastle114 Apr 4, 2023
47662ab
Refactor: Remove prints
happycastle114 Apr 4, 2023
861c389
Merge pull request #38 from sparcs-kaist/#31-add-사용자에게-업데이트-요구
happycastle114 Apr 4, 2023
3af5c84
Merge branch 'main' into #34-add-push-navigation
happycastle114 Apr 4, 2023
7f1dc29
Refactor: review applied
happycastle114 Apr 6, 2023
ea26059
Merge pull request #40 from sparcs-kaist/#34-add-push-navigation
happycastle114 Apr 6, 2023
68d87e9
Style: Change Font Size
happycastle114 Apr 6, 2023
9ee69f1
Refactor: Change Library
happycastle114 Apr 6, 2023
7ed2ce9
Merge pull request #44 from sparcs-kaist/#43-style-update-dialog-font…
happycastle114 Apr 12, 2023
f893049
Add: Firebase Dynamic Links Handler
happycastle114 Feb 28, 2023
4875251
Add: TaxiView Dynamic Links
happycastle114 Feb 28, 2023
c31e0cf
Refactor: Merge from main
happycastle114 Apr 28, 2023
a1cd45f
Merge branch '#23-add-firebase-dynamic-link' of
happycastle114 Apr 28, 2023
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
3 changes: 2 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "org.sparcs.taxiapp"
applicationId "org.sparcs.taxi_app"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 21 // flutter.minSdkVersion
Expand Down Expand Up @@ -104,6 +104,7 @@ flutter {
}

dependencies {
implementation 'com.google.android.material:material:1.8.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation platform('com.google.firebase:firebase-bom:30.2.0')
implementation 'com.google.firebase:firebase-analytics'
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.sparcs.taxiapp">
package="org.sparcs.taxi_app">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
21 changes: 20 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.sparcs.taxiapp">
package="org.sparcs.taxi_app">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />


<application
android:label="Taxi"
android:name="${applicationName}"
Expand All @@ -26,6 +31,9 @@
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand All @@ -38,6 +46,8 @@
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="org.sparcs.taxiapp" />
</intent-filter>
<intent-filter> <action android:name="FLUTTER_NOTIFICATION_CLICK" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>

</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
Expand All @@ -46,5 +56,14 @@
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="taxi_notification" />
<provider
android:name="com.pichillilorenzo.flutter_inappwebview.InAppWebViewFileProvider"
android:authorities="${applicationId}.flutter_inappwebview.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.sparcs.taxiapp
package org.sparcs.taxi_app

import io.flutter.embedding.android.FlutterActivity

Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/res/values-night/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<style name="NormalTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
2 changes: 1 addition & 1 deletion android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<style name="NormalTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
2 changes: 1 addition & 1 deletion android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.sparcs.taxiapp">
package="org.sparcs.taxi_app">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
2 changes: 1 addition & 1 deletion ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>11.0</string>
</dict>
</plist>
21 changes: 14 additions & 7 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -35,6 +35,7 @@
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
49CFEE842023B378035C5EB4 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
651C910329DBF49000E50313 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -104,6 +105,7 @@
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
651C910329DBF49000E50313 /* Runner.entitlements */,
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -216,6 +218,7 @@
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -230,6 +233,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -339,7 +343,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand All @@ -354,8 +358,9 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = TW2C995A4W;
DEVELOPMENT_TEAM = U8TCH8B3WQ;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -417,7 +422,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -466,7 +471,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand All @@ -483,8 +488,9 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = TW2C995A4W;
DEVELOPMENT_TEAM = U8TCH8B3WQ;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -506,8 +512,9 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = TW2C995A4W;
DEVELOPMENT_TEAM = U8TCH8B3WQ;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down
11 changes: 9 additions & 2 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>itms-beta</string>
<string>itms</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand All @@ -51,12 +56,14 @@
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>org.sparcs.taxiapp</string>
<string>org.sparcs.taxi_app</string>
<key>CFBundleURLSchemes</key>
<array>
<string>org.sparcs.taxiapp</string>
<string>org.sparcs.taxi_app</string>
</array>
</dict>
</array>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
8 changes: 8 additions & 0 deletions ios/Runner/Runner.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: 3 additions & 3 deletions lib/constants/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import 'package:flutter_dotenv/flutter_dotenv.dart';

String address = dotenv.get("BACKEND_ADDRESS");

final BaseOptions ConnectionOptions = BaseOptions(
final BaseOptions connectionOptions = BaseOptions(
baseUrl: address,
connectTimeout: 15000,
receiveTimeout: 13000,
connectTimeout: Duration(seconds: 150),
receiveTimeout: Duration(seconds: 130),
);
69 changes: 14 additions & 55 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_dynamic_links/firebase_dynamic_links.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:taxiapp/utils/fcmToken.dart';
import 'package:taxiapp/utils/pushHandler.dart';
import 'package:taxiapp/utils/token.dart';
import 'package:taxiapp/views/taxiView.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
Expand All @@ -12,10 +15,10 @@ late AndroidNotificationChannel channel;
late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;

void main() async {
await dotenv.load(fileName: ".env");

WidgetsFlutterBinding.ensureInitialized();

await dotenv.load(fileName: ".env");

await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
Expand All @@ -27,30 +30,14 @@ void main() async {
importance: Importance.high,
);

var initializationSettingsAndroid =
const AndroidInitializationSettings('@mipmap/ic_launcher');

var initializationSettingsIOS = const IOSInitializationSettings(
requestAlertPermission: true,
requestBadgePermission: true,
requestSoundPermission: true,
);

flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();

await flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>()
?.createNotificationChannel(channel);

var initializationSettings = InitializationSettings(
android: initializationSettingsAndroid,
iOS: initializationSettingsIOS,
);

await flutterLocalNotificationsPlugin.initialize(
initializationSettings,
);
FirebaseMessaging.onBackgroundMessage(handleMessage);

await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions(
alert: true,
Expand All @@ -73,40 +60,10 @@ void main() async {

await FcmToken().init();

runApp(const MyApp());
}

class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);

@override
State<MyApp> createState() => _MyAppState();
runApp(MyHome());
}

class _MyAppState extends State<MyApp> {
@override
void initState() {
FirebaseMessaging.onMessage.listen((RemoteMessage message) async {
RemoteNotification? notification = message.notification;
AndroidNotification? android = message.notification?.android;
var androidNotiDetails = AndroidNotificationDetails(
channel.id, channel.name,
channelDescription: channel.description);

var iOSNotiDetails = const IOSNotificationDetails();

var details =
NotificationDetails(android: androidNotiDetails, iOS: iOSNotiDetails);

if (notification != null) {
flutterLocalNotificationsPlugin.show(notification.hashCode,
notification.title, notification.body, details);
}
});

super.initState();
}

class MyHome extends HookWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
Expand All @@ -115,10 +72,12 @@ class _MyAppState extends State<MyApp> {
primarySwatch: Colors.blue,
),
home: Container(
color: const Color(0xFF6E3647),
child: Container(
child: Container(color: Colors.white, child: TaxiView()),
)),
color: const Color(0xFF6E3647),
child: Container(
color: Colors.white,
child: TaxiView(),
),
),
);
}
}
2 changes: 1 addition & 1 deletion lib/utils/fcmToken.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class FcmToken {

static FcmToken? _instance;

final Dio _dio = Dio(ConnectionOptions);
final Dio _dio = Dio(connectionOptions);

FcmToken._internal({required this.token});

Expand Down
Loading