Esempio n. 1
0
 public int OpenSession(string appId)
 {
     m_notifications.Clear();
     m_results.Clear();
     m_config = Certificates.Instance.PropertiesFor(appId);
     m_appId  = appId;
     m_error  = Certificates.Instance.ErrorCode;
     return(m_error);
 }
Esempio n. 2
0
        public int IOSSetBadge(string applicationId, string deviceToken, int badgeNumber, string sound)
        {
            if (string.IsNullOrEmpty(sound))
            {
                sound = "default";
            }
            ConfigurationProps cert    = Certificates.Instance.PropertiesFor(applicationId);
            string             payload = string.Format(PAYLOAD_BADGE_FORMAT, badgeNumber, sound);

            return(IOSNotifications.Send(deviceToken, payload, cert.iOSuseSandboxServer ? IOS_HOST_SANDBOX : IOS_HOST_PROD, cert.iOScertificate, cert.iOScertificatePassword, out m_customError) ? 0 : 3);
        }
Esempio n. 3
0
        private int SendWin8(string applicationId, string deviceToken, string alert, string action, NotificationParameters props)
        {
            if (props == null)
            {
                props = new NotificationParameters();
            }

            ConfigurationProps securityInfo = Certificates.Instance.PropertiesFor(applicationId);

            return(Win8Notifications.Send(securityInfo.WNSClientSecret, securityInfo.WNSPackageSecurityIdentifier, deviceToken, action, alert, props, out m_customError) ? 0 : 3);
        }
Esempio n. 4
0
        private int SendIOS(string applicationId, string deviceToken, string alert, string action, NotificationParameters props)
        {
            if (props == null)
            {
                props = new NotificationParameters();
            }

            ConfigurationProps cert    = Certificates.Instance.PropertiesFor(applicationId);
            string             payload = string.Format(PAYLOAD_FORMAT, alert, applicationId, action, Certificates.Instance.TypeFor(applicationId), props.ToJson());

            return(IOSNotifications.Send(deviceToken, payload, cert.iOSuseSandboxServer ? IOS_HOST_SANDBOX : IOS_HOST_PROD, cert.iOScertificate, cert.iOScertificatePassword, out m_customError) ? 0 : 3);
        }
Esempio n. 5
0
        private int SendAndroid(string applicationId, string deviceToken, string alert, string action, NotificationParameters props)
        {
            if (props == null)
            {
                props = new NotificationParameters();
            }

            ConfigurationProps cert = Certificates.Instance.PropertiesFor(applicationId);

            // new AndroidUserToken for gcm getting from config file now
            String AndroidUserToken = cert.androidSenderAPIKey;

            //TODO: Add parameters to standart call action?
            return(AndroidNotifications.sendMessage(AndroidUserToken, deviceToken, alert, action, props, out m_customError) ? 0 : 3);
        }
Esempio n. 6
0
        internal void MergePropertiesFor(string entryPoint, ConfigurationProps properties)
        {
            entryPoint = entryPoint.ToLower();
            if (m_data.ContainsKey(entryPoint))
            {
                ConfigurationProps prev = m_data[entryPoint];
                if (!string.IsNullOrEmpty(properties.iOScertificate))
                {
                    prev.iOScertificate      = properties.iOScertificate;
                    prev.iOSuseSandboxServer = properties.iOSuseSandboxServer;
                }
                if (!string.IsNullOrEmpty(properties.iOScertificatePassword))
                {
                    prev.iOScertificatePassword = properties.iOScertificatePassword;
                }

                if (!string.IsNullOrEmpty(properties.androidSenderAPIKey))
                {
                    prev.androidSenderAPIKey = properties.androidSenderAPIKey;
                }

                if (!string.IsNullOrEmpty(properties.androidSenderId))
                {
                    prev.androidSenderId = properties.androidSenderId;
                }

                if (!string.IsNullOrEmpty(properties.WNSClientSecret))
                {
                    prev.WNSClientSecret = properties.WNSClientSecret;
                }

                if (!string.IsNullOrEmpty(properties.WNSPackageSecurityIdentifier))
                {
                    prev.WNSPackageSecurityIdentifier = properties.WNSPackageSecurityIdentifier;
                }
            }
            else
            {
                m_data[entryPoint] = properties;
            }
        }
Esempio n. 7
0
        public int IOSResetBadge(string applicationId, string deviceToken)
        {
            ConfigurationProps cert = Certificates.Instance.PropertiesFor(applicationId);

            return(IOSNotifications.Send(deviceToken, PAYLOAD_RESET, cert.iOSuseSandboxServer ? IOS_HOST_SANDBOX : IOS_HOST_PROD, cert.iOScertificate, cert.iOScertificatePassword, out m_customError) ? 0 : 3);
        }
Esempio n. 8
0
 public void SetConfiguration(string entryPoint, ConfigurationProps properties)
 {
 }
Esempio n. 9
0
 public void SetConfiguration(string entryPoint, ConfigurationProps properties)
 {
     Certificates.Instance.MergePropertiesFor(entryPoint, properties);
 }