leon 1 vuosi sitten
vanhempi
commit
0f99c044ca

+ 13 - 18
ios/AppDelegate.mm

@@ -99,27 +99,32 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
 //  [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(demoPush) userInfo:nil repeats:NO];
 //  [self mixAudio];
 //  [self demoPush];
+  
+//  for (int i = 0;i<5;i++){
+//    [self demoPush:i];
+//  }
   return YES;
 }
 
--(void)demoPush{
-  UNNotificationAction *action = [UNNotificationAction actionWithIdentifier:@"actionIdentifier" title:@"Action Title" options:UNNotificationActionOptionAuthenticationRequired];
+-(void)demoPush:(int)index{
+  UNNotificationAction *action = [UNNotificationAction actionWithIdentifier:[NSString stringWithFormat:@"%@%d",@"actionIdentifier",index] title:@"Action Title" options:UNNotificationActionOptionAuthenticationRequired];
    
   // 接着定义一个分类,并将动作添加到分类中
-  UNNotificationCategory *category = [UNNotificationCategory categoryWithIdentifier:@"categoryIdentifier" actions:@[action] intentIdentifiers:@[] options:UNNotificationCategoryOptionCustomDismissAction];
+  UNNotificationCategory *category = [UNNotificationCategory categoryWithIdentifier:[NSString stringWithFormat:@"%@%d",@"categoryIdentifier",index] actions:@[action] intentIdentifiers:@[] options:UNNotificationCategoryOptionCustomDismissAction];
    
   // 注册分类
   [[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:[NSSet setWithObjects:category, nil]];
    
   // 创建本地推送内容
   UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
-  content.title = @"Notification Title";
+  content.title = [NSString stringWithFormat:@"%@%d",@"Notification Title",index];
   content.body = @"This is the notification body";
-  content.categoryIdentifier = @"categoryIdentifier"; // 使用你刚刚定义的分类标识符
+  content.categoryIdentifier = [NSString stringWithFormat:@"%@%d",@"categoryIdentifier",index]; // 使用你刚刚定义的分类标识符
+  content.badge = @([UIApplication sharedApplication].applicationIconBadgeNumber + 1);
    
   // 创建推送请求
-  UNTimeIntervalNotificationTrigger * trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:5 repeats:NO];
-  UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:@"notificationIdentifier" content:content trigger:trigger];
+  UNTimeIntervalNotificationTrigger * trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:15+index*5 repeats:NO];
+  UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:[NSString stringWithFormat:@"%@%d",@"notificationIdentifier",index] content:content trigger:trigger];
    
   // 将推送请求添加到通知中心
   [[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:request withCompletionHandler:nil];
@@ -245,7 +250,7 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
 - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
 {
   //  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
-#if DEBUGaa
+#if DEBUG
   return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
 #else
   return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
@@ -521,16 +526,6 @@ initParams:
   self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(jumpNotificationSettingPage) userInfo:nil repeats:YES];
 }
 
-- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler{
-  NSLog(@"%@",notification);
-//  [UIApplication sharedApplication].applicationIconBadgeNumber = 100;
-  completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert);
-}
-
-- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
-    // 处理推送消息
-    NSLog(@"Received a notification: %@", notification.alertBody);
-}
 
 
 @end

+ 4 - 1
ios/NativeBridge.m

@@ -342,7 +342,10 @@ RCT_EXPORT_METHOD(addLocalPush:(id)array){
         }
       }
       [center removePendingNotificationRequestsWithIdentifiers:ids];
-      [self addFSNotifications:array];
+      dispatch_async(dispatch_get_main_queue(), ^{
+        [self addFSNotifications:array];
+      });
+//      [self addFSNotifications:array];
     }];
     
     

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

@@ -544,7 +544,7 @@
 				CODE_SIGN_ENTITLEMENTS = hola/hola.entitlements;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 122;
+				CURRENT_PROJECT_VERSION = 124;
 				DEVELOPMENT_TEAM = GPMXAZ9G5N;
 				ENABLE_BITCODE = NO;
 				INFOPLIST_FILE = hola/Info.plist;
