コード例 #1
0
        /// <summary>
        /// Copies this FCM options, and validates the content of it to ensure that it can
        /// be serialized into the JSON format expected by the FCM service.
        /// </summary>
        internal ApnsFcmOptions CopyAndValidate()
        {
            var copy = new ApnsFcmOptions()
            {
                AnalyticsLabel = this.AnalyticsLabel,
            };

            AnalyticsLabelChecker.ValidateAnalyticsLabel(copy.AnalyticsLabel);

            return(copy);
        }
コード例 #2
0
        /// <summary>
        /// Copies this FCM options, and validates the content of it to ensure that it can
        /// be serialized into the JSON format expected by the FCM service.
        /// </summary>
        internal ApnsFcmOptions CopyAndValidate()
        {
            var copy = new ApnsFcmOptions()
            {
                AnalyticsLabel = this.AnalyticsLabel,
                ImageUrl       = this.ImageUrl,
            };

            AnalyticsLabelChecker.ValidateAnalyticsLabel(copy.AnalyticsLabel);

            if (copy.ImageUrl != null && !Uri.IsWellFormedUriString(copy.ImageUrl, UriKind.Absolute))
            {
                throw new ArgumentException($"Malformed image URL string: {copy.ImageUrl}.");
            }

            return(copy);
        }