Skip to content

Commit

Permalink
- 增加单独设置后台推送的开关;
Browse files Browse the repository at this point in the history
- 优化新增定时任务界面的异常;
- 完善语言显示和界面细节优化。
  • Loading branch information
iHTCboy committed Feb 23, 2021
1 parent afafa93 commit c3ab04c
Show file tree
Hide file tree
Showing 23 changed files with 223 additions and 16 deletions.
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,57 @@ iPomodoro(爱番茄)。🍅 番茄工作法是一种时间管理法方法,在
## iPomodoro(爱番茄🍅)
爱番茄是一个简单和有效的番茄工作法的应用,灵感来自`我要当学霸`App 和 macOS版`Promodoro Timer`,这2个App已经下架,所以,想以此为基础,开发Android/iOS/macOS版本,并且开源,所有平台暂定免费下载,计划内置打赏机制,iOS/macOS版本不定时收费1人民币(苹果开发账号费)。


## 简介
分心?
拖延?
高效?
专注?

分心❌
拖延❌
高效✅
专注✅

iPomodoro(爱番茄)

【功能简介】
番茄时间管理和学习规划,妈妈再也不用担心我的学习啦!不再分心!不再拖延!高效!专注!,让大家在学习时可以更加专注也可以快速和简单的学习get!

【三大特点】
1、番茄学习模式,使用番茄工作法学习,让你劳逸结合!
2、计时学习模式,按照设定的时长学习,想学多久就学多久!
3、定时任务模式,倒数日、任务记录,每日学习任务!

杜绝学习没有目标!满足你对学习的求知欲望!


**番茄学习**
- 使用番茄工作法学习

**计时学习**
- 按照设定的时长学习

请不要
放弃治疗!
好好学习
你还有救!


### 下载安装
1、AppStore付费支持
[iOS App Store](https://apps.apple.com/cn/app/ipomodoro/id1439666929)


2、编译安装
因为苹果开发者账号需要 ¥688 年费,所以 AppStore下载收费请见谅。你可以下载本项目代码在macOS系统编译安装。


### 应用截图
![](screenshot/01.png)
![](screenshot/02.png)
![](screenshot/03.png)
![](screenshot/04.png)
![](screenshot/05.png)
![](screenshot/06.png)
![](screenshot/07.png)
28 changes: 22 additions & 6 deletions app/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
6D48C40B25E1F385003A96D1 /* IAppleServiceUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D48C3E825E143AC003A96D1 /* IAppleServiceUtil.swift */; };
6D48C41025E1F54D003A96D1 /* App-share-Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 6D48C40F25E1F54D003A96D1 /* App-share-Icon.png */; };
6D48C41225E20CF2003A96D1 /* ITCommonAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D48C41125E20CF2003A96D1 /* ITCommonAPI.swift */; };
6D72FC3B25E54DB4004CAD9E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6D72FC3D25E54DB4004CAD9E /* InfoPlist.strings */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
Expand Down Expand Up @@ -56,6 +57,9 @@
6D48C40F25E1F54D003A96D1 /* App-share-Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "App-share-Icon.png"; sourceTree = "<group>"; };
6D48C41125E20CF2003A96D1 /* ITCommonAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ITCommonAPI.swift; sourceTree = "<group>"; };
6D48C43125E2599A003A96D1 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
6D72FC3C25E54DB4004CAD9E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
6D72FC3E25E54DB7004CAD9E /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
6D72FC3F25E54DB9004CAD9E /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
6D9103F925DBC00200099295 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = "<group>"; };
6D9103FA25DBC00300099295 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchScreen.strings"; sourceTree = "<group>"; };
6D9103FB25DBC00A00099295 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Main.strings"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -197,6 +201,7 @@
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C147021CF9000F007C117D /* Info.plist */,
6D72FC3D25E54DB4004CAD9E /* InfoPlist.strings */,
);
path = Runner;
sourceTree = "<group>";
Expand Down Expand Up @@ -267,6 +272,7 @@
buildActionMask = 2147483647;
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
6D72FC3B25E54DB4004CAD9E /* InfoPlist.strings in Resources */,
6D48C3ED25E145C0003A96D1 /* iHTCboyApp.json in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
Expand Down Expand Up @@ -367,6 +373,16 @@
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
6D72FC3D25E54DB4004CAD9E /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
6D72FC3C25E54DB4004CAD9E /* en */,
6D72FC3E25E54DB7004CAD9E /* zh-Hans */,
6D72FC3F25E54DB9004CAD9E /* zh-Hant */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
Expand Down Expand Up @@ -448,7 +464,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 2021.02.22;
CURRENT_PROJECT_VERSION = 2021.02.25;
DEVELOPMENT_TEAM = 28PV6G96R7;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -464,7 +480,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.1.0;
MARKETING_VERSION = 1.3.0;
PRODUCT_BUNDLE_IDENTIFIER = com.iHTCboy.iPomodoro;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand Down Expand Up @@ -590,7 +606,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 2021.02.22;
CURRENT_PROJECT_VERSION = 2021.02.25;
DEVELOPMENT_TEAM = 28PV6G96R7;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -606,7 +622,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.1.0;
MARKETING_VERSION = 1.3.0;
PRODUCT_BUNDLE_IDENTIFIER = com.iHTCboy.iPomodoro;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand All @@ -624,7 +640,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 2021.02.22;
CURRENT_PROJECT_VERSION = 2021.02.25;
DEVELOPMENT_TEAM = 28PV6G96R7;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -640,7 +656,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.1.0;
MARKETING_VERSION = 1.3.0;
PRODUCT_BUNDLE_IDENTIFIER = com.iHTCboy.iPomodoro;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand Down
7 changes: 7 additions & 0 deletions app/ios/Runner/en.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
InfoPlist.strings
Runner

