apps-sdk 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/libraries/Networking.js +14 -0
- package/src/libraries/Session.js +13 -1
package/package.json
CHANGED
|
@@ -39,6 +39,20 @@ class Networking {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
getUserID = async () => {
|
|
43
|
+
config.DEBUG_MODE && console.debug("getUserID");
|
|
44
|
+
try {
|
|
45
|
+
let userID = await this.request(config.ENDPOINTS.GET_USER_ID);
|
|
46
|
+
if (userID) {
|
|
47
|
+
config.DEBUG_MODE && console.debug("new userID", userID);
|
|
48
|
+
return userID;
|
|
49
|
+
}
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error(error);
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
42
56
|
async setToken(token) {
|
|
43
57
|
try {
|
|
44
58
|
const installID = await storage.getData('install_id');
|
package/src/libraries/Session.js
CHANGED
|
@@ -61,7 +61,6 @@ class Session {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
generateSessionID = () => {
|
|
64
|
-
config.DEBUG_MODE && console.debug("generateSessionID");
|
|
65
64
|
const dateNow = new Date();
|
|
66
65
|
const sessionID =
|
|
67
66
|
'' +
|
|
@@ -76,6 +75,19 @@ class Session {
|
|
|
76
75
|
return sessionID;
|
|
77
76
|
}
|
|
78
77
|
|
|
78
|
+
checkUserID = async () => {
|
|
79
|
+
config.DEBUG_MODE && console.debug("checkUserID");
|
|
80
|
+
let userID = await Storage.getData("userID");
|
|
81
|
+
if (!userID) {
|
|
82
|
+
userID = await Networking.getUserID();
|
|
83
|
+
if (userID) {
|
|
84
|
+
await Storage.storeData("userID", userID);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
config.DEBUG_MODE && console.debug("checkUserID - userID: ", userID);
|
|
88
|
+
return userID;
|
|
89
|
+
}
|
|
90
|
+
|
|
79
91
|
getSessionData = () => {
|
|
80
92
|
return this.sessionData;
|
|
81
93
|
}
|