Finalised App, Presentation and Report Commenced

This commit is contained in:
Alexander Davis
2017-05-06 02:17:09 +01:00
parent 32f42ec4db
commit 67e9bc1dde
378 changed files with 78554 additions and 952 deletions

View File

@@ -4,7 +4,5 @@ framework module FirebaseAnalytics {
module * { export *}
link "sqlite3"
link "z"
link framework "CoreGraphics"
link framework "Foundation"
link framework "UIKit"
}

View File

@@ -2,7 +2,6 @@ framework module FirebaseCore {
umbrella header "FirebaseCore.h"
export *
module * { export *}
link "c++"
link "z"
link framework "Foundation"
link framework "UIKit"
}

View File

@@ -1,3 +1,10 @@
# 2017-03-31 -- v1.0.10
- Improvements to token-fetching logic
- Fixed some warnings in Instance ID
- Improved error messages if Instance ID couldn't be initialized properly
- Improvements to console logging
# 2017-01-31 -- v1.0.9
- Removed an error being mistakenly logged to the console.

View File

@@ -111,7 +111,7 @@ typedef NS_ENUM(NSInteger, FIRInstanceIDAPNSTokenType) {
/**
* Instance ID provides a unique identifier for each app instance and a mechanism
* to authenticate and authorize actions (for example, sending a GCM message).
* to authenticate and authorize actions (for example, sending an FCM message).
*
* Instance ID is long lived but, may be reset if the device is not used for
* a long time or the Instance ID service detects a problem.

View File

@@ -2,6 +2,6 @@ framework module FirebaseInstanceID {
umbrella header "FirebaseInstanceID.h"
export *
module * { export *}
link framework "Foundation"
link framework "UIKit"
link "c++"
link "z"
}

View File

@@ -100,6 +100,7 @@ typedef NS_ENUM(NSInteger, FIRMessagingMessageStatus) {
* To support devices running iOS 9 or below, use the local and remote notifications handlers
* defined in UIApplicationDelegate protocol.
*/
__IOS_AVAILABLE(10.0)
@protocol FIRMessagingDelegate <NSObject>
/// The callback to handle data message received via FCM for devices running iOS 10 or above.

View File

@@ -2,10 +2,9 @@ framework module FirebaseMessaging {
umbrella header "FirebaseMessaging.h"
export *
module * { export *}
link "c++"
link "sqlite3"
link "z"
link framework "CoreGraphics"
link framework "Foundation"
link framework "SystemConfiguration"
link framework "UIKit"
}

View File

@@ -1,34 +1,35 @@
PODS:
- Firebase/Auth (3.15.0):
- Firebase/Auth (3.16.0):
- Firebase/Core
- FirebaseAuth (= 3.1.1)
- Firebase/Core (3.15.0):
- FirebaseAnalytics (= 3.7.0)
- FirebaseCore (= 3.5.2)
- Firebase/Database (3.15.0):
- Firebase/Core (3.16.0):
- FirebaseAnalytics (= 3.8.0)
- FirebaseCore (= 3.6.0)
- Firebase/Database (3.16.0):
- Firebase/Core
- FirebaseDatabase (= 3.1.2)
- Firebase/Messaging (3.15.0):
- Firebase/Messaging (3.16.0):
- Firebase/Core
- FirebaseMessaging (= 1.2.2)
- Firebase/Storage (3.15.0):
- FirebaseMessaging (= 1.2.3)
- Firebase/Storage (3.16.0):
- Firebase/Core
- FirebaseStorage (= 1.1.0)
- FirebaseAnalytics (3.7.0):
- FirebaseCore (~> 3.5)
- FirebaseAnalytics (3.8.0):
- FirebaseCore (~> 3.6)
- FirebaseInstanceID (~> 1.0)
- GoogleToolboxForMac/NSData+zlib (~> 2.1)
- FirebaseAuth (3.1.1):
- FirebaseAnalytics (~> 3.7)
- GoogleToolboxForMac/NSDictionary+URLArguments (~> 2.1)
- GTMSessionFetcher/Core (~> 1.1)
- FirebaseCore (3.5.2):
- FirebaseCore (3.6.0):
- GoogleToolboxForMac/NSData+zlib (~> 2.1)
- FirebaseDatabase (3.1.2):
- FirebaseAnalytics (~> 3.7)
- FirebaseInstanceID (1.0.9)
- FirebaseMessaging (1.2.2):
- FirebaseAnalytics (~> 3.7)
- FirebaseInstanceID (1.0.10):
- FirebaseCore (~> 3.6)
- FirebaseMessaging (1.2.3):
- FirebaseAnalytics (~> 3.8)
- FirebaseInstanceID (~> 1.0)
- GoogleToolboxForMac/Logger (~> 2.1)
- Protobuf (~> 3.1)
@@ -48,7 +49,7 @@ PODS:
- GoogleToolboxForMac/NSString+URLArguments (= 2.1.1)
- GoogleToolboxForMac/NSString+URLArguments (2.1.1)
- GTMSessionFetcher/Core (1.1.9)
- Protobuf (3.2.0)
- Protobuf (3.2.1)
- SwiftForms (1.7)
DEPENDENCIES:
@@ -60,17 +61,17 @@ DEPENDENCIES:
- SwiftForms
SPEC CHECKSUMS:
Firebase: 2b1cdfba1cda8589f32904a697cc753322bff9d8
FirebaseAnalytics: 0d1b7d81d5021155be37702a94ba1ec16d45365d
Firebase: 21bf4a89d3f01bfbe11adc3a5d934a4a3d3a5fd6
FirebaseAnalytics: 920e46455f27b0a52a80907a6d9b73ee4bd1c635
FirebaseAuth: cc8a1824170adbd351edb7f994490a3fb5c18be6
FirebaseCore: a024587e43778508700af8c6b1209f7c4516ba02
FirebaseCore: 9691ee2ade70c098d7cf92440f4303f16d83ca75
FirebaseDatabase: 05c96d7b43a7368dc91c07791adb49683e1738d1
FirebaseInstanceID: 2d0518b1378fe9d685ef40cbdd63d2fdc1125339
FirebaseMessaging: df8267f378580a24174ce7861233aa11d5c90109
FirebaseInstanceID: b9eedd6846fb5e1f0f7279e1deaa7a7e4cf8392e
FirebaseMessaging: 753d05a925e9eb8eadd09a0ffc9b808578b72fac
FirebaseStorage: a5c55b23741a49a72af8f30f95b3bb5ddbeda12d
GoogleToolboxForMac: 8e329f1b599f2512c6b10676d45736bcc2cbbeb0
GTMSessionFetcher: 5c046c76a1f859bc9c187e918f18e4fc7bb57b5e
Protobuf: 745f59e122e5de98d4d7ef291e264a0eef80f58e
Protobuf: 2ccbaf193f6c65adc67745453ca0c13234c32796
SwiftForms: 3f3dbaa79fe54eb1ccd0aca8d0cd1e38eb00537e
PODFILE CHECKSUM: dd1734d567f280edf21443a33ce1b6333374b6d2

View File

@@ -96,7 +96,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return A newly initialized GPBInt32Array with a copy of the values.
**/
- (instancetype)initWithValues:(const int32_t [])values
- (instancetype)initWithValues:(const int32_t [__nullable])values
count:(NSUInteger)count;
/**
@@ -161,7 +161,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values The values to add to this array.
* @param count The number of elements to add.
**/
- (void)addValues:(const int32_t [])values count:(NSUInteger)count;
- (void)addValues:(const int32_t [__nullable])values count:(NSUInteger)count;
/**
* Adds the values from the given array to this array.
@@ -268,7 +268,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return A newly initialized GPBUInt32Array with a copy of the values.
**/
- (instancetype)initWithValues:(const uint32_t [])values
- (instancetype)initWithValues:(const uint32_t [__nullable])values
count:(NSUInteger)count;
/**
@@ -333,7 +333,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values The values to add to this array.
* @param count The number of elements to add.
**/
- (void)addValues:(const uint32_t [])values count:(NSUInteger)count;
- (void)addValues:(const uint32_t [__nullable])values count:(NSUInteger)count;
/**
* Adds the values from the given array to this array.
@@ -440,7 +440,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return A newly initialized GPBInt64Array with a copy of the values.
**/
- (instancetype)initWithValues:(const int64_t [])values
- (instancetype)initWithValues:(const int64_t [__nullable])values
count:(NSUInteger)count;
/**
@@ -505,7 +505,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values The values to add to this array.
* @param count The number of elements to add.
**/
- (void)addValues:(const int64_t [])values count:(NSUInteger)count;
- (void)addValues:(const int64_t [__nullable])values count:(NSUInteger)count;
/**
* Adds the values from the given array to this array.
@@ -612,7 +612,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return A newly initialized GPBUInt64Array with a copy of the values.
**/
- (instancetype)initWithValues:(const uint64_t [])values
- (instancetype)initWithValues:(const uint64_t [__nullable])values
count:(NSUInteger)count;
/**
@@ -677,7 +677,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values The values to add to this array.
* @param count The number of elements to add.
**/
- (void)addValues:(const uint64_t [])values count:(NSUInteger)count;
- (void)addValues:(const uint64_t [__nullable])values count:(NSUInteger)count;
/**
* Adds the values from the given array to this array.
@@ -784,7 +784,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return A newly initialized GPBFloatArray with a copy of the values.
**/
- (instancetype)initWithValues:(const float [])values
- (instancetype)initWithValues:(const float [__nullable])values
count:(NSUInteger)count;
/**
@@ -849,7 +849,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values The values to add to this array.
* @param count The number of elements to add.
**/
- (void)addValues:(const float [])values count:(NSUInteger)count;
- (void)addValues:(const float [__nullable])values count:(NSUInteger)count;
/**
* Adds the values from the given array to this array.
@@ -956,7 +956,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return A newly initialized GPBDoubleArray with a copy of the values.
**/
- (instancetype)initWithValues:(const double [])values
- (instancetype)initWithValues:(const double [__nullable])values
count:(NSUInteger)count;
/**
@@ -1021,7 +1021,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values The values to add to this array.
* @param count The number of elements to add.
**/
- (void)addValues:(const double [])values count:(NSUInteger)count;
- (void)addValues:(const double [__nullable])values count:(NSUInteger)count;
/**
* Adds the values from the given array to this array.
@@ -1128,7 +1128,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return A newly initialized GPBBoolArray with a copy of the values.
**/
- (instancetype)initWithValues:(const BOOL [])values
- (instancetype)initWithValues:(const BOOL [__nullable])values
count:(NSUInteger)count;
/**
@@ -1193,7 +1193,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values The values to add to this array.
* @param count The number of elements to add.
**/
- (void)addValues:(const BOOL [])values count:(NSUInteger)count;
- (void)addValues:(const BOOL [__nullable])values count:(NSUInteger)count;
/**
* Adds the values from the given array to this array.
@@ -1325,7 +1325,7 @@ NS_ASSUME_NONNULL_BEGIN
* @return A newly initialized GPBEnumArray with a copy of the values.
**/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValues:(const int32_t [])values
rawValues:(const int32_t [__nullable])values
count:(NSUInteger)count;
/**
@@ -1435,7 +1435,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values The values to add to this array.
* @param count The number of elements to add.
**/
- (void)addValues:(const int32_t [])values count:(NSUInteger)count;
- (void)addValues:(const int32_t [__nullable])values count:(NSUInteger)count;
/**
@@ -1486,7 +1486,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param values Array containing the raw enum values to add to this array.
* @param count The number of raw values to add.
**/
- (void)addRawValues:(const int32_t [])values count:(NSUInteger)count;
- (void)addRawValues:(const int32_t [__nullable])values count:(NSUInteger)count;
/**
* Inserts a raw enum value at the given index.
@@ -1613,7 +1613,7 @@ NS_ASSUME_NONNULL_END
//% *
//% * @return A newly initialized GPB##NAME##Array with a copy of the values.
//% **/
//%- (instancetype)initWithValues:(const TYPE [])values
//%- (instancetype)initWithValues:(const TYPE [__nullable])values
//% count:(NSUInteger)count;
//%
//%/**
@@ -1730,7 +1730,7 @@ NS_ASSUME_NONNULL_END
//% * @return A newly initialized GPB##NAME##Array with a copy of the values.
//% **/
//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
//% rawValues:(const TYPE [])values
//% rawValues:(const TYPE [__nullable])values
//% count:(NSUInteger)count;
//%
//%/**
@@ -1849,7 +1849,7 @@ NS_ASSUME_NONNULL_END
//% * @param values The values to add to this array.
//% * @param count The number of elements to add.
//% **/
//%- (void)addValues:(const TYPE [])values count:(NSUInteger)count;
//%- (void)addValues:(const TYPE [__nullable])values count:(NSUInteger)count;
//%
//%ARRAY_EXTRA_MUTABLE_METHODS1_##HELPER_NAME(NAME, TYPE)
//%/**
@@ -1939,7 +1939,7 @@ NS_ASSUME_NONNULL_END
//% * @param values Array containing the raw enum values to add to this array.
//% * @param count The number of raw values to add.
//% **/
//%- (void)addRawValues:(const TYPE [])values count:(NSUInteger)count;
//%- (void)addRawValues:(const TYPE [__nullable])values count:(NSUInteger)count;
//%
//%/**
//% * Inserts a raw enum value at the given index.

View File

@@ -45,7 +45,12 @@ NSString *const GPBCodedInputStreamUnderlyingErrorKey =
NSString *const GPBCodedInputStreamErrorDomain =
GPBNSStringifySymbol(GPBCodedInputStreamErrorDomain);
static const NSUInteger kDefaultRecursionLimit = 64;
// Matching:
// https://github.com/google/protobuf/blob/master/java/core/src/main/java/com/google/protobuf/CodedInputStream.java#L62
// private static final int DEFAULT_RECURSION_LIMIT = 100;
// https://github.com/google/protobuf/blob/master/src/google/protobuf/io/coded_stream.cc#L86
// int CodedInputStream::default_recursion_limit_ = 100;
static const NSUInteger kDefaultRecursionLimit = 100;
static void RaiseException(NSInteger code, NSString *reason) {
NSDictionary *errorInfo = nil;

File diff suppressed because it is too large Load Diff

View File

@@ -738,6 +738,25 @@ void GPBClearMessageAutocreator(GPBMessage *self) {
self->autocreatorExtension_ = nil;
}
// Call this before using the readOnlySemaphore_. This ensures it is created only once.
void GPBPrepareReadOnlySemaphore(GPBMessage *self) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// Create the semaphore on demand (rather than init) as developers might not cause them
// to be needed, and the heap usage can add up. The atomic swap is used to avoid needing
// another lock around creating it.
if (self->readOnlySemaphore_ == nil) {
dispatch_semaphore_t worker = dispatch_semaphore_create(1);
if (!OSAtomicCompareAndSwapPtrBarrier(NULL, worker, (void * volatile *)&(self->readOnlySemaphore_))) {
dispatch_release(worker);
}
}
#pragma clang diagnostic pop
}
static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) {
if (!self->unknownFields_) {
self->unknownFields_ = [[GPBUnknownFieldSet alloc] init];
@@ -3152,8 +3171,17 @@ static void ResolveIvarSet(GPBFieldDescriptor *field,
if (result.impToAdd) {
const char *encoding =
GPBMessageEncodingForSelector(result.encodingSelector, YES);
BOOL methodAdded = class_addMethod(descriptor.messageClass, sel,
result.impToAdd, encoding);
Class msgClass = descriptor.messageClass;
BOOL methodAdded = class_addMethod(msgClass, sel, result.impToAdd, encoding);
// class_addMethod() is documented as also failing if the method was already
// added; so we check if the method is already there and return success so
// the method dispatch will still happen. Why would it already be added?
// Two threads could cause the same method to be bound at the same time,
// but only one will actually bind it; the other still needs to return true
// so things will dispatch.
if (!methodAdded) {
methodAdded = GPBClassHasSel(msgClass, sel);
}
return methodAdded;
}
return [super resolveInstanceMethod:sel];

View File

@@ -70,7 +70,6 @@ typedef struct GPBMessage_Storage *GPBMessage_StoragePtr;
// Use of readOnlySemaphore_ must be prefaced by a call to
// GPBPrepareReadOnlySemaphore to ensure it has been created. This allows
// readOnlySemaphore_ to be only created when actually needed.
dispatch_once_t readOnlySemaphoreCreationOnce_;
dispatch_semaphore_t readOnlySemaphore_;
}
@@ -105,14 +104,7 @@ CF_EXTERN_C_BEGIN
// Call this before using the readOnlySemaphore_. This ensures it is created only once.
NS_INLINE void GPBPrepareReadOnlySemaphore(GPBMessage *self) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
dispatch_once(&self->readOnlySemaphoreCreationOnce_, ^{
self->readOnlySemaphore_ = dispatch_semaphore_create(1);
});
#pragma clang diagnostic pop
}
void GPBPrepareReadOnlySemaphore(GPBMessage *self);
// Returns a new instance that was automatically created by |autocreator| for
// its field |field|.

View File

@@ -184,11 +184,10 @@ static id ExtensionForName(id self, SEL _cmd) {
dispatch_semaphore_wait(gExtensionSingletonDictionarySemaphore,
DISPATCH_TIME_FOREVER);
id extension = (id)CFDictionaryGetValue(gExtensionSingletonDictionary, key);
if (extension) {
// The method is getting wired in to the class, so no need to keep it in
// the dictionary.
CFDictionaryRemoveValue(gExtensionSingletonDictionary, key);
}
// We can't remove the key from the dictionary here (as an optimization),
// two threads could have gone into +resolveClassMethod: for the same method,
// and ended up here; there's no way to ensure both return YES without letting
// both try to wire in the method.
dispatch_semaphore_signal(gExtensionSingletonDictionarySemaphore);
return extension;
}
@@ -212,9 +211,17 @@ BOOL GPBResolveExtensionClassMethod(Class self, SEL sel) {
#pragma unused(obj)
return extension;
});
if (class_addMethod(metaClass, sel, imp, encoding)) {
return YES;
BOOL methodAdded = class_addMethod(metaClass, sel, imp, encoding);
// class_addMethod() is documented as also failing if the method was already
// added; so we check if the method is already there and return success so
// the method dispatch will still happen. Why would it already be added?
// Two threads could cause the same method to be bound at the same time,
// but only one will actually bind it; the other still needs to return true
// so things will dispatch.
if (!methodAdded) {
methodAdded = GPBClassHasSel(metaClass, sel);
}
return methodAdded;
}
return NO;
}

