leon há 1 ano atrás
pai
commit
e741093959

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
android/app/src/main/assets/index.android.bundle


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
android/app/src/main/assets/index.android.map


+ 11 - 17
android/app/src/main/java/com/hola/AlarmReceiver.java

@@ -16,6 +16,7 @@ import androidx.core.app.NotificationManagerCompat;
 import java.time.Duration;
 
 public class AlarmReceiver extends BroadcastReceiver {
+    int count = 0;
     @Override
     public void onReceive(Context context, Intent intent) {
         String title = intent.getStringExtra("title");
@@ -23,15 +24,17 @@ public class AlarmReceiver extends BroadcastReceiver {
         String channel = intent.getStringExtra("channel");
         String categoryId = intent.getStringExtra("categoryId");
         String strId = intent.getStringExtra("id");
+        int msg_id = intent.getIntExtra("msg_id",0);
 
         Intent intent2 = new Intent(context, MainActivity.class);
-        PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent2, PendingIntent.FLAG_IMMUTABLE);
+        count++;
+        PendingIntent pendingIntent = PendingIntent.getActivity(context, count, intent2, PendingIntent.FLAG_UPDATE_CURRENT);
         // 创建通知构建器
         NotificationCompat.Builder builder = new NotificationCompat.Builder(context, strId)
                 .setSmallIcon(R.drawable.ic_stat_onesignal_default)
                 .setContentTitle(title)
                 .setContentText(message)
-                .setPriority(NotificationCompat.PRIORITY_DEFAULT)
+                .setPriority(NotificationCompat.PRIORITY_HIGH)
                 .setContentIntent(pendingIntent);
 
         assert categoryId != null;
@@ -42,14 +45,14 @@ public class AlarmReceiver extends BroadcastReceiver {
             openAppIntent.setAction("START_TIMER_NOW");
             openAppIntent.putExtra("id",strId);
             openAppIntent.putExtra("category_id",categoryId);
-            PendingIntent openAppPendingIntent = PendingIntent.getActivity(context, 0, openAppIntent, PendingIntent.FLAG_IMMUTABLE);
+            PendingIntent openAppPendingIntent = PendingIntent.getActivity(context, 0, openAppIntent, PendingIntent.FLAG_UPDATE_CURRENT);
             builder.addAction(0, "Start timer now with 1-tap", openAppPendingIntent);
 
             Intent openAppIntent2 = new Intent(context, MainActivity.class);
             openAppIntent2.setAction("PICK_EARLIER_START");
             openAppIntent2.putExtra("id",strId);
             openAppIntent2.putExtra("category_id",categoryId);
-            PendingIntent openAppPendingIntent2 = PendingIntent.getActivity(context, 0, openAppIntent2, PendingIntent.FLAG_IMMUTABLE);
+            PendingIntent openAppPendingIntent2 = PendingIntent.getActivity(context, 0, openAppIntent2, PendingIntent.FLAG_UPDATE_CURRENT);
             builder.addAction(0, "Pick an earlier start", openAppPendingIntent2);
         }
 
@@ -60,31 +63,22 @@ public class AlarmReceiver extends BroadcastReceiver {
             openAppIntent.setAction("END_TIMER_NOW");
             openAppIntent.putExtra("id",strId);
             openAppIntent.putExtra("category_id",categoryId);
-            PendingIntent openAppPendingIntent = PendingIntent.getActivity(context, 0, openAppIntent, PendingIntent.FLAG_IMMUTABLE);
+            PendingIntent openAppPendingIntent = PendingIntent.getActivity(context, 0, openAppIntent, PendingIntent.FLAG_UPDATE_CURRENT);
             builder.addAction(0, "End timer now with 1-tap", openAppPendingIntent);
 
             Intent openAppIntent2 = new Intent(context, MainActivity.class);
             openAppIntent2.setAction("PICK_EARLIER_END");
             openAppIntent2.putExtra("id",strId);
             openAppIntent2.putExtra("category_id",categoryId);
-            PendingIntent openAppPendingIntent2 = PendingIntent.getActivity(context, 0, openAppIntent2, PendingIntent.FLAG_IMMUTABLE);
+            PendingIntent openAppPendingIntent2 = PendingIntent.getActivity(context, 0, openAppIntent2, PendingIntent.FLAG_UPDATE_CURRENT);
             builder.addAction(0, "Pick an earlier end", openAppPendingIntent2);
         }
 
-//        // 添加自定义按钮
-//        Intent openAppIntent = new Intent(context, MainActivity.class);
-//        openAppIntent.setAction("OPEN_APP");
-//        PendingIntent openAppPendingIntent = PendingIntent.getActivity(context, 0, openAppIntent, PendingIntent.FLAG_IMMUTABLE);
-//        builder.addAction(0, "Start timer now with 1-tap", openAppPendingIntent);
-//
-//        Intent openAppIntent2 = new Intent(context, MainActivity.class);
-//        openAppIntent2.setAction("OPEN_APP");
-//        PendingIntent openAppPendingIntent2 = PendingIntent.getActivity(context, 0, openAppIntent, PendingIntent.FLAG_IMMUTABLE);
-//        builder.addAction(0, "Pick an earlier start", openAppPendingIntent2);
 
         // 显示通知
         NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
-        notificationManager.notify(0, builder.build());
+
+        notificationManager.notify(msg_id, builder.build());
     }
 
 //    @Override

+ 36 - 5
android/app/src/main/java/com/hola/HolaModule.java

@@ -95,16 +95,20 @@ public class HolaModule extends ReactContextBaseJavaModule {
                 intent.putExtra("channel", CHANNEL_ID);
                 intent.putExtra("id",strId);
                 intent.putExtra("categoryId",categoryId);
+                intent.putExtra("msg_id",i);
                 intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
 
                 PendingIntent pendingIntent = PendingIntent.getBroadcast(
-                        getCurrentActivity(), 0, intent, android.app.PendingIntent.FLAG_IMMUTABLE);
+                        getCurrentActivity(), i, intent, android.app.PendingIntent.FLAG_UPDATE_CURRENT);
 
                 AlarmManager alarmManager = (AlarmManager) getCurrentActivity().getSystemService(Context.ALARM_SERVICE);
                 if (mode.equals("ONCE")){
-                    long aa = jsonObject.getLong("once");
-                    long bb = SystemClock.elapsedRealtime()+10*1000;
-                    alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, jsonObject.getLong("once"),pendingIntent);
+                    long leftMillis = toNearest1000(jsonObject.getLong("once")-System.currentTimeMillis());
+                    if (leftMillis>0){
+                        alarmManager.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime()+leftMillis,pendingIntent);
+//                        alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime()+leftMillis,pendingIntent);
+                    }
+
 //                    alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime()+10*1000,pendingIntent);
                 }
                 else {
@@ -120,6 +124,29 @@ public class HolaModule extends ReactContextBaseJavaModule {
                     // 如果当前时间已经超过 设定时间,则设置为明天
                     if (calendar.getTimeInMillis() <= System.currentTimeMillis()) {
                         calendar.add(Calendar.DAY_OF_YEAR, 1);
+//                        alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
+//                                AlarmManager.INTERVAL_DAY, pendingIntent);
+                    }
+                    else {
+//                        Calendar now = Calendar.getInstance();
+//                        int currentHour = now.get(Calendar.HOUR_OF_DAY);
+//                        int currentMinute = now.get(Calendar.MINUTE);
+//                        int currentSecond = now.get(Calendar.SECOND);
+//
+//                        // 计算目标时间的秒数
+//                        int targetSeconds = Integer.parseInt(parts[0]) * 3600 + Integer.parseInt(parts[1]) * 60 + Integer.parseInt(parts[2]);
+//
+//                        // 计算当前时间的秒数
+//                        int currentSeconds = currentHour * 3600 + currentMinute * 60 + currentSecond;
+//
+//                        // 计算距离目标时间的秒数
+//                        int secondsUntilTime = targetSeconds - currentSeconds;
+//
+//                        alarmManager.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime()+secondsUntilTime*1000,pendingIntent);
+//
+//                        calendar.add(Calendar.DAY_OF_YEAR, 1);
+//                        alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
+//                                AlarmManager.INTERVAL_DAY, pendingIntent);
                     }
                     alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
                         AlarmManager.INTERVAL_DAY, pendingIntent);
@@ -132,6 +159,10 @@ public class HolaModule extends ReactContextBaseJavaModule {
         }
     }
 