@@ -577,7 +577,7 @@
 				CODE_SIGN_ENTITLEMENTS = hola/hola.entitlements;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 122;
+				CURRENT_PROJECT_VERSION = 124;
 				DEVELOPMENT_TEAM = GPMXAZ9G5N;
 				INFOPLIST_FILE = hola/Info.plist;
 				LD_RUNPATH_SEARCH_PATHS = (

+ 1 - 1
ios/hola/Info.plist

@@ -32,7 +32,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>122</string>
+	<string>124</string>
 	<key>ITSAppUsesNonExemptEncryption</key>
 	<false/>
 	<key>LSApplicationCategoryType</key>

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
ios/main.jsbundle


+ 68 - 68
src/features/trackSomething/components/MetricHistory.tsx

@@ -112,35 +112,35 @@ export default function Component(props: { records: any[] }) {
                             top: -rpxToPx(10)
                         }}>More</Text>
                 }
-                <View style={{backgroundColor:'#1C1C1C',marginLeft:rpxToPx(46),marginRight:rpxToPx(46),borderRadius:rpxToPx(24)}}>
+                <View style={{ backgroundColor: '#1C1C1C', marginLeft: rpxToPx(46), marginRight: rpxToPx(46), borderRadius: rpxToPx(24) }}>
 
