diff --git a/README.md b/README.md
index 8b58429..daccaf7 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# jaga_jindan
+# 자가진단
diff --git a/lib/main.dart b/lib/main.dart
index 5c9e95a..1777942 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -48,6 +48,7 @@ class MyApp extends StatelessWidget {
),
home: obj,
darkTheme: ThemeData.dark(),
+ debugShowCheckedModeBanner: false,
);
}
}
@@ -183,6 +184,10 @@ class _MainPageState extends State {
controller: this.widget.nameController,
),
TextFormField(
+ onChanged: (text) {
+ this.widget.data.birthday = text;
+ this.widget.writeJSON();
+ },
keyboardType: TextInputType.number,
decoration: const InputDecoration(
hintText: "생년월일을 입력하세요. (YYMMDD)"),
@@ -192,10 +197,6 @@ class _MainPageState extends State {
}
return null;
},
- onChanged: (text) {
- this.widget.data.birthday = text;
- this.widget.writeJSON();
- },
controller: this.widget.birthdayController,
),
Row(
@@ -571,10 +572,10 @@ class _MainPageState extends State {
CheckboxListTile(
contentPadding: EdgeInsets.zero,
title: const Text('자가진단 결과 알림으로 받기'),
- value: this.widget.data.noti,
+ value: this.widget.data.useNotification,
onChanged: (bool value) {
_setState(() {
- this.widget.data.noti = value;
+ this.widget.data.useNotification = value;
this.widget.writeJSON();
});
}),
@@ -646,10 +647,10 @@ class _MainPageState extends State {
),
actions: [
FlatButton(
- child: Text('닫기'),
onPressed: () {
Navigator.of(context).pop();
},
+ child: Text('닫기'),
),
],
);
diff --git a/lib/send_survey.dart b/lib/send_survey.dart
index 6e22f97..cb36e18 100644
--- a/lib/send_survey.dart
+++ b/lib/send_survey.dart
@@ -26,28 +26,42 @@ Future onDidReceiveLocalNotification(
Future selectNotification(String payload) async {
if (payload != null) {
- debugPrint('notification payload: ' + payload);
+ //debugPrint('notification payload: ' + payload);
toast(payload);
}
}
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
-FlutterLocalNotificationsPlugin();
-var initializationSettingsAndroid = AndroidInitializationSettings('app_icon');
-var initializationSettingsIOS = IOSInitializationSettings(
- onDidReceiveLocalNotification: onDidReceiveLocalNotification);
-var initializationSettings = InitializationSettings(
- initializationSettingsAndroid, initializationSettingsIOS);
-var androidPlatformChannelSpecifics = AndroidNotificationDetails(
- 'com.nlog.flutterlocalnotifications.ScheduledNotificationBootReceiver',
- '자가진단 자동화',
- '자동으로 자가진단 설문을 제출합니다.',
- importance: Importance.Max,
- priority: Priority.High,
- ticker: 'ticker');
-var iOSPlatformChannelSpecifics = IOSNotificationDetails();
-var platformChannelSpecifics = NotificationDetails(
- androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
+ FlutterLocalNotificationsPlugin();
+const AndroidInitializationSettings initializationSettingsAndroid =
+ AndroidInitializationSettings('app_icon');
+final IOSInitializationSettings initializationSettingsIOS =
+ IOSInitializationSettings(
+ requestSoundPermission: false,
+ requestBadgePermission: false,
+ requestAlertPermission: false,
+ onDidReceiveLocalNotification: onDidReceiveLocalNotification,
+);
+final MacOSInitializationSettings initializationSettingsMacOS =
+ MacOSInitializationSettings(
+ requestAlertPermission: false,
+ requestBadgePermission: false,
+ requestSoundPermission: false);
+final InitializationSettings initializationSettings = InitializationSettings(
+ android: initializationSettingsAndroid,
+ iOS: initializationSettingsIOS,
+ macOS: initializationSettingsMacOS);
+
+const AndroidNotificationDetails androidPlatformChannelSpecifics =
+ AndroidNotificationDetails(
+ 'com.nlog.flutterlocalnotifications.ScheduledNotificationBootReceiver',
+ '자가진단 자동화',
+ '자동으로 자가진단 설문을 제출합니다.',
+ importance: Importance.max,
+ priority: Priority.high,
+ showWhen: false);
+const NotificationDetails platformChannelSpecifics =
+ NotificationDetails(android: androidPlatformChannelSpecifics);
void initNotification() async {
await flutterLocalNotificationsPlugin.initialize(initializationSettings,
@@ -55,6 +69,7 @@ void initNotification() async {
}
var notiId = 0;
+
void noti(String title, String desc) async {
await flutterLocalNotificationsPlugin
.show(notiId++, title, desc, platformChannelSpecifics, payload: desc);
@@ -62,7 +77,7 @@ void noti(String title, String desc) async {
class JagaJindanData {
String name, birthday, school, edu, password;
- bool force, agree = false, startup = false, noti = false;
+ bool force, agree = false, startup = false, useNotification = false;
static JagaJindanData readFromJSON(dynamic json) {
return new JagaJindanData(
@@ -78,7 +93,7 @@ class JagaJindanData {
}
JagaJindanData(this.name, this.birthday, this.school, this.edu, this.password,
- this.force, this.agree, this.startup, this.noti);
+ this.force, this.agree, this.startup, this.useNotification);
dynamic toJSON() {
return {
@@ -90,61 +105,65 @@ class JagaJindanData {
"force": this.force,
"agree": this.agree,
"startup": this.startup,
- "noti": this.noti
+ "noti": this.useNotification
};
}
}
-void showSurveyResult(bool success, String message, JagaJindanData credentials) {
- if (credentials.noti) noti(success ? "자가진단 제출을 성공하였습니다." : "자가진단 제출을 실패하였습니다.", message);
- else toast(message);
+void showSurveyResult(
+ bool success, String message, JagaJindanData credentials) {
+ if (credentials.useNotification)
+ noti(success ? "자가진단 제출을 성공하였습니다." : "자가진단 제출을 실패하였습니다.", message);
+ else
+ toast(message);
}
void sendSurvey(JagaJindanData credentials) async {
try {
String jwt = jsonDecode((await http.post(
- 'https://${credentials.edu}hcs.eduro.go.kr/loginwithschool',
+ 'https://${credentials.edu}hcs.eduro.go.kr/v2/findUser',
body: jsonEncode({
'birthday': encrypt(credentials.birthday),
+ 'loginType': 'school',
'name': encrypt(credentials.name),
- 'orgcode': credentials.school
+ 'orgCode': credentials.school,
+ 'stdntPNo': null
}),
headers: {'Content-Type': 'application/json'},
encoding: Encoding.getByName('utf-8')))
.body)['token'];
if (!credentials.force) {
- if ((await http.post('https://${credentials.edu}hcs.eduro.go.kr/checkpw',
+ if ((await http.post(
+ 'https://${credentials.edu}hcs.eduro.go.kr/v2/hasPassword',
body: jsonEncode({}),
headers: {
'Authorization': jwt,
'Content-Type': 'application/json'
}))
- .statusCode !=
- 200) {
+ .body !=
+ 'true') {
showSurveyResult(false, '자가진단 페이지에서 초기 비밀번호를 설정하세요.', credentials);
return;
}
- if (jsonDecode((await http.post(
- 'https://${credentials.edu}hcs.eduro.go.kr/secondlogin',
- body: jsonEncode({
- 'deviceUuid': '',
- 'password': encrypt(credentials.password)
- }),
+ if ((await http.post(
+ 'https://${credentials.edu}hcs.eduro.go.kr/v2/validatePassword',
+ body: jsonEncode({'deviceUuid': '', 'password': encrypt(credentials.password)}),
headers: {
'Authorization': jwt,
'Content-Type': 'application/json'
}))
- .body)['isError'] ==
- true) {
- showSurveyResult(false, '비밀번호를 잘못 입력했습니다.', credentials);
+ .body !=
+ 'true') {
+ showSurveyResult(
+ false, '비밀번호를 잘못 입력했거나 로그인 시도 횟수를 초과했습니다.', credentials);
return;
}
}
var users = jsonDecode((await http.post(
- 'https://${credentials.edu}hcs.eduro.go.kr/selectGroupList',
+ 'https://${credentials.edu}hcs.eduro.go.kr/v2/selectUserGroup',
body: jsonEncode({}),
headers: {
'Authorization': jwt,
@@ -152,23 +171,25 @@ void sendSurvey(JagaJindanData credentials) async {
}))
.body);
- jwt = users['groupList'][0]['token'];
+ jwt = users[0]['token'];
- var userNo = int.parse(users['groupList'][0]['userPNo']);
- String org = users['groupList'][0]['orgCode'];
+ var userNo = int.parse(users[0]['userPNo']);
+ String org = users[0]['orgCode'];
jwt = jsonDecode((await http.post(
- 'https://${credentials.edu}hcs.eduro.go.kr/userrefresh',
+ 'https://${credentials.edu}hcs.eduro.go.kr/v2/getUserInfo',
body: jsonEncode({'userPNo': userNo, 'orgCode': org}),
headers: {
'Authorization': jwt,
'Content-Type': 'application/json'
}))
- .body)['UserInfo']['token'];
+ .body)['token'];
var res = await http.post(
'https://${credentials.edu}hcs.eduro.go.kr/registerServey',
body: jsonEncode({
+ 'deviceUuid': '',
+ 'rspns00': 'Y',
'rspns01': '1',
'rspns02': '1',
'rspns03': null,
@@ -184,14 +205,18 @@ void sendSurvey(JagaJindanData credentials) async {
'rspns13': null,
'rspns14': null,
'rspns15': null,
- 'rspns00': 'Y',
- 'deviceUuid': ''
+ 'upperToken': jwt,
+ 'upperUserNameEncpt': credentials.name
}),
headers: {'Authorization': jwt, 'Content-Type': 'application/json'});
- showSurveyResult(true, "자가진단 설문이 ${DateTime.now().toString().substring(0, 19)}에 제출되었습니다.", credentials);
+ showSurveyResult(
+ true,
+ "자가진단 설문이 ${DateTime.now().toString().substring(0, 19)}에 제출되었습니다.",
+ credentials);
} catch (e) {
- showSurveyResult(false, "인증 정보를 한번 더 확인해주세요.\n오류가 계속 발생하는 경우 개발자에게 알려주세요.", credentials);
+ showSurveyResult(
+ false, "인증 정보를 한번 더 확인해주세요.\n오류가 계속 발생하는 경우 개발자에게 알려주세요.", credentials);
//toast(e.toString());
}
}
diff --git a/pubspec.lock b/pubspec.lock
index b79e1bd..e059852 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -21,42 +21,42 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.5.0-nullsafety"
+ version: "2.5.0-nullsafety.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0-nullsafety"
+ version: "2.1.0-nullsafety.1"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0-nullsafety.2"
+ version: "1.1.0-nullsafety.3"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0-nullsafety"
+ version: "1.2.0-nullsafety.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0-nullsafety"
+ version: "1.1.0-nullsafety.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
- version: "1.15.0-nullsafety.2"
+ version: "1.15.0-nullsafety.3"
convert:
dependency: transitive
description:
@@ -77,7 +77,7 @@ packages:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.3"
+ version: "1.0.0"
encrypt:
dependency: "direct main"
description:
@@ -91,7 +91,14 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0-nullsafety"
+ version: "1.2.0-nullsafety.1"
+ ffi:
+ dependency: transitive
+ description:
+ name: ffi
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.1.3"
file:
dependency: transitive
description:
@@ -110,14 +117,14 @@ packages:
name: flutter_local_notifications
url: "https://pub.dartlang.org"
source: hosted
- version: "1.4.4+4"
+ version: "1.5.0"
flutter_local_notifications_platform_interface:
dependency: transitive
description:
name: flutter_local_notifications_platform_interface
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.1"
+ version: "2.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -162,14 +169,14 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.10-nullsafety"
+ version: "0.12.10-nullsafety.1"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0-nullsafety.2"
+ version: "1.3.0-nullsafety.3"
package_info:
dependency: "direct main"
description:
@@ -183,14 +190,14 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.0-nullsafety"
+ version: "1.8.0-nullsafety.1"
path_provider:
dependency: "direct main"
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
- version: "1.6.14"
+ version: "1.6.18"
path_provider_linux:
dependency: transitive
description:
@@ -212,6 +219,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
+ path_provider_windows:
+ dependency: transitive
+ description:
+ name: path_provider_windows
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.0.4+1"
pedantic:
dependency: transitive
description:
@@ -226,13 +240,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
- platform_detect:
- dependency: transitive
- description:
- name: platform_detect
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.4.0"
plugin_platform_interface:
dependency: transitive
description:
@@ -254,13 +261,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.13"
- pub_semver:
- dependency: transitive
- description:
- name: pub_semver
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.4.4"
sky_engine:
dependency: transitive
description: flutter
@@ -272,56 +272,63 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.0-nullsafety"
+ version: "1.8.0-nullsafety.2"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
- version: "1.10.0-nullsafety"
+ version: "1.10.0-nullsafety.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0-nullsafety"
+ version: "2.1.0-nullsafety.1"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0-nullsafety"
+ version: "1.1.0-nullsafety.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0-nullsafety"
+ version: "1.2.0-nullsafety.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.19-nullsafety"
+ version: "0.2.19-nullsafety.2"
+ timezone:
+ dependency: transitive
+ description:
+ name: timezone
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.5.7"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0-nullsafety.2"
+ version: "1.3.0-nullsafety.3"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
- version: "5.6.0"
+ version: "5.7.2"
url_launcher_linux:
dependency: transitive
description:
@@ -349,7 +356,7 @@ packages:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.3+2"
+ version: "0.1.4+1"
url_launcher_windows:
dependency: transitive
description:
@@ -363,7 +370,14 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0-nullsafety.2"
+ version: "2.1.0-nullsafety.3"
+ win32:
+ dependency: transitive
+ description:
+ name: win32
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.7.3"
xdg_directories:
dependency: transitive
description:
@@ -372,5 +386,5 @@ packages:
source: hosted
version: "0.1.2"
sdks:
- dart: ">=2.10.0-0.0.dev <2.10.0"
+ dart: ">=2.10.0-110 <=2.11.0-161.0.dev"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
diff --git a/pubspec.yaml b/pubspec.yaml
index 06ffd08..9ebf5dd 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -3,7 +3,7 @@ description: 자가진단 자동화 앱
publish_to: 'none'
-version: 0.2.2
+version: 0.2.3
environment:
sdk: ">=2.7.0 <3.0.0"
@@ -12,13 +12,13 @@ dependencies:
flutter:
sdk: flutter
- cupertino_icons: ^0.1.3
- path_provider: ^1.6.14
+ cupertino_icons: ^1.0.0
+ path_provider: ^1.6.18
fluttertoast: ^7.1.1
http: ^0.12.2
- encrypt: ^4.0.2
- flutter_local_notifications: ^1.4.4+4
- url_launcher: ^5.6.0
+ encrypt: ^4.0.3
+ flutter_local_notifications: ^1.5.0
+ url_launcher: ^5.7.2
package_info: ^0.4.3
dev_dependencies: