@@ -87,7 +87,6 @@ void ButtonUnsubscribeAllHandler(){
8787 }
8888 void ButtonDeleteHistoryHandler ( ) {
8989 pubnub . DeleteMessages ( ) . Channel ( "channel1" ) . Start ( 15078932998876451 ) . End ( 15078933628583256 ) . Async ( ( result , status ) => {
90- //pubnub.DeleteMessages().Channel("channel1").Async((result, status) => {
9190 Debug . Log ( "in DeleteMessages" ) ;
9291 if ( ! status . Error ) {
9392 Debug . Log ( string . Format ( "DateTime {0}, In DeleteMessages Example, Timetoken: {1}" , DateTime . UtcNow , result . Message ) ) ;
@@ -306,6 +305,15 @@ void ButtonAddPushNotificationsOnChannelsHandler(){
306305 Display ( string . Format ( "AddPushNotificationsOnChannels: {0}" , result . Message ) ) ;
307306 }
308307 } ) ;
308+ pubnub . AddPushNotificationsOnChannels ( ) . Channels ( listChannels ) . DeviceID ( deviceId ) . PushType ( PNPushType . APNS2 ) . Topic ( "a" ) . Async ( ( result , status ) => {
309+ Debug . Log ( "in AddPushNotificationsOnChannels" ) ;
310+ if ( status . Error ) {
311+ Debug . Log ( string . Format ( "In Example, AddPushNotificationsOnChannels Error: {0} {1} {2}" , status . StatusCode , status . ErrorData , status . Category ) ) ;
312+ } else {
313+ Debug . Log ( string . Format ( "DateTime {0}, In AddPushNotificationsOnChannels, result: {1}" , DateTime . UtcNow , result . Message ) ) ;
314+ Display ( string . Format ( "AddPushNotificationsOnChannels: {0}" , result . Message ) ) ;
315+ }
316+ } ) ;
309317 }
310318 void ButtonAuditPushChannelProvisionsHandler ( ) {
311319 AuditPushChannelProvisions ( pubnub , deviceId , pnPushType ) ;
@@ -434,7 +442,6 @@ void Init(){
434442 }
435443
436444 void MessageCounts ( List < string > listChannels , PubNub pubnub ) {
437- //pubnub.MessageCounts().ChannelTimetokens(new List<string>{"15499825804610610","15499925804610615"}).Channels(listChannels).Timetoken("1549982652").Async((result, status) =>{
438445 pubnub . MessageCounts ( ) . Channels ( listChannels ) . ChannelsTimetoken ( new List < long > { 1549982652 } ) . Async ( ( result , status ) => {
439446 if ( status . Error ) {
440447 Debug . Log ( string . Format ( "In Example, MessageCounts Error: {0} {1} {2}" , status . StatusCode , status . ErrorData , status . Category ) ) ;
@@ -515,11 +522,10 @@ void DisplayMessages(Dictionary<string, object> message, string channel) {
515522 void FetchRecursive ( long start , List < string > listChannels ) {
516523
517524 pubnub . FetchMessages ( ) . Channels ( listChannels ) . Start ( start ) . Async ( ( result , status ) => {
518- //pubnub.FetchMessages().Channels(new List<string>{"channel2"}).Async ((result, status) => {
519525 if ( status . Error ) {
520526 Debug . Log ( string . Format ( "In Example, FetchMessages Error: {0} {1} {2}" , status . StatusCode , status . ErrorData , status . Category ) ) ;
521527 } else {
522- Debug . Log ( string . Format ( "In FetchMessages, result: " ) ) ; //,result.EndTimetoken, result.Messages[0].ToString()));
528+ Debug . Log ( string . Format ( "In FetchMessages, result: " ) ) ;
523529 foreach ( KeyValuePair < string , List < PNMessageResult > > kvp in result . Channels ) {
524530 Debug . Log ( "kvp channelname" + kvp . Key ) ;
525531 foreach ( PNMessageResult pnMessageResut in kvp . Value ) {
@@ -550,8 +556,6 @@ void GetHistoryRecursive(long start, string channel){
550556 } ) ;
551557 }
552558
553-
554-
555559 void SubscribeCallbackHandler ( object sender , EventArgs e ) {
556560 Debug . Log ( "SubscribeCallbackHandler Event handler" ) ;
557561 SubscribeEventEventArgs mea = e as SubscribeEventEventArgs ;
@@ -582,8 +586,6 @@ void SubscribeCallbackHandler(object sender, EventArgs e){
582586 }
583587 if ( mea . MessageResult != null ) {
584588 Debug . Log ( "In Example, SubscribeCallback in message" + mea . MessageResult . Channel + mea . MessageResult . Payload ) ;
585- //var a = mea.MessageResult.Payload as Dictionary<string, string>;
586- //var b = a["a"];
587589 Display ( string . Format ( "SubscribeCallback Result: {0}" , pubnub . JsonLibrary . SerializeToJsonString ( mea . MessageResult . Payload ) ) ) ;
588590 }
589591 if ( mea . PresenceEventResult != null ) {
@@ -605,6 +607,16 @@ void RemoveChannelsFromPush(List<string> listChannels, PubNub pubnub, string dev
605607 Display ( string . Format ( "RemovePushNotificationsFromChannels: {0}" , result . Message ) ) ;
606608 }
607609 } ) ;
610+ pubnub . RemovePushNotificationsFromChannels ( ) . Channels ( listChannels ) . DeviceID ( deviceId ) . PushType ( PNPushType . APNS2 ) . Topic ( "a" ) . Async ( ( result , status ) => {
611+ Debug . Log ( "in RemovePushNotificationsFromChannels" ) ;
612+ if ( status . Error ) {
613+ Debug . Log ( string . Format ( "In Example, RemovePushNotificationsFromChannels Error: {0} {1} {2}" , status . StatusCode , status . ErrorData , status . Category ) ) ;
614+ } else {
615+ Debug . Log ( string . Format ( "DateTime {0}, In RemovePushNotificationsFromChannels, result: {1}" , DateTime . UtcNow , result . Message ) ) ;
616+ Display ( string . Format ( "RemovePushNotificationsFromChannels: {0}" , result . Message ) ) ;
617+ }
618+ } ) ;
619+
608620 }
609621
610622 void AuditPushChannelProvisions ( PubNub pubnub , string deviceId , PNPushType pnPushType ) {
@@ -618,6 +630,17 @@ void AuditPushChannelProvisions(PubNub pubnub, string deviceId, PNPushType pnPus
618630 }
619631
620632 } ) ;
633+ pubnub . AuditPushChannelProvisions ( ) . DeviceID ( deviceId ) . PushType ( pnPushType ) . PushType ( PNPushType . APNS2 ) . Topic ( "a" ) . Async ( ( result , status ) => {
634+ Debug . Log ( "in AuditPushChannelProvisions" ) ;
635+ if ( status . Error ) {
636+ Debug . Log ( string . Format ( "In Example, AuditPushChannelProvisions Error: {0} {1} {2}" , status . StatusCode , status . ErrorData , status . Category ) ) ;
637+ } else {
638+ Debug . Log ( string . Format ( "DateTime {0}, In AuditPushChannelProvisions, result: {1}" , DateTime . UtcNow , ( result . Channels != null ) ? string . Join ( "," , result . Channels . ToArray ( ) ) : "" ) ) ;
639+ Display ( string . Format ( "AuditPushChannelProvisions: {0}" , ( result . Channels != null ) ? string . Join ( "," , result . Channels . ToArray ( ) ) : "" ) ) ;
640+ }
641+
642+ } ) ;
643+
621644 }
622645
623646 void RemoveAllPushNotificationsFromChannels ( PubNub pubnub , string deviceId , PNPushType pnPushType ) {
@@ -631,6 +654,17 @@ void RemoveAllPushNotificationsFromChannels(PubNub pubnub, string deviceId, PNPu
631654 }
632655
633656 } ) ;
657+ pubnub . RemoveAllPushNotifications ( ) . DeviceID ( deviceId ) . PushType ( PNPushType . APNS2 ) . Topic ( "a" ) . Async ( ( result , status ) => {
658+ Debug . Log ( "in RemoveAllPushNotificationsFromChannels" ) ;
659+ if ( status . Error ) {
660+ Debug . Log ( string . Format ( "In Example, RemoveAllPushNotificationsFromChannels Error: {0} {1} {2}" , status . StatusCode , status . ErrorData , status . Category ) ) ;
661+ } else {
662+ Debug . Log ( string . Format ( "DateTime {0}, In RemoveAllPushNotificationsFromChannels, result: {1}" , DateTime . UtcNow , result . Message ) ) ;
663+ Display ( string . Format ( "RemoveAllPushNotificationsFromChannels: {0}" , result . Message ) ) ;
664+ }
665+
666+ } ) ;
667+
634668 }
635669
636670 void RemoveChannelsFromCG ( PubNub pubnub , string cg , List < string > listChannelsRemove ) {
@@ -660,7 +694,6 @@ void ListAllChannelsOfGroup(PubNub pubnub, string cg){
660694
661695 void FetchMessages ( PubNub pubnub , List < string > listChannels ) {
662696 pubnub . FetchMessages ( ) . Channels ( listChannels ) . IncludeMeta ( true ) . Async ( ( result , status ) => {
663- //pubnub.FetchMessages().Channels(new List<string>{"channel2"}).Async ((result, status) => {
664697 if ( status . Error ) {
665698 Debug . Log ( string . Format ( "In Example, FetchMessages Error: {0} {1} {2}" , status . StatusCode , status . ErrorData , status . Category ) ) ;
666699 } else {
@@ -745,22 +778,14 @@ void PrintStatus(PNStatus s){
745778 ( s . ClientRequest != null ) ? s . ClientRequest . ToString ( ) : "null"
746779 ) ) ;
747780
748- //Display (s.Category.ToString());
749781 }
750782 }
751783
752784 void Display ( string textToDisplay ) {
753785 TextContent . text = string . Format ( "{0}\n {1}" , TextContent . text , textToDisplay ) ;
754- //UnityEngine.UI.Text txtRef = (UnityEngine.UI.Text)GameObject.Find("CountText").GetComponent<Text>;
755- //Debug.Log("TextContent.text 2:" + TextContent.text);
756- //TextScroll
757- //Canvas.
758- //Debug.Log("transform:" + transform.Find("TextContent").name);
759786 }
760787
761- //public string stringToEdit = "Hello World";
762788 void OnGUI ( ) {
763- //stringToEdit = GUI.TextField(new Rect(10, 10, 600, 600), stringToEdit, 600);
764789
765790 }
766791
0 commit comments