robbyson-frontend-library 1.0.96-rc2 → 1.0.96
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/dist/utils/chat.utils.js +0 -2
- package/dist/utils/image.utils.js +6 -21
- package/package.json +1 -1
- package/src/components/add-user-to-group-modal/add-user-to-group-modal.interface.ts +1 -1
- package/src/services/chat.service.interface.ts +0 -4
- package/src/utils/chat.utils.ts +0 -2
- package/src/utils/image.utils.ts +5 -33
package/dist/utils/chat.utils.js
CHANGED
|
@@ -63,8 +63,6 @@ export function checkIfUserIsSingleAdmin(identification, group) {
|
|
|
63
63
|
}
|
|
64
64
|
export function getChatName(chat) {
|
|
65
65
|
var _a;
|
|
66
|
-
if (!(chat === null || chat === void 0 ? void 0 : chat.name))
|
|
67
|
-
return "";
|
|
68
66
|
return chat.type !== ChatConstants.TYPE_CHAT.GROUP
|
|
69
67
|
? _.startCase((_a = chat.name) === null || _a === void 0 ? void 0 : _a.toLowerCase())
|
|
70
68
|
: chat.name;
|
|
@@ -97,26 +97,11 @@ export function getCroppedImg(imageSrc, pixelCrop, flip, type) {
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
export function checkExpiresPublicUrl(publicUrl) {
|
|
100
|
-
var
|
|
101
|
-
var
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
var expirationInSeconds = parseInt(googExpires);
|
|
107
|
-
var baseDate = parseISODate(googDate);
|
|
108
|
-
if (!baseDate) {
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
|
-
var expirationDate = new Date(baseDate.getTime() + expirationInSeconds * 1000);
|
|
112
|
-
return new Date() > expirationDate;
|
|
113
|
-
}
|
|
114
|
-
function parseISODate(googDate) {
|
|
115
|
-
try {
|
|
116
|
-
return new Date("".concat(googDate.substring(0, 4), "-").concat(googDate.substring(4, 6), "-").concat(googDate.substring(6, 8), "T") +
|
|
117
|
-
"".concat(googDate.substring(9, 11), ":").concat(googDate.substring(11, 13), ":").concat(googDate.substring(13, 15), "Z"));
|
|
118
|
-
}
|
|
119
|
-
catch (_a) {
|
|
120
|
-
return null;
|
|
100
|
+
var _a, _b;
|
|
101
|
+
var expiresIn = parseInt((_b = (_a = publicUrl.split("Expires=")[1]) === null || _a === void 0 ? void 0 : _a.split("&")) === null || _b === void 0 ? void 0 : _b[0]);
|
|
102
|
+
if (!expiresIn) {
|
|
103
|
+
return false;
|
|
121
104
|
}
|
|
105
|
+
var currentTime = Math.floor(new Date().getTime() / 1000);
|
|
106
|
+
return currentTime > expiresIn;
|
|
122
107
|
}
|
package/package.json
CHANGED
|
@@ -124,8 +124,4 @@ export interface IChatService {
|
|
|
124
124
|
canSendFiles(canSendMessages: boolean): boolean;
|
|
125
125
|
isChatPage(conversationId?: string): boolean;
|
|
126
126
|
getCurrentConversations(search?: string): ChatModel[];
|
|
127
|
-
getStateConversation(
|
|
128
|
-
conversationId: string
|
|
129
|
-
): UserListModel | ChatModel | undefined;
|
|
130
|
-
getStateSmallChat(conversationId: string): ChatDTO.ISmallChat | undefined;
|
|
131
127
|
}
|
package/src/utils/chat.utils.ts
CHANGED
|
@@ -99,8 +99,6 @@ export function checkIfUserIsSingleAdmin(
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
export function getChatName(chat: ChatModel): string {
|
|
102
|
-
if (!chat?.name) return "";
|
|
103
|
-
|
|
104
102
|
return chat.type !== ChatConstants.TYPE_CHAT.GROUP
|
|
105
103
|
? _.startCase(chat.name?.toLowerCase())
|
|
106
104
|
: chat.name;
|
package/src/utils/image.utils.ts
CHANGED
|
@@ -74,41 +74,13 @@ export async function getCroppedImg(
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
export function checkExpiresPublicUrl(publicUrl: string): boolean {
|
|
77
|
-
const
|
|
78
|
-
const googDate = urlParams.get("X-Goog-Date");
|
|
79
|
-
const googExpires = urlParams.get("X-Goog-Expires");
|
|
77
|
+
const expiresIn = parseInt(publicUrl.split("Expires=")[1]?.split("&")?.[0]);
|
|
80
78
|
|
|
81
|
-
if (!
|
|
82
|
-
return
|
|
79
|
+
if (!expiresIn) {
|
|
80
|
+
return false;
|
|
83
81
|
}
|
|
84
82
|
|
|
85
|
-
const
|
|
86
|
-
const baseDate = parseISODate(googDate);
|
|
83
|
+
const currentTime = Math.floor(new Date().getTime() / 1000);
|
|
87
84
|
|
|
88
|
-
|
|
89
|
-
return true;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const expirationDate = new Date(
|
|
93
|
-
baseDate.getTime() + expirationInSeconds * 1000
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
return new Date() > expirationDate;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function parseISODate(googDate: string): Date | null {
|
|
100
|
-
try {
|
|
101
|
-
return new Date(
|
|
102
|
-
`${googDate.substring(0, 4)}-${googDate.substring(
|
|
103
|
-
4,
|
|
104
|
-
6
|
|
105
|
-
)}-${googDate.substring(6, 8)}T` +
|
|
106
|
-
`${googDate.substring(9, 11)}:${googDate.substring(
|
|
107
|
-
11,
|
|
108
|
-
13
|
|
109
|
-
)}:${googDate.substring(13, 15)}Z`
|
|
110
|
-
);
|
|
111
|
-
} catch {
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
85
|
+
return currentTime > expiresIn;
|
|
114
86
|
}
|