var firebaseConfig = {
apiKey: "AIzaSyAB5mr...",
projectId: "xxxxx",
messagingSenderId: "...",
appId: "1:yyyyy:web:xxxxx",
measurementId: "G-xxxxx"
};
var idAPP = app.GetDeviceId();
var cry = "111111";
var api_key="";
var crypt = app.CreateCrypt();
var encryptedId = crypt.Encrypt( idAPP, cry);
function OnStart(){
app.PreventWifiSleep ()
app.SetOrientation( "Portrait" );
app.PreventScreenLock( true )
app.PreventScreenLock(!0)
app.SetScreenMode( "Game" )
/*********************************FIREBAE***************************************/
app.Script("Firebase/Firebase_7.15.5/app.js");
app.Script("Firebase/Firebase_7.15.5/database.js");
app.Script("Firebase/Firebase_7.15.5/auth.js");
app.Script("Firebase/Firebase_7.15.5/firebase.js");
app.Script("Firebase/Firebase_7.15.5/functions.js");
app.Script("Firebase/Firebase_7.15.5/messaging.js");
firebase.initializeApp(firebaseConfig);
db = firebase.database();
auth = firebase.auth();
messaging = firebase.messaging();
messaging.requestPermission().then(function(){conslole.log("ok");})
.catch(function(err){ console.log("error")})
db.goOffline();
CreateListeners();
ConnectFFT();
/**********************************FIREBASE**************************************/
}
function restart(){
//app.Alert('restart')
auth.onAuthStateChanged(OnAuth);
//On connect/disconnect.
db.ref(".info/connected").on("value", OnConnectionChange);
}
function CreateListeners(){
auth.onAuthStateChanged(OnAuth);
//On connect/disconnect.
db.ref(".info/connected").on("value", OnConnectionChange);
db.ref('uidcode').on("value", OnMessage);
}
function Connect(){
//app.Alert('connect')
auth.signInWithEmailAndPassword(idAPP+"@
helloworld.com", encryptedId).catch(function (e){
});
}
function ConnectFFT()
{
auth.createUserWithEmailAndPassword(idAPP+"@
helloworld.com", encryptedId).then(OnAuth)
.catch(error => {
if(error.code=='auth/email-already-in-use')
Connect();
else if(error.code=='auth/invalid-email')
console.log(Email address is invalid.);
else if(error.code=='auth/operation-not-allowed')
console.log(Error during sign up.);
else if(error.code=='auth/weak-password')
console.log('Password is not strong enough. Add additional characters including special characters and numbers.');
else
console.log(error.code);
});
}
function OnAuth(user)
{
if(user!=null){
uid = auth.currentUser.uid;
db.goOnline();
} else {
db.goOffline();}
}
function Listen()
{
// app.HideProgress();
//speech.Recognize();
}
function OnSuccessSend(){};
function OnFailedSend(){};
