NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

contextualOffers.py (1311B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\notifications\common\formatters\contextualOffers.py
      2 from __future__ import print_function
      3 from notifications.common.formatters.baseFormatter import BaseNotificationFormatter
      4 
      5 def OnNotificationClick(offerID):
      6     sm.GetService('contextualOfferSvc').DisplayOfferWindowIfActive(offerID)
      7 
      8 
      9 class ContextualOfferNotification(BaseNotificationFormatter):
     10 
     11     def Format(self, notification):
     12         data = notification.data
     13         notification.subject = data['notificationSubject']
     14         notification.subtext = data['notificationBody']
     15         notification.Activate = lambda : OnNotificationClick(offerID=data['offerID'])
     16 
     17     def GetMessageFromData(self, data):
     18         return data.get('message', '')
     19 
     20     @staticmethod
     21     def MakeData(subject, body, url, offerID):
     22         data = {'notificationSubject': subject,
     23          'notificationBody': body,
     24          'url': url,
     25          'offerID': offerID}
     26         return data
     27 
     28     @staticmethod
     29     def MakeSampleData(variant = 0):
     30         print('SampleData')
     31         return ContextualOfferNotification.MakeData(subject='SpecialOffer For you', body='Like right now dude', url='http://google.com', offerID=2)
     32 
     33     @staticmethod
     34     def OnNotificationClick(notification):
     35         pass