Created by HTC on 2021/2/23.

*/
10 changes: 10 additions & 0 deletions app/ios/Runner/zh-Hans.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
Runner

Created by HTC on 2021/2/23.

*/


"CFBundleName" = "爱番茄";
2 changes: 1 addition & 1 deletion app/ios/Runner/zh-Hans.lproj/LaunchScreen.strings
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

/* Class = "UILabel"; text = "iPomodoro"; ObjectID = "XSp-Ly-PkP"; */
"XSp-Ly-PkP.text" = "爱蕃茄";
"XSp-Ly-PkP.text" = "爱番茄";
10 changes: 10 additions & 0 deletions app/ios/Runner/zh-Hant.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
Runner

Created by HTC on 2021/2/23.

*/


"CFBundleName" = "愛蕃茄";
2 changes: 2 additions & 0 deletions app/lib/common/utils/config_storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class AppStorage {
static const String K_STRING_TIMER_HOURS = "k_string_timer_hours";
static const String K_STRING_TIMER_MINUTES = "k_string_timer_minutes";
static const String K_STRING_CUNTDOWN_ORDER_INDEX = "k_string_countdown_order_idex";
static const String K_STRING_POMODORO_NOTIFICATION = "k_string_pomodoro_notification";
static const String K_STRING_TIMERT_NOTIFICATION = "k_string_timer_notification";


static Future<bool> setInt(String key, int value) async {
Expand Down
10 changes: 10 additions & 0 deletions app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:iPomodoro/ui/page/pomodoro_settings.dart';
import 'package:iPomodoro/ui/page/timer_page.dart';
import 'package:iPomodoro/ui/page/timer_settings.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:timezone/data/latest.dart' as tz;
import 'package:timezone/timezone.dart' as tz;

Expand All @@ -36,6 +37,15 @@ class MyApp extends StatelessWidget {
darkTheme: ThemeData(
brightness: Brightness.dark,
),
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: [
const Locale('zh', 'CH'),
const Locale('en', 'US'),
],
initialRoute: '/',
routes: <String, WidgetBuilder>{
'/': (BuildContext context) => MyRootPage(),
Expand Down
4 changes: 2 additions & 2 deletions app/lib/ui/page/brightness_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class BrightnessSettings extends StatefulWidget {

class _BrightnessSettingsState extends State<BrightnessSettings> {

double _sliderValue = 0.1;
double _sliderValue = 0.0;

@override
void initState() {
Expand Down Expand Up @@ -54,7 +54,7 @@ class _BrightnessSettingsState extends State<BrightnessSettings> {
// print('end:$data');
NativeChannel.changeBrightness(data.toStringAsFixed(1));
},
min: 0.1,
min: 0.0,
max: 1.0,
divisions: 10,
label: '${_sliderValue.toStringAsFixed(1)}',
Expand Down
6 changes: 5 additions & 1 deletion app/lib/ui/page/pomodoro_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class _PomodoroPageState extends State<PomodoroPage> with WidgetsBindingObserver
String _break_short = '05';
String _break_long = '15';
int _break_long_delay = 2;
int _enable_notification = 0;//0是允许推送

@override
void initState() {
Expand Down Expand Up @@ -81,7 +82,7 @@ class _PomodoroPageState extends State<PomodoroPage> with WidgetsBindingObserver
break;
case AppLifecycleState.paused:
//app当前在后台,不可响应用户的输入
if (_timer_mode == TimerStateMode.timing) {
if (_enable_notification == 0 && _timer_mode == TimerStateMode.timing) {
NotificationUtils.showNotification(0, "番茄提醒🍅!", TipsDialog.get_tips());
NotificationUtils.addScheduleNotification(10, "番茄君提醒🍅!", TipsDialog.get_tips(), 10);
NotificationUtils.addScheduleNotification(11, "番茄君提醒🍅!", TipsDialog.get_tips(), 30);
Expand Down Expand Up @@ -271,6 +272,9 @@ class _PomodoroPageState extends State<PomodoroPage> with WidgetsBindingObserver
.then((value) {
_break_long_delay = value ?? 2;
});
AppStorage.getInt(AppStorage.K_STRING_POMODORO_NOTIFICATION).then((value) {
_enable_notification = value ?? 0;
});
AppStorage.getInt(AppStorage.K_STRING_POMODORO_HOURS).then((value) {
_hours = value ?? 0;
_pomodoro_hours = _hours;
Expand Down
45 changes: 45 additions & 0 deletions app/lib/ui/page/pomodoro_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class _PomodoroSettingsPageState extends State<PomodoroSettingsPage> {
int _break_short = 0;
int _break_long = 0;
int _break_long_delay = 0;
int _setting_notification = 0;

@override
void initState() {
Expand All @@ -37,6 +38,9 @@ class _PomodoroSettingsPageState extends State<PomodoroSettingsPage> {
AppStorage.getInt(AppStorage.K_STRING_POMODORO_BREAK_LONG).then((value) {
_break_long = value ?? 15;
});
AppStorage.getInt(AppStorage.K_STRING_POMODORO_NOTIFICATION).then((value) {
_setting_notification = value ?? 0;
});
AppStorage.getInt(AppStorage.K_STRING_POMODORO_BREAK_LONG_DELAY)
.then((value) {
setState(() {
Expand Down Expand Up @@ -162,6 +166,33 @@ class _PomodoroSettingsPageState extends State<PomodoroSettingsPage> {
onTap: _pressed_long_break_delay_item,
),
Divider(height: 1),
ListTile(
leading: Text(
'🔔',
style: TextStyle(
fontSize: DeviceUtils.get_size(context, 25, 30, 35)),
),
title: Text('允许后台推送提醒',
style: TextStyle(
fontSize: DeviceUtils.get_size(context, 17, 19, 22))),
trailing: Container(
height: double.infinity,
width: 120,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(_setting_notification == 0 ? "开" : '关',
style: TextStyle(
color: AppColors.TIMER_MAIN_COLOR,
fontSize:
DeviceUtils.get_size(context, 14, 15, 18))),
Icon(Icons.chevron_right, color: Colors.grey),
],
)),
onTap: _pressed_setting_notification_item,
),
Divider(height: 1),
],
),
);
Expand Down Expand Up @@ -233,4 +264,18 @@ class _PomodoroSettingsPageState extends State<PomodoroSettingsPage> {
AppStorage.setInt(AppStorage.K_STRING_POMODORO_BREAK_LONG_DELAY, value + 1);
});
}

void _pressed_setting_notification_item() {
CustomPicker().show(context, ['开', '关'], _setting_notification, (position) {
setState(() {
_setting_notification = position;
});
}, looping: false).then((value) {
print(value);
setState(() {
_setting_notification = value;
});
AppStorage.setInt(AppStorage.K_STRING_POMODORO_NOTIFICATION, value);
});
}
}
9 changes: 6 additions & 3 deletions app/lib/ui/page/timer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class _TimerPageState extends State<TimerPage> with WidgetsBindingObserver {
bool _show_seconds_text = false;
bool _show_edit_button = true;
TimerStateMode _timer_mode = TimerStateMode.start;

int _enable_notification = 0;//0是允许推送
// 设置的时间
int _timer_hours = 1;
String _timer_minutes = '30';
Expand Down Expand Up @@ -63,7 +63,7 @@ class _TimerPageState extends State<TimerPage> with WidgetsBindingObserver {
break;
case AppLifecycleState.paused:
//app当前在后台,不可响应用户的输入
if (_timer_mode == TimerStateMode.timing) {
if (_enable_notification == 0 && _timer_mode == TimerStateMode.timing) {
NotificationUtils.showNotification(1, "倒计时提醒⏳!", TipsDialog.get_tips());
NotificationUtils.addScheduleNotification(100, "计时君提醒⏳!", TipsDialog.get_tips(), 10);
NotificationUtils.addScheduleNotification(101, "计时君提醒⏳!", TipsDialog.get_tips(), 30);
Expand Down Expand Up @@ -119,7 +119,7 @@ class _TimerPageState extends State<TimerPage> with WidgetsBindingObserver {
SizedBox(height: DeviceUtils.get_size(context, 18, 20, 25)),
Text(
_timer_mode == TimerStateMode.timing
? '️⏳ 倒计时学习'
? '️⏳ 学习中..'
: '⌛ 倒计时学习',
style: TextStyle(
fontSize: DeviceUtils.get_size(context, 20, 22, 35),
Expand Down Expand Up @@ -256,6 +256,9 @@ class _TimerPageState extends State<TimerPage> with WidgetsBindingObserver {
}

void _timer_set_time() {
AppStorage.getInt(AppStorage.K_STRING_TIMERT_NOTIFICATION).then((value) {
_enable_notification = value ?? 0;
});
AppStorage.getInt(AppStorage.K_STRING_TIMER_HOURS).then((value) {
_hours = value ?? 1;
_timer_hours = _hours;
Expand Down
Loading

0 comments on commit c3ab04c

Please sign in to comment.