From 4b1a8c387338a0b345a67ae465b66759ae5bd449 Mon Sep 17 00:00:00 2001 From: Pandu Masabathula Date: Mon, 23 May 2022 17:09:43 +0530 Subject: [PATCH] Multi instance configuration fix (#139) * multi-instance fix for PNConfig * Windows Forms example update * Android example update * monotouch example update --- .pubnub.yml | 19 +- CHANGELOG | 4 + .../PubnubApi/Builder/UrlRequestBuilder.cs | 228 +-- .../EndPoint/PubSub/SubscribeManager.cs | 190 +-- src/Api/PubnubApi/Properties/AssemblyInfo.cs | 4 +- src/Api/PubnubApi/Pubnub.cs | 306 ++-- src/Api/PubnubApi/PubnubApi.csproj | 5 +- src/Api/PubnubApiPCL/PubnubApiPCL.csproj | 5 +- src/Api/PubnubApiUWP/PubnubApiUWP.csproj | 5 +- .../PubnubApi.WinFormExample.csproj | 28 +- .../PubnubDemoForm.cs | 180 +-- .../PubnubApi.WinFormExample/packages.config | 35 +- .../PubNubMessaging.Example/LaunchScreen.cs | 11 +- .../PubNubMessaging.Example/MainActivity.cs | 21 + .../Properties/AndroidManifest.xml | 9 +- .../PubNubMessaging.Example.csproj | 230 ++- .../Resources/Resource.designer.cs | 1325 +++++++++++++---- .../Resources/layout/Launch.axml | 99 +- .../Resources/layout/Main.axml | 39 +- .../Resources/layout/Proxy.axml | 4 +- .../PubNubMessaging.Example/packages.config | 79 +- .../mono-for-android/Pubnub-Messaging.sln | 8 +- src/Examples/monotouch/Pubnub-Messaging.sln | 29 +- .../PubnubMessagingExample.csproj | 39 +- .../Pubnub_MessagingMain.cs | 13 +- .../Pubnub_MessagingSub.cs | 23 +- .../PubnubMessagingExample/packages.config | 105 +- 27 files changed, 2082 insertions(+), 961 deletions(-) diff --git a/.pubnub.yml b/.pubnub.yml index 375b326b9..03e2fa0b3 100644 --- a/.pubnub.yml +++ b/.pubnub.yml @@ -1,8 +1,13 @@ name: c-sharp -version: "6.3.0" +version: "6.4.0" schema: 1 scm: github.com/pubnub/c-sharp changelog: + - date: 2022-05-23 + version: v6.4.0 + changes: + - type: bug + text: "Handle PNConfiguration for multi Pubnub instances." - date: 2022-03-22 version: v6.3.0 changes: @@ -643,7 +648,7 @@ features: - QUERY-PARAM supported-platforms: - - version: Pubnub 'C#' 6.3.0 + version: Pubnub 'C#' 6.4.0 platforms: - Windows 10 and up - Windows Server 2008 and up @@ -653,7 +658,7 @@ supported-platforms: - .Net Framework 4.5 - .Net Framework 4.6.1+ - - version: PubnubPCL 'C#' 6.3.0 + version: PubnubPCL 'C#' 6.4.0 platforms: - Xamarin.Android - Xamarin.iOS @@ -672,7 +677,7 @@ supported-platforms: - .Net Standard 2.1 - .Net Core - - version: PubnubUWP 'C#' 6.3.0 + version: PubnubUWP 'C#' 6.4.0 platforms: - Windows Phone 10 - Universal Windows Apps @@ -696,7 +701,7 @@ sdks: distribution-type: source distribution-repository: GitHub package-name: Pubnub - location: https://github.com/pubnub/c-sharp/releases/tag/v6.3.0.0 + location: https://github.com/pubnub/c-sharp/releases/tag/v6.4.0.0 requires: - name: ".Net" @@ -993,7 +998,7 @@ sdks: distribution-type: source distribution-repository: GitHub package-name: PubNubPCL - location: https://github.com/pubnub/c-sharp/releases/tag/v6.3.0.0 + location: https://github.com/pubnub/c-sharp/releases/tag/v6.4.0.0 requires: - name: ".Net Core" @@ -1366,7 +1371,7 @@ sdks: distribution-type: source distribution-repository: GitHub package-name: PubnubUWP - location: https://github.com/pubnub/c-sharp/releases/tag/v6.3.0.0 + location: https://github.com/pubnub/c-sharp/releases/tag/v6.4.0.0 requires: - name: "Universal Windows Platform Development" diff --git a/CHANGELOG b/CHANGELOG index a1d335501..c8588d9a4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +v6.4.0 - May 23 2022 +----------------------------- +- Fixed: handle PNConfiguration for multi Pubnub instances. + v6.3.0 - March 22 2022 ----------------------------- - Fixed: refactor Telemetry Task Result to GetAwaiter().GetResult() . diff --git a/src/Api/PubnubApi/Builder/UrlRequestBuilder.cs b/src/Api/PubnubApi/Builder/UrlRequestBuilder.cs index 6056e0f0b..51a698eba 100644 --- a/src/Api/PubnubApi/Builder/UrlRequestBuilder.cs +++ b/src/Api/PubnubApi/Builder/UrlRequestBuilder.cs @@ -14,7 +14,7 @@ namespace PubnubApi { public sealed class UrlRequestBuilder : IUrlRequestBuilder { - private readonly PNConfiguration pubnubConfig; + private ConcurrentDictionary pubnubConfig { get; } = new ConcurrentDictionary(); private readonly IJsonPluggableLibrary jsonLib ; private readonly IPubnubUnitTest pubnubUnitTest; private readonly IPubnubLog pubnubLog; @@ -24,7 +24,7 @@ public sealed class UrlRequestBuilder : IUrlRequestBuilder public UrlRequestBuilder(PNConfiguration config, IJsonPluggableLibrary jsonPluggableLibrary, IPubnubUnitTest pubnubUnitTest, IPubnubLog log, EndPoint.TelemetryManager pubnubTelemetryMgr, EndPoint.TokenManager pubnubTokenMgr, string pnInstanceId) { - this.pubnubConfig = config; + pubnubConfig.AddOrUpdate(pnInstanceId, config, (k, o) => config); this.jsonLib = jsonPluggableLibrary; this.pubnubUnitTest = pubnubUnitTest; this.pubnubLog = log; @@ -66,7 +66,7 @@ Uri IUrlRequestBuilder.BuildMultiChannelSubscribeRequest(string requestMethod, s List url = new List(); url.Add("v2"); url.Add("subscribe"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add(channelForUrl); url.Add("0"); @@ -78,9 +78,9 @@ Uri IUrlRequestBuilder.BuildMultiChannelSubscribeRequest(string requestMethod, s Dictionary requestQueryStringParams = new Dictionary(internalInitialSubscribeUrlParams); - if (!requestQueryStringParams.ContainsKey("filter-expr") && !string.IsNullOrEmpty(pubnubConfig.FilterExpression)) + if (!requestQueryStringParams.ContainsKey("filter-expr") && pubnubConfig.ContainsKey(pubnubInstanceId) && !string.IsNullOrEmpty(pubnubConfig[pubnubInstanceId].FilterExpression)) { - requestQueryStringParams.Add("filter-expr", UriUtil.EncodeUriComponent(pubnubConfig.FilterExpression, currentType, false, false, false)); + requestQueryStringParams.Add("filter-expr", UriUtil.EncodeUriComponent(pubnubConfig[pubnubInstanceId].FilterExpression, currentType, false, false, false)); } if (!requestQueryStringParams.ContainsKey("tt")) @@ -93,9 +93,9 @@ Uri IUrlRequestBuilder.BuildMultiChannelSubscribeRequest(string requestMethod, s requestQueryStringParams.Add("tr", region.ToString()); } - if (pubnubConfig.PresenceTimeout != 0) + if (pubnubConfig.ContainsKey(pubnubInstanceId) && pubnubConfig[pubnubInstanceId].PresenceTimeout != 0) { - requestQueryStringParams.Add("heartbeat", pubnubConfig.PresenceTimeout.ToString()); + requestQueryStringParams.Add("heartbeat", pubnubConfig[pubnubInstanceId].PresenceTimeout.ToString()); } if (channelGroups != null && channelGroups.Length > 0 && channelGroups[0] != "") @@ -132,16 +132,16 @@ Uri IUrlRequestBuilder.BuildMultiChannelLeaveRequest(string requestMethod, strin url.Add("v2"); url.Add("presence"); url.Add("sub_key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channel"); url.Add(multiChannel); url.Add("leave"); Dictionary requestQueryStringParams = new Dictionary(); - if (pubnubConfig.PresenceTimeout != 0) + if (pubnubConfig.ContainsKey(pubnubInstanceId) && pubnubConfig[pubnubInstanceId].PresenceTimeout != 0) { - requestQueryStringParams.Add("heartbeat", pubnubConfig.PresenceTimeout.ToString()); + requestQueryStringParams.Add("heartbeat", pubnubConfig[pubnubInstanceId].PresenceTimeout.ToString()); } string channelsJsonState = jsonUserState; @@ -177,8 +177,8 @@ Uri IUrlRequestBuilder.BuildPublishRequest(string requestMethod, string requestB List url = new List(); url.Add("publish"); - url.Add(pubnubConfig.PublishKey); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].PublishKey : ""); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("0"); url.Add(channel); url.Add("0"); @@ -235,8 +235,8 @@ Uri IUrlRequestBuilder.BuildSignalRequest(string requestMethod, string requestBo List url = new List(); url.Add("signal"); - url.Add(pubnubConfig.PublishKey); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].PublishKey : ""); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("0"); url.Add(channel); url.Add("0"); @@ -278,7 +278,7 @@ Uri IUrlRequestBuilder.BuildHereNowRequest(string requestMethod, string requestB url.Add("v2"); url.Add("presence"); url.Add("sub_key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); if (!string.IsNullOrEmpty(channel)) { url.Add("channel"); @@ -323,7 +323,7 @@ Uri IUrlRequestBuilder.BuildHistoryRequest(string requestMethod, string requestB url.Add("v2"); url.Add("history"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channel"); url.Add(channel); @@ -380,7 +380,7 @@ Uri IUrlRequestBuilder.BuildFetchRequest(string requestMethod, string requestBod url.Add("v3"); url.Add(includeMessageActions ? "history-with-actions" : "history"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channel"); url.Add(channel); @@ -441,7 +441,7 @@ Uri IUrlRequestBuilder.BuildMessageCountsRequest(string requestMethod, string re url.Add("v3"); url.Add("history"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("message-counts"); if (!string.IsNullOrEmpty(channel)) { @@ -487,7 +487,7 @@ Uri IUrlRequestBuilder.BuildDeleteMessageRequest(string requestMethod, string re url.Add("v3"); url.Add("history"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channel"); url.Add(channel); @@ -526,7 +526,7 @@ Uri IUrlRequestBuilder.BuildWhereNowRequest(string requestMethod, string request url.Add("v2"); url.Add("presence"); url.Add("sub_key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("uuid"); url.Add(uuid); @@ -556,7 +556,7 @@ Uri IUrlRequestBuilder.BuildGrantV2AccessRequest(string requestMethod, string re url.Add("auth"); url.Add("grant"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); Dictionary requestQueryStringParams = new Dictionary(); @@ -616,7 +616,7 @@ Uri IUrlRequestBuilder.BuildGrantV3AccessRequest(string requestMethod, string re List url = new List(); url.Add("v3"); url.Add("pam"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("grant"); Dictionary requestQueryStringParams = new Dictionary(); @@ -644,7 +644,7 @@ Uri IUrlRequestBuilder.BuildRevokeV3AccessRequest(string requestMethod, string r List url = new List(); url.Add("v3"); url.Add("pam"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("grant"); url.Add(token); @@ -675,7 +675,7 @@ Uri IUrlRequestBuilder.BuildAuditAccessRequest(string requestMethod, string requ url.Add("auth"); url.Add("audit"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); Dictionary requestQueryStringParams = new Dictionary(); @@ -718,7 +718,7 @@ Uri IUrlRequestBuilder.BuildGetUserStateRequest(string requestMethod, string req url.Add("v2"); url.Add("presence"); url.Add("sub_key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channel"); if (string.IsNullOrEmpty(channelsCommaDelimited) || channelsCommaDelimited.Trim().Length <= 0) @@ -774,7 +774,7 @@ Uri IUrlRequestBuilder.BuildSetUserStateRequest(string requestMethod, string req url.Add("v2"); url.Add("presence"); url.Add("sub_key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channel"); url.Add(internalChannelsCommaDelimited); url.Add("uuid"); @@ -817,7 +817,7 @@ Uri IUrlRequestBuilder.BuildAddChannelsToChannelGroupRequest(string requestMetho url.Add("v1"); url.Add("channel-registration"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); if (!string.IsNullOrEmpty(nameSpace) && nameSpace.Trim().Length > 0) { url.Add("namespace"); @@ -858,7 +858,7 @@ Uri IUrlRequestBuilder.BuildRemoveChannelsFromChannelGroupRequest(string request url.Add("v1"); url.Add("channel-registration"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); if (!string.IsNullOrEmpty(nameSpace) && nameSpace.Trim().Length > 0) { nameSpaceAvailable = true; @@ -925,7 +925,7 @@ Uri IUrlRequestBuilder.BuildGetChannelsForChannelGroupRequest(string requestMeth url.Add("v1"); url.Add("channel-registration"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); if (!string.IsNullOrEmpty(nameSpace) && nameSpace.Trim().Length > 0) { nameSpaceAvailable = true; @@ -980,7 +980,7 @@ Uri IUrlRequestBuilder.BuildGetAllChannelGroupRequest(string requestMethod, stri url.Add("v1"); url.Add("channel-registration"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channel-group"); Dictionary requestQueryStringParams = new Dictionary(); @@ -1010,7 +1010,7 @@ Uri IUrlRequestBuilder.BuildRegisterDevicePushRequest(string requestMethod, stri url.Add("v2"); url.Add("push"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("devices-apns2"); url.Add(pushToken); } @@ -1019,7 +1019,7 @@ Uri IUrlRequestBuilder.BuildRegisterDevicePushRequest(string requestMethod, stri url.Add("v1"); url.Add("push"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("devices"); url.Add(pushToken); } @@ -1062,7 +1062,7 @@ Uri IUrlRequestBuilder.BuildUnregisterDevicePushRequest(string requestMethod, st url.Add("v2"); url.Add("push"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("devices-apns2"); url.Add(pushToken); url.Add("remove"); @@ -1072,7 +1072,7 @@ Uri IUrlRequestBuilder.BuildUnregisterDevicePushRequest(string requestMethod, st url.Add("v1"); url.Add("push"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("devices"); url.Add(pushToken); url.Add("remove"); @@ -1115,7 +1115,7 @@ Uri IUrlRequestBuilder.BuildRemoveChannelPushRequest(string requestMethod, strin url.Add("v2"); url.Add("push"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("devices-apns2"); url.Add(pushToken); } @@ -1124,7 +1124,7 @@ Uri IUrlRequestBuilder.BuildRemoveChannelPushRequest(string requestMethod, strin url.Add("v1"); url.Add("push"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("devices"); url.Add(pushToken); } @@ -1167,7 +1167,7 @@ Uri IUrlRequestBuilder.BuildGetChannelsPushRequest(string requestMethod, string url.Add("v2"); url.Add("push"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("devices-apns2"); url.Add(pushToken); } @@ -1176,7 +1176,7 @@ Uri IUrlRequestBuilder.BuildGetChannelsPushRequest(string requestMethod, string url.Add("v1"); url.Add("push"); url.Add("sub-key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("devices"); url.Add(pushToken); } @@ -1219,7 +1219,7 @@ Uri IUrlRequestBuilder.BuildPresenceHeartbeatRequest(string requestMethod, strin url.Add("v2"); url.Add("presence"); url.Add("sub_key"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channel"); url.Add(multiChannel); url.Add("heartbeat"); @@ -1237,9 +1237,9 @@ Uri IUrlRequestBuilder.BuildPresenceHeartbeatRequest(string requestMethod, strin requestQueryStringParams.Add("channel-group", UriUtil.EncodeUriComponent(string.Join(",", channelGroups.OrderBy(x => x).ToArray()), currentType, false, false, false)); } - if (pubnubConfig.PresenceTimeout != 0) + if (pubnubConfig.ContainsKey(pubnubInstanceId) && pubnubConfig[pubnubInstanceId].PresenceTimeout != 0) { - requestQueryStringParams.Add("heartbeat", pubnubConfig.PresenceTimeout.ToString()); + requestQueryStringParams.Add("heartbeat", pubnubConfig[pubnubInstanceId].PresenceTimeout.ToString()); } string queryString = BuildQueryString(currentType, requestQueryStringParams); @@ -1254,7 +1254,7 @@ Uri IUrlRequestBuilder.BuildSetUuidMetadataRequest(string requestMethod, string List url = new List(); url.Add("v2"); url.Add("objects"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("uuids"); url.Add(string.IsNullOrEmpty(uuid) ? "" : uuid); @@ -1285,7 +1285,7 @@ Uri IUrlRequestBuilder.BuildDeleteUuidMetadataRequest(string requestMethod, stri List url = new List(); url.Add("v2"); url.Add("objects"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("uuids"); url.Add(string.IsNullOrEmpty(uuid) ? "" : uuid); @@ -1313,7 +1313,7 @@ Uri IUrlRequestBuilder.BuildGetAllUuidMetadataRequest(string requestMethod, stri List url = new List(); url.Add("v2"); url.Add("objects"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("uuids"); Dictionary requestQueryStringParams = new Dictionary(); @@ -1368,7 +1368,7 @@ Uri IUrlRequestBuilder.BuildGetSingleUuidMetadataRequest(string requestMethod, s List url = new List(); url.Add("v2"); url.Add("objects"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("uuids"); url.Add(string.IsNullOrEmpty(uuid) ? "": uuid); @@ -1400,7 +1400,7 @@ Uri IUrlRequestBuilder.BuildSetChannelMetadataRequest(string requestMethod, stri List url = new List(); url.Add("v2"); url.Add("objects"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channels"); url.Add(string.IsNullOrEmpty(channel) ? "" : channel); @@ -1431,7 +1431,7 @@ Uri IUrlRequestBuilder.BuildDeleteChannelMetadataRequest(string requestMethod, s List url = new List(); url.Add("v2"); url.Add("objects"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channels"); url.Add(string.IsNullOrEmpty(channel) ? "" : channel); @@ -1459,7 +1459,7 @@ Uri IUrlRequestBuilder.BuildGetAllChannelMetadataRequest(string requestMethod, s List url = new List(); url.Add("v2"); url.Add("objects"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channels"); Dictionary requestQueryStringParams = new Dictionary(); @@ -1514,7 +1514,7 @@ Uri IUrlRequestBuilder.BuildGetSingleChannelMetadataRequest(string requestMethod List url = new List(); url.Add("v2"); url.Add("objects"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channels"); url.Add(string.IsNullOrEmpty(channel) ? "" : channel); @@ -1546,7 +1546,7 @@ Uri IUrlRequestBuilder.BuildMembershipSetRemoveManageUserRequest(PNOperationType List url = new List(); url.Add("v2"); url.Add("objects"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("uuids"); url.Add(string.IsNullOrEmpty(uuid) ? "" : uuid); url.Add("channels"); @@ -1598,7 +1598,7 @@ Uri IUrlRequestBuilder.BuildMemberAddUpdateRemoveChannelRequest(string requestMe List url = new List(); url.Add("v2"); url.Add("objects"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channels"); url.Add(string.IsNullOrEmpty(channel) ? "" : channel); url.Add("uuids"); @@ -1650,7 +1650,7 @@ Uri IUrlRequestBuilder.BuildGetAllMembershipsRequest(string requestMethod, strin List url = new List(); url.Add("v2"); url.Add("objects"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("uuids"); url.Add(string.IsNullOrEmpty(uuid) ? "" : uuid); url.Add("channels"); @@ -1707,7 +1707,7 @@ Uri IUrlRequestBuilder.BuildGetAllMembersRequest(string requestMethod, string re List url = new List(); url.Add("v2"); url.Add("objects"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channels"); url.Add(string.IsNullOrEmpty(channel) ? "" : channel); url.Add("uuids"); @@ -1764,7 +1764,7 @@ Uri IUrlRequestBuilder.BuildAddMessageActionRequest(string requestMethod, string List url = new List(); url.Add("v1"); url.Add("message-actions"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channel"); url.Add(channel); url.Add("message"); @@ -1795,7 +1795,7 @@ Uri IUrlRequestBuilder.BuildRemoveMessageActionRequest(string requestMethod, str List url = new List(); url.Add("v1"); url.Add("message-actions"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channel"); url.Add(channel); url.Add("message"); @@ -1832,7 +1832,7 @@ Uri IUrlRequestBuilder.BuildGetMessageActionsRequest(string requestMethod, strin List url = new List(); url.Add("v1"); url.Add("message-actions"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channel"); url.Add(channel); @@ -1873,7 +1873,7 @@ Uri IUrlRequestBuilder.BuildGenerateFileUploadUrlRequest(string requestMethod, s List url = new List(); url.Add("v1"); url.Add("files"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channels"); url.Add(channel); url.Add("generate-upload-url"); @@ -1903,8 +1903,8 @@ Uri IUrlRequestBuilder.BuildPublishFileMessageRequest(string requestMethod, stri url.Add("v1"); url.Add("files"); url.Add("publish-file"); - url.Add(pubnubConfig.PublishKey); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].PublishKey : ""); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("0"); url.Add(channel); url.Add("0"); @@ -1961,7 +1961,7 @@ Uri IUrlRequestBuilder.BuildGetFileUrlOrDeleteReqest(string requestMethod, strin List url = new List(); url.Add("v1"); url.Add("files"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channels"); url.Add(channel); url.Add("files"); @@ -1993,7 +1993,7 @@ Uri IUrlRequestBuilder.BuildListFilesReqest(string requestMethod, string request List url = new List(); url.Add("v1"); url.Add("files"); - url.Add(pubnubConfig.SubscribeKey); + url.Add(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].SubscribeKey : ""); url.Add("channels"); url.Add(channel); url.Add("files"); @@ -2034,11 +2034,11 @@ private Dictionary GenerateCommonQueryParams(PNOperationType typ } Dictionary ret = new Dictionary(); - if (pubnubUnitTest != null) + if (pubnubUnitTest != null && pubnubConfig.ContainsKey(pubnubInstanceId)) { if (pubnubUnitTest.IncludeUuid) { - ret.Add("uuid", UriUtil.EncodeUriComponent(this.pubnubConfig.Uuid, PNOperationType.PNSubscribeOperation, false, false, true)); + ret.Add("uuid", UriUtil.EncodeUriComponent(pubnubConfig[pubnubInstanceId].Uuid, PNOperationType.PNSubscribeOperation, false, false, true)); } if (pubnubUnitTest.IncludePnsdk) @@ -2048,23 +2048,25 @@ private Dictionary GenerateCommonQueryParams(PNOperationType typ } else { - ret.Add("uuid", UriUtil.EncodeUriComponent(uuid != null ? uuid : this.pubnubConfig.Uuid, PNOperationType.PNSubscribeOperation, false, false, true)); + ret.Add("uuid", UriUtil.EncodeUriComponent(uuid != null ? uuid : + (pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].Uuid : ""), + PNOperationType.PNSubscribeOperation, false, false, true)); ret.Add("pnsdk", UriUtil.EncodeUriComponent(Pubnub.Version, PNOperationType.PNSubscribeOperation, false, false, true)); } if (pubnubConfig != null) { - if (pubnubConfig.IncludeRequestIdentifier) + if (pubnubConfig.ContainsKey(pubnubInstanceId) && pubnubConfig[pubnubInstanceId].IncludeRequestIdentifier) { ret.Add("requestid", requestid); } - if (pubnubConfig.IncludeInstanceIdentifier && !string.IsNullOrEmpty(pubnubInstanceId) && pubnubInstanceId.Trim().Length > 0) + if (pubnubConfig.ContainsKey(pubnubInstanceId) && pubnubConfig[pubnubInstanceId].IncludeInstanceIdentifier && !string.IsNullOrEmpty(pubnubInstanceId) && pubnubInstanceId.Trim().Length > 0) { ret.Add("instanceid", pubnubInstanceId); } - if (pubnubConfig.EnableTelemetry && telemetryMgr != null) + if (pubnubConfig.ContainsKey(pubnubInstanceId) && pubnubConfig[pubnubInstanceId].EnableTelemetry && telemetryMgr != null) { Dictionary opsLatency = telemetryMgr.GetOperationsLatency().ConfigureAwait(false).GetAwaiter().GetResult(); if (opsLatency != null && opsLatency.Count > 0) @@ -2076,7 +2078,7 @@ private Dictionary GenerateCommonQueryParams(PNOperationType typ } } - if (!string.IsNullOrEmpty(pubnubConfig.SecretKey)) + if (pubnubConfig.ContainsKey(pubnubInstanceId) && !string.IsNullOrEmpty(pubnubConfig[pubnubInstanceId].SecretKey)) { ret.Add("timestamp", timeStamp.ToString()); } @@ -2089,9 +2091,9 @@ private Dictionary GenerateCommonQueryParams(PNOperationType typ { ret.Add("auth", UriUtil.EncodeUriComponent(tokenMgr.AuthToken, type, false, false, false)); } - else if (!string.IsNullOrEmpty(this.pubnubConfig.AuthKey) && this.pubnubConfig.AuthKey.Trim().Length > 0) + else if (pubnubConfig.ContainsKey(pubnubInstanceId) && !string.IsNullOrEmpty(pubnubConfig[pubnubInstanceId].AuthKey) && pubnubConfig[pubnubInstanceId].AuthKey.Trim().Length > 0) { - ret.Add("auth", UriUtil.EncodeUriComponent(this.pubnubConfig.AuthKey, type, false, false, false)); + ret.Add("auth", UriUtil.EncodeUriComponent(pubnubConfig[pubnubInstanceId].AuthKey, type, false, false, false)); } } } @@ -2103,21 +2105,24 @@ private string GeneratePAMv2Signature(string queryStringToSign, string partialUr { string signature = ""; StringBuilder string_to_sign = new StringBuilder(); - string_to_sign.Append(this.pubnubConfig.SubscribeKey).Append("\n").Append(this.pubnubConfig.PublishKey).Append("\n"); - string_to_sign.Append(partialUrl).Append("\n"); - string_to_sign.Append(queryStringToSign); - - PubnubCrypto pubnubCrypto = new PubnubCrypto((opType != PNOperationType.PNSignalOperation) ? this.pubnubConfig.CipherKey : "", this.pubnubConfig, this.pubnubLog, null); - signature = pubnubCrypto.PubnubAccessManagerSign(this.pubnubConfig.SecretKey, string_to_sign.ToString()); - if (this.pubnubLog != null && this.pubnubConfig != null) - { - LoggingMethod.WriteToLog(pubnubLog, "string_to_sign = " + string_to_sign, pubnubConfig.LogVerbosity); - LoggingMethod.WriteToLog(pubnubLog, "signature = " + signature, pubnubConfig.LogVerbosity); - } - else + if (pubnubConfig.ContainsKey(pubnubInstanceId)) { - System.Diagnostics.Debug.WriteLine("string_to_sign = " + string_to_sign); - System.Diagnostics.Debug.WriteLine("signature = " + signature); + string_to_sign.Append(pubnubConfig[pubnubInstanceId].SubscribeKey).Append("\n").Append(pubnubConfig[pubnubInstanceId].PublishKey).Append("\n"); + string_to_sign.Append(partialUrl).Append("\n"); + string_to_sign.Append(queryStringToSign); + + PubnubCrypto pubnubCrypto = new PubnubCrypto((opType != PNOperationType.PNSignalOperation) ? pubnubConfig[pubnubInstanceId].CipherKey : "", pubnubConfig[pubnubInstanceId], this.pubnubLog, null); + signature = pubnubCrypto.PubnubAccessManagerSign(pubnubConfig[pubnubInstanceId].SecretKey, string_to_sign.ToString()); + if (this.pubnubLog != null && this.pubnubConfig != null) + { + LoggingMethod.WriteToLog(pubnubLog, "string_to_sign = " + string_to_sign, pubnubConfig[pubnubInstanceId].LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, "signature = " + signature, pubnubConfig[pubnubInstanceId].LogVerbosity); + } + else + { + System.Diagnostics.Debug.WriteLine("string_to_sign = " + string_to_sign); + System.Diagnostics.Debug.WriteLine("signature = " + signature); + } } return signature; } @@ -2126,24 +2131,27 @@ private string GeneratePAMv3Signature(string method, string requestBody, string { string signature = ""; StringBuilder string_to_sign = new StringBuilder(); - string_to_sign.AppendFormat("{0}\n", method.ToUpperInvariant()); - string_to_sign.AppendFormat("{0}\n", this.pubnubConfig.PublishKey); - string_to_sign.AppendFormat("{0}\n", partialUrl); - string_to_sign.AppendFormat("{0}\n", queryStringToSign); - string_to_sign.Append(requestBody); - - PubnubCrypto pubnubCrypto = new PubnubCrypto((opType != PNOperationType.PNSignalOperation) ? this.pubnubConfig.CipherKey : "", this.pubnubConfig, this.pubnubLog, null); - signature = pubnubCrypto.PubnubAccessManagerSign(this.pubnubConfig.SecretKey, string_to_sign.ToString()); - signature = string.Format("v2.{0}", signature.TrimEnd(new [] { '=' })); - if (this.pubnubLog != null && this.pubnubConfig != null) - { - LoggingMethod.WriteToLog(pubnubLog, "string_to_sign = " + string_to_sign, pubnubConfig.LogVerbosity); - LoggingMethod.WriteToLog(pubnubLog, "signature = " + signature, pubnubConfig.LogVerbosity); - } - else - { - System.Diagnostics.Debug.WriteLine("string_to_sign = " + string_to_sign); - System.Diagnostics.Debug.WriteLine("signature = " + signature); + if (pubnubConfig.ContainsKey(pubnubInstanceId)) + { + string_to_sign.AppendFormat("{0}\n", method.ToUpperInvariant()); + string_to_sign.AppendFormat("{0}\n", pubnubConfig[pubnubInstanceId].PublishKey); + string_to_sign.AppendFormat("{0}\n", partialUrl); + string_to_sign.AppendFormat("{0}\n", queryStringToSign); + string_to_sign.Append(requestBody); + + PubnubCrypto pubnubCrypto = new PubnubCrypto((opType != PNOperationType.PNSignalOperation) ? pubnubConfig[pubnubInstanceId].CipherKey : "", pubnubConfig[pubnubInstanceId], this.pubnubLog, null); + signature = pubnubCrypto.PubnubAccessManagerSign(pubnubConfig[pubnubInstanceId].SecretKey, string_to_sign.ToString()); + signature = string.Format("v2.{0}", signature.TrimEnd(new[] { '=' })); + if (this.pubnubLog != null && this.pubnubConfig != null) + { + LoggingMethod.WriteToLog(pubnubLog, "string_to_sign = " + string_to_sign, pubnubConfig[pubnubInstanceId].LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, "signature = " + signature, pubnubConfig[pubnubInstanceId].LogVerbosity); + } + else + { + System.Diagnostics.Debug.WriteLine("string_to_sign = " + string_to_sign); + System.Diagnostics.Debug.WriteLine("signature = " + signature); + } } return signature; } @@ -2170,7 +2178,7 @@ private string BuildQueryString(PNOperationType type, Dictionary } catch (Exception ex) { - LoggingMethod.WriteToLog(pubnubLog, "UrlRequestBuilder => BuildQueryString error " + ex, pubnubConfig.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, "UrlRequestBuilder => BuildQueryString error " + ex, pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].LogVerbosity : PNLogVerbosity.BODY); } return queryString; @@ -2180,7 +2188,7 @@ private Uri BuildRestApiRequest(string requestMethod, string requestBody, List(PNOperationType type, Dictionary(PNOperationType type, Dictionary(PNOperationType type, string channe if (PubnubInstance == null) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, PubnubInstance is null. exiting MultiChannelUnSubscribeInit", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, PubnubInstance is null. exiting MultiChannelUnSubscribeInit", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); return; } @@ -137,9 +137,9 @@ internal void MultiChannelUnSubscribeInit(PNOperationType type, string channe continue; } - if (MultiChannelSubscribe.ContainsKey(PubnubInstance.InstanceId) && MultiChannelSubscribe[PubnubInstance.InstanceId] != null && !MultiChannelSubscribe[PubnubInstance.InstanceId].ContainsKey(channelName)) + if (config.ContainsKey(PubnubInstance.InstanceId) && MultiChannelSubscribe.ContainsKey(PubnubInstance.InstanceId) && MultiChannelSubscribe[PubnubInstance.InstanceId] != null && !MultiChannelSubscribe[PubnubInstance.InstanceId].ContainsKey(channelName)) { - PNStatus status = new StatusBuilder(config, jsonLibrary).CreateStatusResponse(PNOperationType.PNUnsubscribeOperation, PNStatusCategory.PNUnexpectedDisconnectCategory, null, (int)HttpStatusCode.NotFound, null); + PNStatus status = new StatusBuilder(config[PubnubInstance.InstanceId], jsonLibrary).CreateStatusResponse(PNOperationType.PNUnsubscribeOperation, PNStatusCategory.PNUnexpectedDisconnectCategory, null, (int)HttpStatusCode.NotFound, null); if (!status.AffectedChannels.Contains(channelName)) { status.AffectedChannels.Add(channelName); @@ -171,9 +171,9 @@ internal void MultiChannelUnSubscribeInit(PNOperationType type, string channe continue; } - if (MultiChannelGroupSubscribe.ContainsKey(PubnubInstance.InstanceId) && MultiChannelGroupSubscribe[PubnubInstance.InstanceId] != null && !MultiChannelGroupSubscribe[PubnubInstance.InstanceId].ContainsKey(channelGroupName)) + if (config.ContainsKey(PubnubInstance.InstanceId) && MultiChannelGroupSubscribe.ContainsKey(PubnubInstance.InstanceId) && MultiChannelGroupSubscribe[PubnubInstance.InstanceId] != null && !MultiChannelGroupSubscribe[PubnubInstance.InstanceId].ContainsKey(channelGroupName)) { - PNStatus status = new StatusBuilder(config, jsonLibrary).CreateStatusResponse(PNOperationType.PNUnsubscribeOperation, PNStatusCategory.PNUnexpectedDisconnectCategory, null, (int)HttpStatusCode.NotFound, null); + PNStatus status = new StatusBuilder(config[PubnubInstance.InstanceId], jsonLibrary).CreateStatusResponse(PNOperationType.PNUnsubscribeOperation, PNStatusCategory.PNUnexpectedDisconnectCategory, null, (int)HttpStatusCode.NotFound, null); if (!status.AffectedChannelGroups.Contains(channelGroupName)) { status.AffectedChannelGroups.Add(channelGroupName); @@ -208,7 +208,7 @@ internal void MultiChannelUnSubscribeInit(PNOperationType type, string channe { if (ChannelRequest[PubnubInstance.InstanceId].ContainsKey(multiChannelName)) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Aborting previous subscribe/presence requests having channel(s)={1}; channelgroup(s)={2}", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannelName, multiChannelGroupName), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Aborting previous subscribe/presence requests having channel(s)={1}; channelgroup(s)={2}", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannelName, multiChannelGroupName), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); HttpWebRequest webRequest; ChannelRequest[PubnubInstance.InstanceId].TryGetValue(multiChannelName, out webRequest); @@ -218,11 +218,11 @@ internal void MultiChannelUnSubscribeInit(PNOperationType type, string channe bool removedChannel = ChannelRequest[PubnubInstance.InstanceId].TryRemove(multiChannelName, out removedRequest); if (removedChannel) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Success to remove channel(s)={1}; channelgroup(s)={2} from _channelRequest (MultiChannelUnSubscribeInit).", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannelName, multiChannelGroupName), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Success to remove channel(s)={1}; channelgroup(s)={2} from _channelRequest (MultiChannelUnSubscribeInit).", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannelName, multiChannelGroupName), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); } else { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Unable to remove channel(s)={1}; channelgroup(s)={2} from _channelRequest (MultiChannelUnSubscribeInit).", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannelName, multiChannelGroupName), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Unable to remove channel(s)={1}; channelgroup(s)={2} from _channelRequest (MultiChannelUnSubscribeInit).", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannelName, multiChannelGroupName), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); } if (webRequest != null) { @@ -231,15 +231,15 @@ internal void MultiChannelUnSubscribeInit(PNOperationType type, string channe } else { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Unable to capture channel(s)={1}; channelgroup(s)={2} from _channelRequest to abort request.", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannelName, multiChannelGroupName), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Unable to capture channel(s)={1}; channelgroup(s)={2} from _channelRequest to abort request.", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannelName, multiChannelGroupName), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); } }, CancellationToken.None, TaskCreationOptions.PreferFairness, TaskScheduler.Default).ConfigureAwait(false); - if (type == PNOperationType.PNUnsubscribeOperation) + if (type == PNOperationType.PNUnsubscribeOperation && config.ContainsKey(PubnubInstance.InstanceId)) { //just fire leave() event to REST API for safeguard string channelsJsonState = BuildJsonUserState(validChannels.ToArray(), validChannelGroups.ToArray(), false); - IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null && !string.IsNullOrEmpty(PubnubInstance.InstanceId) && PubnubTokenMgrCollection.ContainsKey(PubnubInstance.InstanceId)) ? PubnubTokenMgrCollection[PubnubInstance.InstanceId] : null, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); + IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config[PubnubInstance.InstanceId], jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null && !string.IsNullOrEmpty(PubnubInstance.InstanceId) && PubnubTokenMgrCollection.ContainsKey(PubnubInstance.InstanceId)) ? PubnubTokenMgrCollection[PubnubInstance.InstanceId] : null, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); Uri request = urlBuilder.BuildMultiChannelLeaveRequest("GET", "", validChannels.ToArray(), validChannelGroups.ToArray(), channelsJsonState, externalQueryParam); @@ -264,8 +264,8 @@ internal void MultiChannelUnSubscribeInit(PNOperationType type, string channe originalMultiChannelGroupSubscribe = MultiChannelGroupSubscribe[PubnubInstance.InstanceId].Count > 0 ? MultiChannelGroupSubscribe[PubnubInstance.InstanceId].ToDictionary(kvp => kvp.Key, kvp => kvp.Value) : null; } - PNStatus successStatus = new StatusBuilder(config, jsonLibrary).CreateStatusResponse(PNOperationType.PNUnsubscribeOperation, PNStatusCategory.PNDisconnectedCategory, null, (int)HttpStatusCode.OK, null); - PNStatus failStatus = new StatusBuilder(config, jsonLibrary).CreateStatusResponse(PNOperationType.PNUnsubscribeOperation, PNStatusCategory.PNDisconnectedCategory, null, (int)HttpStatusCode.NotFound, new PNException("Unsubscribe Error. Please retry unsubscribe operation")); + PNStatus successStatus = new StatusBuilder(config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId] : null, jsonLibrary).CreateStatusResponse(PNOperationType.PNUnsubscribeOperation, PNStatusCategory.PNDisconnectedCategory, null, (int)HttpStatusCode.OK, null); + PNStatus failStatus = new StatusBuilder(config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId] : null, jsonLibrary).CreateStatusResponse(PNOperationType.PNUnsubscribeOperation, PNStatusCategory.PNDisconnectedCategory, null, (int)HttpStatusCode.NotFound, new PNException("Unsubscribe Error. Please retry unsubscribe operation")); bool successExist = false; bool failExist = false; @@ -400,13 +400,13 @@ internal void MultiChannelUnSubscribeInit(PNOperationType type, string channe PresenceHeartbeatTimer.Dispose(); PresenceHeartbeatTimer = null; } - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, All channels are Unsubscribed. Further subscription was stopped", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, All channels are Unsubscribed. Further subscription was stopped", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); } } } catch(Exception ex) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0} SubscribeManager=> MultiChannelUnSubscribeInit \n channel(s)={1} \n cg(s)={2} \n Exception Details={3}", DateTime.Now.ToString(CultureInfo.InvariantCulture), string.Join(",", validChannels.OrderBy(x => x).ToArray()), string.Join(",", validChannelGroups.OrderBy(x => x).ToArray()), ex), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0} SubscribeManager=> MultiChannelUnSubscribeInit \n channel(s)={1} \n cg(s)={2} \n Exception Details={3}", DateTime.Now.ToString(CultureInfo.InvariantCulture), string.Join(",", validChannels.OrderBy(x => x).ToArray()), string.Join(",", validChannelGroups.OrderBy(x => x).ToArray()), ex), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); } } @@ -465,7 +465,7 @@ internal void MultiChannelSubscribeInit(PNOperationType responseType, string[ } } - if (validChannels.Count > 0 || validChannelGroups.Count > 0) + if (validChannels.Count > 0 || validChannelGroups.Count > 0 && config.ContainsKey(PubnubInstance.InstanceId)) { //Retrieve the current channels already subscribed previously and terminate them string[] currentChannels = MultiChannelSubscribe[PubnubInstance.InstanceId].Keys.ToArray(); @@ -482,7 +482,7 @@ internal void MultiChannelSubscribeInit(PNOperationType responseType, string[ string multiChannelName = keysList[keyIndex]; if (ChannelRequest[PubnubInstance.InstanceId].ContainsKey(multiChannelName)) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Aborting previous subscribe/presence requests having channel(s)={1}; channelgroup(s)={2}", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannelName, multiChannelGroupName), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Aborting previous subscribe/presence requests having channel(s)={1}; channelgroup(s)={2}", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannelName, multiChannelGroupName), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); HttpWebRequest webRequest; ChannelRequest[PubnubInstance.InstanceId].TryGetValue(multiChannelName, out webRequest); ChannelRequest[PubnubInstance.InstanceId].TryUpdate(multiChannelName, null, webRequest); @@ -491,11 +491,11 @@ internal void MultiChannelSubscribeInit(PNOperationType responseType, string[ bool removedChannel = ChannelRequest[PubnubInstance.InstanceId].TryRemove(multiChannelName, out removedRequest); if (removedChannel) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Success to remove channel(s)={1}; channelgroup(s)={2} from _channelRequest (MultiChannelSubscribeInit).", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannelName, multiChannelGroupName), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Success to remove channel(s)={1}; channelgroup(s)={2} from _channelRequest (MultiChannelSubscribeInit).", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannelName, multiChannelGroupName), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); } else { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Unable to remove channel(s)={1}; channelgroup(s)={2} from _channelRequest (MultiChannelSubscribeInit).", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannelName, multiChannelGroupName), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Unable to remove channel(s)={1}; channelgroup(s)={2} from _channelRequest (MultiChannelSubscribeInit).", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannelName, multiChannelGroupName), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); } if (webRequest != null) { @@ -504,13 +504,13 @@ internal void MultiChannelSubscribeInit(PNOperationType responseType, string[ } else { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Unable to capture channel(s)={1}; channelgroup(s)={2} from _channelRequest to abort request.", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannelName, multiChannelGroupName), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Unable to capture channel(s)={1}; channelgroup(s)={2} from _channelRequest to abort request.", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannelName, multiChannelGroupName), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); } } } else { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Unable to find instance id = {1} from _channelRequest.", DateTime.Now.ToString(CultureInfo.InvariantCulture), PubnubInstance.InstanceId), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Unable to find instance id = {1} from _channelRequest.", DateTime.Now.ToString(CultureInfo.InvariantCulture), PubnubInstance.InstanceId), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); } } @@ -563,27 +563,32 @@ internal void MultiChannelSubscribeInit(PNOperationType responseType, string[ } catch { /* ignore */ } } - SubscribeHeartbeatCheckTimer = new Timer(StartSubscribeHeartbeatCheckCallback, null, config.SubscribeTimeout * 500, config.SubscribeTimeout * 500); + SubscribeHeartbeatCheckTimer = new Timer(StartSubscribeHeartbeatCheckCallback, null, config[PubnubInstance.InstanceId].SubscribeTimeout * 500, config[PubnubInstance.InstanceId].SubscribeTimeout * 500); } } catch(Exception ex) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0} SubscribeManager=> MultiChannelSubscribeInit \n channel(s)={1} \n cg(s)={2} \n Exception Details={3}", DateTime.Now.ToString(CultureInfo.InvariantCulture), string.Join(",", validChannels.OrderBy(x => x).ToArray()), string.Join(",", validChannelGroups.OrderBy(x => x).ToArray()), ex), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0} SubscribeManager=> MultiChannelSubscribeInit \n channel(s)={1} \n cg(s)={2} \n Exception Details={3}", DateTime.Now.ToString(CultureInfo.InvariantCulture), string.Join(",", validChannels.OrderBy(x => x).ToArray()), string.Join(",", validChannelGroups.OrderBy(x => x).ToArray()), ex), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); } } private void MultiChannelSubscribeRequest(PNOperationType type, string[] channels, string[] channelGroups, object timetoken, int region, bool reconnect, Dictionary initialSubscribeUrlParams, Dictionary externalQueryParam) { + if (!config.ContainsKey(PubnubInstance.InstanceId)) + { + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, InstanceId Not Available. Exiting MultiChannelSubscribeRequest", DateTime.Now.ToString(CultureInfo.InvariantCulture)), PNLogVerbosity.BODY); + return; + } if (SubscribeDisconnected[PubnubInstance.InstanceId]) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeDisconnected. Exiting MultiChannelSubscribeRequest", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeDisconnected. Exiting MultiChannelSubscribeRequest", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config[PubnubInstance.InstanceId].LogVerbosity); return; } //Exit if the channel is unsubscribed if (MultiChannelSubscribe != null && MultiChannelSubscribe[PubnubInstance.InstanceId].Count <= 0 && MultiChannelGroupSubscribe != null && MultiChannelGroupSubscribe[PubnubInstance.InstanceId].Count <= 0) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Zero channels/channelGroups. Further subscription was stopped", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Zero channels/channelGroups. Further subscription was stopped", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); return; } @@ -614,7 +619,7 @@ private void MultiChannelSubscribeRequest(PNOperationType type, string[] chan if (!ChannelRequest.ContainsKey(PubnubInstance.InstanceId) || (!multiChannel.Equals(",", StringComparison.CurrentCultureIgnoreCase) && !ChannelRequest[PubnubInstance.InstanceId].ContainsKey(multiChannel))) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, PubnubInstance.InstanceId NOT matching", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, PubnubInstance.InstanceId NOT matching", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); return; } @@ -652,11 +657,11 @@ private void MultiChannelSubscribeRequest(PNOperationType type, string[] chan lastTimetoken = LastSubscribeTimetoken[PubnubInstance.InstanceId]; } } - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Building request for channel(s)={1}, channelgroup(s)={2} with timetoken={3}", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannel, multiChannelGroup, lastTimetoken), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Building request for channel(s)={1}, channelgroup(s)={2} with timetoken={3}", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannel, multiChannelGroup, lastTimetoken), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); // Build URL string channelsJsonState = BuildJsonUserState(channels, channelGroups, false); - config.Uuid = CurrentUuid; // to make sure we capture if UUID is changed - IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null && !string.IsNullOrEmpty(PubnubInstance.InstanceId) && PubnubTokenMgrCollection.ContainsKey(PubnubInstance.InstanceId)) ? PubnubTokenMgrCollection[PubnubInstance.InstanceId] : null, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); + config[PubnubInstance.InstanceId].Uuid = CurrentUuid; // to make sure we capture if UUID is changed + IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config[PubnubInstance.InstanceId], jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null && !string.IsNullOrEmpty(PubnubInstance.InstanceId) && PubnubTokenMgrCollection.ContainsKey(PubnubInstance.InstanceId)) ? PubnubTokenMgrCollection[PubnubInstance.InstanceId] : null, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); Uri request = urlBuilder.BuildMultiChannelSubscribeRequest("GET", "", channels, channelGroups, (Convert.ToInt64(timetoken.ToString()) == 0) ? Convert.ToInt64(timetoken.ToString()) : lastTimetoken, region, channelsJsonState, initialSubscribeUrlParams, externalQueryParam); @@ -685,14 +690,14 @@ private void MultiChannelSubscribeRequest(PNOperationType type, string[] chan if (subscribedChannels.Equals(currentChannels, StringComparison.CurrentCultureIgnoreCase) && subscribedChannelGroups.Equals(currentChannelGroups, StringComparison.CurrentCultureIgnoreCase)) { List result = ProcessJsonResponse(pubnubRequestState, json); - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, result count of ProcessJsonResponse = {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), (result != null) ? result.Count : -1), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, result count of ProcessJsonResponse = {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), (result != null) ? result.Count : -1), config[PubnubInstance.InstanceId].LogVerbosity); ProcessResponseCallbacks(result, pubnubRequestState); if ((pubnubRequestState.ResponseType == PNOperationType.PNSubscribeOperation || pubnubRequestState.ResponseType == PNOperationType.Presence) && (result != null) && (result.Count > 0)) { long jsonTimetoken = GetTimetokenFromMultiplexResult(result); - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, jsonTimetoken = {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), jsonTimetoken), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, jsonTimetoken = {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), jsonTimetoken), config[PubnubInstance.InstanceId].LogVerbosity); if (jsonTimetoken > 0) { @@ -720,11 +725,11 @@ private void MultiChannelSubscribeRequest(PNOperationType type, string[] chan } else { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, condition failed for subscribedChannels == currentChannels && subscribedChannelGroups == currentChannelGroups", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, subscribedChannels = {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), subscribedChannels), config.LogVerbosity); - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, currentChannels = {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), currentChannels), config.LogVerbosity); - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, subscribedChannelGroups = {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), subscribedChannelGroups), config.LogVerbosity); - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, currentChannelGroups = {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), currentChannelGroups), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, condition failed for subscribedChannels == currentChannels && subscribedChannelGroups == currentChannelGroups", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config[PubnubInstance.InstanceId].LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, subscribedChannels = {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), subscribedChannels), config[PubnubInstance.InstanceId].LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, currentChannels = {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), currentChannels), config[PubnubInstance.InstanceId].LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, subscribedChannelGroups = {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), subscribedChannelGroups), config[PubnubInstance.InstanceId].LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, currentChannelGroups = {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), currentChannelGroups), config[PubnubInstance.InstanceId].LogVerbosity); } } @@ -743,10 +748,10 @@ private void MultiChannelSubscribeRequest(PNOperationType type, string[] chan } catch (Exception ex) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0} method:_subscribe \n channel={1} \n timetoken={2} \n Exception Details={3}", DateTime.Now.ToString(CultureInfo.InvariantCulture), string.Join(",", channels.OrderBy(x => x).ToArray()), timetoken, ex), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0} method:_subscribe \n channel={1} \n timetoken={2} \n Exception Details={3}", DateTime.Now.ToString(CultureInfo.InvariantCulture), string.Join(",", channels.OrderBy(x => x).ToArray()), timetoken, ex), config[PubnubInstance.InstanceId].LogVerbosity); PNStatusCategory errorCategory = PNStatusCategoryHelper.GetPNStatusCategory(ex); - PNStatus status = new StatusBuilder(config, jsonLibrary).CreateStatusResponse(type, errorCategory, pubnubRequestState, (int)HttpStatusCode.NotFound, new PNException(ex)); + PNStatus status = new StatusBuilder(config[PubnubInstance.InstanceId], jsonLibrary).CreateStatusResponse(type, errorCategory, pubnubRequestState, (int)HttpStatusCode.NotFound, new PNException(ex)); if (channels != null && channels.Length > 0) { status.AffectedChannels.AddRange(channels); @@ -765,7 +770,7 @@ private void MultiChannelSubscribeRequest(PNOperationType type, string[] chan private void MultiplexExceptionHandlerTimerCallback(object state) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0} MultiplexExceptionHandlerTimerCallback", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0} MultiplexExceptionHandlerTimerCallback", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); RequestState currentState = state as RequestState; if (currentState != null) { @@ -840,13 +845,13 @@ private void MultiplexInternalCallback(PNOperationType type, object multiplex int region = GetRegionFromMultiplexResult(message); Task.Factory.StartNew(() => { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0} MultiplexInternalCallback timetoken = {1}; region = {2}", DateTime.Now.ToString(CultureInfo.InvariantCulture), timetoken, region), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0} MultiplexInternalCallback timetoken = {1}; region = {2}", DateTime.Now.ToString(CultureInfo.InvariantCulture), timetoken, region), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); MultiChannelSubscribeRequest(type, channels, channelGroups, timetoken, region, false, null, this.customQueryParam); }, CancellationToken.None, TaskCreationOptions.PreferFairness, TaskScheduler.Default).ConfigureAwait(false); } else { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Lost Channel Name for resubscribe", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Lost Channel Name for resubscribe", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); } } @@ -860,24 +865,28 @@ private bool ReconnectNetworkIfOverrideTcpKeepAlive(PNOperationType type, str netState.ResponseType = type; netState.Timetoken = timetoken; netState.Region = region; + if (!config.ContainsKey(PubnubInstance.InstanceId)) + { + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, InstanceId Not Available. So no reconnect", DateTime.Now.ToString(CultureInfo.InvariantCulture)), PNLogVerbosity.BODY); + } if (SubscribeDisconnected[PubnubInstance.InstanceId]) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Subscribe is still Disconnected. So no reconnect", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Subscribe is still Disconnected. So no reconnect", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config[PubnubInstance.InstanceId].LogVerbosity); } - else if (config.ReconnectionPolicy != PNReconnectionPolicy.NONE) + else if (config[PubnubInstance.InstanceId].ReconnectionPolicy != PNReconnectionPolicy.NONE) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Subscribe - No internet connection for channel={1} and channelgroup={2}; networkAvailable={3}", DateTime.Now.ToString(CultureInfo.InvariantCulture), string.Join(",", channels.OrderBy(x => x).ToArray()), channelGroups != null ? string.Join(",", channelGroups) : "", networkAvailable), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Subscribe - No internet connection for channel={1} and channelgroup={2}; networkAvailable={3}", DateTime.Now.ToString(CultureInfo.InvariantCulture), string.Join(",", channels.OrderBy(x => x).ToArray()), channelGroups != null ? string.Join(",", channelGroups) : "", networkAvailable), config[PubnubInstance.InstanceId].LogVerbosity); TerminateReconnectTimer(); ReconnectNetwork(netState); } else { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, reconnection policy is DISABLED, please handle reconnection manually.", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, reconnection policy is DISABLED, please handle reconnection manually.", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config[PubnubInstance.InstanceId].LogVerbosity); if (!networkAvailable) { PNStatusCategory errorCategory = PNStatusCategory.PNNetworkIssuesCategory; - PNStatus status = new StatusBuilder(config, jsonLibrary).CreateStatusResponse(type, errorCategory, null, (int)HttpStatusCode.NotFound, new PNException("SDK Network related error")); + PNStatus status = new StatusBuilder(config[PubnubInstance.InstanceId], jsonLibrary).CreateStatusResponse(type, errorCategory, null, (int)HttpStatusCode.NotFound, new PNException("SDK Network related error")); if (channels != null && channels.Length > 0) { status.AffectedChannels.AddRange(channels); @@ -902,7 +911,7 @@ private void ReconnectNetwork(ReconnectState netState) { if (netState != null && ((netState.Channels != null && netState.Channels.Length > 0) || (netState.ChannelGroups != null && netState.ChannelGroups.Length > 0))) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager ReconnectNetwork interval = {1} sec", DateTime.Now.ToString(CultureInfo.InvariantCulture), PubnubNetworkTcpCheckIntervalInSeconds), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager ReconnectNetwork interval = {1} sec", DateTime.Now.ToString(CultureInfo.InvariantCulture), PubnubNetworkTcpCheckIntervalInSeconds), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); System.Threading.Timer timer; @@ -960,7 +969,7 @@ internal bool Reconnect(bool resetSubscribeTimetoken) } if (networkConnection) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Network available for SubscribeManager Manual Reconnect", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Network available for SubscribeManager Manual Reconnect", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); if (!string.IsNullOrEmpty(channel) && ChannelInternetStatus[PubnubInstance.InstanceId].ContainsKey(channel)) { ChannelInternetStatus[PubnubInstance.InstanceId].AddOrUpdate(channel, networkConnection, (key, oldValue) => networkConnection); @@ -972,10 +981,10 @@ internal bool Reconnect(bool resetSubscribeTimetoken) } else { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, No network for SubscribeManager Manual Reconnect", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, No network for SubscribeManager Manual Reconnect", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); PNStatusCategory errorCategory = PNStatusCategory.PNNetworkIssuesCategory; - PNStatus status = new StatusBuilder(config, jsonLibrary).CreateStatusResponse(PNOperationType.PNSubscribeOperation, errorCategory, null, (int)HttpStatusCode.NotFound, new PNException("SDK Network related error")); + PNStatus status = new StatusBuilder(config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId] : null, jsonLibrary).CreateStatusResponse(PNOperationType.PNSubscribeOperation, errorCategory, null, (int)HttpStatusCode.NotFound, new PNException("SDK Network related error")); if (channels != null && channels.Length > 0) { status.AffectedChannels.AddRange(channels); @@ -991,12 +1000,12 @@ internal bool Reconnect(bool resetSubscribeTimetoken) } else { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, No channels/channelgroups for SubscribeManager Manual Reconnect", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, No channels/channelgroups for SubscribeManager Manual Reconnect", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); return false; } - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager Manual Reconnect", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager Manual Reconnect", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); SubscribeDisconnected[PubnubInstance.InstanceId] = false; Task.Factory.StartNew(() => @@ -1018,7 +1027,7 @@ internal bool Disconnect() { return false; } - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager Manual Disconnect", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager Manual Disconnect", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); SubscribeDisconnected[PubnubInstance.InstanceId] = true; TerminateCurrentSubscriberRequest(); TerminatePresenceHeartbeatTimer(); @@ -1033,7 +1042,12 @@ internal void StartSubscribeHeartbeatCheckCallback(object state) { if (SubscribeDisconnected[PubnubInstance.InstanceId]) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager - SubscribeDisconnected. No heartbeat check.", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager - SubscribeDisconnected. No heartbeat check.", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); + return; + } + if (!config.ContainsKey(PubnubInstance.InstanceId)) + { + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, InstanceId Not Available. So No heartbeat check.", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); return; } @@ -1046,13 +1060,13 @@ internal void StartSubscribeHeartbeatCheckCallback(object state) if (networkConnection && PubnubInstance != null && SubscribeRequestTracker.ContainsKey(PubnubInstance.InstanceId)) { DateTime lastSubscribeRequestTime = SubscribeRequestTracker[PubnubInstance.InstanceId]; - if ((DateTime.Now - lastSubscribeRequestTime).TotalSeconds < config.SubscribeTimeout) + if ((DateTime.Now - lastSubscribeRequestTime).TotalSeconds < config[PubnubInstance.InstanceId].SubscribeTimeout) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager - ok. expected subscribe within threshold limit of SubscribeTimeout. No action needed", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager - ok. expected subscribe within threshold limit of SubscribeTimeout. No action needed", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config[PubnubInstance.InstanceId].LogVerbosity); } - else if ((DateTime.Now - lastSubscribeRequestTime).TotalSeconds > 2 * (config.SubscribeTimeout - config.SubscribeTimeout/2)) + else if ((DateTime.Now - lastSubscribeRequestTime).TotalSeconds > 2 * (config[PubnubInstance.InstanceId].SubscribeTimeout - config[PubnubInstance.InstanceId].SubscribeTimeout/2)) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager - **No auto subscribe within threshold limit of SubscribeTimeout**. Calling MultiChannelSubscribeRequest", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager - **No auto subscribe within threshold limit of SubscribeTimeout**. Calling MultiChannelSubscribeRequest", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config[PubnubInstance.InstanceId].LogVerbosity); Task.Factory.StartNew(() => { TerminateCurrentSubscriberRequest(); @@ -1061,7 +1075,7 @@ internal void StartSubscribeHeartbeatCheckCallback(object state) } else { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager - **No auto subscribe within threshold limit of SubscribeTimeout**. Calling TerminateCurrentSubscriberRequest", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager - **No auto subscribe within threshold limit of SubscribeTimeout**. Calling TerminateCurrentSubscriberRequest", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config[PubnubInstance.InstanceId].LogVerbosity); Task.Factory.StartNew(() => { TerminateCurrentSubscriberRequest(); @@ -1070,10 +1084,10 @@ internal void StartSubscribeHeartbeatCheckCallback(object state) } else { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager - StartSubscribeHeartbeatCheckCallback - No network or no pubnub instance mapping", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager - StartSubscribeHeartbeatCheckCallback - No network or no pubnub instance mapping", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config[PubnubInstance.InstanceId].LogVerbosity); if (PubnubInstance != null && !networkConnection) { - PNStatus status = new StatusBuilder(config, jsonLibrary).CreateStatusResponse(PNOperationType.PNSubscribeOperation, PNStatusCategory.PNNetworkIssuesCategory, null, (int)System.Net.HttpStatusCode.NotFound, new PNException("Internet connection problem during subscribe heartbeat.")); + PNStatus status = new StatusBuilder(config[PubnubInstance.InstanceId], jsonLibrary).CreateStatusResponse(PNOperationType.PNSubscribeOperation, PNStatusCategory.PNNetworkIssuesCategory, null, (int)System.Net.HttpStatusCode.NotFound, new PNException("Internet connection problem during subscribe heartbeat.")); if (channels != null && channels.Length > 0) { status.AffectedChannels.AddRange(channels.ToList()); @@ -1094,7 +1108,7 @@ internal void StartSubscribeHeartbeatCheckCallback(object state) } else { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager - StartSubscribeHeartbeatCheckCallback - No channels/cgs avaialable", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager - StartSubscribeHeartbeatCheckCallback - No channels/cgs avaialable", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config[PubnubInstance.InstanceId].LogVerbosity); try { SubscribeHeartbeatCheckTimer.Change(Timeout.Infinite, Timeout.Infinite); @@ -1105,7 +1119,7 @@ internal void StartSubscribeHeartbeatCheckCallback(object state) } catch (Exception ex) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager - StartSubscribeHeartbeatCheckCallback - EXCEPTION: {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture),ex), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, SubscribeManager - StartSubscribeHeartbeatCheckCallback - EXCEPTION: {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture),ex), config[PubnubInstance.InstanceId].LogVerbosity); } } @@ -1189,11 +1203,11 @@ protected void ReconnectNetworkCallback(System.Object reconnectState) ConnectionErrors++; UpdatePubnubNetworkTcpCheckIntervalInSeconds(); - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, channel={1} {2} reconnectNetworkCallback. Retry", DateTime.Now.ToString(CultureInfo.InvariantCulture), channel, netState.ResponseType), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, channel={1} {2} reconnectNetworkCallback. Retry", DateTime.Now.ToString(CultureInfo.InvariantCulture), channel, netState.ResponseType), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); if (netState.Channels != null && netState.Channels.Length > 0) { - PNStatus status = new StatusBuilder(config, jsonLibrary).CreateStatusResponse(netState.ResponseType, PNStatusCategory.PNReconnectedCategory, null, (int)System.Net.HttpStatusCode.NotFound, new PNException("Internet connection problem. Retrying connection")); + PNStatus status = new StatusBuilder(config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId] : null, jsonLibrary).CreateStatusResponse(netState.ResponseType, PNStatusCategory.PNReconnectedCategory, null, (int)System.Net.HttpStatusCode.NotFound, new PNException("Internet connection problem. Retrying connection")); if (netState.Channels != null && netState.Channels.Length > 0) { status.AffectedChannels.AddRange(netState.Channels.ToList()); @@ -1212,11 +1226,11 @@ protected void ReconnectNetworkCallback(System.Object reconnectState) { if (ChannelReconnectTimer[PubnubInstance.InstanceId].ContainsKey(channel)) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, {1} {2} terminating ch reconnectimer", DateTime.Now.ToString(CultureInfo.InvariantCulture), channel, netState.ResponseType), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, {1} {2} terminating ch reconnectimer", DateTime.Now.ToString(CultureInfo.InvariantCulture), channel, netState.ResponseType), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); TerminateReconnectTimer(); } - PNStatus status = new StatusBuilder(config, jsonLibrary).CreateStatusResponse(netState.ResponseType, PNStatusCategory.PNReconnectedCategory, null, (int)System.Net.HttpStatusCode.OK, null); + PNStatus status = new StatusBuilder(config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId] : null, jsonLibrary).CreateStatusResponse(netState.ResponseType, PNStatusCategory.PNReconnectedCategory, null, (int)System.Net.HttpStatusCode.OK, null); if (netState.Channels != null && netState.Channels.Length > 0) { status.AffectedChannels.AddRange(netState.Channels.ToList()); @@ -1227,7 +1241,7 @@ protected void ReconnectNetworkCallback(System.Object reconnectState) } Announce(status); - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, channel={1} {2} reconnectNetworkCallback. Internet Available : {3}", DateTime.Now.ToString(CultureInfo.InvariantCulture), channel, netState.ResponseType, channelInternetFlag.ToString()), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, channel={1} {2} reconnectNetworkCallback. Internet Available : {3}", DateTime.Now.ToString(CultureInfo.InvariantCulture), channel, netState.ResponseType, channelInternetFlag.ToString()), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); switch (netState.ResponseType) { case PNOperationType.PNSubscribeOperation: @@ -1266,11 +1280,11 @@ protected void ReconnectNetworkCallback(System.Object reconnectState) ChannelInternetStatus[PubnubInstance.InstanceId].AddOrUpdate(channel, networkConnection, (key, oldValue) => networkConnection); } - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, channelgroup={1} {2} reconnectNetworkCallback. Retrying", DateTime.Now.ToString(CultureInfo.InvariantCulture), channelGroup, netState.ResponseType), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, channelgroup={1} {2} reconnectNetworkCallback. Retrying", DateTime.Now.ToString(CultureInfo.InvariantCulture), channelGroup, netState.ResponseType), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); if (netState.ChannelGroups != null && netState.ChannelGroups.Length > 0) { - PNStatus status = new StatusBuilder(config, jsonLibrary).CreateStatusResponse(netState.ResponseType, PNStatusCategory.PNReconnectedCategory, null, (int)System.Net.HttpStatusCode.NotFound, new PNException("Internet connection problem. Retrying connection")); + PNStatus status = new StatusBuilder(config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId] : null, jsonLibrary).CreateStatusResponse(netState.ResponseType, PNStatusCategory.PNReconnectedCategory, null, (int)System.Net.HttpStatusCode.NotFound, new PNException("Internet connection problem. Retrying connection")); if (netState.Channels != null && netState.Channels.Length > 0) { status.AffectedChannels.AddRange(netState.Channels.ToList()); @@ -1288,14 +1302,14 @@ protected void ReconnectNetworkCallback(System.Object reconnectState) { if (ChannelGroupReconnectTimer[PubnubInstance.InstanceId].ContainsKey(channelGroup)) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, {1} {2} terminating cg reconnectimer", DateTime.Now.ToString(CultureInfo.InvariantCulture), channelGroup, netState.ResponseType), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, {1} {2} terminating cg reconnectimer", DateTime.Now.ToString(CultureInfo.InvariantCulture), channelGroup, netState.ResponseType), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); TerminateReconnectTimer(); } //Send one ReConnectedCategory message. If Channels NOT available then use this if (netState.Channels.Length == 0 && netState.ChannelGroups != null && netState.ChannelGroups.Length > 0) { - PNStatus status = new StatusBuilder(config, jsonLibrary).CreateStatusResponse(netState.ResponseType, PNStatusCategory.PNReconnectedCategory, null, (int)System.Net.HttpStatusCode.OK, null); + PNStatus status = new StatusBuilder(config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId] : null, jsonLibrary).CreateStatusResponse(netState.ResponseType, PNStatusCategory.PNReconnectedCategory, null, (int)System.Net.HttpStatusCode.OK, null); if (netState.Channels != null && netState.Channels.Length > 0) { status.AffectedChannels.AddRange(netState.Channels.ToList()); @@ -1307,7 +1321,7 @@ protected void ReconnectNetworkCallback(System.Object reconnectState) Announce(status); } - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, channelgroup={1} {2} reconnectNetworkCallback. Internet Available", DateTime.Now.ToString(CultureInfo.InvariantCulture), channelGroup, netState.ResponseType), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, channelgroup={1} {2} reconnectNetworkCallback. Internet Available", DateTime.Now.ToString(CultureInfo.InvariantCulture), channelGroup, netState.ResponseType), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); switch (netState.ResponseType) { case PNOperationType.PNSubscribeOperation: @@ -1322,7 +1336,7 @@ protected void ReconnectNetworkCallback(System.Object reconnectState) } else { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Unknown request state in reconnectNetworkCallback", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Unknown request state in reconnectNetworkCallback", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); } } catch (Exception ex) @@ -1330,7 +1344,7 @@ protected void ReconnectNetworkCallback(System.Object reconnectState) if (netState != null) { PNStatusCategory errorCategory = PNStatusCategoryHelper.GetPNStatusCategory(ex); - PNStatus status = new StatusBuilder(config, jsonLibrary).CreateStatusResponse(netState.ResponseType, errorCategory, null, (int)HttpStatusCode.NotFound, new PNException(ex)); + PNStatus status = new StatusBuilder(config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId] : null, jsonLibrary).CreateStatusResponse(netState.ResponseType, errorCategory, null, (int)HttpStatusCode.NotFound, new PNException(ex)); if (netState.Channels != null && netState.Channels.Length > 0) { status.AffectedChannels.AddRange(netState.Channels.ToList()); @@ -1342,7 +1356,7 @@ protected void ReconnectNetworkCallback(System.Object reconnectState) Announce(status); } - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0} method:reconnectNetworkCallback \n Exception Details={1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), ex), config.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0} method:reconnectNetworkCallback \n Exception Details={1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), ex), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); } } @@ -1368,9 +1382,9 @@ private void RegisterPresenceHeartbeatTimer(string[] channels, string[] chann presenceHeartbeatState.Request = null; presenceHeartbeatState.Response = null; - if (config.PresenceInterval > 0) + if (config.ContainsKey(PubnubInstance.InstanceId) && config[PubnubInstance.InstanceId].PresenceInterval > 0) { - PresenceHeartbeatTimer = new Timer(OnPresenceHeartbeatIntervalTimeout, presenceHeartbeatState, config.PresenceInterval * 1000, config.PresenceInterval * 1000); + PresenceHeartbeatTimer = new Timer(OnPresenceHeartbeatIntervalTimeout, presenceHeartbeatState, config[PubnubInstance.InstanceId].PresenceInterval * 1000, config[PubnubInstance.InstanceId].PresenceInterval * 1000); } } } @@ -1392,7 +1406,7 @@ void OnPresenceHeartbeatIntervalTimeout(System.Object presenceHeartbeatState) if ((subscriberChannels != null && subscriberChannels.Length > 0) || (subscriberChannelGroups != null && subscriberChannelGroups.Length > 0)) { string channelsJsonState = BuildJsonUserState(subscriberChannels, subscriberChannelGroups, false); - IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null && !string.IsNullOrEmpty(PubnubInstance.InstanceId) && PubnubTokenMgrCollection.ContainsKey(PubnubInstance.InstanceId)) ? PubnubTokenMgrCollection[PubnubInstance.InstanceId] : null, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); + IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId] : null, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null && !string.IsNullOrEmpty(PubnubInstance.InstanceId) && PubnubTokenMgrCollection.ContainsKey(PubnubInstance.InstanceId)) ? PubnubTokenMgrCollection[PubnubInstance.InstanceId] : null, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); Uri request = urlBuilder.BuildPresenceHeartbeatRequest("GET", "", subscriberChannels, subscriberChannelGroups, channelsJsonState); @@ -1419,7 +1433,7 @@ void OnPresenceHeartbeatIntervalTimeout(System.Object presenceHeartbeatState) { if (PubnubInstance != null && !networkConnection) { - PNStatus status = new StatusBuilder(config, jsonLibrary).CreateStatusResponse(PNOperationType.PNSubscribeOperation, PNStatusCategory.PNNetworkIssuesCategory, null, (int)System.Net.HttpStatusCode.NotFound, new PNException("Internet connection problem during presence heartbeat.")); + PNStatus status = new StatusBuilder(config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId] : null, jsonLibrary).CreateStatusResponse(PNOperationType.PNSubscribeOperation, PNStatusCategory.PNNetworkIssuesCategory, null, (int)System.Net.HttpStatusCode.NotFound, new PNException("Internet connection problem during presence heartbeat.")); if (subscriberChannels != null && subscriberChannels.Length > 0) { status.AffectedChannels.AddRange(subscriberChannels.ToList()); diff --git a/src/Api/PubnubApi/Properties/AssemblyInfo.cs b/src/Api/PubnubApi/Properties/AssemblyInfo.cs index f655e4506..a35278a7d 100644 --- a/src/Api/PubnubApi/Properties/AssemblyInfo.cs +++ b/src/Api/PubnubApi/Properties/AssemblyInfo.cs @@ -11,8 +11,8 @@ [assembly: AssemblyProduct("Pubnub C# SDK")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("6.3.0.0")] -[assembly: AssemblyFileVersion("6.3.0.0")] +[assembly: AssemblyVersion("6.4.0.0")] +[assembly: AssemblyFileVersion("6.4.0.0")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. diff --git a/src/Api/PubnubApi/Pubnub.cs b/src/Api/PubnubApi/Pubnub.cs index aca6e39d1..20409bb5d 100644 --- a/src/Api/PubnubApi/Pubnub.cs +++ b/src/Api/PubnubApi/Pubnub.cs @@ -7,7 +7,7 @@ namespace PubnubApi { public class Pubnub { - private PNConfiguration pubnubConfig; + private ConcurrentDictionary pubnubConfig { get; } = new ConcurrentDictionary(); private IPubnubUnitTest pubnubUnitTest; private IPubnubLog pubnubLog; private EndPoint.ListenerManager listenerManager; @@ -32,7 +32,7 @@ static Pubnub() public EndPoint.SubscribeOperation Subscribe() { - EndPoint.SubscribeOperation subscribeOperation = new EndPoint.SubscribeOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, null, tokenManager, this); + EndPoint.SubscribeOperation subscribeOperation = new EndPoint.SubscribeOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, null, tokenManager, this); subscribeOperation.CurrentPubnubInstance(this); savedSubscribeOperation = subscribeOperation; return subscribeOperation; @@ -40,257 +40,257 @@ public EndPoint.SubscribeOperation Subscribe() public EndPoint.UnsubscribeOperation Unsubscribe() { - EndPoint.UnsubscribeOperation unsubscribeOperation = new EndPoint.UnsubscribeOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.UnsubscribeOperation unsubscribeOperation = new EndPoint.UnsubscribeOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); unsubscribeOperation.CurrentPubnubInstance(this); return unsubscribeOperation; } public EndPoint.UnsubscribeAllOperation UnsubscribeAll() { - EndPoint.UnsubscribeAllOperation unSubscribeAllOperation = new EndPoint.UnsubscribeAllOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.UnsubscribeAllOperation unSubscribeAllOperation = new EndPoint.UnsubscribeAllOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return unSubscribeAllOperation; } public EndPoint.PublishOperation Publish() { - EndPoint.PublishOperation publishOperation = new EndPoint.PublishOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.PublishOperation publishOperation = new EndPoint.PublishOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); publishOperation.CurrentPubnubInstance(this); return publishOperation; } public EndPoint.FireOperation Fire() { - EndPoint.FireOperation fireOperation = new EndPoint.FireOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.FireOperation fireOperation = new EndPoint.FireOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); fireOperation.CurrentPubnubInstance(this); return fireOperation; } public EndPoint.SignalOperation Signal() { - EndPoint.SignalOperation signalOperation = new EndPoint.SignalOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.SignalOperation signalOperation = new EndPoint.SignalOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return signalOperation; } public EndPoint.HistoryOperation History() { - EndPoint.HistoryOperation historyOperaton = new EndPoint.HistoryOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.HistoryOperation historyOperaton = new EndPoint.HistoryOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return historyOperaton; } public EndPoint.FetchHistoryOperation FetchHistory() { - EndPoint.FetchHistoryOperation historyOperaton = new EndPoint.FetchHistoryOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.FetchHistoryOperation historyOperaton = new EndPoint.FetchHistoryOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return historyOperaton; } public EndPoint.DeleteMessageOperation DeleteMessages() { - EndPoint.DeleteMessageOperation deleteMessageOperaton = new EndPoint.DeleteMessageOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.DeleteMessageOperation deleteMessageOperaton = new EndPoint.DeleteMessageOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return deleteMessageOperaton; } public EndPoint.MessageCountsOperation MessageCounts() { - EndPoint.MessageCountsOperation messageCount = new EndPoint.MessageCountsOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.MessageCountsOperation messageCount = new EndPoint.MessageCountsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); messageCount.CurrentPubnubInstance(this); return messageCount; } public EndPoint.HereNowOperation HereNow() { - EndPoint.HereNowOperation hereNowOperation = new EndPoint.HereNowOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.HereNowOperation hereNowOperation = new EndPoint.HereNowOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); hereNowOperation.CurrentPubnubInstance(this); return hereNowOperation; } public EndPoint.WhereNowOperation WhereNow() { - EndPoint.WhereNowOperation whereNowOperation = new EndPoint.WhereNowOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.WhereNowOperation whereNowOperation = new EndPoint.WhereNowOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); whereNowOperation.CurrentPubnubInstance(this); return whereNowOperation; } public EndPoint.TimeOperation Time() { - EndPoint.TimeOperation timeOperation = new EndPoint.TimeOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, this); + EndPoint.TimeOperation timeOperation = new EndPoint.TimeOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, this); timeOperation.CurrentPubnubInstance(this); return timeOperation; } public EndPoint.AuditOperation Audit() { - EndPoint.AuditOperation auditOperation = new EndPoint.AuditOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, this); + EndPoint.AuditOperation auditOperation = new EndPoint.AuditOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, this); auditOperation.CurrentPubnubInstance(this); return auditOperation; } public EndPoint.GrantTokenOperation GrantToken() { - EndPoint.GrantTokenOperation grantOperation = new EndPoint.GrantTokenOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.GrantTokenOperation grantOperation = new EndPoint.GrantTokenOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return grantOperation; } public EndPoint.RevokeTokenOperation RevokeToken() { - EndPoint.RevokeTokenOperation revokeTokenOperation = new EndPoint.RevokeTokenOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.RevokeTokenOperation revokeTokenOperation = new EndPoint.RevokeTokenOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return revokeTokenOperation; } public EndPoint.GrantOperation Grant() { - EndPoint.GrantOperation grantOperation = new EndPoint.GrantOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, this); + EndPoint.GrantOperation grantOperation = new EndPoint.GrantOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, this); grantOperation.CurrentPubnubInstance(this); return grantOperation; } public EndPoint.SetStateOperation SetPresenceState() { - EndPoint.SetStateOperation setStateOperation = new EndPoint.SetStateOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.SetStateOperation setStateOperation = new EndPoint.SetStateOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return setStateOperation; } public EndPoint.GetStateOperation GetPresenceState() { - EndPoint.GetStateOperation getStateOperation = new EndPoint.GetStateOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.GetStateOperation getStateOperation = new EndPoint.GetStateOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); getStateOperation.CurrentPubnubInstance(this); return getStateOperation; } public EndPoint.AddPushChannelOperation AddPushNotificationsOnChannels() { - EndPoint.AddPushChannelOperation addPushChannelOperation = new EndPoint.AddPushChannelOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.AddPushChannelOperation addPushChannelOperation = new EndPoint.AddPushChannelOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return addPushChannelOperation; } public EndPoint.RemovePushChannelOperation RemovePushNotificationsFromChannels() { - EndPoint.RemovePushChannelOperation removePushChannelOperation = new EndPoint.RemovePushChannelOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.RemovePushChannelOperation removePushChannelOperation = new EndPoint.RemovePushChannelOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return removePushChannelOperation; } public EndPoint.RemoveAllPushChannelsOperation RemoveAllPushNotificationsFromDeviceWithPushToken() { - EndPoint.RemoveAllPushChannelsOperation removeAllPushChannelsOperation = new EndPoint.RemoveAllPushChannelsOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.RemoveAllPushChannelsOperation removeAllPushChannelsOperation = new EndPoint.RemoveAllPushChannelsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); removeAllPushChannelsOperation.CurrentPubnubInstance(this); return removeAllPushChannelsOperation; } public EndPoint.AuditPushChannelOperation AuditPushChannelProvisions() { - EndPoint.AuditPushChannelOperation auditPushChannelOperation = new EndPoint.AuditPushChannelOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.AuditPushChannelOperation auditPushChannelOperation = new EndPoint.AuditPushChannelOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); auditPushChannelOperation.CurrentPubnubInstance(this); return auditPushChannelOperation; } public EndPoint.SetUuidMetadataOperation SetUuidMetadata() { - EndPoint.SetUuidMetadataOperation setUuidMetadataOperation = new EndPoint.SetUuidMetadataOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.SetUuidMetadataOperation setUuidMetadataOperation = new EndPoint.SetUuidMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return setUuidMetadataOperation; } public EndPoint.RemoveUuidMetadataOperation RemoveUuidMetadata() { - EndPoint.RemoveUuidMetadataOperation removeUuidMetadataOperation = new EndPoint.RemoveUuidMetadataOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.RemoveUuidMetadataOperation removeUuidMetadataOperation = new EndPoint.RemoveUuidMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return removeUuidMetadataOperation; } public EndPoint.GetAllUuidMetadataOperation GetAllUuidMetadata() { - EndPoint.GetAllUuidMetadataOperation getAllUuidMetadataOperation = new EndPoint.GetAllUuidMetadataOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.GetAllUuidMetadataOperation getAllUuidMetadataOperation = new EndPoint.GetAllUuidMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return getAllUuidMetadataOperation; } public EndPoint.GetUuidMetadataOperation GetUuidMetadata() { - EndPoint.GetUuidMetadataOperation getUuidMetadataOperation = new EndPoint.GetUuidMetadataOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.GetUuidMetadataOperation getUuidMetadataOperation = new EndPoint.GetUuidMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return getUuidMetadataOperation; } public EndPoint.SetChannelMetadataOperation SetChannelMetadata() { - EndPoint.SetChannelMetadataOperation setChannelMetadataOperation = new EndPoint.SetChannelMetadataOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.SetChannelMetadataOperation setChannelMetadataOperation = new EndPoint.SetChannelMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return setChannelMetadataOperation; } public EndPoint.RemoveChannelMetadataOperation RemoveChannelMetadata() { - EndPoint.RemoveChannelMetadataOperation removeChannelMetadataOperation = new EndPoint.RemoveChannelMetadataOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.RemoveChannelMetadataOperation removeChannelMetadataOperation = new EndPoint.RemoveChannelMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return removeChannelMetadataOperation; } public EndPoint.GetAllChannelMetadataOperation GetAllChannelMetadata() { - EndPoint.GetAllChannelMetadataOperation getAllChannelMetadataOperation = new EndPoint.GetAllChannelMetadataOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.GetAllChannelMetadataOperation getAllChannelMetadataOperation = new EndPoint.GetAllChannelMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return getAllChannelMetadataOperation; } public EndPoint.GetChannelMetadataOperation GetChannelMetadata() { - EndPoint.GetChannelMetadataOperation getSingleSpaceOperation = new EndPoint.GetChannelMetadataOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.GetChannelMetadataOperation getSingleSpaceOperation = new EndPoint.GetChannelMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return getSingleSpaceOperation; } public EndPoint.GetMembershipsOperation GetMemberships() { - EndPoint.GetMembershipsOperation getMembershipOperation = new EndPoint.GetMembershipsOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.GetMembershipsOperation getMembershipOperation = new EndPoint.GetMembershipsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return getMembershipOperation; } public EndPoint.SetMembershipsOperation SetMemberships() { - EndPoint.SetMembershipsOperation setMembershipsOperation = new EndPoint.SetMembershipsOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.SetMembershipsOperation setMembershipsOperation = new EndPoint.SetMembershipsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return setMembershipsOperation; } public EndPoint.RemoveMembershipsOperation RemoveMemberships() { - EndPoint.RemoveMembershipsOperation removeMembershipsOperation = new EndPoint.RemoveMembershipsOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.RemoveMembershipsOperation removeMembershipsOperation = new EndPoint.RemoveMembershipsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return removeMembershipsOperation; } public EndPoint.ManageMembershipsOperation ManageMemberships() { - EndPoint.ManageMembershipsOperation manageMembershipsOperation = new EndPoint.ManageMembershipsOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.ManageMembershipsOperation manageMembershipsOperation = new EndPoint.ManageMembershipsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return manageMembershipsOperation; } public EndPoint.GetChannelMembersOperation GetChannelMembers() { - EndPoint.GetChannelMembersOperation getChannelMembersOperation = new EndPoint.GetChannelMembersOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.GetChannelMembersOperation getChannelMembersOperation = new EndPoint.GetChannelMembersOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return getChannelMembersOperation; } public EndPoint.SetChannelMembersOperation SetChannelMembers() { - EndPoint.SetChannelMembersOperation setChannelMembersOperation = new EndPoint.SetChannelMembersOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.SetChannelMembersOperation setChannelMembersOperation = new EndPoint.SetChannelMembersOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return setChannelMembersOperation; } public EndPoint.RemoveChannelMembersOperation RemoveChannelMembers() { - EndPoint.RemoveChannelMembersOperation removeChannelMembersOperation = new EndPoint.RemoveChannelMembersOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.RemoveChannelMembersOperation removeChannelMembersOperation = new EndPoint.RemoveChannelMembersOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return removeChannelMembersOperation; } public EndPoint.ManageChannelMembersOperation ManageChannelMembers() { - EndPoint.ManageChannelMembersOperation channelMembersOperation = new EndPoint.ManageChannelMembersOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.ManageChannelMembersOperation channelMembersOperation = new EndPoint.ManageChannelMembersOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return channelMembersOperation; } public EndPoint.AddMessageActionOperation AddMessageAction() { - EndPoint.AddMessageActionOperation addMessageActionOperation = new EndPoint.AddMessageActionOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.AddMessageActionOperation addMessageActionOperation = new EndPoint.AddMessageActionOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return addMessageActionOperation; } public EndPoint.RemoveMessageActionOperation RemoveMessageAction() { - EndPoint.RemoveMessageActionOperation removeMessageActionOperation = new EndPoint.RemoveMessageActionOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.RemoveMessageActionOperation removeMessageActionOperation = new EndPoint.RemoveMessageActionOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return removeMessageActionOperation; } public EndPoint.GetMessageActionsOperation GetMessageActions() { - EndPoint.GetMessageActionsOperation getMessageActionsOperation = new EndPoint.GetMessageActionsOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.GetMessageActionsOperation getMessageActionsOperation = new EndPoint.GetMessageActionsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return getMessageActionsOperation; } @@ -300,35 +300,35 @@ public EndPoint.GetMessageActionsOperation GetMessageActions() public EndPoint.AddChannelsToChannelGroupOperation AddChannelsToChannelGroup() { - EndPoint.AddChannelsToChannelGroupOperation addChannelToChannelGroupOperation = new EndPoint.AddChannelsToChannelGroupOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.AddChannelsToChannelGroupOperation addChannelToChannelGroupOperation = new EndPoint.AddChannelsToChannelGroupOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); addChannelToChannelGroupOperation.CurrentPubnubInstance(this); return addChannelToChannelGroupOperation; } public EndPoint.RemoveChannelsFromChannelGroupOperation RemoveChannelsFromChannelGroup() { - EndPoint.RemoveChannelsFromChannelGroupOperation removeChannelsFromChannelGroupOperation = new EndPoint.RemoveChannelsFromChannelGroupOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.RemoveChannelsFromChannelGroupOperation removeChannelsFromChannelGroupOperation = new EndPoint.RemoveChannelsFromChannelGroupOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); removeChannelsFromChannelGroupOperation.CurrentPubnubInstance(this); return removeChannelsFromChannelGroupOperation; } public EndPoint.DeleteChannelGroupOperation DeleteChannelGroup() { - EndPoint.DeleteChannelGroupOperation deleteChannelGroupOperation = new EndPoint.DeleteChannelGroupOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.DeleteChannelGroupOperation deleteChannelGroupOperation = new EndPoint.DeleteChannelGroupOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); deleteChannelGroupOperation.CurrentPubnubInstance(this); return deleteChannelGroupOperation; } public EndPoint.ListChannelsForChannelGroupOperation ListChannelsForChannelGroup() { - EndPoint.ListChannelsForChannelGroupOperation listChannelsForChannelGroupOperation = new EndPoint.ListChannelsForChannelGroupOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, null, tokenManager, this); + EndPoint.ListChannelsForChannelGroupOperation listChannelsForChannelGroupOperation = new EndPoint.ListChannelsForChannelGroupOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, null, tokenManager, this); listChannelsForChannelGroupOperation.CurrentPubnubInstance(this); return listChannelsForChannelGroupOperation; } public EndPoint.ListAllChannelGroupOperation ListChannelGroups() { - EndPoint.ListAllChannelGroupOperation listAllChannelGroupOperation = new EndPoint.ListAllChannelGroupOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, null, tokenManager, this); + EndPoint.ListAllChannelGroupOperation listAllChannelGroupOperation = new EndPoint.ListAllChannelGroupOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, null, tokenManager, this); listAllChannelGroupOperation.CurrentPubnubInstance(this); return listAllChannelGroupOperation; } @@ -337,7 +337,7 @@ public bool AddListener(SubscribeCallback listener) { if (listenerManager == null) { - listenerManager = new EndPoint.ListenerManager(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, null, tokenManager, this); + listenerManager = new EndPoint.ListenerManager(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, null, tokenManager, this); } return listenerManager.AddListener(listener); } @@ -355,44 +355,44 @@ public bool RemoveListener(SubscribeCallback listener) public EndPoint.SendFileOperation SendFile() { - EndPoint.SendFileOperation uploadFileOperation = new EndPoint.SendFileOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.SendFileOperation uploadFileOperation = new EndPoint.SendFileOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return uploadFileOperation; } public EndPoint.GetFileUrlOperation GetFileUrl() { - EndPoint.GetFileUrlOperation getFileUrlOperation = new EndPoint.GetFileUrlOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.GetFileUrlOperation getFileUrlOperation = new EndPoint.GetFileUrlOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return getFileUrlOperation; } public EndPoint.DownloadFileOperation DownloadFile() { - EndPoint.DownloadFileOperation downloadFileOperation = new EndPoint.DownloadFileOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.DownloadFileOperation downloadFileOperation = new EndPoint.DownloadFileOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return downloadFileOperation; } public EndPoint.ListFilesOperation ListFiles() { - EndPoint.ListFilesOperation listFilesOperation = new EndPoint.ListFilesOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.ListFilesOperation listFilesOperation = new EndPoint.ListFilesOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return listFilesOperation; } public EndPoint.DeleteFileOperation DeleteFile() { - EndPoint.DeleteFileOperation deleteFileOperation = new EndPoint.DeleteFileOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.DeleteFileOperation deleteFileOperation = new EndPoint.DeleteFileOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return deleteFileOperation; } public EndPoint.PublishFileMessageOperation PublishFileMessage() { - EndPoint.PublishFileMessageOperation publshFileMessageOperation = new EndPoint.PublishFileMessageOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.PublishFileMessageOperation publshFileMessageOperation = new EndPoint.PublishFileMessageOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); return publshFileMessageOperation; } #region "PubNub API Other Methods" public void TerminateCurrentSubscriberRequest() { - EndPoint.OtherOperation endpoint = new EndPoint.OtherOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, null, tokenManager, this); + EndPoint.OtherOperation endpoint = new EndPoint.OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, null, tokenManager, this); endpoint.CurrentPubnubInstance(this); endpoint.TerminateCurrentSubscriberRequest(); } @@ -418,11 +418,11 @@ public void ChangeUUID(string newUUID) { if (pubnubLog != null && pubnubConfig != null) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, UUID cannot be null/empty.", DateTime.Now.ToString(CultureInfo.InvariantCulture)), pubnubConfig.LogVerbosity); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, UUID cannot be null/empty.", DateTime.Now.ToString(CultureInfo.InvariantCulture)), pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId].LogVerbosity : PNLogVerbosity.NONE); } throw new MissingMemberException("UUID cannot be null/empty"); } - EndPoint.OtherOperation endPoint = new EndPoint.OtherOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + EndPoint.OtherOperation endPoint = new EndPoint.OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); endPoint.CurrentPubnubInstance(this); endPoint.ChangeUUID(newUUID); } @@ -444,14 +444,14 @@ public static DateTime TranslatePubnubUnixNanoSecondsToDateTime(string unixNanoS public List GetSubscribedChannels() { - EndPoint.OtherOperation endpoint = new EndPoint.OtherOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, null, tokenManager, this); + EndPoint.OtherOperation endpoint = new EndPoint.OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, null, tokenManager, this); endpoint.CurrentPubnubInstance(this); return endpoint.GetSubscribedChannels(); } public List GetSubscribedChannelGroups() { - EndPoint.OtherOperation endpoint = new EndPoint.OtherOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, null, tokenManager, this); + EndPoint.OtherOperation endpoint = new EndPoint.OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, null, tokenManager, this); endpoint.CurrentPubnubInstance(this); return endpoint.GetSubscribedChannelGroups(); } @@ -459,7 +459,7 @@ public List GetSubscribedChannelGroups() public void Destroy() { savedSubscribeOperation = null; - EndPoint.OtherOperation endpoint = new EndPoint.OtherOperation(pubnubConfig, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, null, tokenManager, this); + EndPoint.OtherOperation endpoint = new EndPoint.OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, null, tokenManager, this); endpoint.CurrentPubnubInstance(this); endpoint.EndPendingRequests(); } @@ -540,13 +540,20 @@ public string Decrypt(string inputString) throw new ArgumentException("inputString is not valid"); } - if (pubnubConfig == null || string.IsNullOrEmpty(pubnubConfig.CipherKey)) + if (pubnubConfig.ContainsKey(InstanceId)) + { + if (pubnubConfig[InstanceId] == null || string.IsNullOrEmpty(pubnubConfig[InstanceId].CipherKey)) + { + throw new ArgumentException("CipherKey missing"); + } + + PubnubCrypto pc = new PubnubCrypto(pubnubConfig[InstanceId].CipherKey, pubnubConfig[InstanceId], pubnubLog, pubnubUnitTest); + return pc.Decrypt(inputString); + } + else { throw new ArgumentException("CipherKey missing"); } - - PubnubCrypto pc = new PubnubCrypto(pubnubConfig.CipherKey, pubnubConfig, pubnubLog, pubnubUnitTest); - return pc.Decrypt(inputString); } public string Decrypt(string inputString, string cipherKey) @@ -556,7 +563,7 @@ public string Decrypt(string inputString, string cipherKey) throw new ArgumentException("inputString is not valid"); } - PubnubCrypto pc = new PubnubCrypto(cipherKey, pubnubConfig, pubnubLog, pubnubUnitTest); + PubnubCrypto pc = new PubnubCrypto(cipherKey, pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, pubnubLog, pubnubUnitTest); return pc.Decrypt(inputString); } @@ -566,14 +573,20 @@ public string Encrypt(string inputString) { throw new ArgumentException("inputString is not valid"); } + if (pubnubConfig.ContainsKey(InstanceId)) + { + if (pubnubConfig[InstanceId] == null || string.IsNullOrEmpty(pubnubConfig[InstanceId].CipherKey)) + { + throw new MissingMemberException("CipherKey missing"); + } - if (pubnubConfig == null || string.IsNullOrEmpty(pubnubConfig.CipherKey)) + PubnubCrypto pc = new PubnubCrypto(pubnubConfig[InstanceId].CipherKey, pubnubConfig[InstanceId], pubnubLog, pubnubUnitTest); + return pc.Encrypt(inputString); + } + else { throw new MissingMemberException("CipherKey missing"); } - - PubnubCrypto pc = new PubnubCrypto(pubnubConfig.CipherKey, pubnubConfig, pubnubLog, pubnubUnitTest); - return pc.Encrypt(inputString); } public string Encrypt(string inputString, string cipherKey) @@ -583,7 +596,7 @@ public string Encrypt(string inputString, string cipherKey) throw new ArgumentException("inputString is not valid"); } - PubnubCrypto pc = new PubnubCrypto(cipherKey, pubnubConfig, pubnubLog, pubnubUnitTest); + PubnubCrypto pc = new PubnubCrypto(cipherKey, pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, pubnubLog, pubnubUnitTest); return pc.Encrypt(inputString); } @@ -593,12 +606,19 @@ public byte[] EncryptFile(byte[] inputBytes) { throw new ArgumentException("inputBytes is not valid"); } - if (pubnubConfig == null || string.IsNullOrEmpty(pubnubConfig.CipherKey)) + if (pubnubConfig.ContainsKey(InstanceId)) { - throw new MissingMemberException("CipherKey missing"); + if (pubnubConfig[InstanceId] == null || string.IsNullOrEmpty(pubnubConfig[InstanceId].CipherKey)) + { + throw new MissingMemberException("CipherKey missing"); + } + PubnubCrypto pc = new PubnubCrypto(pubnubConfig[InstanceId].CipherKey, pubnubConfig[InstanceId], pubnubLog, pubnubUnitTest); + return pc.Encrypt(inputBytes, true); + } + else + { + throw new ArgumentException("CipherKey missing"); } - PubnubCrypto pc = new PubnubCrypto(pubnubConfig.CipherKey, pubnubConfig, pubnubLog, pubnubUnitTest); - return pc.Encrypt(inputBytes, true); } public byte[] EncryptFile(byte[] inputBytes, string cipherKey) { @@ -606,12 +626,12 @@ public byte[] EncryptFile(byte[] inputBytes, string cipherKey) { throw new ArgumentException("inputBytes is not valid"); } - if (pubnubConfig != null && !string.IsNullOrEmpty(pubnubConfig.CipherKey)) + if (pubnubConfig.ContainsKey(InstanceId) && !string.IsNullOrEmpty(pubnubConfig[InstanceId].CipherKey)) { //Ignore this. Added this condition to pass Codacy recommendation of making this as static method } - PubnubCrypto pc = new PubnubCrypto(cipherKey, pubnubConfig, pubnubLog, pubnubUnitTest); + PubnubCrypto pc = new PubnubCrypto(cipherKey, pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, pubnubLog, pubnubUnitTest); return pc.Encrypt(inputBytes, true); } public void EncryptFile(string sourceFile, string destinationFile) @@ -620,28 +640,35 @@ public void EncryptFile(string sourceFile, string destinationFile) { throw new ArgumentException("sourceFile is not valid"); } - if (pubnubConfig == null || string.IsNullOrEmpty(pubnubConfig.CipherKey)) + if (pubnubConfig.ContainsKey(InstanceId)) { - throw new MissingMemberException("CipherKey missing"); - } -#if !NETSTANDARD10 && !NETSTANDARD11 - bool validSource = System.IO.File.Exists(sourceFile); - if (!validSource) - { - throw new ArgumentException("sourceFile is not valid"); + if (pubnubConfig[InstanceId] == null || string.IsNullOrEmpty(pubnubConfig[InstanceId].CipherKey)) + { + throw new MissingMemberException("CipherKey missing"); + } + #if !NETSTANDARD10 && !NETSTANDARD11 + bool validSource = System.IO.File.Exists(sourceFile); + if (!validSource) + { + throw new ArgumentException("sourceFile is not valid"); + } + string destDirectory = System.IO.Path.GetDirectoryName(destinationFile); + bool validDest = System.IO.Directory.Exists(destDirectory); + if (!string.IsNullOrEmpty(destDirectory) && !validDest) + { + throw new ArgumentException("destination path is not valid"); + } + byte[] inputBytes = System.IO.File.ReadAllBytes(sourceFile); + byte[] outputBytes = EncryptFile(inputBytes); + System.IO.File.WriteAllBytes(destinationFile, outputBytes); + #else + throw new NotSupportedException("FileSystem not supported in NetStandard 1.0/1.1. Consider higher version of .NetStandard."); + #endif } - string destDirectory = System.IO.Path.GetDirectoryName(destinationFile); - bool validDest = System.IO.Directory.Exists(destDirectory); - if (!string.IsNullOrEmpty(destDirectory) && !validDest) + else { - throw new ArgumentException("destination path is not valid"); + throw new ArgumentException("CipherKey missing"); } - byte[] inputBytes = System.IO.File.ReadAllBytes(sourceFile); - byte[] outputBytes = EncryptFile(inputBytes); - System.IO.File.WriteAllBytes(destinationFile, outputBytes); -#else - throw new NotSupportedException("FileSystem not supported in NetStandard 1.0/1.1. Consider higher version of .NetStandard."); -#endif } public void EncryptFile(string sourceFile, string destinationFile, string cipherKey) { @@ -677,13 +704,20 @@ public byte[] DecryptFile(byte[] inputBytes) throw new ArgumentException("inputBytes is not valid"); } - if (pubnubConfig == null || string.IsNullOrEmpty(pubnubConfig.CipherKey)) + if (pubnubConfig.ContainsKey(InstanceId)) + { + if (pubnubConfig[InstanceId] == null || string.IsNullOrEmpty(pubnubConfig[InstanceId].CipherKey)) + { + throw new ArgumentException("CipherKey missing"); + } + + PubnubCrypto pc = new PubnubCrypto(pubnubConfig[InstanceId].CipherKey, pubnubConfig[InstanceId], pubnubLog, pubnubUnitTest); + return pc.Decrypt(inputBytes, true); + } + else { throw new ArgumentException("CipherKey missing"); } - - PubnubCrypto pc = new PubnubCrypto(pubnubConfig.CipherKey, pubnubConfig, pubnubLog, pubnubUnitTest); - return pc.Decrypt(inputBytes, true); } public void DecryptFile(string sourceFile, string destinationFile) { @@ -692,29 +726,35 @@ public void DecryptFile(string sourceFile, string destinationFile) throw new ArgumentException("sourceFile is not valid"); } - if (pubnubConfig == null || string.IsNullOrEmpty(pubnubConfig.CipherKey)) + if (pubnubConfig.ContainsKey(InstanceId)) { - throw new ArgumentException("CipherKey missing"); - } - -#if !NETSTANDARD10 && !NETSTANDARD11 - bool validSource = System.IO.File.Exists(sourceFile); - if (!validSource) - { - throw new ArgumentException("sourceFile is not valid"); + if (pubnubConfig[InstanceId] == null || string.IsNullOrEmpty(pubnubConfig[InstanceId].CipherKey)) + { + throw new ArgumentException("CipherKey missing"); + } + #if !NETSTANDARD10 && !NETSTANDARD11 + bool validSource = System.IO.File.Exists(sourceFile); + if (!validSource) + { + throw new ArgumentException("sourceFile is not valid"); + } + string destDirectory = System.IO.Path.GetDirectoryName(destinationFile); + bool validDest = System.IO.Directory.Exists(destDirectory); + if (!string.IsNullOrEmpty(destDirectory) && !validDest) + { + throw new ArgumentException("destination path is not valid"); + } + byte[] inputBytes = System.IO.File.ReadAllBytes(sourceFile); + byte[] outputBytes = DecryptFile(inputBytes, pubnubConfig[InstanceId].CipherKey); + System.IO.File.WriteAllBytes(destinationFile, outputBytes); + #else + throw new NotSupportedException("FileSystem not supported in NetStandard 1.0/1.1. Consider higher version of .NetStandard."); + #endif } - string destDirectory = System.IO.Path.GetDirectoryName(destinationFile); - bool validDest = System.IO.Directory.Exists(destDirectory); - if (!string.IsNullOrEmpty(destDirectory) && !validDest) + else { - throw new ArgumentException("destination path is not valid"); + throw new ArgumentException("CipherKey missing"); } - byte[] inputBytes = System.IO.File.ReadAllBytes(sourceFile); - byte[] outputBytes = DecryptFile(inputBytes, pubnubConfig.CipherKey); - System.IO.File.WriteAllBytes(destinationFile, outputBytes); -#else - throw new NotSupportedException("FileSystem not supported in NetStandard 1.0/1.1. Consider higher version of .NetStandard."); -#endif } public byte[] DecryptFile(byte[] inputBytes, string cipherKey) { @@ -722,11 +762,11 @@ public byte[] DecryptFile(byte[] inputBytes, string cipherKey) { throw new ArgumentException("inputBytes is not valid"); } - if (pubnubConfig != null && !string.IsNullOrEmpty(pubnubConfig.CipherKey)) + if (pubnubConfig.ContainsKey(InstanceId) && !string.IsNullOrEmpty(pubnubConfig[InstanceId].CipherKey)) { //Ignore this. Added this condition to pass Codacy recommendation of making this as static method } - PubnubCrypto pc = new PubnubCrypto(cipherKey, pubnubConfig, pubnubLog, pubnubUnitTest); + PubnubCrypto pc = new PubnubCrypto(cipherKey, pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, pubnubLog, pubnubUnitTest); return pc.Decrypt(inputBytes, true); } public void DecryptFile(string sourceFile, string destinationFile, string cipherKey) @@ -781,7 +821,7 @@ public PNConfiguration PNConfig { get { - return pubnubConfig; + return pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null; } } @@ -806,7 +846,7 @@ public Pubnub(PNConfiguration config) { savedSdkVerion = Version; InstanceId = Guid.NewGuid().ToString(); - pubnubConfig = config; + pubnubConfig.AddOrUpdate(InstanceId, config, (k, o) => config); if (config != null) { pubnubLog = config.PubnubLog; @@ -814,12 +854,12 @@ public Pubnub(PNConfiguration config) JsonPluggableLibrary = new NewtonsoftJsonDotNet(config, pubnubLog); if (config != null && config.EnableTelemetry) { - telemetryManager = new EndPoint.TelemetryManager(pubnubConfig, pubnubLog); + telemetryManager = new EndPoint.TelemetryManager(pubnubConfig[InstanceId], pubnubLog); } CheckRequiredConfigValues(); if (config != null) { - tokenManager = new EndPoint.TokenManager(pubnubConfig, JsonPluggableLibrary, pubnubLog, this.InstanceId); + tokenManager = new EndPoint.TokenManager(pubnubConfig[InstanceId], JsonPluggableLibrary, pubnubLog, this.InstanceId); } if (config != null && pubnubLog != null) { @@ -846,26 +886,26 @@ public Pubnub(PNConfiguration config) private void CheckRequiredConfigValues() { - if (pubnubConfig != null) + if (pubnubConfig != null && pubnubConfig.ContainsKey(InstanceId)) { - if (string.IsNullOrEmpty(pubnubConfig.SubscribeKey)) + if (string.IsNullOrEmpty(pubnubConfig[InstanceId].SubscribeKey)) { - pubnubConfig.SubscribeKey = ""; + pubnubConfig[InstanceId].SubscribeKey = ""; } - if (string.IsNullOrEmpty(pubnubConfig.PublishKey)) + if (string.IsNullOrEmpty(pubnubConfig[InstanceId].PublishKey)) { - pubnubConfig.PublishKey = ""; + pubnubConfig[InstanceId].PublishKey = ""; } - if (string.IsNullOrEmpty(pubnubConfig.SecretKey)) + if (string.IsNullOrEmpty(pubnubConfig[InstanceId].SecretKey)) { - pubnubConfig.SecretKey = ""; + pubnubConfig[InstanceId].SecretKey = ""; } - if (string.IsNullOrEmpty(pubnubConfig.CipherKey)) + if (string.IsNullOrEmpty(pubnubConfig[InstanceId].CipherKey)) { - pubnubConfig.CipherKey = ""; + pubnubConfig[InstanceId].CipherKey = ""; } } } diff --git a/src/Api/PubnubApi/PubnubApi.csproj b/src/Api/PubnubApi/PubnubApi.csproj index bb301b153..bbe7ae5ea 100644 --- a/src/Api/PubnubApi/PubnubApi.csproj +++ b/src/Api/PubnubApi/PubnubApi.csproj @@ -13,7 +13,7 @@ Pubnub - 6.3.0.0 + 6.4.0.0 PubNub C# .NET - Web Data Push API Pandu Masabathula PubNub @@ -21,8 +21,7 @@ http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png true https://github.com/pubnub/c-sharp/ - Refactor Telemetry Task Result to GetAwaiter().GetResult() . -Removed SILVERLIGHT, WINDOWS_PHONE preprocessor directive code. + Handle PNConfiguration for multi Pubnub instances. Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously diff --git a/src/Api/PubnubApiPCL/PubnubApiPCL.csproj b/src/Api/PubnubApiPCL/PubnubApiPCL.csproj index 56964ced3..dcc23d1f1 100644 --- a/src/Api/PubnubApiPCL/PubnubApiPCL.csproj +++ b/src/Api/PubnubApiPCL/PubnubApiPCL.csproj @@ -14,7 +14,7 @@ PubnubPCL - 6.3.0.0 + 6.4.0.0 PubNub C# .NET - Web Data Push API Pandu Masabathula PubNub @@ -22,8 +22,7 @@ http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png true https://github.com/pubnub/c-sharp/ - Refactor Telemetry Task Result to GetAwaiter().GetResult() . -Removed SILVERLIGHT, WINDOWS_PHONE preprocessor directive code. + Handle PNConfiguration for multi Pubnub instances. Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously diff --git a/src/Api/PubnubApiUWP/PubnubApiUWP.csproj b/src/Api/PubnubApiUWP/PubnubApiUWP.csproj index 49f9ebf4c..d1ae92ad3 100644 --- a/src/Api/PubnubApiUWP/PubnubApiUWP.csproj +++ b/src/Api/PubnubApiUWP/PubnubApiUWP.csproj @@ -15,7 +15,7 @@ PubnubUWP - 6.3.0.0 + 6.4.0.0 PubNub C# .NET - Web Data Push API Pandu Masabathula PubNub @@ -23,8 +23,7 @@ http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png true https://github.com/pubnub/c-sharp/ - Refactor Telemetry Task Result to GetAwaiter().GetResult() . -Removed SILVERLIGHT, WINDOWS_PHONE preprocessor directive code. + Handle PNConfiguration for multi Pubnub instances. Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously diff --git a/src/Examples/PubnubApi.WinFormExample/PubnubApi.WinFormExample.csproj b/src/Examples/PubnubApi.WinFormExample/PubnubApi.WinFormExample.csproj index a51c3e341..4fb3d5cfb 100644 --- a/src/Examples/PubnubApi.WinFormExample/PubnubApi.WinFormExample.csproj +++ b/src/Examples/PubnubApi.WinFormExample/PubnubApi.WinFormExample.csproj @@ -33,9 +33,6 @@ 4 - - packages\Portable.BouncyCastle.1.8.1.2\lib\net4\BouncyCastle.Crypto.dll - ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll True @@ -49,23 +46,27 @@ True - packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + + + ..\..\packages\PeterO.Numbers.1.8.2\lib\net40\Numbers.dll - - packages\Pubnub.4.2.0\lib\net45\Pubnub.dll + + ..\..\packages\Pubnub.6.3.0\lib\net45\Pubnub.dll - - ..\..\packages\System.IO.FileSystem.4.0.1\lib\net46\System.IO.FileSystem.dll - True + + ..\..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll - - ..\..\packages\System.IO.FileSystem.Primitives.4.0.1\lib\net46\System.IO.FileSystem.Primitives.dll - True + + ..\..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll + + ..\..\packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll + @@ -75,6 +76,9 @@ + + ..\..\packages\PeterO.URIUtility.1.0.0\lib\net40\URIUtility.dll + diff --git a/src/Examples/PubnubApi.WinFormExample/PubnubDemoForm.cs b/src/Examples/PubnubApi.WinFormExample/PubnubDemoForm.cs index bfce4f8d2..9adafb8b5 100644 --- a/src/Examples/PubnubApi.WinFormExample/PubnubDemoForm.cs +++ b/src/Examples/PubnubApi.WinFormExample/PubnubDemoForm.cs @@ -13,8 +13,8 @@ namespace PubnubApi.WinFormExample public partial class PubnubDemoForm : Form { static private Pubnub[] pubnub; - PNConfiguration config1 = new PNConfiguration(); - PNConfiguration config2 = new PNConfiguration(); + PNConfiguration config1 = new PNConfiguration("uuidone"); + PNConfiguration config2 = new PNConfiguration("uuidtwo"); string origin = "ps.pndsn.com"; public class MyLog1 : IPubnubLog @@ -979,7 +979,7 @@ private void btnGrantToken1_Click(object sender, EventArgs e) DialogResult result = accessManager.ShowDialog(); if (result == DialogResult.OK) { - PNResourcePermission perm = new PNResourcePermission + PNTokenAuthValues perm = new PNTokenAuthValues { Read = accessManager.AccessRead, Write = accessManager.AccessWrite, @@ -988,9 +988,11 @@ private void btnGrantToken1_Click(object sender, EventArgs e) Create = accessManager.AccessCreate }; pubnub[0].GrantToken() - .Users(new Dictionary() { { accessManager.UserId, perm } }) - .Spaces(new Dictionary() { { accessManager.SpaceId, perm } }) - .AuthKey(accessManager.AuthKey) + .Resources(new PNTokenResources() + { + Users = new Dictionary() { { accessManager.UserId, perm } }, + Spaces = new Dictionary() { { accessManager.SpaceId, perm } }, + }) .TTL(accessManager.TTL) .Execute(new PNAccessManagerTokenResultExt( (r, s) => @@ -998,6 +1000,10 @@ private void btnGrantToken1_Click(object sender, EventArgs e) Invoke(new Action(() => { if (r != null) { + if (!string.IsNullOrEmpty(r.Token)) + { + accessManager.AuthKey = r.Token; + } lvResults1.Items.Add(pubnub[0].JsonPluggableLibrary.SerializeToJsonString(r)); } else if (s != null) @@ -1020,7 +1026,7 @@ private void btnGrantToken2_Click(object sender, EventArgs e) DialogResult result = accessManager.ShowDialog(); if (result == DialogResult.OK) { - PNResourcePermission perm = new PNResourcePermission + PNTokenAuthValues perm = new PNTokenAuthValues { Read = accessManager.AccessRead, Write = accessManager.AccessWrite, @@ -1029,9 +1035,11 @@ private void btnGrantToken2_Click(object sender, EventArgs e) Create = accessManager.AccessCreate }; pubnub[1].GrantToken() - .Users(new Dictionary() { { accessManager.UserId, perm } }) - .Spaces(new Dictionary() { { accessManager.SpaceId, perm } }) - .AuthKey(accessManager.AuthKey) + .Resources(new PNTokenResources() + { + Users = new Dictionary() { { accessManager.UserId, perm } }, + Spaces = new Dictionary() { { accessManager.SpaceId, perm } }, + }) .TTL(accessManager.TTL) .Execute(new PNAccessManagerTokenResultExt( (r, s) => @@ -1039,6 +1047,10 @@ private void btnGrantToken2_Click(object sender, EventArgs e) Invoke(new Action(() => { if (r != null) { + if (!string.IsNullOrEmpty(r.Token)) + { + accessManager.AuthKey = r.Token; + } lvResults2.Items.Add(pubnub[1].JsonPluggableLibrary.SerializeToJsonString(r)); } else if (s != null) @@ -1074,10 +1086,10 @@ private void btnObjects1_Click(object sender, EventArgs e) switch (obj.ObjectsRequestType.ToLower()) { case "createuser": - pubnub[0].CreateUser() - .Id(obj.UserId) + pubnub[0].SetUuidMetadata() + .Uuid(obj.UserId) .Name(obj.UserName) - .Execute(new PNCreateUserResultExt( + .Execute(new PNSetUuidMetadataResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1093,10 +1105,10 @@ private void btnObjects1_Click(object sender, EventArgs e) })); break; case "updateuser": - pubnub[0].UpdateUser() - .Id(obj.UserId) + pubnub[0].SetUuidMetadata() + .Uuid(obj.UserId) .Name(obj.UserName) - .Execute(new PNUpdateUserResultExt( + .Execute(new PNSetUuidMetadataResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1112,9 +1124,9 @@ private void btnObjects1_Click(object sender, EventArgs e) })); break; case "deleteuser": - pubnub[0].DeleteUser() - .Id(obj.UserId) - .Execute(new PNDeleteUserResultExt( + pubnub[0].RemoveUuidMetadata() + .Uuid(obj.UserId) + .Execute(new PNRemoveUuidMetadataResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1130,9 +1142,9 @@ private void btnObjects1_Click(object sender, EventArgs e) })); break; case "getuser": - pubnub[0].GetUser() - .UserId(obj.UserId) - .Execute(new PNGetUserResultExt( + pubnub[0].GetUuidMetadata() + .Uuid(obj.UserId) + .Execute(new PNGetUuidMetadataResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1148,10 +1160,10 @@ private void btnObjects1_Click(object sender, EventArgs e) })); break; case "createspace": - pubnub[0].CreateSpace() - .Id(obj.SpaceId) + pubnub[0].SetChannelMetadata() + .Channel(obj.SpaceId) .Name(obj.SpaceName) - .Execute(new PNCreateSpaceResultExt( + .Execute(new PNSetChannelMetadataResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1167,10 +1179,10 @@ private void btnObjects1_Click(object sender, EventArgs e) })); break; case "updatespace": - pubnub[0].UpdateSpace() - .Id(obj.SpaceId) + pubnub[0].SetChannelMetadata() + .Channel(obj.SpaceId) .Name(obj.SpaceName) - .Execute(new PNUpdateSpaceResultExt( + .Execute(new PNSetChannelMetadataResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1186,9 +1198,9 @@ private void btnObjects1_Click(object sender, EventArgs e) })); break; case "deletespace": - pubnub[0].DeleteSpace() - .Id(obj.SpaceId) - .Execute(new PNDeleteSpaceResultExt( + pubnub[0].RemoveChannelMetadata() + .Channel(obj.SpaceId) + .Execute(new PNRemoveChannelMetadataResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1204,9 +1216,9 @@ private void btnObjects1_Click(object sender, EventArgs e) })); break; case "getspace": - pubnub[0].GetSpace() - .SpaceId(obj.SpaceId) - .Execute(new PNGetSpaceResultExt( + pubnub[0].GetChannelMetadata() + .Channel(obj.SpaceId) + .Execute(new PNGetChannelMetadataResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1222,10 +1234,10 @@ private void btnObjects1_Click(object sender, EventArgs e) })); break; case "memberadd": - pubnub[0].ManageMembers() - .SpaceId(obj.SpaceId) - .Add(new List() { new PNMember { UserId = obj.UserId } }) - .Execute(new PNManageMembersResultExt( + pubnub[0].ManageChannelMembers() + .Channel(obj.SpaceId) + .Set(new List() { new PNChannelMember { Uuid = obj.UserId } }) + .Execute(new PNChannelMembersResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1241,10 +1253,10 @@ private void btnObjects1_Click(object sender, EventArgs e) })); break; case "memberremove": - pubnub[0].ManageMembers() - .SpaceId(obj.SpaceId) + pubnub[0].ManageChannelMembers() + .Channel(obj.SpaceId) .Remove(new List() { obj.UserId }) - .Execute(new PNManageMembersResultExt( + .Execute(new PNChannelMembersResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1261,9 +1273,9 @@ private void btnObjects1_Click(object sender, EventArgs e) break; case "membershipadd": pubnub[0].ManageMemberships() - .UserId(obj.UserId) - .Add(new List() { new PNMembership { SpaceId = obj.SpaceId } }) - .Execute(new PNManageMembershipsResultExt( + .Uuid(obj.UserId) + .Set(new List() { new PNMembership { Channel = obj.SpaceId } }) + .Execute(new PNMembershipsResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1280,9 +1292,9 @@ private void btnObjects1_Click(object sender, EventArgs e) break; case "membershipremove": pubnub[0].ManageMemberships() - .UserId(obj.UserId) + .Uuid(obj.UserId) .Remove(new List() { obj.SpaceId }) - .Execute(new PNManageMembershipsResultExt( + .Execute(new PNMembershipsResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1312,10 +1324,10 @@ private void btnObjects2_Click(object sender, EventArgs e) switch (obj.ObjectsRequestType.ToLower()) { case "createuser": - pubnub[1].CreateUser() - .Id(obj.UserId) + pubnub[1].SetUuidMetadata() + .Uuid(obj.UserId) .Name(obj.UserName) - .Execute(new PNCreateUserResultExt( + .Execute(new PNSetUuidMetadataResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1331,10 +1343,10 @@ private void btnObjects2_Click(object sender, EventArgs e) })); break; case "updateuser": - pubnub[1].UpdateUser() - .Id(obj.UserId) + pubnub[1].SetUuidMetadata() + .Uuid(obj.UserId) .Name(obj.UserName) - .Execute(new PNUpdateUserResultExt( + .Execute(new PNSetUuidMetadataResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1350,9 +1362,9 @@ private void btnObjects2_Click(object sender, EventArgs e) })); break; case "deleteuser": - pubnub[1].DeleteUser() - .Id(obj.UserId) - .Execute(new PNDeleteUserResultExt( + pubnub[1].RemoveUuidMetadata() + .Uuid(obj.UserId) + .Execute(new PNRemoveUuidMetadataResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1368,9 +1380,9 @@ private void btnObjects2_Click(object sender, EventArgs e) })); break; case "getuser": - pubnub[1].GetUser() - .UserId(obj.UserId) - .Execute(new PNGetUserResultExt( + pubnub[1].GetUuidMetadata() + .Uuid(obj.UserId) + .Execute(new PNGetUuidMetadataResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1386,10 +1398,10 @@ private void btnObjects2_Click(object sender, EventArgs e) })); break; case "createspace": - pubnub[1].CreateSpace() - .Id(obj.SpaceId) + pubnub[1].SetChannelMetadata() + .Channel(obj.SpaceId) .Name(obj.SpaceName) - .Execute(new PNCreateSpaceResultExt( + .Execute(new PNSetChannelMetadataResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1405,10 +1417,10 @@ private void btnObjects2_Click(object sender, EventArgs e) })); break; case "updatespace": - pubnub[1].UpdateSpace() - .Id(obj.SpaceId) + pubnub[1].SetChannelMetadata() + .Channel(obj.SpaceId) .Name(obj.SpaceName) - .Execute(new PNUpdateSpaceResultExt( + .Execute(new PNSetChannelMetadataResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1424,9 +1436,9 @@ private void btnObjects2_Click(object sender, EventArgs e) })); break; case "deletespace": - pubnub[1].DeleteSpace() - .Id(obj.SpaceId) - .Execute(new PNDeleteSpaceResultExt( + pubnub[1].RemoveChannelMetadata() + .Channel(obj.SpaceId) + .Execute(new PNRemoveChannelMetadataResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1442,9 +1454,9 @@ private void btnObjects2_Click(object sender, EventArgs e) })); break; case "getspace": - pubnub[1].GetSpace() - .SpaceId(obj.SpaceId) - .Execute(new PNGetSpaceResultExt( + pubnub[1].GetChannelMetadata() + .Channel(obj.SpaceId) + .Execute(new PNGetChannelMetadataResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1460,10 +1472,10 @@ private void btnObjects2_Click(object sender, EventArgs e) })); break; case "memberadd": - pubnub[1].ManageMembers() - .SpaceId(obj.SpaceId) - .Add(new List() { new PNMember { UserId = obj.UserId } }) - .Execute(new PNManageMembersResultExt( + pubnub[1].ManageChannelMembers() + .Channel(obj.SpaceId) + .Set(new List() { new PNChannelMember { Uuid = obj.UserId } }) + .Execute(new PNChannelMembersResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1479,10 +1491,10 @@ private void btnObjects2_Click(object sender, EventArgs e) })); break; case "memberremove": - pubnub[1].ManageMembers() - .SpaceId(obj.SpaceId) + pubnub[1].ManageChannelMembers() + .Channel(obj.SpaceId) .Remove(new List() { obj.UserId }) - .Execute(new PNManageMembersResultExt( + .Execute(new PNChannelMembersResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1499,9 +1511,9 @@ private void btnObjects2_Click(object sender, EventArgs e) break; case "membershipadd": pubnub[1].ManageMemberships() - .UserId(obj.UserId) - .Add(new List() { new PNMembership { SpaceId = obj.SpaceId } }) - .Execute(new PNManageMembershipsResultExt( + .Uuid(obj.UserId) + .Set(new List() { new PNMembership { Channel = obj.SpaceId } }) + .Execute(new PNMembershipsResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1518,9 +1530,9 @@ private void btnObjects2_Click(object sender, EventArgs e) break; case "membershipremove": pubnub[1].ManageMemberships() - .UserId(obj.UserId) + .Uuid(obj.UserId) .Remove(new List() { obj.SpaceId }) - .Execute(new PNManageMembershipsResultExt( + .Execute(new PNMembershipsResultExt( (r, s) => { Invoke(new Action(() => { if (r != null) @@ -1543,13 +1555,13 @@ private void btnObjects2_Click(object sender, EventArgs e) private void btnSetToken1_Click(object sender, EventArgs e) { - pubnub[0].SetToken(txtToken1.Text); + pubnub[0].SetAuthToken(txtToken1.Text); lvResults1.Items.Add(pubnub[0].JsonPluggableLibrary.SerializeToJsonString(pubnub[0].ParseToken(txtToken1.Text))); } private void btnSetToken2_Click(object sender, EventArgs e) { - pubnub[1].SetToken(txtToken2.Text); + pubnub[1].SetAuthToken(txtToken2.Text); lvResults2.Items.Add(pubnub[1].JsonPluggableLibrary.SerializeToJsonString(pubnub[1].ParseToken(txtToken2.Text))); } } diff --git a/src/Examples/PubnubApi.WinFormExample/packages.config b/src/Examples/PubnubApi.WinFormExample/packages.config index bff798afb..56e3abad1 100644 --- a/src/Examples/PubnubApi.WinFormExample/packages.config +++ b/src/Examples/PubnubApi.WinFormExample/packages.config @@ -4,20 +4,23 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Examples/mono-for-android/PubNubMessaging.Example/LaunchScreen.cs b/src/Examples/mono-for-android/PubNubMessaging.Example/LaunchScreen.cs index 63e920167..890d0b233 100755 --- a/src/Examples/mono-for-android/PubNubMessaging.Example/LaunchScreen.cs +++ b/src/Examples/mono-for-android/PubNubMessaging.Example/LaunchScreen.cs @@ -187,13 +187,18 @@ void LaunchClick (object sender, EventArgs e) { EditText txtChannel = FindViewById (Resource.Id.txtChannel); EditText txtChannelGroup = FindViewById (Resource.Id.txtChannelGroup); + EditText txtCustomUuid = FindViewById(Resource.Id.txtCustomUuid); if (String.IsNullOrWhiteSpace (txtChannel.Text.Trim ()) && String.IsNullOrWhiteSpace (txtChannelGroup.Text.Trim ())) { ShowAlert ("Please enter a channel name or channelgroup or both"); - } else { + } + else if (String.IsNullOrWhiteSpace(txtCustomUuid.Text.Trim())) + { + ShowAlert("Please enter UUID"); + } + else { ToggleButton tbSsl = FindViewById (Resource.Id.tbSsl); EditText txtCipher = FindViewById (Resource.Id.txtCipher); - EditText txtCustomUuid = FindViewById (Resource.Id.txtCustomUuid); var mainActivity = new Intent (this, typeof(MainActivity)); @@ -207,7 +212,7 @@ void LaunchClick (object sender, EventArgs e) } mainActivity.PutExtra ("Cipher", txtCipher.Text.Trim ()); - PNConfiguration config = new PNConfiguration (); + PNConfiguration config = new PNConfiguration (txtCustomUuid.Text); config.PublishKey = txtPubKey.Text.Trim (); config.SubscribeKey = txtSubKey.Text.Trim (); config.SecretKey = txtSecKey.Text.Trim (); diff --git a/src/Examples/mono-for-android/PubNubMessaging.Example/MainActivity.cs b/src/Examples/mono-for-android/PubNubMessaging.Example/MainActivity.cs index 226a8a189..8c6badec6 100755 --- a/src/Examples/mono-for-android/PubNubMessaging.Example/MainActivity.cs +++ b/src/Examples/mono-for-android/PubNubMessaging.Example/MainActivity.cs @@ -831,6 +831,12 @@ public DemoSubscribeCallback (Action displayCallback) { this.callback = displayCallback; } + + public override void File(Pubnub pubnub, PNFileEventResult fileEvent) + { + throw new NotImplementedException(); + } + public override void Message (Pubnub pubnub, PNMessageResult messageResult) { if (messageResult != null) { @@ -838,6 +844,16 @@ public override void Message (Pubnub pubnub, PNMessageResult messageResult } } + public override void MessageAction(Pubnub pubnub, PNMessageActionEventResult messageAction) + { + throw new NotImplementedException(); + } + + public override void ObjectEvent(Pubnub pubnub, PNObjectEventResult objectEvent) + { + throw new NotImplementedException(); + } + public override void Presence (Pubnub pubnub, PNPresenceEventResult presenceResult) { if (presenceResult != null) { @@ -845,6 +861,11 @@ public override void Presence (Pubnub pubnub, PNPresenceEventResult presenceResu } } + public override void Signal(Pubnub pubnub, PNSignalResult signal) + { + throw new NotImplementedException(); + } + public override void Status (Pubnub pubnub, PNStatus statusObj) { string msg = string.Format ("Operation: {0}; Category: {1}; StatusCode: {2}", statusObj.Operation, statusObj.Category, statusObj.StatusCode); diff --git a/src/Examples/mono-for-android/PubNubMessaging.Example/Properties/AndroidManifest.xml b/src/Examples/mono-for-android/PubNubMessaging.Example/Properties/AndroidManifest.xml index 7c7c665e1..d60dbb3eb 100644 --- a/src/Examples/mono-for-android/PubNubMessaging.Example/Properties/AndroidManifest.xml +++ b/src/Examples/mono-for-android/PubNubMessaging.Example/Properties/AndroidManifest.xml @@ -1,8 +1,7 @@ - - - - - + + + + \ No newline at end of file diff --git a/src/Examples/mono-for-android/PubNubMessaging.Example/PubNubMessaging.Example.csproj b/src/Examples/mono-for-android/PubNubMessaging.Example/PubNubMessaging.Example.csproj index 76ce83d2a..e35e93d38 100644 --- a/src/Examples/mono-for-android/PubNubMessaging.Example/PubNubMessaging.Example.csproj +++ b/src/Examples/mono-for-android/PubNubMessaging.Example/PubNubMessaging.Example.csproj @@ -1,6 +1,6 @@  - + Debug AnyCPU @@ -17,12 +17,13 @@ Resources\Resource.designer.cs PubNub_Messaging Properties\AndroidManifest.xml - v7.1 - True + v9.0 false true + + True @@ -34,8 +35,12 @@ 4 False True - None - armeabi;armeabi-v7a;x86 + SdkOnly + x86_64;arm64-v8a + false + false + false + false full @@ -44,55 +49,131 @@ prompt 4 False - armeabi;armeabi-v7a + x86_64;arm64-v8a - - ..\packages\PubnubPCL.4.0.12\lib\netstandard1.4\PubnubPCL.dll + + ..\packages\Portable.BouncyCastle.1.9.0\lib\netstandard2.0\BouncyCastle.Crypto.dll + + + ..\packages\PeterO.Cbor.4.5.2\lib\netstandard1.0\CBOR.dll + True + + + + ..\packages\Newtonsoft.Json.13.0.1\lib\netstandard2.0\Newtonsoft.Json.dll + + + ..\packages\PeterO.Numbers.1.8.2\lib\netstandard1.0\Numbers.dll + True + + + ..\packages\PubnubPCL.6.3.0\lib\netstandard2.0\PubnubPCL.dll True - - ..\packages\Xamarin.Android.Support.v4.24.2.1\lib\MonoAndroid70\Xamarin.Android.Support.v4.dll + + ..\packages\PeterO.URIUtility.1.0.0\lib\netstandard1.0\URIUtility.dll + True + + + ..\packages\Xamarin.Android.Arch.Core.Common.1.1.1.3\lib\monoandroid90\Xamarin.Android.Arch.Core.Common.dll + + + ..\packages\Xamarin.Android.Arch.Core.Runtime.1.1.1.3\lib\monoandroid90\Xamarin.Android.Arch.Core.Runtime.dll + + + ..\packages\Xamarin.Android.Arch.Lifecycle.Common.1.1.1.3\lib\monoandroid90\Xamarin.Android.Arch.Lifecycle.Common.dll + + + ..\packages\Xamarin.Android.Arch.Lifecycle.LiveData.1.1.1.3\lib\monoandroid90\Xamarin.Android.Arch.Lifecycle.LiveData.dll + + + ..\packages\Xamarin.Android.Arch.Lifecycle.LiveData.Core.1.1.1.3\lib\monoandroid90\Xamarin.Android.Arch.Lifecycle.LiveData.Core.dll + + + ..\packages\Xamarin.Android.Arch.Lifecycle.Runtime.1.1.1.3\lib\monoandroid90\Xamarin.Android.Arch.Lifecycle.Runtime.dll + + + ..\packages\Xamarin.Android.Arch.Lifecycle.ViewModel.1.1.1.3\lib\monoandroid90\Xamarin.Android.Arch.Lifecycle.ViewModel.dll + + + ..\packages\Xamarin.Android.Support.Annotations.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Annotations.dll + + + ..\packages\Xamarin.Android.Support.AsyncLayoutInflater.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.AsyncLayoutInflater.dll + + + ..\packages\Xamarin.Android.Support.Collections.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Collections.dll + + + ..\packages\Xamarin.Android.Support.Compat.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Compat.dll + + + ..\packages\Xamarin.Android.Support.CoordinaterLayout.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.CoordinaterLayout.dll + + + ..\packages\Xamarin.Android.Support.Core.UI.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Core.UI.dll + + + ..\packages\Xamarin.Android.Support.Core.Utils.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Core.Utils.dll + + + ..\packages\Xamarin.Android.Support.CursorAdapter.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.CursorAdapter.dll + + + ..\packages\Xamarin.Android.Support.CustomView.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.CustomView.dll + + + ..\packages\Xamarin.Android.Support.DocumentFile.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.DocumentFile.dll + + + ..\packages\Xamarin.Android.Support.DrawerLayout.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.DrawerLayout.dll + + + ..\packages\Xamarin.Android.Support.Fragment.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Fragment.dll + + + ..\packages\Xamarin.Android.Support.Interpolator.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Interpolator.dll + + + ..\packages\Xamarin.Android.Support.Loader.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Loader.dll + + + ..\packages\Xamarin.Android.Support.LocalBroadcastManager.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.LocalBroadcastManager.dll + + + ..\packages\Xamarin.Android.Support.Media.Compat.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Media.Compat.dll + + + ..\packages\Xamarin.Android.Support.Print.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.Print.dll + + + ..\packages\Xamarin.Android.Support.SlidingPaneLayout.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.SlidingPaneLayout.dll + + + ..\packages\Xamarin.Android.Support.SwipeRefreshLayout.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.SwipeRefreshLayout.dll - - ..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll - - - ..\packages\Portable.BouncyCastle.1.8.1.1\lib\netstandard1.3\crypto.dll - False - - - ..\packages\Xamarin.Android.Support.Compat.25.1.1\lib\MonoAndroid70\Xamarin.Android.Support.Compat.dll - False - - - ..\packages\Xamarin.Android.Support.Core.UI.25.1.1\lib\MonoAndroid70\Xamarin.Android.Support.Core.UI.dll - False - - - ..\packages\Xamarin.Android.Support.Core.Utils.25.1.1\lib\MonoAndroid70\Xamarin.Android.Support.Core.Utils.dll - False + + ..\packages\Xamarin.Android.Support.v13.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.v13.dll - - ..\packages\Xamarin.Android.Support.Media.Compat.25.1.1\lib\MonoAndroid70\Xamarin.Android.Support.Media.Compat.dll - False + + ..\packages\Xamarin.Android.Support.v4.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.v4.dll - - ..\packages\Xamarin.Android.Support.Fragment.25.1.1\lib\MonoAndroid70\Xamarin.Android.Support.Fragment.dll - False + + ..\packages\Xamarin.Android.Support.VersionedParcelable.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.VersionedParcelable.dll - - ..\packages\Xamarin.Android.Support.v13.25.1.1\lib\MonoAndroid70\Xamarin.Android.Support.v13.dll + + ..\packages\Xamarin.Android.Support.ViewPager.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.ViewPager.dll @@ -147,11 +228,74 @@ False - - - - - - - + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Examples/mono-for-android/PubNubMessaging.Example/Resources/Resource.designer.cs b/src/Examples/mono-for-android/PubNubMessaging.Example/Resources/Resource.designer.cs index cf271f5d7..4ba4b6a8b 100755 --- a/src/Examples/mono-for-android/PubNubMessaging.Example/Resources/Resource.designer.cs +++ b/src/Examples/mono-for-android/PubNubMessaging.Example/Resources/Resource.designer.cs @@ -2,7 +2,6 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -15,7 +14,7 @@ namespace PubNubMessaging.Example { - [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] public partial class Resource { @@ -31,6 +30,69 @@ public static void UpdateIdValues() public partial class Attribute { + // aapt resource value: 0x7F010000 + public const int alpha = 2130771968; + + // aapt resource value: 0x7F010001 + public const int coordinatorLayoutStyle = 2130771969; + + // aapt resource value: 0x7F010002 + public const int font = 2130771970; + + // aapt resource value: 0x7F010003 + public const int fontProviderAuthority = 2130771971; + + // aapt resource value: 0x7F010004 + public const int fontProviderCerts = 2130771972; + + // aapt resource value: 0x7F010005 + public const int fontProviderFetchStrategy = 2130771973; + + // aapt resource value: 0x7F010006 + public const int fontProviderFetchTimeout = 2130771974; + + // aapt resource value: 0x7F010007 + public const int fontProviderPackage = 2130771975; + + // aapt resource value: 0x7F010008 + public const int fontProviderQuery = 2130771976; + + // aapt resource value: 0x7F010009 + public const int fontStyle = 2130771977; + + // aapt resource value: 0x7F01000A + public const int fontVariationSettings = 2130771978; + + // aapt resource value: 0x7F01000B + public const int fontWeight = 2130771979; + + // aapt resource value: 0x7F01000C + public const int keylines = 2130771980; + + // aapt resource value: 0x7F01000D + public const int layout_anchor = 2130771981; + + // aapt resource value: 0x7F01000E + public const int layout_anchorGravity = 2130771982; + + // aapt resource value: 0x7F01000F + public const int layout_behavior = 2130771983; + + // aapt resource value: 0x7F010010 + public const int layout_dodgeInsetEdges = 2130771984; + + // aapt resource value: 0x7F010011 + public const int layout_insetEdge = 2130771985; + + // aapt resource value: 0x7F010012 + public const int layout_keyline = 2130771986; + + // aapt resource value: 0x7F010013 + public const int statusBarBackground = 2130771987; + + // aapt resource value: 0x7F010014 + public const int ttcIndex = 2130771988; + static Attribute() { global::Android.Runtime.ResourceIdManager.UpdateIdValues(); @@ -41,29 +103,190 @@ private Attribute() } } + public partial class Color + { + + // aapt resource value: 0x7F020000 + public const int notification_action_color_filter = 2130837504; + + // aapt resource value: 0x7F020001 + public const int notification_icon_bg_color = 2130837505; + + // aapt resource value: 0x7F020002 + public const int notification_material_background_media_default_color = 2130837506; + + // aapt resource value: 0x7F020003 + public const int primary_text_default_material_dark = 2130837507; + + // aapt resource value: 0x7F020004 + public const int ripple_material_light = 2130837508; + + // aapt resource value: 0x7F020005 + public const int secondary_text_default_material_dark = 2130837509; + + // aapt resource value: 0x7F020006 + public const int secondary_text_default_material_light = 2130837510; + + static Color() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Color() + { + } + } + + public partial class Dimension + { + + // aapt resource value: 0x7F030000 + public const int compat_button_inset_horizontal_material = 2130903040; + + // aapt resource value: 0x7F030001 + public const int compat_button_inset_vertical_material = 2130903041; + + // aapt resource value: 0x7F030002 + public const int compat_button_padding_horizontal_material = 2130903042; + + // aapt resource value: 0x7F030003 + public const int compat_button_padding_vertical_material = 2130903043; + + // aapt resource value: 0x7F030004 + public const int compat_control_corner_material = 2130903044; + + // aapt resource value: 0x7F030005 + public const int compat_notification_large_icon_max_height = 2130903045; + + // aapt resource value: 0x7F030006 + public const int compat_notification_large_icon_max_width = 2130903046; + + // aapt resource value: 0x7F030007 + public const int notification_action_icon_size = 2130903047; + + // aapt resource value: 0x7F030008 + public const int notification_action_text_size = 2130903048; + + // aapt resource value: 0x7F030009 + public const int notification_big_circle_margin = 2130903049; + + // aapt resource value: 0x7F03000A + public const int notification_content_margin_start = 2130903050; + + // aapt resource value: 0x7F03000B + public const int notification_large_icon_height = 2130903051; + + // aapt resource value: 0x7F03000C + public const int notification_large_icon_width = 2130903052; + + // aapt resource value: 0x7F03000D + public const int notification_main_column_padding_top = 2130903053; + + // aapt resource value: 0x7F03000E + public const int notification_media_narrow_margin = 2130903054; + + // aapt resource value: 0x7F03000F + public const int notification_right_icon_size = 2130903055; + + // aapt resource value: 0x7F030010 + public const int notification_right_side_padding_top = 2130903056; + + // aapt resource value: 0x7F030011 + public const int notification_small_icon_background_padding = 2130903057; + + // aapt resource value: 0x7F030012 + public const int notification_small_icon_size_as_large = 2130903058; + + // aapt resource value: 0x7F030013 + public const int notification_subtext_size = 2130903059; + + // aapt resource value: 0x7F030014 + public const int notification_top_pad = 2130903060; + + // aapt resource value: 0x7F030015 + public const int notification_top_pad_large_text = 2130903061; + + // aapt resource value: 0x7F030016 + public const int subtitle_corner_radius = 2130903062; + + // aapt resource value: 0x7F030017 + public const int subtitle_outline_width = 2130903063; + + // aapt resource value: 0x7F030018 + public const int subtitle_shadow_offset = 2130903064; + + // aapt resource value: 0x7F030019 + public const int subtitle_shadow_radius = 2130903065; + + static Dimension() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Dimension() + { + } + } + public partial class Drawable { - // aapt resource value: 0x7f020000 - public const int border = 2130837504; + // aapt resource value: 0x7F040000 + public const int border = 2130968576; + + // aapt resource value: 0x7F040001 + public const int customdialog = 2130968577; + + // aapt resource value: 0x7F040002 + public const int drawer_shadow_dark = 2130968578; + + // aapt resource value: 0x7F040003 + public const int drawer_shadow_light = 2130968579; - // aapt resource value: 0x7f020001 - public const int customdialog = 2130837505; + // aapt resource value: 0x7F040006 + public const int Icon = 2130968582; - // aapt resource value: 0x7f020002 - public const int drawer_shadow_dark = 2130837506; + // aapt resource value: 0x7F040004 + public const int ic_drawer_dark = 2130968580; - // aapt resource value: 0x7f020003 - public const int drawer_shadow_light = 2130837507; + // aapt resource value: 0x7F040005 + public const int ic_drawer_light = 2130968581; - // aapt resource value: 0x7f020004 - public const int ic_drawer_dark = 2130837508; + // aapt resource value: 0x7F040007 + public const int notification_action_background = 2130968583; - // aapt resource value: 0x7f020005 - public const int ic_drawer_light = 2130837509; + // aapt resource value: 0x7F040008 + public const int notification_bg = 2130968584; - // aapt resource value: 0x7f020006 - public const int Icon = 2130837510; + // aapt resource value: 0x7F040009 + public const int notification_bg_low = 2130968585; + + // aapt resource value: 0x7F04000A + public const int notification_bg_low_normal = 2130968586; + + // aapt resource value: 0x7F04000B + public const int notification_bg_low_pressed = 2130968587; + + // aapt resource value: 0x7F04000C + public const int notification_bg_normal = 2130968588; + + // aapt resource value: 0x7F04000D + public const int notification_bg_normal_pressed = 2130968589; + + // aapt resource value: 0x7F04000E + public const int notification_icon_background = 2130968590; + + // aapt resource value: 0x7F04000F + public const int notification_template_icon_bg = 2130968591; + + // aapt resource value: 0x7F040010 + public const int notification_template_icon_low_bg = 2130968592; + + // aapt resource value: 0x7F040011 + public const int notification_tile_bg = 2130968593; + + // aapt resource value: 0x7F040012 + public const int notify_panel_notification_icon_bg = 2130968594; static Drawable() { @@ -78,170 +301,323 @@ private Drawable() public partial class Id { - // aapt resource value: 0x7f050006 - public const int btnCancel = 2131034118; + // aapt resource value: 0x7F050000 + public const int action0 = 2131034112; + + // aapt resource value: 0x7F050005 + public const int actions = 2131034117; + + // aapt resource value: 0x7F050001 + public const int action_container = 2131034113; + + // aapt resource value: 0x7F050002 + public const int action_divider = 2131034114; + + // aapt resource value: 0x7F050003 + public const int action_image = 2131034115; + + // aapt resource value: 0x7F050004 + public const int action_text = 2131034116; + + // aapt resource value: 0x7F050006 + public const int all = 2131034118; + + // aapt resource value: 0x7F050007 + public const int async = 2131034119; + + // aapt resource value: 0x7F050008 + public const int blocking = 2131034120; + + // aapt resource value: 0x7F050009 + public const int bottom = 2131034121; + + // aapt resource value: 0x7F05000A + public const int btnCancel = 2131034122; + + // aapt resource value: 0x7F05000B + public const int btnDetailedHis = 2131034123; + + // aapt resource value: 0x7F05000C + public const int btnGrant = 2131034124; + + // aapt resource value: 0x7F05000D + public const int btnHereNow = 2131034125; + + // aapt resource value: 0x7F05000E + public const int btnLaunch = 2131034126; + + // aapt resource value: 0x7F05000F + public const int btnPresence = 2131034127; + + // aapt resource value: 0x7F050010 + public const int btnProxy = 2131034128; + + // aapt resource value: 0x7F050011 + public const int btnProxyCancel = 2131034129; + + // aapt resource value: 0x7F050012 + public const int btnProxySave = 2131034130; + + // aapt resource value: 0x7F050013 + public const int btnPublish = 2131034131; + + // aapt resource value: 0x7F050014 + public const int btnSet = 2131034132; + + // aapt resource value: 0x7F050015 + public const int btnSet2 = 2131034133; + + // aapt resource value: 0x7F050016 + public const int btnSubscribe = 2131034134; + + // aapt resource value: 0x7F050017 + public const int btnTime = 2131034135; + + // aapt resource value: 0x7F050018 + public const int btnUnsub = 2131034136; + + // aapt resource value: 0x7F050019 + public const int btnUnsubPres = 2131034137; + + // aapt resource value: 0x7F05001A + public const int cancel_action = 2131034138; + + // aapt resource value: 0x7F05001B + public const int center = 2131034139; + + // aapt resource value: 0x7F05001C + public const int center_horizontal = 2131034140; + + // aapt resource value: 0x7F05001D + public const int center_vertical = 2131034141; + + // aapt resource value: 0x7F05001E + public const int chronometer = 2131034142; + + // aapt resource value: 0x7F05001F + public const int clip_horizontal = 2131034143; + + // aapt resource value: 0x7F050020 + public const int clip_vertical = 2131034144; + + // aapt resource value: 0x7F050021 + public const int drawer_layout = 2131034145; + + // aapt resource value: 0x7F050022 + public const int end = 2131034146; + + // aapt resource value: 0x7F050023 + public const int end_padder = 2131034147; + + // aapt resource value: 0x7F050024 + public const int fill = 2131034148; - // aapt resource value: 0x7f050025 - public const int btnDetailedHis = 2131034149; + // aapt resource value: 0x7F050025 + public const int fill_horizontal = 2131034149; - // aapt resource value: 0x7f050018 - public const int btnGrant = 2131034136; + // aapt resource value: 0x7F050026 + public const int fill_vertical = 2131034150; - // aapt resource value: 0x7f050026 - public const int btnHereNow = 2131034150; + // aapt resource value: 0x7F050027 + public const int forever = 2131034151; - // aapt resource value: 0x7f050021 - public const int btnLaunch = 2131034145; + // aapt resource value: 0x7F050028 + public const int icon = 2131034152; - // aapt resource value: 0x7f050024 - public const int btnPresence = 2131034148; + // aapt resource value: 0x7F050029 + public const int icon_group = 2131034153; - // aapt resource value: 0x7f050020 - public const int btnProxy = 2131034144; + // aapt resource value: 0x7F05002A + public const int info = 2131034154; - // aapt resource value: 0x7f050036 - public const int btnProxyCancel = 2131034166; + // aapt resource value: 0x7F05002B + public const int italic = 2131034155; - // aapt resource value: 0x7f050035 - public const int btnProxySave = 2131034165; + // aapt resource value: 0x7F05002C + public const int lblCGinput = 2131034156; - // aapt resource value: 0x7f050023 - public const int btnPublish = 2131034147; + // aapt resource value: 0x7F05002D + public const int lblChannel = 2131034157; - // aapt resource value: 0x7f050005 - public const int btnSet = 2131034117; + // aapt resource value: 0x7F05002E + public const int lblChannelGroup = 2131034158; - // aapt resource value: 0x7f05000e - public const int btnSet2 = 2131034126; + // aapt resource value: 0x7F05002F + public const int lblGrant1 = 2131034159; - // aapt resource value: 0x7f050022 - public const int btnSubscribe = 2131034146; + // aapt resource value: 0x7F050030 + public const int lblGrant2 = 2131034160; - // aapt resource value: 0x7f050027 - public const int btnTime = 2131034151; + // aapt resource value: 0x7F050031 + public const int lblGrant3 = 2131034161; - // aapt resource value: 0x7f050028 - public const int btnUnsub = 2131034152; + // aapt resource value: 0x7F050032 + public const int lblGrantChannel = 2131034162; - // aapt resource value: 0x7f050029 - public const int btnUnsubPres = 2131034153; + // aapt resource value: 0x7F050033 + public const int lblGrantChannelGroup = 2131034163; - // aapt resource value: 0x7f05002c - public const int drawer_layout = 2131034156; + // aapt resource value: 0x7F050034 + public const int lblinput0 = 2131034164; - // aapt resource value: 0x7f050009 - public const int lblCGinput = 2131034121; + // aapt resource value: 0x7F050035 + public const int lblinput1 = 2131034165; - // aapt resource value: 0x7f050003 - public const int lblChannel = 2131034115; + // aapt resource value: 0x7F050036 + public const int lblinput2 = 2131034166; - // aapt resource value: 0x7f050001 - public const int lblChannelGroup = 2131034113; + // aapt resource value: 0x7F050037 + public const int left = 2131034167; - // aapt resource value: 0x7f050012 - public const int lblGrant1 = 2131034130; + // aapt resource value: 0x7F050038 + public const int left_drawer = 2131034168; - // aapt resource value: 0x7f050014 - public const int lblGrant2 = 2131034132; + // aapt resource value: 0x7F050039 + public const int line1 = 2131034169; - // aapt resource value: 0x7f050016 - public const int lblGrant3 = 2131034134; + // aapt resource value: 0x7F05003A + public const int line3 = 2131034170; - // aapt resource value: 0x7f050010 - public const int lblGrantChannel = 2131034128; + // aapt resource value: 0x7F05003B + public const int media_actions = 2131034171; - // aapt resource value: 0x7f050011 - public const int lblGrantChannelGroup = 2131034129; + // aapt resource value: 0x7F05003C + public const int newChannelGroups = 2131034172; - // aapt resource value: 0x7f050008 - public const int lblinput0 = 2131034120; + // aapt resource value: 0x7F05003D + public const int newChannels = 2131034173; - // aapt resource value: 0x7f05000a - public const int lblinput1 = 2131034122; + // aapt resource value: 0x7F05003E + public const int none = 2131034174; - // aapt resource value: 0x7f05000c - public const int lblinput2 = 2131034124; + // aapt resource value: 0x7F05003F + public const int normal = 2131034175; - // aapt resource value: 0x7f05002f - public const int left_drawer = 2131034159; + // aapt resource value: 0x7F050040 + public const int notification_background = 2131034176; - // aapt resource value: 0x7f05002e - public const int newChannelGroups = 2131034158; + // aapt resource value: 0x7F050041 + public const int notification_main_column = 2131034177; - // aapt resource value: 0x7f05002d - public const int newChannels = 2131034157; + // aapt resource value: 0x7F050042 + public const int notification_main_column_container = 2131034178; - // aapt resource value: 0x7f050034 - public const int proxyPassword = 2131034164; + // aapt resource value: 0x7F050043 + public const int proxyPassword = 2131034179; - // aapt resource value: 0x7f050032 - public const int proxyPort = 2131034162; + // aapt resource value: 0x7F050044 + public const int proxyPort = 2131034180; - // aapt resource value: 0x7f050031 - public const int proxyServer = 2131034161; + // aapt resource value: 0x7F050045 + public const int proxyServer = 2131034181; - // aapt resource value: 0x7f050033 - public const int proxyUsername = 2131034163; + // aapt resource value: 0x7F050046 + public const int proxyUsername = 2131034182; - // aapt resource value: 0x7f05002a - public const int scroll = 2131034154; + // aapt resource value: 0x7F050047 + public const int right = 2131034183; - // aapt resource value: 0x7f050030 - public const int tbProxy = 2131034160; + // aapt resource value: 0x7F050048 + public const int right_icon = 2131034184; - // aapt resource value: 0x7f050013 - public const int tbRead = 2131034131; + // aapt resource value: 0x7F050049 + public const int right_side = 2131034185; - // aapt resource value: 0x7f05001c - public const int tbSsl = 2131034140; + // aapt resource value: 0x7F05004A + public const int scroll = 2131034186; - // aapt resource value: 0x7f050015 - public const int tbWrite = 2131034133; + // aapt resource value: 0x7F05004B + public const int start = 2131034187; - // aapt resource value: 0x7f050000 - public const int tvAddRemoveCgLabel = 2131034112; + // aapt resource value: 0x7F05004C + public const int status_bar_latest_event_content = 2131034188; - // aapt resource value: 0x7f050007 - public const int tvAuthLabel = 2131034119; + // aapt resource value: 0x7F05004D + public const int tag_transition_group = 2131034189; - // aapt resource value: 0x7f05000f - public const int tvGrantLabel = 2131034127; + // aapt resource value: 0x7F05004E + public const int tag_unhandled_key_event_manager = 2131034190; - // aapt resource value: 0x7f05001f - public const int tvProxy = 2131034143; + // aapt resource value: 0x7F05004F + public const int tag_unhandled_key_listeners = 2131034191; - // aapt resource value: 0x7f050004 - public const int txtChannel = 2131034116; + // aapt resource value: 0x7F050050 + public const int tbProxy = 2131034192; - // aapt resource value: 0x7f050002 - public const int txtChannelGroup = 2131034114; + // aapt resource value: 0x7F050051 + public const int tbRead = 2131034193; - // aapt resource value: 0x7f05001d - public const int txtCipher = 2131034141; + // aapt resource value: 0x7F050052 + public const int tbSsl = 2131034194; - // aapt resource value: 0x7f05001e - public const int txtCustomUuid = 2131034142; + // aapt resource value: 0x7F050053 + public const int tbWrite = 2131034195; - // aapt resource value: 0x7f05001a - public const int txtPubKey = 2131034138; + // aapt resource value: 0x7F050054 + public const int text = 2131034196; - // aapt resource value: 0x7f05001b - public const int txtSecKey = 2131034139; + // aapt resource value: 0x7F050055 + public const int text2 = 2131034197; - // aapt resource value: 0x7f050019 - public const int txtSubKey = 2131034137; + // aapt resource value: 0x7F050056 + public const int textView1 = 2131034198; - // aapt resource value: 0x7f05002b - public const int txtViewLog = 2131034155; + // aapt resource value: 0x7F050057 + public const int textView2 = 2131034199; - // aapt resource value: 0x7f05000b - public const int txtauth = 2131034123; + // aapt resource value: 0x7F050058 + public const int time = 2131034200; - // aapt resource value: 0x7f05000d - public const int txtinput2 = 2131034125; + // aapt resource value: 0x7F050059 + public const int title = 2131034201; - // aapt resource value: 0x7f050017 - public const int txtttl = 2131034135; + // aapt resource value: 0x7F05005A + public const int top = 2131034202; + + // aapt resource value: 0x7F05005B + public const int tvAddRemoveCgLabel = 2131034203; + + // aapt resource value: 0x7F05005C + public const int tvAuthLabel = 2131034204; + + // aapt resource value: 0x7F05005D + public const int tvGrantLabel = 2131034205; + + // aapt resource value: 0x7F05005E + public const int tvProxy = 2131034206; + + // aapt resource value: 0x7F050067 + public const int txtauth = 2131034215; + + // aapt resource value: 0x7F05005F + public const int txtChannel = 2131034207; + + // aapt resource value: 0x7F050060 + public const int txtChannelGroup = 2131034208; + + // aapt resource value: 0x7F050061 + public const int txtCipher = 2131034209; + + // aapt resource value: 0x7F050062 + public const int txtCustomUuid = 2131034210; + + // aapt resource value: 0x7F050068 + public const int txtinput2 = 2131034216; + + // aapt resource value: 0x7F050063 + public const int txtPubKey = 2131034211; + + // aapt resource value: 0x7F050064 + public const int txtSecKey = 2131034212; + + // aapt resource value: 0x7F050065 + public const int txtSubKey = 2131034213; + + // aapt resource value: 0x7F050069 + public const int txtttl = 2131034217; + + // aapt resource value: 0x7F050066 + public const int txtViewLog = 2131034214; static Id() { @@ -253,32 +629,96 @@ private Id() } } + public partial class Integer + { + + // aapt resource value: 0x7F060000 + public const int cancel_button_image_alpha = 2131099648; + + // aapt resource value: 0x7F060001 + public const int status_bar_notification_info_maxnum = 2131099649; + + static Integer() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Integer() + { + } + } + public partial class Layout { - // aapt resource value: 0x7f030000 - public const int AddRemoveFromChannelGroup = 2130903040; + // aapt resource value: 0x7F070000 + public const int AddRemoveFromChannelGroup = 2131165184; + + // aapt resource value: 0x7F070001 + public const int AuthKey = 2131165185; + + // aapt resource value: 0x7F070002 + public const int GrantDialog = 2131165186; + + // aapt resource value: 0x7F070003 + public const int ItemMenu = 2131165187; + + // aapt resource value: 0x7F070004 + public const int Launch = 2131165188; - // aapt resource value: 0x7f030001 - public const int AuthKey = 2130903041; + // aapt resource value: 0x7F070005 + public const int Main = 2131165189; - // aapt resource value: 0x7f030002 - public const int GrantDialog = 2130903042; + // aapt resource value: 0x7F070006 + public const int notification_action = 2131165190; - // aapt resource value: 0x7f030003 - public const int ItemMenu = 2130903043; + // aapt resource value: 0x7F070007 + public const int notification_action_tombstone = 2131165191; - // aapt resource value: 0x7f030004 - public const int Launch = 2130903044; + // aapt resource value: 0x7F070008 + public const int notification_media_action = 2131165192; - // aapt resource value: 0x7f030005 - public const int Main = 2130903045; + // aapt resource value: 0x7F070009 + public const int notification_media_cancel_action = 2131165193; - // aapt resource value: 0x7f030006 - public const int PageHomeView = 2130903046; + // aapt resource value: 0x7F07000A + public const int notification_template_big_media = 2131165194; - // aapt resource value: 0x7f030007 - public const int Proxy = 2130903047; + // aapt resource value: 0x7F07000B + public const int notification_template_big_media_custom = 2131165195; + + // aapt resource value: 0x7F07000C + public const int notification_template_big_media_narrow = 2131165196; + + // aapt resource value: 0x7F07000D + public const int notification_template_big_media_narrow_custom = 2131165197; + + // aapt resource value: 0x7F07000E + public const int notification_template_custom_big = 2131165198; + + // aapt resource value: 0x7F07000F + public const int notification_template_icon_group = 2131165199; + + // aapt resource value: 0x7F070010 + public const int notification_template_lines_media = 2131165200; + + // aapt resource value: 0x7F070011 + public const int notification_template_media = 2131165201; + + // aapt resource value: 0x7F070012 + public const int notification_template_media_custom = 2131165202; + + // aapt resource value: 0x7F070013 + public const int notification_template_part_chronometer = 2131165203; + + // aapt resource value: 0x7F070014 + public const int notification_template_part_time = 2131165204; + + // aapt resource value: 0x7F070015 + public const int PageHomeView = 2131165205; + + // aapt resource value: 0x7F070016 + public const int Proxy = 2131165206; static Layout() { @@ -293,263 +733,266 @@ private Layout() public partial class String { - // aapt resource value: 0x7f040043 - public const int addUserState = 2130968643; + // aapt resource value: 0x7F080000 + public const int addUserState = 2131230720; + + // aapt resource value: 0x7F080001 + public const int app_name = 2131230721; - // aapt resource value: 0x7f040022 - public const int app_name = 2130968610; + // aapt resource value: 0x7F080002 + public const int audit = 2131230722; - // aapt resource value: 0x7f040033 - public const int audit = 2130968627; + // aapt resource value: 0x7F080003 + public const int auditpresence = 2131230723; - // aapt resource value: 0x7f040035 - public const int auditpresence = 2130968629; + // aapt resource value: 0x7F080004 + public const int auth = 2131230724; - // aapt resource value: 0x7f040038 - public const int auth = 2130968632; + // aapt resource value: 0x7F080005 + public const int authkey = 2131230725; - // aapt resource value: 0x7f040030 - public const int authkey = 2130968624; + // aapt resource value: 0x7F080006 + public const int authkeyopt = 2131230726; - // aapt resource value: 0x7f040031 - public const int authkeyopt = 2130968625; + // aapt resource value: 0x7F080007 + public const int authopt = 2131230727; - // aapt resource value: 0x7f040039 - public const int authopt = 2130968633; + // aapt resource value: 0x7F080012 + public const int btncancel = 2131230738; - // aapt resource value: 0x7f040055 - public const int btnChangeUuid = 2130968661; + // aapt resource value: 0x7F080008 + public const int btnChangeUuid = 2131230728; - // aapt resource value: 0x7f040047 - public const int btnDelUserStateAndExit = 2130968647; + // aapt resource value: 0x7F080009 + public const int btnDelUserStateAndExit = 2131230729; - // aapt resource value: 0x7f040048 - public const int btnDelUserStateAndMore = 2130968648; + // aapt resource value: 0x7F08000A + public const int btnDelUserStateAndMore = 2131230730; - // aapt resource value: 0x7f040049 - public const int btnGetUserState = 2130968649; + // aapt resource value: 0x7F08000B + public const int btnGetUserState = 2131230731; - // aapt resource value: 0x7f04004e - public const int btnGlobalHereNow = 2130968654; + // aapt resource value: 0x7F08000C + public const int btnGlobalHereNow = 2131230732; - // aapt resource value: 0x7f040045 - public const int btnSaveUserStateAndAddMore = 2130968645; + // aapt resource value: 0x7F080013 + public const int btngrant = 2131230739; - // aapt resource value: 0x7f040044 - public const int btnSaveUserStateAndExit = 2130968644; + // aapt resource value: 0x7F08000D + public const int btnSaveUserStateAndAddMore = 2131230733; - // aapt resource value: 0x7f04004b - public const int btnSetUserState = 2130968651; + // aapt resource value: 0x7F08000E + public const int btnSaveUserStateAndExit = 2131230734; - // aapt resource value: 0x7f04004a - public const int btnUserStateInst = 2130968650; + // aapt resource value: 0x7F080014 + public const int btnset = 2131230740; - // aapt resource value: 0x7f04003e - public const int btnWhereNow = 2130968638; + // aapt resource value: 0x7F08000F + public const int btnSetUserState = 2131230735; - // aapt resource value: 0x7f040037 - public const int btncancel = 2130968631; + // aapt resource value: 0x7F080010 + public const int btnUserStateInst = 2131230736; - // aapt resource value: 0x7f040032 - public const int btngrant = 2130968626; + // aapt resource value: 0x7F080011 + public const int btnWhereNow = 2131230737; - // aapt resource value: 0x7f04003a - public const int btnset = 2130968634; + // aapt resource value: 0x7F080015 + public const int cancel = 2131230741; - // aapt resource value: 0x7f04000f - public const int cancel = 2130968591; + // aapt resource value: 0x7F080016 + public const int channel = 2131230742; - // aapt resource value: 0x7f04001b - public const int channel = 2130968603; + // aapt resource value: 0x7F080017 + public const int channelGroup = 2131230743; - // aapt resource value: 0x7f04001c - public const int channelGroup = 2130968604; + // aapt resource value: 0x7F080018 + public const int channelgroup = 2131230744; - // aapt resource value: 0x7f04003b - public const int channelgroup = 2130968635; + // aapt resource value: 0x7F080019 + public const int channelinfo = 2131230745; - // aapt resource value: 0x7f040027 - public const int channelinfo = 2130968615; + // aapt resource value: 0x7F08001A + public const int cipher = 2131230746; - // aapt resource value: 0x7f040020 - public const int cipher = 2130968608; + // aapt resource value: 0x7F08001B + public const int customUuid = 2131230747; - // aapt resource value: 0x7f040000 - public const int customUuid = 2130968576; + // aapt resource value: 0x7F08001C + public const int deleteUserState = 2131230748; - // aapt resource value: 0x7f040046 - public const int deleteUserState = 2130968646; + // aapt resource value: 0x7F08001D + public const int detailedHistory = 2131230749; - // aapt resource value: 0x7f040017 - public const int detailedHistory = 2130968599; + // aapt resource value: 0x7F08001E + public const int drawer_close = 2131230750; - // aapt resource value: 0x7f040024 - public const int drawer_close = 2130968612; + // aapt resource value: 0x7F08001F + public const int drawer_open = 2131230751; - // aapt resource value: 0x7f040023 - public const int drawer_open = 2130968611; + // aapt resource value: 0x7F080020 + public const int enableproxy = 2131230752; - // aapt resource value: 0x7f040001 - public const int enableproxy = 2130968577; + // aapt resource value: 0x7F080021 + public const int enablessl = 2131230753; - // aapt resource value: 0x7f04001d - public const int enablessl = 2130968605; + // aapt resource value: 0x7F080022 + public const int enterHeartbeatInterval = 2131230754; - // aapt resource value: 0x7f040040 - public const int enterHeartbeatInterval = 2130968640; + // aapt resource value: 0x7F080023 + public const int enterHeartbeatTime = 2131230755; - // aapt resource value: 0x7f04003f - public const int enterHeartbeatTime = 2130968639; + // aapt resource value: 0x7F080024 + public const int enterUserStateKey = 2131230756; - // aapt resource value: 0x7f040041 - public const int enterUserStateKey = 2130968641; + // aapt resource value: 0x7F080025 + public const int enterUserStateValue = 2131230757; - // aapt resource value: 0x7f040042 - public const int enterUserStateValue = 2130968642; + // aapt resource value: 0x7F080026 + public const int enterUuid = 2131230758; - // aapt resource value: 0x7f040054 - public const int enterUuid = 2130968660; + // aapt resource value: 0x7F080027 + public const int globalHereNow = 2131230759; - // aapt resource value: 0x7f040050 - public const int globalHereNow = 2130968656; + // aapt resource value: 0x7F080028 + public const int grant = 2131230760; - // aapt resource value: 0x7f04002a - public const int grant = 2130968618; + // aapt resource value: 0x7F080029 + public const int grantchannel = 2131230761; - // aapt resource value: 0x7f04003c - public const int grantchannel = 2130968636; + // aapt resource value: 0x7F08002A + public const int grantchannelgroup = 2131230762; - // aapt resource value: 0x7f04003d - public const int grantchannelgroup = 2130968637; + // aapt resource value: 0x7F08002B + public const int grantread = 2131230763; - // aapt resource value: 0x7f04002b - public const int grantread = 2130968619; + // aapt resource value: 0x7F08002C + public const int grantwrite = 2131230764; - // aapt resource value: 0x7f04002c - public const int grantwrite = 2130968620; + // aapt resource value: 0x7F08002D + public const int hereNow = 2131230765; - // aapt resource value: 0x7f04004f - public const int hereNow = 2130968655; + // aapt resource value: 0x7F08002E + public const int herenow = 2131230766; - // aapt resource value: 0x7f040016 - public const int herenow = 2130968598; + // aapt resource value: 0x7F08002F + public const int inStore = 2131230767; - // aapt resource value: 0x7f040013 - public const int inStore = 2130968595; + // aapt resource value: 0x7F080030 + public const int launch = 2131230768; - // aapt resource value: 0x7f040021 - public const int launch = 2130968609; + // aapt resource value: 0x7F080031 + public const int menu_refresh = 2131230769; - // aapt resource value: 0x7f040025 - public const int menu_refresh = 2130968613; + // aapt resource value: 0x7F080032 + public const int message = 2131230770; - // aapt resource value: 0x7f040015 - public const int message = 2130968597; + // aapt resource value: 0x7F080033 + public const int newchannel = 2131230771; - // aapt resource value: 0x7f040028 - public const int newchannel = 2130968616; + // aapt resource value: 0x7F080034 + public const int newchannelGroup = 2131230772; - // aapt resource value: 0x7f040029 - public const int newchannelGroup = 2130968617; + // aapt resource value: 0x7F080035 + public const int off = 2131230773; - // aapt resource value: 0x7f04002e - public const int off = 2130968622; + // aapt resource value: 0x7F080036 + public const int on = 2131230774; - // aapt resource value: 0x7f04002d - public const int on = 2130968621; + // aapt resource value: 0x7F080037 + public const int optional = 2131230775; - // aapt resource value: 0x7f04004c - public const int optional = 2130968652; + // aapt resource value: 0x7F080038 + public const int presence = 2131230776; - // aapt resource value: 0x7f040014 - public const int presence = 2130968596; + // aapt resource value: 0x7F080039 + public const int proxy = 2131230777; - // aapt resource value: 0x7f040002 - public const int proxy = 2130968578; + // aapt resource value: 0x7F08003A + public const int proxyCancel = 2131230778; - // aapt resource value: 0x7f04000e - public const int proxyCancel = 2130968590; + // aapt resource value: 0x7F08003B + public const int proxyOff = 2131230779; - // aapt resource value: 0x7f040008 - public const int proxyOff = 2130968584; + // aapt resource value: 0x7F08003C + public const int proxyOn = 2131230780; - // aapt resource value: 0x7f040007 - public const int proxyOn = 2130968583; + // aapt resource value: 0x7F08003D + public const int proxyPassword = 2131230781; - // aapt resource value: 0x7f04000c - public const int proxyPassword = 2130968588; + // aapt resource value: 0x7F08003E + public const int proxyPort = 2131230782; - // aapt resource value: 0x7f04000a - public const int proxyPort = 2130968586; + // aapt resource value: 0x7F08003F + public const int proxySave = 2131230783; - // aapt resource value: 0x7f04000d - public const int proxySave = 2130968589; + // aapt resource value: 0x7F080040 + public const int proxyServer = 2131230784; - // aapt resource value: 0x7f040009 - public const int proxyServer = 2130968585; + // aapt resource value: 0x7F080041 + public const int proxyUsername = 2131230785; - // aapt resource value: 0x7f04000b - public const int proxyUsername = 2130968587; + // aapt resource value: 0x7F080042 + public const int pubKey = 2131230786; - // aapt resource value: 0x7f040004 - public const int pubKey = 2130968580; + // aapt resource value: 0x7F080043 + public const int publish = 2131230787; - // aapt resource value: 0x7f040012 - public const int publish = 2130968594; + // aapt resource value: 0x7F080044 + public const int revoke = 2131230788; - // aapt resource value: 0x7f040034 - public const int revoke = 2130968628; + // aapt resource value: 0x7F080045 + public const int revokepresence = 2131230789; - // aapt resource value: 0x7f040036 - public const int revokepresence = 2130968630; + // aapt resource value: 0x7F080046 + public const int secKey = 2131230790; - // aapt resource value: 0x7f040005 - public const int secKey = 2130968581; + // aapt resource value: 0x7F080047 + public const int setProxy = 2131230791; - // aapt resource value: 0x7f040006 - public const int setProxy = 2130968582; + // aapt resource value: 0x7F080048 + public const int showUserState = 2131230792; - // aapt resource value: 0x7f040052 - public const int showUserState = 2130968658; + // aapt resource value: 0x7F080049 + public const int showUuid = 2131230793; - // aapt resource value: 0x7f040051 - public const int showUuid = 2130968657; + // aapt resource value: 0x7F08004A + public const int sslOff = 2131230794; - // aapt resource value: 0x7f04001f - public const int sslOff = 2130968607; + // aapt resource value: 0x7F08004B + public const int sslOn = 2131230795; - // aapt resource value: 0x7f04001e - public const int sslOn = 2130968606; + // aapt resource value: 0x7F08004C + public const int status_bar_notification_info_overflow = 2131230796; - // aapt resource value: 0x7f040003 - public const int subKey = 2130968579; + // aapt resource value: 0x7F08004E + public const int subchannel = 2131230798; - // aapt resource value: 0x7f040026 - public const int subchannel = 2130968614; + // aapt resource value: 0x7F08004D + public const int subKey = 2131230797; - // aapt resource value: 0x7f040010 - public const int subscribe = 2130968592; + // aapt resource value: 0x7F08004F + public const int subscribe = 2131230799; - // aapt resource value: 0x7f040011 - public const int subscribeConnCallback = 2130968593; + // aapt resource value: 0x7F080050 + public const int subscribeConnCallback = 2131230800; - // aapt resource value: 0x7f040018 - public const int time = 2130968600; + // aapt resource value: 0x7F080051 + public const int time = 2131230801; - // aapt resource value: 0x7f04002f - public const int ttl = 2130968623; + // aapt resource value: 0x7F080052 + public const int ttl = 2131230802; - // aapt resource value: 0x7f040019 - public const int unsubscribe = 2130968601; + // aapt resource value: 0x7F080053 + public const int unsubscribe = 2131230803; - // aapt resource value: 0x7f04001a - public const int unsubscribePres = 2130968602; + // aapt resource value: 0x7F080054 + public const int unsubscribePres = 2131230804; - // aapt resource value: 0x7f040053 - public const int uuid = 2130968659; + // aapt resource value: 0x7F080055 + public const int uuid = 2131230805; - // aapt resource value: 0x7f04004d - public const int whereNow = 2130968653; + // aapt resource value: 0x7F080056 + public const int whereNow = 2131230806; static String() { @@ -560,6 +1003,260 @@ private String() { } } + + public partial class Style + { + + // aapt resource value: 0x7F090000 + public const int TextAppearance_Compat_Notification = 2131296256; + + // aapt resource value: 0x7F090001 + public const int TextAppearance_Compat_Notification_Info = 2131296257; + + // aapt resource value: 0x7F090002 + public const int TextAppearance_Compat_Notification_Info_Media = 2131296258; + + // aapt resource value: 0x7F090003 + public const int TextAppearance_Compat_Notification_Line2 = 2131296259; + + // aapt resource value: 0x7F090004 + public const int TextAppearance_Compat_Notification_Line2_Media = 2131296260; + + // aapt resource value: 0x7F090005 + public const int TextAppearance_Compat_Notification_Media = 2131296261; + + // aapt resource value: 0x7F090006 + public const int TextAppearance_Compat_Notification_Time = 2131296262; + + // aapt resource value: 0x7F090007 + public const int TextAppearance_Compat_Notification_Time_Media = 2131296263; + + // aapt resource value: 0x7F090008 + public const int TextAppearance_Compat_Notification_Title = 2131296264; + + // aapt resource value: 0x7F090009 + public const int TextAppearance_Compat_Notification_Title_Media = 2131296265; + + // aapt resource value: 0x7F09000A + public const int Widget_Compat_NotificationActionContainer = 2131296266; + + // aapt resource value: 0x7F09000B + public const int Widget_Compat_NotificationActionText = 2131296267; + + // aapt resource value: 0x7F09000C + public const int Widget_Support_CoordinatorLayout = 2131296268; + + static Style() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Style() + { + } + } + + public partial class Styleable + { + + // aapt resource value: { 0x10101A5,0x101031F,0x7F010000 } + public static int[] ColorStateListItem = new int[] { + 16843173, + 16843551, + 2130771968}; + + // aapt resource value: 2 + public const int ColorStateListItem_alpha = 2; + + // aapt resource value: 1 + public const int ColorStateListItem_android_alpha = 1; + + // aapt resource value: 0 + public const int ColorStateListItem_android_color = 0; + + // aapt resource value: { 0x7F01000C,0x7F010013 } + public static int[] CoordinatorLayout = new int[] { + 2130771980, + 2130771987}; + + // aapt resource value: 0 + public const int CoordinatorLayout_keylines = 0; + + // aapt resource value: { 0x10100B3,0x7F01000D,0x7F01000E,0x7F01000F,0x7F010010,0x7F010011,0x7F010012 } + public static int[] CoordinatorLayout_Layout = new int[] { + 16842931, + 2130771981, + 2130771982, + 2130771983, + 2130771984, + 2130771985, + 2130771986}; + + // aapt resource value: 0 + public const int CoordinatorLayout_Layout_android_layout_gravity = 0; + + // aapt resource value: 1 + public const int CoordinatorLayout_Layout_layout_anchor = 1; + + // aapt resource value: 2 + public const int CoordinatorLayout_Layout_layout_anchorGravity = 2; + + // aapt resource value: 3 + public const int CoordinatorLayout_Layout_layout_behavior = 3; + + // aapt resource value: 4 + public const int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4; + + // aapt resource value: 5 + public const int CoordinatorLayout_Layout_layout_insetEdge = 5; + + // aapt resource value: 6 + public const int CoordinatorLayout_Layout_layout_keyline = 6; + + // aapt resource value: 1 + public const int CoordinatorLayout_statusBarBackground = 1; + + // aapt resource value: { 0x7F010003,0x7F010004,0x7F010005,0x7F010006,0x7F010007,0x7F010008 } + public static int[] FontFamily = new int[] { + 2130771971, + 2130771972, + 2130771973, + 2130771974, + 2130771975, + 2130771976}; + + // aapt resource value: { 0x1010532,0x1010533,0x101053F,0x101056F,0x1010570,0x7F010002,0x7F010009,0x7F01000A,0x7F01000B,0x7F010014 } + public static int[] FontFamilyFont = new int[] { + 16844082, + 16844083, + 16844095, + 16844143, + 16844144, + 2130771970, + 2130771977, + 2130771978, + 2130771979, + 2130771988}; + + // aapt resource value: 0 + public const int FontFamilyFont_android_font = 0; + + // aapt resource value: 2 + public const int FontFamilyFont_android_fontStyle = 2; + + // aapt resource value: 4 + public const int FontFamilyFont_android_fontVariationSettings = 4; + + // aapt resource value: 1 + public const int FontFamilyFont_android_fontWeight = 1; + + // aapt resource value: 3 + public const int FontFamilyFont_android_ttcIndex = 3; + + // aapt resource value: 5 + public const int FontFamilyFont_font = 5; + + // aapt resource value: 6 + public const int FontFamilyFont_fontStyle = 6; + + // aapt resource value: 7 + public const int FontFamilyFont_fontVariationSettings = 7; + + // aapt resource value: 8 + public const int FontFamilyFont_fontWeight = 8; + + // aapt resource value: 9 + public const int FontFamilyFont_ttcIndex = 9; + + // aapt resource value: 0 + public const int FontFamily_fontProviderAuthority = 0; + + // aapt resource value: 1 + public const int FontFamily_fontProviderCerts = 1; + + // aapt resource value: 2 + public const int FontFamily_fontProviderFetchStrategy = 2; + + // aapt resource value: 3 + public const int FontFamily_fontProviderFetchTimeout = 3; + + // aapt resource value: 4 + public const int FontFamily_fontProviderPackage = 4; + + // aapt resource value: 5 + public const int FontFamily_fontProviderQuery = 5; + + // aapt resource value: { 0x101019D,0x101019E,0x10101A1,0x10101A2,0x10101A3,0x10101A4,0x1010201,0x101020B,0x1010510,0x1010511,0x1010512,0x1010513 } + public static int[] GradientColor = new int[] { + 16843165, + 16843166, + 16843169, + 16843170, + 16843171, + 16843172, + 16843265, + 16843275, + 16844048, + 16844049, + 16844050, + 16844051}; + + // aapt resource value: { 0x10101A5,0x1010514 } + public static int[] GradientColorItem = new int[] { + 16843173, + 16844052}; + + // aapt resource value: 0 + public const int GradientColorItem_android_color = 0; + + // aapt resource value: 1 + public const int GradientColorItem_android_offset = 1; + + // aapt resource value: 7 + public const int GradientColor_android_centerColor = 7; + + // aapt resource value: 3 + public const int GradientColor_android_centerX = 3; + + // aapt resource value: 4 + public const int GradientColor_android_centerY = 4; + + // aapt resource value: 1 + public const int GradientColor_android_endColor = 1; + + // aapt resource value: 10 + public const int GradientColor_android_endX = 10; + + // aapt resource value: 11 + public const int GradientColor_android_endY = 11; + + // aapt resource value: 5 + public const int GradientColor_android_gradientRadius = 5; + + // aapt resource value: 0 + public const int GradientColor_android_startColor = 0; + + // aapt resource value: 8 + public const int GradientColor_android_startX = 8; + + // aapt resource value: 9 + public const int GradientColor_android_startY = 9; + + // aapt resource value: 6 + public const int GradientColor_android_tileMode = 6; + + // aapt resource value: 2 + public const int GradientColor_android_type = 2; + + static Styleable() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Styleable() + { + } + } } } #pragma warning restore 1591 diff --git a/src/Examples/mono-for-android/PubNubMessaging.Example/Resources/layout/Launch.axml b/src/Examples/mono-for-android/PubNubMessaging.Example/Resources/layout/Launch.axml index 37f43a41c..b12dced22 100755 --- a/src/Examples/mono-for-android/PubNubMessaging.Example/Resources/layout/Launch.axml +++ b/src/Examples/mono-for-android/PubNubMessaging.Example/Resources/layout/Launch.axml @@ -8,7 +8,9 @@ android:layout_height="fill_parent" android:padding="5dip" android:stretchColumns="*"> - + - + + android:layout_height="wrap_content" + android:inputType="text" /> - + - + + android:layout_height="wrap_content" + android:inputType="text" /> - + - + + android:layout_height="wrap_content" + android:inputType="text" /> - + - + + android:layout_height="wrap_content" + android:inputType="text" /> - + - + + android:layout_height="wrap_content" + android:inputType="text" /> - + - + - + + android:layout_height="wrap_content" + android:inputType="text" /> - + - + + android:layout_height="wrap_content" + android:inputType="text" /> - + + android:text="@string/setProxy" + android:layout_width="match_parent" /> - + + android:layout_height="2dip" + android:layout_width="match_parent" /> - +