diff --git a/app/android/app/src/main/kotlin/com/iHTCboy/iPomodoro/DeviceUtils.kt b/app/android/app/src/main/kotlin/com/iHTCboy/iPomodoro/DeviceUtils.kt new file mode 100644 index 0000000..9552f3a --- /dev/null +++ b/app/android/app/src/main/kotlin/com/iHTCboy/iPomodoro/DeviceUtils.kt @@ -0,0 +1,33 @@ +package com.iHTCboy.iPomodoro +import android.os.Build +import java.lang.reflect.Method + +object DeviceUtils { + //emuiApiLevel>0 即华为系统 + //判断是否是华为系统 官网提供 + val isEMUI: Boolean + get() { + //emuiApiLevel>0 即华为系统 + var emuiApiLevel: Int = 0 + try { + val cls = Class.forName("android.os.SystemProperties") + val method: Method = cls.getDeclaredMethod("get", *arrayOf>(String::class.java)) + emuiApiLevel = (method.invoke(cls, arrayOf("ro.build.hw_emui_api_level")) as String).toInt() + } catch (e: Exception) { + e.printStackTrace() + } + return emuiApiLevel > 0 + }//这个字符串可以自己定义,例如判断华为就填写huawei,魅族就填写meizu + + //判官是否是小米系统 官网提供 + val isMIUI: Boolean + get() { + val manufacturer: String = Build.MANUFACTURER + //这个字符串可以自己定义,例如判断华为就填写huawei,魅族就填写meizu + if ("xiaomi".equals(manufacturer, ignoreCase = true)) { + return true + } + return false + } +} + diff --git a/app/android/app/src/main/kotlin/com/iHTCboy/iPomodoro/MainActivity.kt b/app/android/app/src/main/kotlin/com/iHTCboy/iPomodoro/MainActivity.kt index 44211f5..485e189 100644 --- a/app/android/app/src/main/kotlin/com/iHTCboy/iPomodoro/MainActivity.kt +++ b/app/android/app/src/main/kotlin/com/iHTCboy/iPomodoro/MainActivity.kt @@ -158,6 +158,20 @@ class MainActivity : FlutterActivity() { val intent = Intent(this, AppWebviewAvtivity::class.java) startActivity(intent) } + + if ("device_type" == call.method) { + if (DeviceUtils.isEMUI) { + result.success("hw") + return@setMethodCallHandler + } + + if (DeviceUtils.isMIUI) { + result.success("xm") + return@setMethodCallHandler + } + + result.success("success") + } } } @@ -188,13 +202,13 @@ class MainActivity : FlutterActivity() { private fun changeSystemBrightness(brightness: Float) { if (hasPermissionsToWriteSettings(this)) { - println("已获取权限") + //println("已获取权限") val lp = window.attributes lp.screenBrightness = brightness window.attributes = lp } else { //shortToast("你拒绝了权限") - println("你拒绝了权限") + //println("你拒绝了权限") val msg = "更改屏幕亮度,需要先允许修改系统亮度权限,是否允许?" AlertDialog.Builder(this, R.style.DialogTheme) .setMessage(msg) diff --git a/app/assets/musics/cowbell.caf b/app/assets/musics/cowbell.caf new file mode 100644 index 0000000..5e3456a Binary files /dev/null and b/app/assets/musics/cowbell.caf differ diff --git a/app/ios/Flutter/flutter_export_environment.sh b/app/ios/Flutter/flutter_export_environment.sh index 465e83c..3704923 100755 --- a/app/ios/Flutter/flutter_export_environment.sh +++ b/app/ios/Flutter/flutter_export_environment.sh @@ -5,8 +5,8 @@ export "FLUTTER_APPLICATION_PATH=/Users/HTC/Documents/Programing/Flutter/iPomodo export "FLUTTER_TARGET=/Users/HTC/Documents/Programing/Flutter/iPomodoro-Flutter/app/lib/main.dart" export "FLUTTER_BUILD_DIR=build" export "SYMROOT=${SOURCE_ROOT}/../build/ios" -export "FLUTTER_BUILD_NAME=1.3.2" -export "FLUTTER_BUILD_NUMBER=210306" +export "FLUTTER_BUILD_NAME=2.0.0" +export "FLUTTER_BUILD_NUMBER=210307" export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==" export "DART_OBFUSCATION=false" export "TRACK_WIDGET_CREATION=true" diff --git a/app/ios/Runner.xcodeproj/project.pbxproj b/app/ios/Runner.xcodeproj/project.pbxproj index e7e8a3b..287a0f3 100644 --- a/app/ios/Runner.xcodeproj/project.pbxproj +++ b/app/ios/Runner.xcodeproj/project.pbxproj @@ -464,7 +464,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2021.03.05; + CURRENT_PROJECT_VERSION = 2021.03.07; DEVELOPMENT_TEAM = 28PV6G96R7; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -480,7 +480,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.3.2; + MARKETING_VERSION = 2.0.0; PRODUCT_BUNDLE_IDENTIFIER = com.iHTCboy.iPomodoro; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -606,7 +606,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2021.03.05; + CURRENT_PROJECT_VERSION = 2021.03.07; DEVELOPMENT_TEAM = 28PV6G96R7; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -622,7 +622,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.3.2; + MARKETING_VERSION = 2.0.0; PRODUCT_BUNDLE_IDENTIFIER = com.iHTCboy.iPomodoro; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -640,7 +640,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2021.03.05; + CURRENT_PROJECT_VERSION = 2021.03.07; DEVELOPMENT_TEAM = 28PV6G96R7; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -656,7 +656,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.3.2; + MARKETING_VERSION = 2.0.0; PRODUCT_BUNDLE_IDENTIFIER = com.iHTCboy.iPomodoro; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/app/lib/common/utils/config_storage.dart b/app/lib/common/utils/config_storage.dart index 6d62b3c..ee4b1ee 100644 --- a/app/lib/common/utils/config_storage.dart +++ b/app/lib/common/utils/config_storage.dart @@ -13,6 +13,7 @@ class AppStorage { static const String K_STRING_POMODORO_NOTIFICATION = "k_string_pomodoro_notification"; static const String K_STRING_TIMERT_NOTIFICATION = "k_string_timer_notification"; static const String K_STRING_LANGUAGE_SETTINGS = "k_string_language_settings"; + static const String K_STRING_PRIVACY_SHOW_TIPS = "k_string_privacy_show_tips"; static Future setInt(String key, int value) async { diff --git a/app/lib/generated/intl/messages_en.dart b/app/lib/generated/intl/messages_en.dart index 209ca12..a9ad07c 100644 --- a/app/lib/generated/intl/messages_en.dart +++ b/app/lib/generated/intl/messages_en.dart @@ -35,7 +35,7 @@ class MessageLookup extends MessageLookupByLibrary { static m7(AppName) => "Welcome to rate ${AppName}!"; - static m8(AppName) => "Welcome write review for ${AppName}!"; + static m8(AppName) => "Write a review ${AppName}"; static m9(AppStoreUrl) => "Hello, iPomodoro! This is a Pomodoro time management and planning App, no longer distracted! No more delay! Efficient! Focus! A good tool for learning! iOS download: ${AppStoreUrl},Android download:Google Play Store"; @@ -77,16 +77,19 @@ class MessageLookup extends MessageLookupByLibrary { "pomodoro_time" : MessageLookupByLibrary.simpleMessage("🍅 Pomodoro learning"), "pomodoro_times" : m6, "pomodoro_yes" : MessageLookupByLibrary.simpleMessage("Yes(😭)"), + "privacy_policy_agree" : MessageLookupByLibrary.simpleMessage("Agree"), + "privacy_policy_show" : MessageLookupByLibrary.simpleMessage("Privacy Agreement"), + "privacy_policy_tips" : MessageLookupByLibrary.simpleMessage("You need to agree to the user privacy policy agreement to use this application, click \'agree\', to continue using, if you do not agree, please exit the application."), "set_app_review" : MessageLookupByLibrary.simpleMessage("In-app review"), "set_app_review_desc" : m7, "set_appstore_review" : MessageLookupByLibrary.simpleMessage("Store to review"), "set_appstore_review_desc" : m8, "set_email_connect" : MessageLookupByLibrary.simpleMessage("Email"), - "set_email_connect_desc" : MessageLookupByLibrary.simpleMessage("Any questions, please write to us"), + "set_email_connect_desc" : MessageLookupByLibrary.simpleMessage("Any questions, please to us"), "set_feedback" : MessageLookupByLibrary.simpleMessage("Feedback"), "set_feedback_desc" : MessageLookupByLibrary.simpleMessage("Needs or bugs are welcome"), "set_focus" : MessageLookupByLibrary.simpleMessage("Focus more"), - "set_focus_desc" : MessageLookupByLibrary.simpleMessage("Welcome to the author\'s blog"), + "set_focus_desc" : MessageLookupByLibrary.simpleMessage("Welcome to author\'s blog"), "set_localizetion" : MessageLookupByLibrary.simpleMessage("Set Language"), "set_localizetion_desc" : MessageLookupByLibrary.simpleMessage("Change app language"), "set_open_source" : MessageLookupByLibrary.simpleMessage("Open source"), @@ -96,7 +99,7 @@ class MessageLookup extends MessageLookupByLibrary { "set_recommend" : MessageLookupByLibrary.simpleMessage("More"), "set_recommend_desc" : MessageLookupByLibrary.simpleMessage("More developer recommendations"), "set_screen_brightness" : MessageLookupByLibrary.simpleMessage("Set brightness"), - "set_screen_brightness_desc" : MessageLookupByLibrary.simpleMessage("In order to save power during app"), + "set_screen_brightness_desc" : MessageLookupByLibrary.simpleMessage("In order to save power"), "set_share_friend" : MessageLookupByLibrary.simpleMessage("Share"), "set_share_friend_desc" : MessageLookupByLibrary.simpleMessage("Learn with friends around you!"), "start_button" : MessageLookupByLibrary.simpleMessage("start"), diff --git a/app/lib/generated/intl/messages_zh.dart b/app/lib/generated/intl/messages_zh.dart index db27053..2b88674 100644 --- a/app/lib/generated/intl/messages_zh.dart +++ b/app/lib/generated/intl/messages_zh.dart @@ -77,6 +77,9 @@ class MessageLookup extends MessageLookupByLibrary { "pomodoro_time" : MessageLookupByLibrary.simpleMessage("🍅 番茄学习"), "pomodoro_times" : m6, "pomodoro_yes" : MessageLookupByLibrary.simpleMessage("是(😭)"), + "privacy_policy_agree" : MessageLookupByLibrary.simpleMessage("同意"), + "privacy_policy_show" : MessageLookupByLibrary.simpleMessage("隐私协议"), + "privacy_policy_tips" : MessageLookupByLibrary.simpleMessage("使用本应用需要同意用户隐私政策协议,点击“同意”继续使用,不同意请退出应用。"), "set_app_review" : MessageLookupByLibrary.simpleMessage("应用内评分"), "set_app_review_desc" : m7, "set_appstore_review" : MessageLookupByLibrary.simpleMessage("去商店评分"), diff --git a/app/lib/generated/l10n.dart b/app/lib/generated/l10n.dart index b8fb8fc..bd31773 100644 --- a/app/lib/generated/l10n.dart +++ b/app/lib/generated/l10n.dart @@ -885,10 +885,10 @@ class S { ); } - /// `In order to save power during app` + /// `In order to save power` String get set_screen_brightness_desc { return Intl.message( - 'In order to save power during app', + 'In order to save power', name: 'set_screen_brightness_desc', desc: '', args: [], @@ -925,10 +925,10 @@ class S { ); } - /// `Welcome write review for {AppName}!` + /// `Write a review {AppName}` String set_appstore_review_desc(Object AppName) { return Intl.message( - 'Welcome write review for $AppName!', + 'Write a review $AppName', name: 'set_appstore_review_desc', desc: '', args: [AppName], @@ -985,10 +985,10 @@ class S { ); } - /// `Any questions, please write to us` + /// `Any questions, please to us` String get set_email_connect_desc { return Intl.message( - 'Any questions, please write to us', + 'Any questions, please to us', name: 'set_email_connect_desc', desc: '', args: [], @@ -1045,10 +1045,10 @@ class S { ); } - /// `Welcome to the author's blog` + /// `Welcome to author's blog` String get set_focus_desc { return Intl.message( - 'Welcome to the author\'s blog', + 'Welcome to author\'s blog', name: 'set_focus_desc', desc: '', args: [], @@ -1094,6 +1094,36 @@ class S { args: [], ); } + + /// `You need to agree to the user privacy policy agreement to use this application, click 'agree', to continue using, if you do not agree, please exit the application.` + String get privacy_policy_tips { + return Intl.message( + 'You need to agree to the user privacy policy agreement to use this application, click \'agree\', to continue using, if you do not agree, please exit the application.', + name: 'privacy_policy_tips', + desc: '', + args: [], + ); + } + + /// `Agree` + String get privacy_policy_agree { + return Intl.message( + 'Agree', + name: 'privacy_policy_agree', + desc: '', + args: [], + ); + } + + /// `Privacy Agreement` + String get privacy_policy_show { + return Intl.message( + 'Privacy Agreement', + name: 'privacy_policy_show', + desc: '', + args: [], + ); + } } class AppLocalizationDelegate extends LocalizationsDelegate { diff --git a/app/lib/l10n/intl_en.arb b/app/lib/l10n/intl_en.arb index da218c1..f87f643 100644 --- a/app/lib/l10n/intl_en.arb +++ b/app/lib/l10n/intl_en.arb @@ -84,25 +84,28 @@ "tips_confirm": "Confirm", "tips_select_time": "To choose time", "set_screen_brightness": "Set brightness", - "set_screen_brightness_desc": "In order to save power during app", + "set_screen_brightness_desc": "In order to save power", "set_app_review": "In-app review", "set_app_review_desc": "Welcome to rate {AppName}!", "set_appstore_review": "Store to review", - "set_appstore_review_desc": "Welcome write review for {AppName}!", + "set_appstore_review_desc": "Write a review {AppName}", "set_share_friend": "Share", "set_share_friend_desc": "Learn with friends around you!", "set_feedback": "Feedback", "set_feedback_desc": "Needs or bugs are welcome", "set_email_connect": "Email", - "set_email_connect_desc": "Any questions, please write to us", + "set_email_connect_desc": "Any questions, please to us", "set_privacy_policy": "Privacy Policy", "set_privacy_policy_desc": "User Use Service Agreement", "set_open_source": "Open source", "set_open_source_desc": "Open source, welcome to follow", "set_focus": "Focus more", - "set_focus_desc": "Welcome to the author's blog", + "set_focus_desc": "Welcome to author's blog", "set_recommend": "More", "set_recommend_desc": "More developer recommendations", "set_localizetion": "Set Language", - "set_localizetion_desc": "Change app language" + "set_localizetion_desc": "Change app language", + "privacy_policy_tips": "You need to agree to the user privacy policy agreement to use this application, click 'agree', to continue using, if you do not agree, please exit the application.", + "privacy_policy_agree": "Agree", + "privacy_policy_show": "Privacy Agreement" } \ No newline at end of file diff --git a/app/lib/l10n/intl_zh.arb b/app/lib/l10n/intl_zh.arb index ebcc28c..39f9d17 100644 --- a/app/lib/l10n/intl_zh.arb +++ b/app/lib/l10n/intl_zh.arb @@ -104,5 +104,8 @@ "set_recommend": "更多推荐", "set_recommend_desc": "更多开发者内容推荐", "set_localizetion": "设置显示语言", - "set_localizetion_desc": "更改App的语言" + "set_localizetion_desc": "更改App的语言", + "privacy_policy_tips": "使用本应用需要同意用户隐私政策协议,点击“同意”继续使用,不同意请退出应用。", + "privacy_policy_agree": "同意", + "privacy_policy_show": "隐私协议" } \ No newline at end of file diff --git a/app/lib/ui/page/pomodoro_page.dart b/app/lib/ui/page/pomodoro_page.dart index 64dc39b..7f01bb5 100644 --- a/app/lib/ui/page/pomodoro_page.dart +++ b/app/lib/ui/page/pomodoro_page.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -55,6 +56,7 @@ class _PomodoroPageState extends State with WidgetsBindingObserver _show_tpis = false; WidgetsBinding.instance.addPostFrameCallback((timeStamp) { showTips(); + // show_privacy_policy(); }); }; } @@ -425,6 +427,23 @@ class _PomodoroPageState extends State with WidgetsBindingObserver } }); } + + void show_privacy_policy() { + if(Platform.isAndroid) { + AppStorage.getInt(AppStorage.K_STRING_PRIVACY_SHOW_TIPS).then((value) { + if (value == null) { + AlertView.show(context, S.of(context).tips_text, S.of(context).privacy_policy_tips, + confirmText: S.of(context).privacy_policy_agree, cancelText: S.of(context).privacy_policy_show, cancelTextColor: Colors.green).then((bool isOK) { + //save status + AppStorage.setInt(AppStorage.K_STRING_PRIVACY_SHOW_TIPS, 1); + if(!isOK) { + NativeChannel.invokeMethod('privacy_policy'); + } + }); + } + }); + } + } } diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 6d036e7..b9e10f4 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.3.2+210306 +version: 2.1.1+210310 environment: sdk: ">=2.7.0 <3.0.0" @@ -52,6 +52,7 @@ flutter: # To add assets to your application, add an assets section, like this: assets: - assets/images/ + - assets/musics/ # - images/a_dot_burr.jpeg # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see