diff --git a/README.md b/README.md index ec9abd86..534364e9 100644 --- a/README.md +++ b/README.md @@ -335,12 +335,13 @@ request is an object containing: request.repeatsComponent is an object containing (each field is optionnal): +- `year`: Will repeat every selected year in your fireDate. - `month`: Will repeat every selected month in your fireDate. - `day`: Will repeat every selected day in your fireDate. +- `dayOfWeek`: Will repeast every selected day of the week in your fireDate. - `hour`: Will repeat every selected hour in your fireDate. - `minute`: Will repeat every selected minute in your fireDate. - `second`: Will repeat every selected second in your fireDate. -- `nanosecond`: Will repeat every selected nanosecond in your fireDate. For example, let’s say you want to have a notification repeating every day at 23:54, starting tomorrow, you will use something like this: diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index bce1a379..3f3f5727 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -332,7 +332,7 @@ PODS: - React-cxxreact (= 0.64.2) - React-jsi (= 0.64.2) - React-perflogger (= 0.64.2) - - RNCPushNotificationIOS (1.8.0): + - RNCPushNotificationIOS (1.9.0): - React-Core - Yoga (1.14.0) - YogaKit (1.18.1): @@ -472,9 +472,9 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 - DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de + DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2 FBLazyVector: e686045572151edef46010a6f819ade377dfeb4b - FBReactNativeSpec: 5f16d334c9fd49a492f4db708f24d207c39bb3ac + FBReactNativeSpec: 671da7bdb2a22799bfef695306097397b129ab9e Flipper: d3da1aa199aad94455ae725e9f3aa43f3ec17021 Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41 Flipper-Folly: 755929a4f851b2fb2c347d533a23f191b008554c @@ -482,7 +482,7 @@ SPEC CHECKSUMS: Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9 Flipper-RSocket: 127954abe8b162fcaf68d2134d34dc2bd7076154 FlipperKit: 8a20b5c5fcf9436cac58551dc049867247f64b00 - glog: 73c2498ac6884b13ede40eda8228cb1eee9d9d62 + glog: 1f3da668190260b06b429bb211bfbee5cd790c28 hermes-engine: 7d97ba46a1e29bacf3e3c61ecb2804a5ddd02d4f libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b @@ -509,7 +509,7 @@ SPEC CHECKSUMS: React-RCTVibration: 24600e3b1aaa77126989bc58b6747509a1ba14f3 React-runtimeexecutor: a9904c6d0218fb9f8b19d6dd88607225927668f9 ReactCommon: 149906e01aa51142707a10665185db879898e966 - RNCPushNotificationIOS: 61a7c72bd1ebad3568025957d001e0f0e7b32191 + RNCPushNotificationIOS: 5bffde624d1fd15bfc8b2fd202b012a517a6dc9b Yoga: 575c581c63e0d35c9a83f4b46d01d63abc1100ac YogaKit: f782866e155069a2cca2517aafea43200b01fd5a diff --git a/example/ios/example.xcodeproj/project.pbxproj b/example/ios/example.xcodeproj/project.pbxproj index b8002cfe..c15bd730 100644 --- a/example/ios/example.xcodeproj/project.pbxproj +++ b/example/ios/example.xcodeproj/project.pbxproj @@ -560,7 +560,7 @@ COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 i386"; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -625,7 +625,7 @@ COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 i386"; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; diff --git a/index.d.ts b/index.d.ts index 13679d26..06bdd536 100644 --- a/index.d.ts +++ b/index.d.ts @@ -174,6 +174,19 @@ export type NotificationRequest = { * Must be used with fireDate. */ repeats?: boolean; + /** + * Define what components should be used in the fireDate during repeats. + * Must be used with repeats and fireDate. + */ + repeatsComponent?: { + year?: boolean; + month?: boolean; + day?: boolean; + dayOfWeek?: boolean; + hour?: boolean; + minute?: boolean; + second?: boolean; + }; /** * Sets notification to be silent */ diff --git a/ios/RCTConvert+Notification.m b/ios/RCTConvert+Notification.m index 08bfc2e9..b0b81f54 100644 --- a/ios/RCTConvert+Notification.m +++ b/ios/RCTConvert+Notification.m @@ -112,12 +112,13 @@ + (UNNotificationRequest *)UNNotificationRequest:(id)json } NSDictionary *userDateComps = [RCTConvert NSDictionary:details[@"repeatsComponent"]]; + BOOL year = [RCTConvert BOOL:userDateComps[@"year"]]; BOOL month = [RCTConvert BOOL:userDateComps[@"month"]]; BOOL day = [RCTConvert BOOL:userDateComps[@"day"]]; + BOOL dayOfWeek = [RCTConvert BOOL:userDateComps[@"dayOfWeek"]]; BOOL hour = [RCTConvert BOOL:userDateComps[@"hour"]]; BOOL minute = [RCTConvert BOOL:userDateComps[@"minute"]]; BOOL second = [RCTConvert BOOL:userDateComps[@"second"]]; - BOOL nanosecond = [RCTConvert BOOL:userDateComps[@"nanosecond"]]; content.userInfo = [RCTConvert NSDictionary:details[@"userInfo"]]; if (!isSilent) { @@ -129,7 +130,7 @@ + (UNNotificationRequest *)UNNotificationRequest:(id)json } } else { content.sound = [RCTConvert NSString:details[@"sound"]] ? [UNNotificationSound soundNamed:[RCTConvert NSString:details[@"sound"]]] : [UNNotificationSound defaultSound]; - }``` + } } NSDate* fireDate = [RCTConvert NSDate:details[@"fireDate"]]; @@ -142,12 +143,13 @@ + (UNNotificationRequest *)UNNotificationRequest:(id)json NSCalendarUnitMinute | NSCalendarUnitSecond; NSCalendarUnit repeatDateComponents = + (year ? NSCalendarUnitYear : 0) | (month ? NSCalendarUnitMonth : 0) | (day ? NSCalendarUnitDay : 0) | + (dayOfWeek ? NSCalendarUnitWeekday : 0) | (hour ? NSCalendarUnitHour : 0) | (minute ? NSCalendarUnitMinute : 0) | - (second ? NSCalendarUnitSecond : 0) | - (nanosecond ? NSCalendarUnitNanosecond : 0); + (second ? NSCalendarUnitSecond : 0); NSDateComponents *triggerDate = fireDate ? [[NSCalendar currentCalendar] components:(repeats ? repeatDateComponents : defaultDateComponents) | NSCalendarUnitTimeZone diff --git a/js/types.js b/js/types.js index 8248e665..df3545d0 100644 --- a/js/types.js +++ b/js/types.js @@ -50,12 +50,13 @@ export type NotificationRequest = {| * Must be used with repeats and fireDate. */ repeatsComponent?: { + year?: boolean, month?: boolean, day?: boolean, + dayOfWeek?: boolean, hour?: boolean, minute?: boolean, second?: boolean, - nanosecond?: boolean, }, /** * Sets notification to be silent