+    public static long toNearest1000(long number) {
+        return ((number + 500) / 1000) * 1000;
+    }
+
     @ReactMethod
     public void rnPageLoaded(){
         GlobalVariable.rnLoaded = true;
@@ -174,7 +205,7 @@ public class HolaModule extends ReactContextBaseJavaModule {
 
     private void createNotificationChannel(Context context,String channelId) {
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
-            NotificationChannel channel = new NotificationChannel(channelId, CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT);
+            NotificationChannel channel = new NotificationChannel(channelId, CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH);
             channel.setDescription(CHANNEL_DESCRIPTION);
 
             NotificationManager notificationManager = context.getSystemService(NotificationManager.class);

+ 2 - 2
src/components/view/NoData.scss

@@ -1,8 +1,8 @@
 .no_data_bg{
     display: flex;
     flex-direction: column;
-    width: '100%';
-    height: '100%';
+    // width: '100%';
+    // height: '100%';
     align-items: center;
     justify-content: center;
 }

+ 1 - 1
src/context/locales/en.js

@@ -573,7 +573,7 @@ export default {
                 sleep_duration: 'Sleep target duration',
                 real_fast_start_dt: 'Start time for fasting',
                 real_fast_start_tip: 'Expected end time: {{time}}',
-                real_fast_end_dt: 'End time of fasting',
+                real_fast_end_dt: 'End time for fasting',
                 real_fast_end_tip: 'Expected end time: {{time}}',
                 real_sleep_start_dt: 'Bedtime',
                 real_sleep_start_tip: 'Expected wake-up time: {{time}}',

+ 7 - 2
src/features/auth/components/login.tsx

@@ -141,7 +141,7 @@ export default function Login(props: { register: () => void }) {
             return item.code == 'privacy'
         })
         debugger
-        if (!resource|| resource.length == 0) {
+        if (!resource || resource.length == 0) {
             Taro.showToast({
                 title: 'Not found.',
                 icon: 'none'
@@ -163,7 +163,12 @@ export default function Login(props: { register: () => void }) {
         <Buttons
             onClick={LoginF}
             title={t('feature.auth.create_account.login')}
-            btnStyle={{ marginLeft: 23, marginRight: 23, marginTop: 20, marginBottom: 20, height: 44, borderRadius: 22, backgroundColor: ColorType.fast }}
+            btnStyle={{
+                marginLeft: 23, marginRight: 23, marginTop: 20,
+                color: ColorType.black,
+                marginBottom: 20, height: 44,
+                borderRadius: 22, backgroundColor: ColorType.fast
+            }}
             disabled={isLoginButtonDisabled || !checked}></Buttons>
 
         <View className="agree_view">

+ 2 - 2
src/features/daynight/DayNightDetailPopup.tsx

@@ -620,7 +620,7 @@ export default function DayNightDetailPopup(props: {
                 </View> :
                 <View className='detail_bottom'>{
                     process.env.TARO_ENV == 'weapp' ?
-                        <View className='detail_bottom_btn' onClick={(e) => {
+                        <View className='detail_bottom_btn' style={{color:'#000'}} onClick={(e) => {
                             clickFooterBtn(e)
                         }}>{props.isNight ? t('feature.day_night.get_local_time') : t('feature.day_night.get_local_time_sunrise')}</View> :
                         <View onClick={(e) => {
@@ -639,7 +639,7 @@ export default function DayNightDetailPopup(props: {
                                 end={{ x: 1, y: 0 }}
 
                             >
-                                <Text style={{ fontWeight: 'bold', fontSize: 18 }}>{props.isNight ? t('feature.day_night.get_local_time') : t('feature.day_night.get_local_time_sunrise')}</Text>
+                                <Text style={{ fontWeight: 'bold', fontSize: 18,color:'#000' }}>{props.isNight ? t('feature.day_night.get_local_time') : t('feature.day_night.get_local_time_sunrise')}</Text>
                             </LinearGradient>
                         </View>
                 }

+ 2 - 1
src/features/trackTimeDuration/components/CheckAccess.tsx

@@ -12,6 +12,7 @@ import { useDidHide, useDidShow } from "@tarojs/taro";
 import Taro from "@tarojs/taro";
 import { useTranslation } from "react-i18next";
 import { kIsIOS } from "@/utils/tools";
+import { ColorType } from "@/context/themes/color";
 
 let confirmAction: any = null;
 let cancelAction: any = null;
@@ -450,7 +451,7 @@ export default function CheckAccess(props: { record: any, count: number }) {
                 <View className="fast_alert_title">{alertTitle}</View>
                 <View className="fast_alert_detail">{alertContent}</View>
                 <View className={subConfirmText.length > 0 ? 'fast_alert_confirm confirm_multline' : 'fast_alert_confirm'} onClick={confirm}>
-                    <Text style={{fontWeight:'bold'}}>{confirmText}</Text>
+                    <Text style={{fontWeight:'bold',color:ColorType.black}}>{confirmText}</Text>
                     {
                         subConfirmText.length > 0 && <Text className="confirm_sub_text">{subConfirmText}</Text>
                     }

+ 1 - 1
src/features/trackTimeDuration/components/CircadianDetailPopup.tsx

@@ -1081,7 +1081,7 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
                             end={{ x: 1, y: 0 }}
 
                         >
-                            <Text style={{ fontWeight: 'bold', fontSize: 20 }}>{getBottomText()}</Text>
+                            <Text style={{ fontWeight: 'bold', fontSize: 20,color:ColorType.black }}>{getBottomText()}</Text>
                         </LinearGradient>
                     </View>
                 // <View className='detail_bottom_btn' onClick={(e) => {

+ 3 - 3
src/features/trackTimeDuration/components/ConsolePicker.tsx

@@ -221,21 +221,21 @@ const Component = forwardRef((props: {
                     <PickerViewColumn style='flex:0 0 45%'>
                         {days.map(item => {
                             return (
-                                <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#fff' }}>{item}</View>
+                                <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#fff',height:50 }}>{item}</View>
                             );
                         })}
                     </PickerViewColumn>
                     <PickerViewColumn>
                         {hours.map(item => {
                             return (
-                                <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#fff' }}>{item < 10 ? `0${item}` : item}</View>
+                                <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#fff',height:50 }}>{item < 10 ? `0${item}` : item}</View>
                             );
                         })}
                     </PickerViewColumn>
                     <PickerViewColumn>
                         {minutes.map(item => {
                             return (
-                                <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#fff' }}>{item < 10 ? `0${item}` : item}</View>
+                                <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#fff',height:50 }}>{item < 10 ? `0${item}` : item}</View>
                             );
                         })}
                     </PickerViewColumn>

+ 1 - 1
src/pages/clock/ChooseScenario.tsx

@@ -210,7 +210,7 @@ export default function ChooseScenario() {
                         start={{ x: 0, y: 0 }}
                         end={{ x: 1, y: 0 }}
                     >
-                        <Text style={{ fontSize: rpxToPx(20),fontWeight:'bold' }}>{t('feature.choose_scenario.limit_time_offer')}</Text>
+                        <Text style={{ fontSize: rpxToPx(20),fontWeight:'bold',color:ColorType.black }}>{t('feature.choose_scenario.limit_time_offer')}</Text>
                     </LinearGradient>
             }
             {

+ 1 - 1
src/pages/clock/ClockMain.tsx

@@ -841,7 +841,7 @@ export default function Page() {
                         }
                         {
                             process.env.TARO_ENV == 'rn' && <View onClick={more}>
-                                <GradientText style={{ fontSize: rpxToPx(32), fontWeight: 'bold' }}>{t('feature.track_time_duration.record_fast_sleep.header.btn_show_all')}</GradientText>
+                                <GradientText style={{ fontSize: rpxToPx(32), fontWeight: 'bold',color:'black' }}>{t('feature.track_time_duration.record_fast_sleep.header.btn_show_all')}</GradientText>
                             </View>
                         }
                     </View>

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff