Skip to content

Commit

Permalink
- 优化应用性能和体验细节。
Browse files Browse the repository at this point in the history
- 優化應用性能和體驗細節。
- Optimize application performance and experience details.
  • Loading branch information
iHTCboy committed Mar 9, 2021
1 parent 8c4fecb commit 5b044d5
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -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<Class<*>>(String::class.java))
emuiApiLevel = (method.invoke(cls, arrayOf<Any>("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
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

}
Expand Down Expand Up @@ -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)
Expand Down
Binary file added app/assets/musics/cowbell.caf
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,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"
Expand Down
12 changes: 6 additions & 6 deletions app/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand All @@ -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";
Expand Down Expand Up @@ -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 = (
Expand All @@ -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";
Expand All @@ -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 = (
Expand All @@ -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";
Expand Down
1 change: 1 addition & 0 deletions app/lib/common/utils/config_storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> setInt(String key, int value) async {
Expand Down
11 changes: 7 additions & 4 deletions app/lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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"),
Expand All @@ -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"),
Expand Down
3 changes: 3 additions & 0 deletions app/lib/generated/intl/messages_zh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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("去商店评分"),
Expand Down
46 changes: 38 additions & 8 deletions app/lib/generated/l10n.dart

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

13 changes: 8 additions & 5 deletions app/lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
5 changes: 4 additions & 1 deletion app/lib/l10n/intl_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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": "隐私协议"
}
19 changes: 19 additions & 0 deletions app/lib/ui/page/pomodoro_page.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -55,6 +56,7 @@ class _PomodoroPageState extends State<PomodoroPage> with WidgetsBindingObserver
_show_tpis = false;
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
showTips();
// show_privacy_policy();
});
};
}
Expand Down Expand Up @@ -425,6 +427,23 @@ class _PomodoroPageState extends State<PomodoroPage> 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');
}
});
}
});
}
}

}

Expand Down
3 changes: 2 additions & 1 deletion app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5b044d5

Please sign in to comment.