// // AdService.h // Copyright ROBLOX Corp 2014 // // Created by Ben Tkacheff on 4/16/14. // // #pragma once #include "V8Tree/Instance.h" #include "V8Tree/Service.h" #include "V8DataModel/UserInputService.h" namespace RBX { extern const char* const sAdService; class AdService : public DescribedCreatable , public Service { private: typedef DescribedCreatable Super; bool showingVideoAd; std::string platformToWebString(const UserInputService::Platform userPlatform); bool canUseService(); protected: /*override*/ void onServiceProvider(ServiceProvider* oldProvider, ServiceProvider* newProvider); public: AdService(); rbx::signal videoAdClosedSignal; rbx::signal playVideoAdSignal; rbx::remote_signal sendServerVideoAdVerification; rbx::remote_signal sendClientVideoAdVerificationResults; rbx::remote_signal sendServerRecordImpression; void showVideoAd(); void videoAdClosed(bool didPlay); void sendAdImpression(int userId, UserInputService::Platform platform, bool didPlay); void verifyCanPlayVideoAdReceivedResponseNoDMLock(const std::string& response, int userId); void verifyCanPlayVideoAdReceivedErrorNoDMLock(const std::string& error, int userId); void verifyCanPlayVideoAdReceivedError(const std::string& error, int userId); void checkCanPlayVideoAd(int userId, UserInputService::Platform userPlatform); void receivedServerShowAdMessage(const bool success, int userId, const std::string& errorMessage); }; }