View File

@@ -1774,6 +1774,25 @@ NSString *GPBDecodeTextFormatName(const uint8_t *decodeData, int32_t key,
#pragma clang diagnostic pop
BOOL GPBClassHasSel(Class aClass, SEL sel) {
// NOTE: We have to use class_copyMethodList, all other runtime method
// lookups actually also resolve the method implementation and this
// is called from within those methods.
BOOL result = NO;
unsigned int methodCount = 0;
Method *methodList = class_copyMethodList(aClass, &methodCount);
for (unsigned int i = 0; i < methodCount; ++i) {
SEL methodSelector = method_getName(methodList[i]);
if (methodSelector == sel) {
result = YES;
break;
}
}
free(methodList);
return result;
}
#pragma mark - GPBMessageSignatureProtocol
// A series of selectors that are used solely to get @encoding values

View File

@@ -345,4 +345,6 @@ GPB_MESSAGE_SIGNATURE_ENTRY(int32_t, Enum)
+ (id)getClassValue;
@end
BOOL GPBClassHasSel(Class aClass, SEL sel);
CF_EXTERN_C_END

View File

@@ -112,16 +112,27 @@ typedef NS_ENUM(NSInteger, GPBWellKnownTypesErrorCode) {
* @note: Not all second/nanos combinations can be represented in a
* NSTimeInterval, so getting this could be a lossy transform.
**/
@property(nonatomic, readwrite) NSTimeInterval timeIntervalSince1970;
@property(nonatomic, readwrite) NSTimeInterval timeInterval;
/**
* Initializes a GPBDuration with the given NSTimeInterval.
*
* @param timeIntervalSince1970 Time interval to configure the GPBDuration with.
* @param timeInterval Time interval to configure the GPBDuration with.
*
* @return A newly initialized GPBDuration.
**/
- (instancetype)initWithTimeIntervalSince1970:(NSTimeInterval)timeIntervalSince1970;
- (instancetype)initWithTimeInterval:(NSTimeInterval)timeInterval;
// These next two methods are deprecated because GBPDuration has no need of a
// "base" time. The older methods were about symmetry with GBPTimestamp, but
// the unix epoch usage is too confusing.
/** Deprecated, use timeInterval instead. */
@property(nonatomic, readwrite) NSTimeInterval timeIntervalSince1970
__attribute__((deprecated("Use timeInterval")));
/** Deprecated, use initWithTimeInterval: instead. */
- (instancetype)initWithTimeIntervalSince1970:(NSTimeInterval)timeIntervalSince1970
__attribute__((deprecated("Use initWithTimeInterval:")));
@end

View File

@@ -41,15 +41,25 @@ NSString *const GPBWellKnownTypesErrorDomain =
static NSString *kTypePrefixGoogleApisCom = @"type.googleapis.com/";
static NSTimeInterval TimeIntervalSince1970FromSecondsAndNanos(int64_t seconds,
int32_t nanos) {
static NSTimeInterval TimeIntervalFromSecondsAndNanos(int64_t seconds,
int32_t nanos) {
return seconds + (NSTimeInterval)nanos / 1e9;
}
static int32_t SecondsAndNanosFromTimeIntervalSince1970(NSTimeInterval time,
int64_t *outSeconds) {
static int32_t SecondsAndNanosFromTimeInterval(NSTimeInterval time,
int64_t *outSeconds,
BOOL nanosMustBePositive) {
NSTimeInterval seconds;
NSTimeInterval nanos = modf(time, &seconds);
if (nanosMustBePositive && (nanos < 0)) {
// Per Timestamp.proto, nanos is non-negative and "Negative second values with
// fractions must still have non-negative nanos values that count forward in
// time. Must be from 0 to 999,999,999 inclusive."
--seconds;
nanos = 1.0 + nanos;
}
nanos *= 1e9;
*outSeconds = (int64_t)seconds;
return (int32_t)nanos;
@@ -88,8 +98,8 @@ static NSString *ParseTypeFromURL(NSString *typeURLString) {
- (instancetype)initWithTimeIntervalSince1970:(NSTimeInterval)timeIntervalSince1970 {
if ((self = [super init])) {
int64_t seconds;
int32_t nanos = SecondsAndNanosFromTimeIntervalSince1970(
timeIntervalSince1970, &seconds);
int32_t nanos = SecondsAndNanosFromTimeInterval(
timeIntervalSince1970, &seconds, YES);
self.seconds = seconds;
self.nanos = nanos;
}
@@ -105,13 +115,13 @@ static NSString *ParseTypeFromURL(NSString *typeURLString) {
}
- (NSTimeInterval)timeIntervalSince1970 {
return TimeIntervalSince1970FromSecondsAndNanos(self.seconds, self.nanos);
return TimeIntervalFromSecondsAndNanos(self.seconds, self.nanos);
}
- (void)setTimeIntervalSince1970:(NSTimeInterval)timeIntervalSince1970 {
int64_t seconds;
int32_t nanos =
SecondsAndNanosFromTimeIntervalSince1970(timeIntervalSince1970, &seconds);
SecondsAndNanosFromTimeInterval(timeIntervalSince1970, &seconds, YES);
self.seconds = seconds;
self.nanos = nanos;
}
@@ -122,27 +132,39 @@ static NSString *ParseTypeFromURL(NSString *typeURLString) {
@implementation GPBDuration (GBPWellKnownTypes)
- (instancetype)initWithTimeIntervalSince1970:(NSTimeInterval)timeIntervalSince1970 {
- (instancetype)initWithTimeInterval:(NSTimeInterval)timeInterval {
if ((self = [super init])) {
int64_t seconds;
int32_t nanos = SecondsAndNanosFromTimeIntervalSince1970(
timeIntervalSince1970, &seconds);
int32_t nanos = SecondsAndNanosFromTimeInterval(
timeInterval, &seconds, NO);
self.seconds = seconds;
self.nanos = nanos;
}
return self;
}
- (instancetype)initWithTimeIntervalSince1970:(NSTimeInterval)timeIntervalSince1970 {
return [self initWithTimeInterval:timeIntervalSince1970];
}
- (NSTimeInterval)timeInterval {
return TimeIntervalFromSecondsAndNanos(self.seconds, self.nanos);
}
- (void)setTimeInterval:(NSTimeInterval)timeInterval {
int64_t seconds;
int32_t nanos =
SecondsAndNanosFromTimeInterval(timeInterval, &seconds, NO);
self.seconds = seconds;
self.nanos = nanos;
}
- (NSTimeInterval)timeIntervalSince1970 {
return TimeIntervalSince1970FromSecondsAndNanos(self.seconds, self.nanos);
return self.timeInterval;
}
- (void)setTimeIntervalSince1970:(NSTimeInterval)timeIntervalSince1970 {
int64_t seconds;
int32_t nanos =
SecondsAndNanosFromTimeIntervalSince1970(timeIntervalSince1970, &seconds);
self.seconds = seconds;
self.nanos = nanos;
self.timeInterval = timeIntervalSince1970;
}
@end

View File

@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.2.0</string>
<string>3.2.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>