-                {
-                    selReference.categories.map((item, index) => {
-                        var cellClassName = 'cell_full1'
-                        var showLine = false
-                        if (selReference.categories.length > 1) {
-                            if (index == 0) {
-                                cellClassName = 'cell_top'
-                                showLine = true
-                            }
-                            else if (index == selReference.categories.length - 1) {
-                                cellClassName = 'cell_bottom'
-                                showLine = false
-                            }
-                            else {
-                                cellClassName = 'cell_center'
-                                showLine = true
-                            }
-                        }
-                        return <View className={cellClassName} style={{marginLeft:0,marginRight:0}} key={index}>
-                            <Text className="cell_title" style={{ color: global.selMetricItem.theme_color }}>{item.value_range}</Text>
-                            <Text className="cell_value" style={{ color: '#fff' }}>{item.category}</Text>
-                            {
-                                showLine && <View className="cell_line" style={{position:'absolute',left:0,right:0,bottom:0,marginLeft:rpxToPx(40)}}></View>
+                    {
+                        selReference.categories.map((item, index) => {
+                            var cellClassName = 'cell_full1'
+                            var showLine = false
+                            if (selReference.categories.length > 1) {
+                                if (index == 0) {
+                                    cellClassName = 'cell_top'
+                                    showLine = true
+                                }
+                                else if (index == selReference.categories.length - 1) {
+                                    cellClassName = 'cell_bottom'
+                                    showLine = false
+                                }
+                                else {
+                                    cellClassName = 'cell_center'
+                                    showLine = true
+                                }
                             }
-                        </View>
-                    })
-                }
+                            return <View className={cellClassName} style={{ marginLeft: 0, marginRight: 0 }} key={index}>
+                                <Text className="cell_title" style={{ color: global.selMetricItem.theme_color }}>{item.value_range}</Text>
+                                <Text className="cell_value" style={{ color: '#fff' }}>{item.category}</Text>
+                                {
+                                    showLine && <View className="cell_line" style={{ position: 'absolute', left: 0, right: 0, bottom: 0, marginLeft: rpxToPx(40) }}></View>
+                                }
+                            </View>
+                        })
+                    }
                 </View>
 
             </View>
@@ -150,7 +150,7 @@ export default function Component(props: { records: any[] }) {
     var lastYearStr = '2050年'
     return <View style={{ display: 'flex', flexDirection: 'column' }} onClick={() => { setSelIndex([-1, -1]) }}>
         {
-            user.test_user && <Text style={{ color: '#fff', position: 'absolute', right: 50, top: 0 }} onClick={() => {
+            user.test_user && <Text style={{ color: '#fff', position: 'absolute', right: 50, top: 0, zIndex: 1000 }} onClick={() => {
                 global.clearHistory()
             }}>删除全部</Text>
         }
@@ -164,20 +164,20 @@ export default function Component(props: { records: any[] }) {
             (list as any).map((item, index) => {
                 var showYear = lastYearStr != TimeFormatter.getYearByDate(item.date)
                 lastYearStr = TimeFormatter.getYearByDate(item.date)
-                return <View style={{ display: 'flex', flexDirection: 'column', paddingBottom: index < list.length - 1 ? 0 : 80,zIndex:index==selIndex[0]?1:0 }}>
+                return <View style={{ display: 'flex', flexDirection: 'column', paddingBottom: index < list.length - 1 ? 0 : 80, zIndex: index == selIndex[0] ? 1 : 0 }}>
                     {
                         showYear && <Text className="year" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>{TimeFormatter.getYearByDate(item.date)}</Text>
                     }
                     <Text className="operate_day" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>{TimeFormatter.getMonthAndDayByDate(item.date)}</Text>
                     {
                         item.records.map((record, j) => {
-                            return <View style={{ position: 'relative',zIndex:j==selIndex[1]?3:2 }} key={j}><RecordItem delete={() => deleteRecord(record)}>
-                                <View className="operate_item1" onClick={(e) => {
-                                    if (process.env.TARO_ENV == 'weapp') {
-                                        e.stopPropagation()
-                                    }
-                                    tapItem(index, j)
-                                }} style={{ position: 'relative', zIndex: 100 }}>
+                            return <View style={{ position: 'relative', zIndex: j == selIndex[1] ? 3 : 2 }} key={j}><RecordItem delete={() => deleteRecord(record)} onClick={(e) => {
+                                if (process.env.TARO_ENV == 'weapp') {
+                                    e.stopPropagation()
+                                }
+                                tapItem(index, j)
+                            }}>
+                                <View className="operate_item1" style={{ position: 'relative', zIndex: 100 }}>
 
                                     {
                                         record.items[0].special == 'FT_IN' ?
@@ -206,39 +206,39 @@ export default function Component(props: { records: any[] }) {
                                 </View>
                             </RecordItem>
                                 {
-                                    index == selIndex[0] && j == selIndex[1] && 
-                                        <View style={{ display: 'flex', flexDirection: 'column',zIndex:10, position: 'absolute', alignItems: 'center', top: rpxToPx(125), left: 30 }}>
-                                            <Image src={require('@assets/images/pointer.png')} style={{ width: 32, height: 12, marginBottom: -2 }} />
-                                            <View style={{
-                                                backgroundColor: '#505050',
-                                                width: 82,
-                                                borderRadius: 12,
-                                                boxSizing: 'border-box',
-                                                flexDirection: 'column',
-                                                display: 'flex'
-                                            }}>
-                                                {
-                                                    global.selMetricItem.schemas[0].unit_options.map((obj, k) => {
-                                                        return <View key={k * 1000} style={{
-                                                            height: 28,
-                                                            display: 'flex',
-                                                            flexDirection: 'row',
-                                                            alignItems: 'center',
-                                                            borderBottomWidth: 1,
-                                                            borderBottomColor: k < global.selMetricItem.schemas[0].unit_options.length - 1 ? '#FFFFFF33' : 'transparent',
-                                                            borderBottomStyle: 'solid'
-                                                        }} onClick={() => {
-                                                            changeUnit(k)
-                                                            setSelIndex([-1, -1])
-                                                        }}>
-                                                            <View style={{ width: 12 }} />
-                                                            <Image style={{ width: 12, height: 9, marginRight: 7, opacity: record.items[0].unit == obj.unit ? 1 : 0 }} src={require('@assets/images/check_white.png')} />
-                                                            <Text style={{ color: '#fff', fontSize: 12 }}>{obj.special == 'FT_IN' ? 'ft in' : obj.unit}</Text>
-                                                        </View>
-                                                    })
-                                                }
-                                            </View>
+                                    index == selIndex[0] && j == selIndex[1] &&
+                                    <View style={{ display: 'flex', flexDirection: 'column', zIndex: 10, position: 'absolute', alignItems: 'center', top: rpxToPx(125), left: 30 }}>
+                                        <Image src={require('@assets/images/pointer.png')} style={{ width: 32, height: 12, marginBottom: -2 }} />
+                                        <View style={{
+                                            backgroundColor: '#505050',
+                                            width: 82,
+                                            borderRadius: 12,
+                                            boxSizing: 'border-box',
+                                            flexDirection: 'column',
+                                            display: 'flex'
+                                        }}>
+                                            {
+                                                global.selMetricItem.schemas[0].unit_options.map((obj, k) => {
+                                                    return <View key={k * 1000} style={{
+                                                        height: 28,
+                                                        display: 'flex',
+                                                        flexDirection: 'row',
+                                                        alignItems: 'center',
+                                                        borderBottomWidth: 1,
+                                                        borderBottomColor: k < global.selMetricItem.schemas[0].unit_options.length - 1 ? '#FFFFFF33' : 'transparent',
+                                                        borderBottomStyle: 'solid'
+                                                    }} onClick={() => {
+                                                        changeUnit(k)
+                                                        setSelIndex([-1, -1])
+                                                    }}>
+                                                        <View style={{ width: 12 }} />
+                                                        <Image style={{ width: 12, height: 9, marginRight: 7, opacity: record.items[0].unit == obj.unit ? 1 : 0 }} src={require('@assets/images/check_white.png')} />
+                                                        <Text style={{ color: '#fff', fontSize: 12 }}>{obj.special == 'FT_IN' ? 'ft in' : obj.unit}</Text>
+                                                    </View>
+                                                })
+                                            }
                                         </View>
+                                    </View>
 
 
                                 }

+ 22 - 2
src/features/trackSomething/components/MetricModalAdd.tsx

@@ -25,6 +25,25 @@ export default function Component(props: { item: any, strTime: string, showPicke
         setSelUnit(-1)
     }
 
+    function trimTrailingZero(num) {
+        // 先将数字转换为字符串
+        let numStr = num.toString();
+      
+        // 检查是否包含小数点
+        if (numStr.indexOf('.') !== -1) {
+          // 获取小数部分
+          let decimalPart = numStr.split('.')[1];
+      
+          // 如果小数部分最后一位是 0,则去掉
+          if (decimalPart.endsWith('0')) {
+            numStr = numStr.slice(0, numStr.lastIndexOf('.'));
+          }
+        }
+      
+        // 返回处理后的数字
+        return parseFloat(numStr);
+      }
+
     function addDetail() {
         return <View className='modal_content'>
             {
@@ -59,8 +78,8 @@ export default function Component(props: { item: any, strTime: string, showPicke
                                 }} pointerEvents="none">{item.name}</Text>
                             }
                             {
-                                unit_options && unit_options.length > 1 && <View style={{ position: 'absolute', right: 20, zIndex: 1000000, top: (metricItem as any).schemas.length == 1 ? -rpxToPx(80) : -rpxToPx(5) }}>
-                                    <Text style={{ color: '#fff', opacity: 0.2, fontSize: 12 }} onClick={(e) => {
+                                unit_options && unit_options.length > 1 && <View style={{ position: 'absolute', right: 20, zIndex: 1000000, top: (metricItem as any).schemas.length == 1 ? -rpxToPx(80)-10 : -rpxToPx(5)-10 }}>
+                                    <Text style={{ color: '#fff', opacity: 0.2, fontSize: 12,paddingTop:10,paddingBottom:10 }} onClick={(e) => {
                                         if (process.env.TARO_ENV == 'weapp') {
                                             e.stopPropagation()
                                         }
@@ -117,6 +136,7 @@ export default function Component(props: { item: any, strTime: string, showPicke
                                                             }
                                                             else {
                                                                 currentValue = parseFloat(currentValue).toFixed(current_obj.scale);
+                                                                currentValue = trimTrailingZero(currentValue)
                                                             }
                                                             current_obj.default_value = currentValue
                                                             dt.schemas[index].tempValue = currentValue

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä