Skip to content

Commit

Permalink
feat:增加更多倒计时背景声,增加更多的名言名句
Browse files Browse the repository at this point in the history
  • Loading branch information
iHTCboy committed Jan 24, 2023
1 parent 32e2820 commit 01f07e8
Show file tree
Hide file tree
Showing 22 changed files with 280 additions and 47 deletions.
Binary file added app/assets/musics/Birds.mp3
Binary file not shown.
Binary file added app/assets/musics/Campfire.mp3
Binary file not shown.
Binary file added app/assets/musics/RiverStream.mp3
Binary file not shown.
Binary file added app/assets/musics/SeaWaves.mp3
Binary file not shown.
Binary file added app/assets/musics/SummerNight.mp3
Binary file not shown.
Binary file added app/assets/musics/Thunderstorm.mp3
Binary file not shown.
Binary file added app/assets/musics/WhiteNoise.mp3
Binary file not shown.
4 changes: 2 additions & 2 deletions app/ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ export "FLUTTER_APPLICATION_PATH=/Users/HTC/Documents/Programing/Flutter/iPomodo
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_TARGET=/Users/HTC/Documents/Programing/Flutter/iPomodoro-Flutter/app/lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=3.0.0"
export "FLUTTER_BUILD_NAME=3.1.0"
export "FLUTTER_BUILD_NUMBER=230124"
export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false"
Expand Down
6 changes: 3 additions & 3 deletions app/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.0.0;
MARKETING_VERSION = 3.1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.iHTCboy.iPomodoro;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand Down Expand Up @@ -593,7 +593,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.0.0;
MARKETING_VERSION = 3.1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.iHTCboy.iPomodoro;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand All @@ -619,7 +619,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.0.0;
MARKETING_VERSION = 3.1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.iHTCboy.iPomodoro;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand Down
3 changes: 3 additions & 0 deletions app/lib/common/utils/audio_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class AudioPlayerUtil {
}
}

static stopAudio() {
return player.stop();
}
setCache(url) {
AudioPlayer.global.setGlobalAudioContext(audioContext);
audioPlayer.setPlayerMode(PlayerMode.lowLatency);
Expand Down
4 changes: 2 additions & 2 deletions app/lib/common/utils/config_storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ class AppStorage {
static const String K_STRING_POMODORO_BREAK_LONG = "k_string_pomodoro_break_long";
static const String K_STRING_POMODORO_BREAK_LONG_DELAY = "k_string_pomodoro_break_long_delay";
static const String K_STRING_POMODORO_NOTIFICATION = "k_string_pomodoro_notification";
static const String K_STRING_POMODORO_TICKING_SOUND = "k_string_pomodoro_ticking_sound";
static const String K_STRING_POMODORO_TICKING_SOUND = "k_string_pomodoro_tick_sound";
static const String K_STRING_POMODORO_ALARM_SOUND = "k_string_pomodoro_alarm_sound";
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_TIMERT_NOTIFICATION = "k_string_timer_notification";
static const String K_STRING_TIMER_TICKING_SOUND = "k_string_timer_ticking_sound";
static const String K_STRING_TIMER_TICKING_SOUND = "k_string_timer_tick_sound";
static const String K_STRING_TIMER_ALARM_SOUND = "k_string_timer_alarm_sound";
static const String K_STRING_CUNTDOWN_ORDER_INDEX = "k_string_countdown_order_idex";
static const String K_STRING_LANGUAGE_SETTINGS = "k_string_language_settings";
Expand Down
4 changes: 2 additions & 2 deletions app/lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class MessageLookup extends MessageLookupByLibrary {
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"about_me" : MessageLookupByLibrary.simpleMessage("About"),
"alarm_sound" : MessageLookupByLibrary.simpleMessage("Alarm sound"),
"alarm_sound" : MessageLookupByLibrary.simpleMessage("Countdown end sound"),
"background_push_tips" : MessageLookupByLibrary.simpleMessage("Allows background push notifications"),
"break_time" : MessageLookupByLibrary.simpleMessage("🍌 Break time.."),
"continue_button" : MessageLookupByLibrary.simpleMessage("continue"),
Expand All @@ -61,7 +61,7 @@ class MessageLookup extends MessageLookupByLibrary {
"learn_time" : MessageLookupByLibrary.simpleMessage("🍅 Studing.."),
"minutes" : MessageLookupByLibrary.simpleMessage("M"),
"pause_button" : MessageLookupByLibrary.simpleMessage("pause"),
"play_clock_ticking_sound" : MessageLookupByLibrary.simpleMessage("Allows play clock ticking sound"),
"play_clock_ticking_sound" : MessageLookupByLibrary.simpleMessage("Countdown background sound"),
"pomodoro" : MessageLookupByLibrary.simpleMessage("Pomodoro"),
"pomodoro_duration" : MessageLookupByLibrary.simpleMessage("Pomodoro duration"),
"pomodoro_give_up_tips" : MessageLookupByLibrary.simpleMessage("Are you sure you want to give up 🍅 Pomodoro time?"),
Expand Down
4 changes: 2 additions & 2 deletions app/lib/generated/intl/messages_zh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class MessageLookup extends MessageLookupByLibrary {
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"about_me" : MessageLookupByLibrary.simpleMessage("关于我"),
"alarm_sound" : MessageLookupByLibrary.simpleMessage("计时结束铃声"),
"alarm_sound" : MessageLookupByLibrary.simpleMessage("倒计时结束铃声"),
"background_push_tips" : MessageLookupByLibrary.simpleMessage("允许后台推送提醒"),
"break_time" : MessageLookupByLibrary.simpleMessage("🍌 休息时间.."),
"continue_button" : MessageLookupByLibrary.simpleMessage("继续"),
Expand All @@ -61,7 +61,7 @@ class MessageLookup extends MessageLookupByLibrary {
"learn_time" : MessageLookupByLibrary.simpleMessage("🍅 学习中.."),
"minutes" : MessageLookupByLibrary.simpleMessage("分"),
"pause_button" : MessageLookupByLibrary.simpleMessage("暂停"),
"play_clock_ticking_sound" : MessageLookupByLibrary.simpleMessage("播放时钟滴答声"),
"play_clock_ticking_sound" : MessageLookupByLibrary.simpleMessage("倒计时背景声"),
"pomodoro" : MessageLookupByLibrary.simpleMessage("番茄钟"),
"pomodoro_duration" : MessageLookupByLibrary.simpleMessage("每个番茄学习时间"),
"pomodoro_give_up_tips" : MessageLookupByLibrary.simpleMessage("确认要放弃当前🍅番茄时间吗?"),
Expand Down
8 changes: 4 additions & 4 deletions app/lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"pomodoro_hours_minutes": "{pomodoro_hours} hours {pomodoro_minutes} minutes",
"pomodoro_times": "{pomodoro_times} Pomodoro times",
"background_push_tips": "Allows background push notifications",
"play_clock_ticking_sound": "Allows play clock ticking sound",
"alarm_sound": "Alarm sound",
"play_clock_ticking_sound": "Countdown background sound",
"alarm_sound": "Countdown end sound",
"switch_on": "On",
"switch_off": "Off",
"timer_push_tips": "Timer reminder⏳!",
Expand Down
4 changes: 2 additions & 2 deletions app/lib/l10n/intl_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"pomodoro_hours_minutes": "{pomodoro_hours}小时{pomodoro_minutes}分钟",
"pomodoro_times": "{pomodoro_times}个番茄时间",
"background_push_tips": "允许后台推送提醒",
"play_clock_ticking_sound": "播放时钟滴答声",
"alarm_sound": "计时结束铃声",
"play_clock_ticking_sound": "倒计时背景声",
"alarm_sound": "倒计时结束铃声",
"switch_on": "开",
"switch_off": "关",
"timer_push_tips": "计时君提醒⏳!",
Expand Down
12 changes: 9 additions & 3 deletions app/lib/ui/page/pomodoro_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class _PomodoroPageState extends State<PomodoroPage> with WidgetsBindingObserver
WidgetsBinding.instance.addObserver(this);
_pomodoro_set_time();
_pomodoro_set_sounds();
tickingPlayer.setCache("musics/Ticking.mp3");
}


Expand Down Expand Up @@ -302,9 +301,16 @@ class _PomodoroPageState extends State<PomodoroPage> with WidgetsBindingObserver
}

void _pomodoro_set_sounds() {
AppStorage.getInt(AppStorage.K_STRING_POMODORO_TICKING_SOUND).then((value) {
_is_ticking_sound = value == 1 ? false : true;
AppStorage.getString(AppStorage.K_STRING_POMODORO_TICKING_SOUND).then((value) {
var sound = value ?? "Ticking";
if (sound != 'None') {
_is_ticking_sound = true;
tickingPlayer.setCache("musics/${sound}.mp3");
} else {
_is_ticking_sound = false;
}
});

AppStorage.getString(AppStorage.K_STRING_POMODORO_ALARM_SOUND).then((value) {
var sound = value ?? "Cowbell";
if (sound != 'None') {
Expand Down
28 changes: 19 additions & 9 deletions app/lib/ui/page/pomodoro_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class _PomodoroSettingsPageState extends State<PomodoroSettingsPage> {
int _break_long = 0;
int _break_long_delay = 0;
int _setting_notification = 0;
int _play_clock_ticking_sound = 0;
String _ticking_sound = "Ticking";
String _alarm_sound = "Cowbell";

@override
Expand All @@ -46,8 +46,8 @@ class _PomodoroSettingsPageState extends State<PomodoroSettingsPage> {
AppStorage.getInt(AppStorage.K_STRING_POMODORO_NOTIFICATION).then((value) {
_setting_notification = value ?? 0;
});
AppStorage.getInt(AppStorage.K_STRING_POMODORO_TICKING_SOUND).then((value) {
_play_clock_ticking_sound = value ?? 0;
AppStorage.getString(AppStorage.K_STRING_POMODORO_TICKING_SOUND).then((value) {
_ticking_sound = value ?? "Ticking";
});
AppStorage.getString(AppStorage.K_STRING_POMODORO_ALARM_SOUND).then((value) {
_alarm_sound = value ?? 'Cowbell';
Expand Down Expand Up @@ -221,7 +221,7 @@ class _PomodoroSettingsPageState extends State<PomodoroSettingsPage> {
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(_play_clock_ticking_sound == 0 ? S.of(context).switch_on : S.of(context).switch_off,
Text("${_ticking_sound}",
style: TextStyle(
color: AppColors.TIMER_MAIN_COLOR,
fontSize: DeviceUtils.get_size(context, 14, 15, 18))),
Expand Down Expand Up @@ -345,16 +345,24 @@ class _PomodoroSettingsPageState extends State<PomodoroSettingsPage> {
}

void _pressed_play_clock_ticking_sound() {
CustomPicker().show(context, [S.of(context).switch_on, S.of(context).switch_off], _play_clock_ticking_sound, (position) {
final List<String> sounds = ['None', 'Birds', 'Campfire', 'RiverStream', 'SeaWaves', 'SummerNight', 'Thunderstorm', 'Ticking', 'WhiteNoise'];
CustomPicker().show(context, sounds, sounds.indexOf(_ticking_sound), (position) {
var sound = sounds[position];
setState(() {
_play_clock_ticking_sound = position;
_ticking_sound = sound;
});
if (sound != "None") {
AudioPlayerUtil.playAudio("musics/${sound}.mp3");
} else {
AudioPlayerUtil.stopAudio();
}
}, looping: false).then((value) {
print(value);
AudioPlayerUtil.stopAudio();
var sound = sounds[value];
setState(() {
_play_clock_ticking_sound = value;
_ticking_sound = sound;
});
AppStorage.setInt(AppStorage.K_STRING_POMODORO_TICKING_SOUND, value);
AppStorage.setString(AppStorage.K_STRING_POMODORO_TICKING_SOUND, sound);
});
}

Expand All @@ -367,6 +375,8 @@ class _PomodoroSettingsPageState extends State<PomodoroSettingsPage> {
});
if (sound != "None") {
AudioPlayerUtil.playAudio("musics/${sound}.mp3");
} else {
AudioPlayerUtil.stopAudio();
}
}, looping: false).then((value) {
print(value);
Expand Down
12 changes: 9 additions & 3 deletions app/lib/ui/page/timer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class _TimerPageState extends State<TimerPage> with WidgetsBindingObserver {
WidgetsBinding.instance.addObserver(this);
_timer_set_time();
_timer_set_sounds();
tickingPlayer.setCache("musics/Ticking.mp3");
}

@override
Expand Down Expand Up @@ -282,9 +281,16 @@ class _TimerPageState extends State<TimerPage> with WidgetsBindingObserver {
}

void _timer_set_sounds() {
AppStorage.getInt(AppStorage.K_STRING_TIMER_TICKING_SOUND).then((value) {
_is_ticking_sound = value == 1 ? false : true;
AppStorage.getString(AppStorage.K_STRING_TIMER_TICKING_SOUND).then((value) {
var sound = value ?? "Ticking";
if (sound != 'None') {
_is_ticking_sound = true;
tickingPlayer.setCache("musics/${sound}.mp3");
} else {
_is_ticking_sound = false;
}
});

AppStorage.getString(AppStorage.K_STRING_TIMER_ALARM_SOUND).then((value) {
var sound = value ?? "Cowbell";
if (sound != 'None') {
Expand Down
30 changes: 20 additions & 10 deletions app/lib/ui/page/timer_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class _TimerSettingsPageState extends State<TimerSettingsPage> {
int _timer_hours = 1;
int _timer_minutes = 30;
int _setting_notification = 0;
int _play_clock_ticking_sound = 0;
String _ticking_sound = "Ticking";
String _alarm_sound = "Cowbell";

@override
Expand All @@ -39,8 +39,8 @@ class _TimerSettingsPageState extends State<TimerSettingsPage> {
_timer_minutes = value ?? 30;
});
});
AppStorage.getInt(AppStorage.K_STRING_TIMER_TICKING_SOUND).then((value) {
_play_clock_ticking_sound = value ?? 0;
AppStorage.getString(AppStorage.K_STRING_TIMER_TICKING_SOUND).then((value) {
_ticking_sound = value ?? "Ticking";
});
AppStorage.getString(AppStorage.K_STRING_TIMER_ALARM_SOUND).then((value) {
_alarm_sound = value ?? 'Cowbell';
Expand Down Expand Up @@ -127,7 +127,7 @@ class _TimerSettingsPageState extends State<TimerSettingsPage> {
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(_play_clock_ticking_sound == 0 ? S.of(context).switch_on : S.of(context).switch_off,
Text("${_ticking_sound}",
style: TextStyle(
color: AppColors.TIMER_MAIN_COLOR,
fontSize: DeviceUtils.get_size(context, 14, 15, 18))),
Expand Down Expand Up @@ -211,16 +211,24 @@ class _TimerSettingsPageState extends State<TimerSettingsPage> {
}

void _pressed_play_clock_ticking_sound() {
CustomPicker().show(context, [S.of(context).switch_on, S.of(context).switch_off], _play_clock_ticking_sound, (position) {
final List<String> sounds = ['None', 'Birds', 'Campfire', 'RiverStream', 'SeaWaves', 'SummerNight', 'Thunderstorm', 'Ticking', 'WhiteNoise'];
CustomPicker().show(context, sounds, sounds.indexOf(_ticking_sound), (position) {
var sound = sounds[position];
setState(() {
_play_clock_ticking_sound = position;
_ticking_sound = sound;
});
if (sound != "None") {
AudioPlayerUtil.playAudio("musics/${sound}.mp3");
} else {
AudioPlayerUtil.stopAudio();
}
}, looping: false).then((value) {
print(value);
AudioPlayerUtil.stopAudio();
var sound = sounds[value];
setState(() {
_play_clock_ticking_sound = value;
_ticking_sound = sound;
});
AppStorage.setInt(AppStorage.K_STRING_TIMER_TICKING_SOUND, value);
AppStorage.setString(AppStorage.K_STRING_TIMER_TICKING_SOUND, sound);
});
}

Expand All @@ -233,9 +241,11 @@ class _TimerSettingsPageState extends State<TimerSettingsPage> {
});
if (sound != "None") {
AudioPlayerUtil.playAudio("musics/${sound}.mp3");
} else {
AudioPlayerUtil.stopAudio();
}
}, looping: false).then((value) {
print(value);
AudioPlayerUtil.stopAudio();
var sound = sounds[value];
setState(() {
_alarm_sound = sound;
Expand Down
Loading

0 comments on commit 01f07e8

Please sign in to comment.