Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
dispatcher_test
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gavin An
dispatcher_test
Commits
2e705874
Commit
2e705874
authored
Aug 16, 2024
by
Gavin An
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
여러가지 테스트
parent
7421b5a0
Changes
13
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
547 additions
and
11 deletions
+547
-11
android/app/src/main/AndroidManifest.xml
android/app/src/main/AndroidManifest.xml
+16
-0
lib/main.dart
lib/main.dart
+44
-7
lib/module/dependency_inject.dart
lib/module/dependency_inject.dart
+24
-0
lib/module/remote/base_module/base_network.dart
lib/module/remote/base_module/base_network.dart
+62
-0
lib/module/remote/base_module/base_network_Interceptor.dart
lib/module/remote/base_module/base_network_Interceptor.dart
+29
-0
lib/module/storage/secure_storage.dart
lib/module/storage/secure_storage.dart
+15
-0
linux/flutter/generated_plugin_registrant.cc
linux/flutter/generated_plugin_registrant.cc
+4
-0
linux/flutter/generated_plugins.cmake
linux/flutter/generated_plugins.cmake
+1
-0
macos/Flutter/GeneratedPluginRegistrant.swift
macos/Flutter/GeneratedPluginRegistrant.swift
+6
-0
pubspec.lock
pubspec.lock
+324
-4
pubspec.yaml
pubspec.yaml
+18
-0
windows/flutter/generated_plugin_registrant.cc
windows/flutter/generated_plugin_registrant.cc
+3
-0
windows/flutter/generated_plugins.cmake
windows/flutter/generated_plugins.cmake
+1
-0
No files found.
android/app/src/main/AndroidManifest.xml
View file @
2e705874
...
...
@@ -22,6 +22,22 @@
android:name=
"${applicationName}"
android:icon=
"@mipmap/ic_launcher"
android:label=
"dispatcher_test"
>
<!-- 카카오 로그인 커스텀 URL 스킴 설정 -->
<activity
android:name=
"com.kakao.sdk.flutter.AuthCodeCustomTabsActivity"
android:exported=
"true"
>
<intent-filter
android:label=
"flutter_web_auth"
>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<!-- "kakao${YOUR_NATIVE_APP_KEY}://oauth" 형식의 앱 실행 스킴 설정 -->
<!-- 카카오 로그인 Redirect URI -->
<!-- <data android:scheme="kakao${564563452}" android:host="oauth"/>-->
</intent-filter>
</activity>
<activity
android:name=
".MainActivity"
android:configChanges=
"orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
...
...
lib/main.dart
View file @
2e705874
...
...
@@ -2,6 +2,7 @@ import 'dart:math';
import
'package:cloud_firestore/cloud_firestore.dart'
;
import
'package:dispatcher_test/firebase_options.dart'
;
import
'package:dispatcher_test/module/dependency_inject.dart'
;
import
'package:dispatcher_test/notification_page.dart'
;
import
'package:dispatcher_test/speech_to_text_page.dart'
;
import
'package:dispatcher_test/text_to_speech_page.dart'
;
...
...
@@ -10,7 +11,9 @@ import 'package:firebase_core/firebase_core.dart';
import
'package:firebase_messaging/firebase_messaging.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_local_notifications/flutter_local_notifications.dart'
;
import
'package:kakao_flutter_sdk_user/kakao_flutter_sdk_user.dart'
;
import
'package:permission_handler/permission_handler.dart'
;
const
List
<
String
>
sample
=
[
...
...
@@ -85,14 +88,14 @@ Future<void> setupFlutterNotifications() async {
///
/// We use this channel in the `AndroidManifest.xml` file to override the
/// default FCM channel to enable heads up notifications.
await
flutterLocalNotificationsPlugin
.
resolvePlatformSpecificImplementation
<
AndroidFlutterLocalNotificationsPlugin
>()?.
createNotificationChannel
(
channel
);
await
flutterLocalNotificationsPlugin
.
resolvePlatformSpecificImplementation
<
AndroidFlutterLocalNotificationsPlugin
>()
?.
createNotificationChannel
(
channel
);
/// Update the iOS foreground notification presentation options to allow
/// heads up notifications.
await
FirebaseMessaging
.
instance
.
setForegroundNotificationPresentationOptions
(
await
FirebaseMessaging
.
instance
.
setForegroundNotificationPresentationOptions
(
alert:
true
,
badge:
true
,
sound:
true
,
...
...
@@ -100,15 +103,21 @@ Future<void> setupFlutterNotifications() async {
isFlutterLocalNotificationsInitialized
=
true
;
}
void
main
(
)
async
{
WidgetsFlutterBinding
.
ensureInitialized
();
dependenciesInitialized
();
await
Firebase
.
initializeApp
(
options:
DefaultFirebaseOptions
.
currentPlatform
);
FirebaseMessaging
.
onBackgroundMessage
(
_firebaseMessagingBackgroundHandler
);
// FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
FirebaseFirestore
.
instance
.
settings
=
const
Settings
(
persistenceEnabled:
true
,
);
// TODO 카카오 Login
// KakaoSdk.init(
// nativeAppKey: ''
// );
// final fcmToken = await FirebaseMessaging.instance.getToken();
// print('fcmToken: $fcmToken');
if
(!
kIsWeb
)
{
...
...
@@ -136,6 +145,7 @@ class MyApp extends StatelessWidget {
class
MyHomePage
extends
StatefulWidget
{
const
MyHomePage
({
super
.
key
,
required
this
.
title
});
final
String
title
;
@override
...
...
@@ -222,6 +232,33 @@ class _MyHomePageState extends State<MyHomePage> {
style:
TextStyle
(
color:
Colors
.
black
),
),
),
TextButton
(
style:
const
ButtonStyle
(
backgroundColor:
WidgetStatePropertyAll
(
Colors
.
amber
),
minimumSize:
WidgetStatePropertyAll
(
Size
.
fromHeight
(
30
))),
onPressed:
()
async
{
// bool talkInstalled = await isKakaoTalkInstalled();
// if (talkInstalled) {
try
{
OAuthToken
token
=
await
UserApi
.
instance
.
loginWithKakaoAccount
();
// TODO 서버에 토큰 올린 후, response 에 따라 회원가입 절차
return
;
}
catch
(
e
)
{
print
(
'카카오톡으로 로그인 실패
$e
'
);
// 사용자가 카카오톡 설치 후 디바이스 권한 요청 화면에서 로그인을 취소한 경우,
// 의도적인 로그인 취소로 보고 카카오계정으로 로그인 시도 없이 로그인 취소로 처리 (예: 뒤로 가기)
if
(
e
is
PlatformException
&&
e
.
code
==
'CANCELED'
)
{
return
;
}
}
// }
// 카카오톡 계정이 없거나, 카카오톡 설치가 되지 않았다면 웹으로 로그인
OAuthToken
token
=
await
UserApi
.
instance
.
loginWithKakaoAccount
();
// TODO 서버에 토큰 올린 후, response 에 따라 회원가입 절차
},
child:
Text
(
'카카오로그인'
,
style:
const
TextStyle
(
color:
Colors
.
black
)),
),
const
SizedBox
(
height:
10
,
),
...
...
lib/module/dependency_inject.dart
0 → 100644
View file @
2e705874
import
'package:dispatcher_test/module/remote/base_module/base_network.dart'
;
import
'package:dispatcher_test/module/remote/base_module/base_network_Interceptor.dart'
;
import
'package:dispatcher_test/module/storage/secure_storage.dart'
;
import
'package:flutter_secure_storage/flutter_secure_storage.dart'
;
import
'package:get_it/get_it.dart'
;
final
getIt
=
GetIt
.
instance
;
Future
<
void
>
dependenciesInitialized
()
async
{
getIt
.
registerSingleton
<
SecureStorageModule
>(
SecureStorageModule
(
const
FlutterSecureStorage
(),
),
);
// base network module
getIt
.
registerLazySingleton
<
BaseNetwork
>(
()
=>
BaseNetwork
(
baseRequestInterceptor:
BaseRequestInterceptor
(
secureStorageModule:
getIt
<
SecureStorageModule
>(),
),
),
);
}
lib/module/remote/base_module/base_network.dart
0 → 100644
View file @
2e705874
import
'package:dio/dio.dart'
;
import
'package:dispatcher_test/module/remote/base_module/base_network_Interceptor.dart'
;
class
BaseNetwork
{
final
Dio
_dio
=
Dio
();
final
BaseRequestInterceptor
baseRequestInterceptor
;
BaseNetwork
({
required
this
.
baseRequestInterceptor
,
})
{
_dio
.
options
=
_dioOptions
();
_dio
.
interceptors
.
add
(
baseRequestInterceptor
);
}
BaseOptions
_dioOptions
()
{
BaseOptions
opts
=
BaseOptions
();
opts
.
connectTimeout
=
const
Duration
(
minutes:
1
);
opts
.
receiveTimeout
=
const
Duration
(
minutes:
1
);
opts
.
sendTimeout
=
const
Duration
(
minutes:
1
);
opts
.
baseUrl
=
"https://dispatcher-dev.realbyte.net/"
;
// TODO 개발 서버 URL
return
opts
;
}
Future
<
Response
>
get
({
required
String
path
,
Map
<
String
,
dynamic
>?
queryParameters
,
})
async
{
return
_dio
.
get
(
path
,
queryParameters:
queryParameters
);
}
Future
<
Response
>
post
({
required
String
path
,
Map
<
String
,
dynamic
>?
queryParameters
,
dynamic
data
,
})
async
{
return
_dio
.
post
(
path
,
queryParameters:
queryParameters
,
data:
data
);
}
Future
<
Response
>
put
({
required
String
path
,
Map
<
String
,
dynamic
>?
queryParameters
,
dynamic
data
,
})
async
{
return
_dio
.
put
(
path
,
queryParameters:
queryParameters
,
data:
data
);
}
Future
<
Response
>
delete
({
required
String
path
,
Map
<
String
,
dynamic
>?
queryParameters
,
dynamic
data
,
})
async
{
return
_dio
.
delete
(
path
,
queryParameters:
queryParameters
,
data:
data
);
}
Future
<
Response
>
patch
({
required
String
path
,
Map
<
String
,
dynamic
>?
queryParameters
,
dynamic
data
,
})
async
{
return
_dio
.
patch
(
path
,
queryParameters:
queryParameters
,
data:
data
);
}
}
lib/module/remote/base_module/base_network_Interceptor.dart
0 → 100644
View file @
2e705874
import
'package:dio/dio.dart'
;
import
'package:dispatcher_test/module/storage/secure_storage.dart'
;
class
BaseRequestInterceptor
extends
Interceptor
{
final
SecureStorageModule
secureStorageModule
;
BaseRequestInterceptor
({
required
this
.
secureStorageModule
});
@override
void
onRequest
(
RequestOptions
options
,
RequestInterceptorHandler
handler
)
{
// TODO 토큰 판별 후, accesstoken 이 만료 되었다면 refreshToken 요청 콜.
// 콜이 끝나면 해당 토큰으로 다시 set 하여 options 에 태워 보냄
// 토큰 저장은 SecureStorage 에
return
super
.
onRequest
(
options
,
handler
);
}
@override
void
onError
(
DioException
err
,
ErrorInterceptorHandler
handler
)
{
// TODO 에러에 대한 처음 처리
return
super
.
onError
(
err
,
handler
);
}
@override
void
onResponse
(
Response
response
,
ResponseInterceptorHandler
handler
)
{
// TODO 응답에 대한 처음 처리
return
super
.
onResponse
(
response
,
handler
);
}
}
\ No newline at end of file
lib/module/storage/secure_storage.dart
0 → 100644
View file @
2e705874
import
'package:flutter_secure_storage/flutter_secure_storage.dart'
;
class
SecureStorageModule
{
final
FlutterSecureStorage
storage
;
SecureStorageModule
(
this
.
storage
);
Future
<
void
>
write
(
String
key
,
String
value
)
async
{
await
storage
.
write
(
key:
key
,
value:
value
);
}
Future
<
String
>
read
(
String
key
)
async
{
final
String
ret
=
await
storage
.
read
(
key:
key
)
??
''
;
return
ret
;
}
}
linux/flutter/generated_plugin_registrant.cc
View file @
2e705874
...
...
@@ -6,6 +6,10 @@
#include "generated_plugin_registrant.h"
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
void
fl_register_plugins
(
FlPluginRegistry
*
registry
)
{
g_autoptr
(
FlPluginRegistrar
)
flutter_secure_storage_linux_registrar
=
fl_plugin_registry_get_registrar_for_plugin
(
registry
,
"FlutterSecureStorageLinuxPlugin"
);
flutter_secure_storage_linux_plugin_register_with_registrar
(
flutter_secure_storage_linux_registrar
);
}
linux/flutter/generated_plugins.cmake
View file @
2e705874
...
...
@@ -3,6 +3,7 @@
#
list
(
APPEND FLUTTER_PLUGIN_LIST
flutter_secure_storage_linux
)
list
(
APPEND FLUTTER_FFI_PLUGIN_LIST
...
...
macos/Flutter/GeneratedPluginRegistrant.swift
View file @
2e705874
...
...
@@ -9,7 +9,10 @@ import cloud_firestore
import
firebase_core
import
firebase_messaging
import
flutter_local_notifications
import
flutter_secure_storage_macos
import
flutter_tts
import
path_provider_foundation
import
shared_preferences_foundation
import
speech_to_text_macos
func
RegisterGeneratedPlugins
(
registry
:
FlutterPluginRegistry
)
{
...
...
@@ -17,6 +20,9 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseCorePlugin
.
register
(
with
:
registry
.
registrar
(
forPlugin
:
"FLTFirebaseCorePlugin"
))
FLTFirebaseMessagingPlugin
.
register
(
with
:
registry
.
registrar
(
forPlugin
:
"FLTFirebaseMessagingPlugin"
))
FlutterLocalNotificationsPlugin
.
register
(
with
:
registry
.
registrar
(
forPlugin
:
"FlutterLocalNotificationsPlugin"
))
FlutterSecureStoragePlugin
.
register
(
with
:
registry
.
registrar
(
forPlugin
:
"FlutterSecureStoragePlugin"
))
FlutterTtsPlugin
.
register
(
with
:
registry
.
registrar
(
forPlugin
:
"FlutterTtsPlugin"
))
PathProviderPlugin
.
register
(
with
:
registry
.
registrar
(
forPlugin
:
"PathProviderPlugin"
))
SharedPreferencesPlugin
.
register
(
with
:
registry
.
registrar
(
forPlugin
:
"SharedPreferencesPlugin"
))
SpeechToTextMacosPlugin
.
register
(
with
:
registry
.
registrar
(
forPlugin
:
"SpeechToTextMacosPlugin"
))
}
pubspec.lock
View file @
2e705874
This diff is collapsed.
Click to expand it.
pubspec.yaml
View file @
2e705874
...
...
@@ -42,6 +42,24 @@ dependencies:
flutter_local_notifications
:
^17.2.1+2
permission_handler
:
^11.3.1
firebase_messaging
:
^15.0.4
kakao_flutter_sdk_user
:
^1.9.5
# 카카오 로그인 API 패키지
# inversion of control(service locator)
get_it
:
^7.7.0
# network
dio
:
^5.5.0+1
pretty_dio_logger
:
^1.4.0
fluttertoast
:
^8.2.8
uuid
:
^4.4.2
# secure storage
flutter_secure_storage
:
^9.2.2
dependency_overrides
:
js
:
"
>=0.6.3
<
0.7.1"
dev_dependencies
:
flutter_test
:
sdk
:
flutter
...
...
windows/flutter/generated_plugin_registrant.cc
View file @
2e705874
...
...
@@ -8,6 +8,7 @@
#include <cloud_firestore/cloud_firestore_plugin_c_api.h>
#include <firebase_core/firebase_core_plugin_c_api.h>
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
#include <flutter_tts/flutter_tts_plugin.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
...
...
@@ -16,6 +17,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry
->
GetRegistrarForPlugin
(
"CloudFirestorePluginCApi"
));
FirebaseCorePluginCApiRegisterWithRegistrar
(
registry
->
GetRegistrarForPlugin
(
"FirebaseCorePluginCApi"
));
FlutterSecureStorageWindowsPluginRegisterWithRegistrar
(
registry
->
GetRegistrarForPlugin
(
"FlutterSecureStorageWindowsPlugin"
));
FlutterTtsPluginRegisterWithRegistrar
(
registry
->
GetRegistrarForPlugin
(
"FlutterTtsPlugin"
));
PermissionHandlerWindowsPluginRegisterWithRegistrar
(
...
...
windows/flutter/generated_plugins.cmake
View file @
2e705874
...
...
@@ -5,6 +5,7 @@
list
(
APPEND FLUTTER_PLUGIN_LIST
cloud_firestore
firebase_core
flutter_secure_storage_windows
flutter_tts
permission_handler_windows
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment