Skip to content

Commit 8669e72

Browse files
PubNub SDK v4.10.0 release.
1 parent 5d32e9a commit 8669e72

File tree

113 files changed

+4527
-481
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+4527
-481
lines changed

.pubnub.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
11
---
2-
version: v4.9.0
2+
version: v4.10.0
33
changelog:
4+
-
5+
changes:
6+
-
7+
text: "Files."
8+
type: feature
9+
-
10+
text: " Random IV in Encryption."
11+
type: feature
12+
-
13+
text: "Fetch with UUID and Message Type."
14+
type: feature
15+
-
16+
text: "Fetch with 100 messages."
17+
type: improvement
18+
date: Oct 19, 20
19+
version: v4.10.0
420
-
521
changes:
622
-
723
text: "Objects V2."
824
type: feature
925
date: Sep 15, 20
10-
version: v4.9.0
26+
version: v4.10.0
1127
-
1228
changes:
1329
-
@@ -431,7 +447,8 @@ features:
431447
others:
432448
- TELEMETRY
433449
- QUERY-PARAM
434-
- CREATE-PUSH-PAYLOAD
450+
- CREATE-PUSH-PAYLOAD
451+
- RANDOM-INITIALIZATION-VECTOR
435452
presence:
436453
- PRESENCE-HERE-NOW
437454
- PRESENCE-WHERE-NOW
@@ -452,6 +469,7 @@ features:
452469
- PUBLISH-FIRE
453470
- PUBLISH-REPLICATION-FLAG
454471
- PUBLISH-RAW-JSON
472+
- PUBLISH-FILE-MESSAGE
455473
push:
456474
- PUSH-ADD-DEVICE-TO-CHANNELS
457475
- PUSH-REMOVE-DEVICE-FROM-CHANNELS
@@ -472,6 +490,10 @@ features:
472490
- STORAGE-HISTORY-WITH-META
473491
- STORAGE-FETCH-WITH-META
474492
- STORAGE-FETCH-WITH-MESSAGE-ACTIONS
493+
- STORAGE-FETCH-WITH-FILE
494+
- STORAGE-FETCH-WITH-INCLUDE-MESSAGE-TYPE
495+
- STORAGE-FETCH-WITH-INCLUDE-UUID
496+
- STORAGE-FETCH-DEFAULT-100
475497
subscribe:
476498
- SUBSCRIBE-CHANNELS
477499
- SUBSCRIBE-CHANNEL-GROUPS
@@ -487,6 +509,7 @@ features:
487509
- SUBSCRIBE-SPACE-LISTENER
488510
- SUBSCRIBE-USER-LISTENER
489511
- SUBSCRIBE-MESSAGE-ACTIONS-LISTENER
512+
- SUBSCRIBE-FILE-LISTENER
490513
objects:
491514
- OBJECTS-FILTERING
492515
- OBJECTS-SORTING
@@ -506,6 +529,13 @@ features:
506529
- OBJECTS-REMOVE-CHANNEL-MEMBERS-V2
507530
- OBJECTS-MANAGE-MEMBERSHIPS-V2
508531
- OBJECTS-MANAGE-CHANNEL-MEMBERS-V2
532+
files:
533+
- FILES-SEND-FILE
534+
- FILES-LIST-FILES
535+
- FILES-GET-FILE-URL
536+
- FILES-DELETE-FILE
537+
- FILES-DOWNLOAD-FILE
538+
- FILES-TIMETOKEN-IN-RESPONSE
509539
message-actions:
510540
- MESSAGE-ACTIONS-GET
511541
- MESSAGE-ACTIONS-ADD
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<<<<<<< HEAD
2+
{
3+
=======
4+
{
5+
>>>>>>> 80eff96527a6e6b84c4a323c02ab3c70be8e6f8a
6+
"files.exclude":
7+
{
8+
"**/.DS_Store":true,
9+
"**/.git":true,
10+
"**/.gitignore":true,
11+
"**/.gitmodules":true,
12+
"**/*.booproj":true,
13+
"**/*.pidb":true,
14+
"**/*.suo":true,
15+
"**/*.user":true,
16+
"**/*.userprefs":true,
17+
"**/*.unityproj":true,
18+
"**/*.dll":true,
19+
"**/*.exe":true,
20+
"**/*.pdf":true,
21+
"**/*.mid":true,
22+
"**/*.midi":true,
23+
"**/*.wav":true,
24+
"**/*.gif":true,
25+
"**/*.ico":true,
26+
"**/*.jpg":true,
27+
"**/*.jpeg":true,
28+
"**/*.png":true,
29+
"**/*.psd":true,
30+
"**/*.tga":true,
31+
"**/*.tif":true,
32+
"**/*.tiff":true,
33+
"**/*.3ds":true,
34+
"**/*.3DS":true,
35+
"**/*.fbx":true,
36+
"**/*.FBX":true,
37+
"**/*.lxo":true,
38+
"**/*.LXO":true,
39+
"**/*.ma":true,
40+
"**/*.MA":true,
41+
"**/*.obj":true,
42+
"**/*.OBJ":true,
43+
"**/*.asset":true,
44+
"**/*.cubemap":true,
45+
"**/*.flare":true,
46+
"**/*.mat":true,
47+
"**/*.meta":true,
48+
"**/*.prefab":true,
49+
"**/*.unity":true,
50+
"build/":true,
51+
"Build/":true,
52+
"Library/":true,
53+
"library/":true,
54+
"obj/":true,
55+
"Obj/":true,
56+
"ProjectSettings/":true,
57+
"temp/":true,
58+
"Temp/":true
59+
}
60+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
using System;
2+
using System.Linq;
3+
using System.Collections.Generic;
4+
using UnityEngine;
5+
6+
namespace PubNubAPI
7+
{
8+
public class DeleteFileRequestBuilder: PubNubNonSubBuilder<DeleteFileRequestBuilder, PNDeleteFileResult>, IPubNubNonSubscribeBuilder<DeleteFileRequestBuilder, PNDeleteFileResult>
9+
{
10+
private string DeleteFileID { get; set;}
11+
private string DeleteFileChannel { get; set;}
12+
private string DeleteFileName { get; set;}
13+
14+
public DeleteFileRequestBuilder(PubNubUnity pn): base(pn, PNOperationType.PNDeleteFileOperation){
15+
}
16+
17+
#region IPubNubBuilder implementation
18+
public void Async(Action<PNDeleteFileResult, PNStatus> callback)
19+
{
20+
this.Callback = callback;
21+
base.Async(this);
22+
}
23+
#endregion
24+
25+
public DeleteFileRequestBuilder Channel(string channel)
26+
{
27+
DeleteFileChannel = channel;
28+
return this;
29+
}
30+
public DeleteFileRequestBuilder ID(string id){
31+
DeleteFileID = id;
32+
return this;
33+
}
34+
public DeleteFileRequestBuilder Name(string name){
35+
DeleteFileName = name;
36+
return this;
37+
}
38+
protected override void RunWebRequest(QueueManager qm){
39+
RequestState requestState = new RequestState ();
40+
requestState.OperationType = OperationType;
41+
requestState.httpMethod = HTTPMethod.Delete;
42+
43+
Uri request = BuildRequests.BuildDeleteFileRequest(
44+
DeleteFileChannel,
45+
DeleteFileID.ToString(),
46+
DeleteFileName.ToString(),
47+
this.PubNubInstance,
48+
this.QueryParams
49+
);
50+
base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this);
51+
}
52+
53+
protected override void CreatePubNubResponse(object deSerializedResult, RequestState requestState){
54+
PNDeleteFileResult pnDeleteFileResult = new PNDeleteFileResult();
55+
PNStatus pnStatus = new PNStatus();
56+
57+
try{
58+
Dictionary<string, object> dictionary = deSerializedResult as Dictionary<string, object>;
59+
60+
if(dictionary == null) {
61+
pnDeleteFileResult = null;
62+
pnStatus = base.CreateErrorResponseFromException(new PubNubException("Data not present"), requestState, PNStatusCategory.PNUnknownCategory);
63+
}
64+
} catch (Exception ex){
65+
pnDeleteFileResult = null;
66+
pnStatus = base.CreateErrorResponseFromException(ex, requestState, PNStatusCategory.PNUnknownCategory);
67+
}
68+
Callback(pnDeleteFileResult, pnStatus);
69+
70+
}
71+
72+
}
73+
}

PubNubUnity/Assets/PubNub/Builders/Files/DeleteFileRequestBuilder.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
using System;
2+
using System.Linq;
3+
using System.Collections.Generic;
4+
using UnityEngine;
5+
using UnityEngine.Networking;
6+
using System.Collections;
7+
8+
namespace PubNubAPI
9+
{
10+
public class DownloadFileRequestBuilder
11+
{
12+
private string DownloadFileID { get; set;}
13+
private string DownloadFileChannel { get; set;}
14+
private string DownloadFileName { get; set;}
15+
private string DownloadFileCipherKey { get; set;}
16+
internal PubNubUnity PubNubInstance;
17+
SendFileToS3RequestBuilder s3;
18+
private string DownloadFileSavePath { get; set;}
19+
20+
public DownloadFileRequestBuilder(PubNubUnity pn){
21+
PubNubInstance = pn;
22+
s3 = pn.GameObjectRef.AddComponent<SendFileToS3RequestBuilder> ();
23+
s3.PubNubInstance = pn;
24+
}
25+
26+
public void AbortRequest(){
27+
s3.AbortDownloadRequest();
28+
}
29+
30+
31+
#region IPubNubBuilder implementation
32+
public void Async(Action<PNDownloadFileResult, PNStatus> callback)
33+
{
34+
PNDownloadFileResult pnDownloadFileResult = new PNDownloadFileResult();
35+
string cipherKeyToUse = "";
36+
string dlFilePath = DownloadFileSavePath;
37+
string tempFilePath = string.Format("{0}/{1}.dl.enc", Application.temporaryCachePath, DownloadFileName);
38+
if(!string.IsNullOrEmpty(DownloadFileCipherKey)){
39+
cipherKeyToUse = DownloadFileCipherKey;
40+
dlFilePath = tempFilePath;
41+
} else if(!string.IsNullOrEmpty(PubNubInstance.PNConfig.CipherKey)){
42+
cipherKeyToUse = PubNubInstance.PNConfig.CipherKey;
43+
dlFilePath = tempFilePath;
44+
}
45+
s3.Channel(DownloadFileChannel).ID(DownloadFileID).Name(DownloadFileName).SavePath(dlFilePath);
46+
s3.ExecuteDownloadFile((status) => {
47+
#if (ENABLE_PUBNUB_LOGGING)
48+
this.PubNubInstance.PNLog.WriteToLog(string.Format("request.GetResponseHeader {0}", status.StatusCode), PNLoggingMethod.LevelInfo);
49+
#endif
50+
if(status.StatusCode != 200){
51+
pnDownloadFileResult = null;
52+
callback(pnDownloadFileResult, status);
53+
} else{
54+
// Decrypt
55+
// save file to temp, decrypt, save file to desired location
56+
if(!string.IsNullOrEmpty(cipherKeyToUse)){
57+
PubnubCrypto pubnubCrypto = new PubnubCrypto (cipherKeyToUse, this.PubNubInstance.PNLog);
58+
pubnubCrypto.DecryptFile(dlFilePath, DownloadFileSavePath);
59+
}
60+
#if (ENABLE_PUBNUB_LOGGING)
61+
this.PubNubInstance.PNLog.WriteToLog(string.Format("File successfully downloaded and saved to {0}", DownloadFileSavePath), PNLoggingMethod.LevelInfo);
62+
#endif
63+
callback(pnDownloadFileResult, status);
64+
}
65+
});
66+
}
67+
#endregion
68+
69+
70+
public DownloadFileRequestBuilder Channel(string channel)
71+
{
72+
DownloadFileChannel = channel;
73+
return this;
74+
}
75+
public DownloadFileRequestBuilder CipherKey(string cipherKey)
76+
{
77+
DownloadFileCipherKey = cipherKey;
78+
return this;
79+
}
80+
public DownloadFileRequestBuilder ID(string id){
81+
DownloadFileID = id;
82+
return this;
83+
}
84+
public DownloadFileRequestBuilder Name(string name){
85+
DownloadFileName = name;
86+
return this;
87+
}
88+
public DownloadFileRequestBuilder SavePath(string path){
89+
DownloadFileSavePath = path;
90+
return this;
91+
}
92+
93+
}
94+
}

PubNubUnity/Assets/PubNub/Builders/Files/DownloadFileRequestBuilder.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)