feat(global): major fixes...i dont even know that to call this commit so ill just say its global. Who even cares

This commit is contained in:
Dillon Skaggs authored and GitHub committed 2021-07-06 23:10:47 +02:00
1 parent f6395e4b8e
commit 104fda2c11
10 files changed
+21 -27

No files matched your search

-4
View File
@@ -62,10 +62,6 @@ function Phone() {
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, []); }, []);
useEffect(() => {
Nui.send(PhoneEvents.UI_IS_READY);
}, [Nui]);
useKeyboardService(); useKeyboardService();
usePhoneService(); usePhoneService();
useSimcardService(); useSimcardService();
+2 -2
View File
@@ -11,11 +11,11 @@ export const twitterState = {
}), }),
tweets: atom({ tweets: atom({
key: 'tweets', key: 'tweets',
default: null, default: [],
}), }),
filteredTweets: atom({ filteredTweets: atom({
key: 'filteredTweets', key: 'filteredTweets',
default: null, default: [],
}), }),
showCreateTweetModal: atom({ showCreateTweetModal: atom({
key: 'showCreateTweetModal', key: 'showCreateTweetModal',
+3 -11
View File
@@ -20,11 +20,9 @@ function fetchOnInitialize() {
sendMessage('PHONE', PhoneEvents.SET_CONFIG, config); sendMessage('PHONE', PhoneEvents.SET_CONFIG, config);
} }
if (config.general.enableMultiChar) { onNet(PhoneEvents.ON_INIT, () => {
onNet(PhoneEvents.ON_INIT, () => { fetchOnInitialize();
fetchOnInitialize(); });
});
}
RegisterKeyMapping('phone', 'Open Phone', 'keyboard', 'f1'); RegisterKeyMapping('phone', 'Open Phone', 'keyboard', 'f1');
@@ -125,12 +123,6 @@ AddEventHandler('onResourceStop', function (resource: string) {
} }
}); });
RegisterNuiCallbackType(PhoneEvents.UI_IS_READY);
on(`__cfx_nui:${PhoneEvents.UI_IS_READY}`, (_data: any, cb: Function) => {
fetchOnInitialize();
cb();
});
// DO NOT CHANGE THIS EITHER, PLEASE - CHIP // DO NOT CHANGE THIS EITHER, PLEASE - CHIP
// ^ AND WHAT ARE YOU GOING TO DO HUH? - KIDZ // ^ AND WHAT ARE YOU GOING TO DO HUH? - KIDZ
+6 -1
View File
@@ -29,9 +29,11 @@ const displayHelperText = () => {
EndTextCommandDisplayHelp(0, true, false, -1); EndTextCommandDisplayHelp(0, true, false, -1);
}; };
RegisterNuiCallbackType(PhotoEvents.TAKE_PHOTO); RegisterNuiCallbackType(PhotoEvents.TAKE_PHOTO);
on(`__cfx_nui:${PhotoEvents.TAKE_PHOTO}`, async (data: any, cb: Function) => { on(`__cfx_nui:${PhotoEvents.TAKE_PHOTO}`, async (data: any, cb: Function) => {
cb(); cb();
emit('npwd:disableControlActions', false);
// Create Phone Prop // Create Phone Prop
let frontCam = false; let frontCam = false;
CreateMobilePhone(1); CreateMobilePhone(1);
@@ -46,7 +48,6 @@ on(`__cfx_nui:${PhotoEvents.TAKE_PHOTO}`, async (data: any, cb: Function) => {
while (inCameraMode) { while (inCameraMode) {
await Delay(0); await Delay(0);
displayHelperText();
if (IsControlJustPressed(1, 27)) { if (IsControlJustPressed(1, 27)) {
frontCam = !frontCam; frontCam = !frontCam;
CellFrontCamActivate(frontCam); CellFrontCamActivate(frontCam);
@@ -56,11 +57,15 @@ on(`__cfx_nui:${PhotoEvents.TAKE_PHOTO}`, async (data: any, cb: Function) => {
handleCameraExit(); handleCameraExit();
break; break;
} }
displayHelperText();
} }
ClearHelp(true); ClearHelp(true);
emit('npwd:disableControlActions', true);
}); });
const handleTakePicture = async () => { const handleTakePicture = async () => {
// Wait a frame so we don't draw the display helper text
await Delay(0);
takePhoto(); takePhoto();
await Delay(200); await Delay(200);
DestroyMobilePhone(); DestroyMobilePhone();
+3 -3
View File
@@ -60,8 +60,8 @@ class CallsService {
transmitterSource: transmittingPlayer.source, transmitterSource: transmittingPlayer.source,
receiver: receivingNumber, receiver: receivingNumber,
receiverSource: receivingPlayer.source, receiverSource: receivingPlayer.source,
start: startCallTimeUnix, start: startCallTimeUnix.toString(),
accepted: false, is_accepted: false,
}; };
if (!receivingPlayer) { if (!receivingPlayer) {
@@ -99,7 +99,7 @@ class CallsService {
// We retrieve the call that was accepted from the current calls map // We retrieve the call that was accepted from the current calls map
const curCallAccepted = this.callMap.get(transmitterNumber); const curCallAccepted = this.callMap.get(transmitterNumber);
// We update its reference // We update its reference
curCallAccepted.accepted = true; curCallAccepted.is_accepted = true;
const channelId = src; const channelId = src;
-1
View File
@@ -1,7 +1,6 @@
import { matchLogger } from './match.utils'; import { matchLogger } from './match.utils';
import MatchDB, { _MatchDB } from './match.db'; import MatchDB, { _MatchDB } from './match.db';
import { Like, MatchEvents, Profile } from '../../../typings/match'; import { Like, MatchEvents, Profile } from '../../../typings/match';
import { getOrCreateProfile } from '../sv_match';
import PlayerService from '../players/player.service'; import PlayerService from '../players/player.service';
class _MatchService { class _MatchService {
+1 -1
View File
@@ -6,7 +6,7 @@ export class PlayerRepo {
const query = `SELECT ${config.database.identifierColumn} FROM ${config.database.playerTable} WHERE phone_number = ?`; const query = `SELECT ${config.database.identifierColumn} FROM ${config.database.playerTable} WHERE phone_number = ?`;
const [results] = await pool.query(query, [phoneNumber]); const [results] = await pool.query(query, [phoneNumber]);
// Get identifier from results // Get identifier from results
return (results as { identifier: string }[])[0].identifier || null; return (results as any[])[0][config.database.identifierColumn] || null;
} }
} }
@@ -129,6 +129,7 @@ class _PlayerService {
playerLogger.info('NPWD Player Loaded!'); playerLogger.info('NPWD Player Loaded!');
playerLogger.debug(newPlayer); playerLogger.debug(newPlayer);
emitNet(PhoneEvents.ON_INIT, pSource);
} }
/** /**
+4 -3
View File
@@ -34,13 +34,15 @@ const formatTweets = (profileId: number) => (tweet: Tweet): Tweet => ({
export class _TwitterDB { export class _TwitterDB {
/** /**
* Retrieve the latest 100 tweets * Retrieve the latest 50 tweets
* @param profileId - twitter profile id of the player * @param profileId - twitter profile id of the player
*/ */
async fetchAllTweets(profileId: number): Promise<Tweet[]> { async fetchAllTweets(profileId: number): Promise<Tweet[]> {
const query = ` const query = `
SELECT ${SELECT_FIELDS} SELECT ${SELECT_FIELDS}
FROM npwd_twitter_tweets FROM (
SELECT * FROM npwd_twitter_tweets ORDER BY id DESC LIMIT 50
) npwd_twitter_tweets
LEFT OUTER JOIN npwd_twitter_profiles LEFT OUTER JOIN npwd_twitter_profiles
ON npwd_twitter_tweets.identifier = npwd_twitter_profiles.identifier ON npwd_twitter_tweets.identifier = npwd_twitter_profiles.identifier
LEFT OUTER JOIN npwd_twitter_likes ON npwd_twitter_tweets.id = npwd_twitter_likes.tweet_id AND LEFT OUTER JOIN npwd_twitter_likes ON npwd_twitter_tweets.id = npwd_twitter_likes.tweet_id AND
@@ -51,7 +53,6 @@ export class _TwitterDB {
LEFT OUTER JOIN npwd_twitter_profiles AS retweets_profiles LEFT OUTER JOIN npwd_twitter_profiles AS retweets_profiles
ON retweets.identifier = retweets_profiles.identifier ON retweets.identifier = retweets_profiles.identifier
WHERE npwd_twitter_tweets.visible = 1 WHERE npwd_twitter_tweets.visible = 1
ORDER BY npwd_twitter_tweets.id DESC LIMIT 50
`; `;
const [results] = await pool.query(query, [profileId, profileId]); const [results] = await pool.query(query, [profileId, profileId]);
const tweets = <Tweet[]>results; const tweets = <Tweet[]>results;
+1 -1
View File
@@ -15,7 +15,7 @@ export interface CallHistoryItem {
receiverSource?: number; receiverSource?: number;
start: string; start: string;
end?: number; end?: number;
is_accepted: number; is_accepted: boolean;
} }
export enum CallRejectReasons { export enum CallRejectReasons {