Leon 1 год назад
Родитель
Сommit
129700bf23

+ 6 - 6
android/app/build.gradle

@@ -147,10 +147,10 @@ aaptOptions.useNewCruncher = false
         versionCode 7
         versionName "1.0.0"
         buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
-        manifestPlaceholders = [
-                JPUSH_APPKEY: "7cf918ada725a9e9aecc8a17",         //在此替换你的APPKey
-                JPUSH_CHANNEL: "online"        //在此替换你的channelÏ
-        ]
+//        manifestPlaceholders = [
+//                JPUSH_APPKEY: "7cf918ada725a9e9aecc8a17",         //在此替换你的APPKey
+//                JPUSH_CHANNEL: "online"        //在此替换你的channelÏ
+//        ]
         if (isNewArchitectureEnabled()) {
             // We configure the CMake build only if you decide to opt-in for the New Architecture.
             externalNativeBuild {
@@ -259,8 +259,8 @@ aaptOptions.useNewCruncher = false
 
 dependencies {
     implementation fileTree(dir: "libs", include: ["*.jar"])
-    implementation project(':jpush-react-native')  // 添加 jpush 依赖
-    implementation project(':jcore-react-native')  // 添加 jcore 依赖
+//    implementation project(':jpush-react-native')  // 添加 jpush 依赖
+//    implementation project(':jcore-react-native')  // 添加 jcore 依赖
     implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
     implementation platform('com.google.firebase:firebase-bom:33.0.0')
 

+ 6 - 6
android/app/src/main/AndroidManifest.xml

@@ -32,12 +32,12 @@
         <meta-data
             android:name="com.dieam.reactnativepushnotification.default_notification_channel_id"
             android:value="@string/default_notification_channel_id" />
-        <meta-data
-            android:name="JPUSH_CHANNEL"
-            android:value="online" />
-        <meta-data
-            android:name="JPUSH_APPKEY"
-            android:value="7cf918ada725a9e9aecc8a17" />
+<!--        <meta-data-->
+<!--            android:name="JPUSH_CHANNEL"-->
+<!--            android:value="online" />-->
+<!--        <meta-data-->
+<!--            android:name="JPUSH_APPKEY"-->
+<!--            android:value="7cf918ada725a9e9aecc8a17" />-->
         <meta-data android:name="com.google.firebase.messaging.default_notification_icon"
             android:resource="@mipmap/ic_launcher" />
 

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
android/app/src/main/assets/index.android.bundle


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
android/app/src/main/assets/index.android.map


+ 1 - 1
android/app/src/main/java/com/hola/MainActivity.java

@@ -128,7 +128,7 @@ public class MainActivity extends ReactActivity {
 
       // 2. 设置 Notification 的内容
       NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID)
-              .setSmallIcon(R.drawable.ic_launcher)
+              .setSmallIcon(R.drawable.picture_ic_flash_on)
               .setContentTitle("Daily Reminder")
               .setContentText("It's 9:00 AM, time to start your day!")
               .setPriority(NotificationCompat.PRIORITY_DEFAULT);

+ 1 - 1
ios/NativeBridge.m

@@ -171,7 +171,7 @@ RCT_EXPORT_METHOD(addLocalPush:(id)array){
       content.sound = [UNNotificationSound defaultSound];
       content.badge = @([UIApplication sharedApplication].applicationIconBadgeNumber + 1);
       if (@available(iOS 15.0,*)){
-        content.interruptionLevel = UNNotificationInterruptionLevelTimeSensitive;
+        content.interruptionLevel = UNNotificationInterruptionLevelActive;
       }
       
       NSString *category_id = detail[@"category_id"];

+ 2 - 2
ios/hola.xcodeproj/project.pbxproj

@@ -572,7 +572,7 @@
 				CODE_SIGN_ENTITLEMENTS = hola/hola.entitlements;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 36;
+				CURRENT_PROJECT_VERSION = 38;
 				DEVELOPMENT_TEAM = GPMXAZ9G5N;
 				ENABLE_BITCODE = NO;
 				INFOPLIST_FILE = hola/Info.plist;
@@ -605,7 +605,7 @@
 				CODE_SIGN_ENTITLEMENTS = hola/hola.entitlements;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 36;
+				CURRENT_PROJECT_VERSION = 38;
 				DEVELOPMENT_TEAM = GPMXAZ9G5N;
 				INFOPLIST_FILE = hola/Info.plist;
 				LD_RUNPATH_SEARCH_PATHS = (

+ 0 - 2
ios/hola/hola.entitlements

@@ -4,7 +4,5 @@
 <dict>
 	<key>aps-environment</key>
 	<string>development</string>
-	<key>com.apple.developer.usernotifications.time-sensitive</key>
-	<true/>
 </dict>
 </plist>

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
ios/main.jsbundle


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

@@ -570,7 +570,7 @@ export default {
                 real_duration: 'Actual',
                 fast_duration: 'Fasting target duration',
                 sleep_duration: 'Sleep target duration',
-                real_fast_start_dt: 'Start time of fasting',
+                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_tip: 'Expected end time: {{time}}',

+ 2 - 0
src/features/daynight/AllRings.tsx

@@ -1,5 +1,7 @@
 import Box from '@/components/layout/Box'
 import './AllRings.scss'
+import './DayNightCard.scss'
+import '../trackTimeDuration/components/IndexItem.scss'
 import { PageContainer, View, Text, Image } from '@tarojs/components'
 import { useEffect, useState } from 'react'
 import Modal from '@/components/layout/Modal.weapp'

+ 0 - 1
src/features/daynight/DayNightCard.tsx

@@ -21,7 +21,6 @@ import DayNightRing from './DayNightRing'
 import dayjs from 'dayjs'
 import DayNightStatus from './DayNightStatus'
 import showAlert from '@/components/basic/Alert'
-// import checkLocation from '@/utils/native_permission_check'
 
 let useNavigation;
 let Linking;

+ 0 - 1
src/features/daynight/DayNightCard2.tsx

@@ -21,7 +21,6 @@ import DayNightRing from './DayNightRing'
 import dayjs from 'dayjs'
 import DayNightStatus from './DayNightStatus'
 import showAlert from '@/components/basic/Alert'
-// import checkLocation from '@/utils/native_permission_check'
 
 let useNavigation;
 let Linking;

+ 6 - 9
src/features/trackTimeDuration/actions/TrackTimeActions.tsx

@@ -111,11 +111,11 @@ export const uploadLocalPushInfo = (params) => {
 
 export const getLocalPush = () => {
     if (process.env.TARO_ENV == 'rn') {
-        console.log('appppple')
         PushNotification.checkPermissions((res)=>{
-            console.log('sssss',res)
+            console.log('aaaaaaaa',res)
+            console.log('aaaaaaaa',res.alert)
             //允许授权
-            if (res.authorizationStatus == 2){
+            if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)){
                 request({
                     url: API_LOCAL_PUSHES, method: 'GET', data: {}
                 }).then(res => {
@@ -144,10 +144,6 @@ export const getLocalPush = () => {
                     });
                     PushNotification.cancelAllLocalNotifications()
         
-                    if (messages.length == 0) {
-                        return
-                    }
-        
                     if (kIsIOS) {
                         var Jto = require('react-native').NativeModules.NativeBridge;
                         Jto.addLocalPush(messages)
@@ -177,7 +173,8 @@ export const getLocalPush = () => {
                                         //... You can use all the options from localNotifications
                                         channelId: item.id,
                                         title: item.title,
-                                        message: item.content + '  ', // (required)
+                                        message: item.body + '\nPress for actions >>', // (required)
+                                        // date:new Date(new Date().getTime()+10*1000),
                                         date: new Date(item.once), // in 60 secs
                                         allowWhileIdle: true, // (optional) set notification to work while on doze, default: false
                                         messageId: item.id,
@@ -191,7 +188,7 @@ export const getLocalPush = () => {
                                     const date = dayjs().format('YYYY-MM-DD')
                                     const { HolaModule } = NativeModules
                                     debugger
-                                    HolaModule.addLocalPush(item.title, item.content, time)
+                                    HolaModule.addLocalPush(item.title, item.body+ '\nPress for actions >>', time)
                                     return;
         
                                     PushNotification.localNotificationSchedule({

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

@@ -11,6 +11,7 @@ import { jumpPage } from "../hooks/Common";
 import { useDidHide, useDidShow } from "@tarojs/taro";
 import Taro from "@tarojs/taro";
 import { useTranslation } from "react-i18next";
+import { kIsIOS } from "@/utils/tools";
 
 let confirmAction: any = null;
 let cancelAction: any = null;
@@ -142,7 +143,7 @@ export default function CheckAccess(props: { record: any, count: number }) {
             confirmAction = null
 
             const { trigger_event } = access.current.qualification;
-            debugger
+            
             //删除记录后仍有资格,不做特殊处理。只有删除时为NOT_SATISFIED_AFTER_DELETE时,弹失去资格弹窗
             if (trigger_event == 'SATISFIED_AFTER_DELETE') {
                 return;
@@ -167,6 +168,7 @@ export default function CheckAccess(props: { record: any, count: number }) {
                 setConfirmText(t('feature.check_access.non_access.btn'))
             }
             else if (preStatus == 'NOT_QUALIFIED' && currentStatus == 'PROVISIONAL_QUALIFIED') {
+                
                 const { streak_fast_current } = acccessData.current.qualification.condition
                 const reason = t('feature.check_access.gain_access.reason',{day: streak_fast_current})
                 Taro.setStorage({ key: 'showedDisqualifiedAlert', data: false })
@@ -181,6 +183,11 @@ export default function CheckAccess(props: { record: any, count: number }) {
                 setSubConfirmText(t('feature.check_access.gain_access.upgrade_desc', { time: TimeFormatter.countdown(expire) }))
 
                 confirmAction = upgrade
+
+                // if (process.env.TARO_ENV=='rn' && !kIsIOS){
+                //     return
+                // }
+
                 timer = setInterval(() => {
                     if (new Date().getTime() > expire) {
                         cancel()

+ 2 - 2
src/features/trackTimeDuration/components/CircadianStatus.tsx

@@ -21,7 +21,7 @@ export default function CircadianStatus(props: { data: any }) {
     if (record.status == 'WAIT_FOR_START') {
         if (record.scenario == 'FAST') {
             return <View className="day_night_status"
-                style={{ backgroundColor: ColorType.fast, color: ColorType.white }}
+                style={{ backgroundColor: ColorType.fast, color: ColorType.black }}
             >{t('feature.track_time_duration.common.pending')}</View>
         }
         else if (record.scenario == 'SLEEP') {
@@ -45,7 +45,7 @@ export default function CircadianStatus(props: { data: any }) {
 
     if (record.scenario == 'FAST') {
         return <View className="day_night_status"
-            style={{ backgroundColor: ColorType.fast, color: ColorType.white }}
+            style={{ backgroundColor: ColorType.fast, color: ColorType.black }}
         >{t('feature.track_time_duration.common.ongoing')}</View>
     }
     else if (record.scenario == 'SLEEP') {

+ 2 - 2
src/features/trackTimeDuration/components/IndexConsole.tsx

@@ -578,7 +578,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
                     else {
                         PushNotification.checkPermissions((res)=>{
                             //允许授权
-                            if (res.authorizationStatus == 2){
+                            if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)){
                                 getLocalPush()
                                 // showAlert({
                                 //     title: t('feature.track_time_duration.reminders.fast_end_title'),
@@ -650,7 +650,7 @@ export default function IndexConsole(props: { record: any, count: number }) {
                     else {
                         PushNotification.checkPermissions((res)=>{
                             //允许授权
-                            if (res.authorizationStatus == 2){
+                            if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)){
                                 getLocalPush()
                                 // showAlert({
                                 //     title: t('feature.track_time_duration.reminders.wake_title'),

+ 2 - 2
src/features/trackTimeDuration/components/SetSchedule.rn.tsx

@@ -297,7 +297,7 @@ export default function Component() {
     function popScheduleAlert(scenario, startTime) {
         PushNotification.checkPermissions((res)=>{
             //允许授权
-            if (res.authorizationStatus == 2){
+            if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)){
                 showAlert({
                     title: t('feature.track_time_duration.reminders.schedule_title'),
                     content: scenario.name == 'FAST' ?
@@ -341,7 +341,7 @@ export default function Component() {
         console.log(time1, time2)
         PushNotification.checkPermissions((res)=>{
             //允许授权
-            if (res.authorizationStatus == 2){
+            if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)){
                 showAlert({
                     title: t('feature.track_time_duration.reminders.schedule_title'),
                     content: t('feature.track_time_duration.reminders.enable_schedule_mix_content', { time1: time1, time2: time2 }),

+ 6 - 5
src/pages/clock/ClockMain.tsx

@@ -657,7 +657,7 @@ export default function Page() {
         else {
             PushNotification.checkPermissions((res) => {
                 //允许授权
-                if (res.authorizationStatus == 2) {
+                if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)){
                 }
                 else {
                     showAlert({
@@ -702,7 +702,7 @@ export default function Page() {
         else {
             PushNotification.checkPermissions((res) => {
                 //允许授权
-                if (res.authorizationStatus == 2) {
+                if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)){
                 }
                 else {
                     showAlert({
@@ -851,6 +851,9 @@ export default function Page() {
                 {
                     showErrorPage && <NoData refresh={() => { getCheckData() }} />
                 }
+                {
+                    user.isLogin && <Streaks count={count} />
+                }
 
                 {
                     user.isLogin && !showErrorPage && <View style={{ display: 'flex', flexDirection: 'column' }}>
@@ -861,9 +864,7 @@ export default function Page() {
                     </View>
                 }
 
-                {
-                    user.isLogin && <Streaks count={count} />
-                }
+                
 
 
                 {

+ 2 - 2
src/pages/clock/SetGoal.tsx

@@ -368,7 +368,7 @@ export default function SetGoal() {
         if (process.env.TARO_ENV === 'rn') {
             PushNotification.checkPermissions((res) => {
                 //允许授权
-                if (res.authorizationStatus == 2) {
+                if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)){
                     getLocalPush();
                     navigation.popToTop()
                     // showAlert({
@@ -418,7 +418,7 @@ export default function SetGoal() {
             const checkNotification = require('@/utils/native_permission_check').checkNotification;
             PushNotification.checkPermissions((res) => {
                 //允许授权
-                if (res.authorizationStatus == 2) {
+                if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)){
                     getLocalPush();
                     navigation.popToTop()
                     // showAlert({

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

@@ -93,7 +93,7 @@ export default function StreakDetail() {
 
     function headerView() {
         return <View style={{ display: 'flex' }}>
-            <Text className='detail_header' style={{ marginTop: 10 }}>{isFast ? t('feature.track_time_duration.streaks.fast') : t('feature.track_time_duration.streaks.sleep')}{t('feature.track_time_duration.streaks.title')}</Text>
+            <Text className='detail_header' style={{ marginTop: 10 }}>{isFast ? t('feature.track_time_duration.streaks.faststreak') : t('feature.track_time_duration.streaks.sleepstreak')}</Text>
         </View>
     }
 

+ 0 - 34
src/utils/native_permission_check.tsx

@@ -8,40 +8,6 @@ import { check, PERMISSIONS, RESULTS, checkMultiple } from 'react-native-permiss
 import { kIsIOS } from './tools';
 // import {OneSignal} from 'react-native-onesignal';
 
-export const checkLocation = () => {
-
-    // JPush.isNotificationEnabled((result) => {
-    //     Taro.showModal({
-    //         title: '提示',
-    //         content: JSON.stringify(result)
-    //     })
-    // });
-
-    check(PERMISSIONS.IOS.LOCATION_ALWAYS)
-        .then((result) => {
-            switch (result) {
-                case RESULTS.UNAVAILABLE:
-                    // Alert.alert('This feature is not available (on this device / in this context)');
-                    break;
-                case RESULTS.DENIED:
-                    console.log('The permission has not been requested / is denied but requestable');
-                    break;
-                case RESULTS.LIMITED:
-                    console.log('The permission is limited: some actions are possible');
-                    break;
-                case RESULTS.GRANTED:
-                    console.log('The permission is granted');
-                    break;
-                case RESULTS.BLOCKED:
-                    // console.log('The permission is denied and not requestable anymore');
-                    break;
-            }
-        })
-        .catch((error) => {
-            // …
-        });
-}
-
 
 export const uploadPermissions = () => {
     if (Taro.getSystemInfoSync().platform == 'android') {

Некоторые файлы не были показаны из-за большого количества измененных файлов