@@ -37,9 +37,6 @@ class eews2fcm:
3737 #language can be es-US or en-US. By default is es-US
3838 def __init__ (self , worldCitiesFile , language = "es-US" , fcmDataFile = None ):
3939
40- #this is the long string template for sending notification to apps with version less than 2.0.0
41- self .oldFormat = '''%EVTID%;%MAG%;%DEPTH%;%LAT%;%LON%;%LIKELIHOOD%;%ORTIME%;%TIMENOW%;NULL;%AGENCY%;%STATUS%;%TYPE%;%LOCATION%;%ORID%;%MAGID%;%STAMAGNUM%;%TIME_NOWMS%;%DISTANCE%'''
42-
4340 self .fcmDataFile = fcmDataFile
4441 self .authKey = ''
4542 self .topic = ''
@@ -51,7 +48,6 @@ def __init__(self, worldCitiesFile, language = "es-US", fcmDataFile=None):
5148 self .distance = 0
5249 self .projectId = ""
5350 self .serviceAccountFile = ""
54- self .oldFormatSupport = False
5551 self .android = True
5652 self .ios = True
5753
@@ -73,7 +69,6 @@ def readFcmDataFile(self):
7369 self .topic = config .get ('TOPICS' , 'topic' )
7470 self .serviceAccountFile = config .get ('SERVICEFILE' , 'servicefile' )
7571 self .projectId = config .get ('PROJECTID' , 'projectid' )
76- #self.oldFormatSupport = config.getboolean("SUPPORT_OLD_FORMAT","oldformat")
7772 self .android = config .getboolean ("ENABLED_OS" ,"android" )
7873 self .ios = config .getboolean ("ENABLED_OS" ,"ios" )
7974 except :
@@ -112,9 +107,6 @@ def message_creator(self, ep ):
112107 "location" : "%LOCATION%" ,
113108 "numArrivals" : "%STAMAGNUM%" ,
114109 "nearPlaceDist" : "%DISTANCE%" ,
115- "message" : "%OLDFORMAT%" ,
116- "title" : "someOldformatTitle" ,
117- "body" : "someOldformatBody" ,
118110 "magId" : "%MAGID%"
119111 }
120112
@@ -198,31 +190,7 @@ def message_creator(self, ep ):
198190 evtPayload ["nearPlaceDist" ] = str (self .distance )
199191
200192 evtPayload ["magId" ] = prefMagID
201-
202- if self .oldFormatSupport :
203- oldMsg = self .oldFormat
204- oldMsg = oldMsg .replace ("%EVTID%" , evtid )
205- oldMsg = oldMsg .replace ("%AGENCY%" ,agency )
206- oldMsg = oldMsg .replace ("%MAG%" ,str (round (mag ,1 )))
207- oldMsg = oldMsg .replace ("%DEPTH%" ,str (round (depth ,1 )))
208- oldMsg = oldMsg .replace ("%LAT%" ,str (lat ))
209- oldMsg = oldMsg .replace ("%LON%" ,str (lon ))
210- oldMsg = oldMsg .replace ("%LIKELIHOOD%" , likelihood )
211- oldMsg = oldMsg .replace ("%ORTIME%" , str (orTime ))
212- oldMsg = oldMsg .replace ("%TIMENOW%" ,str (now_seconds )) #exception: this is in seconds for old format
213- oldMsg = oldMsg .replace ("%STATUS%" ,"automatic" )
214- oldMsg = oldMsg .replace ("%TYPE%" , "alert" )
215- oldMsg = oldMsg .replace ("%LOCATION%" , location )
216- oldMsg = oldMsg .replace ("%ORID%" , prefOrID )
217- oldMsg = oldMsg .replace ("%MAGID%" , prefMagID )
218- oldMsg = oldMsg .replace ("%STAMAGNUM%" , str (numStaMag ) )
219- oldMsg = oldMsg .replace ("%TIME_NOWMS%" ,str (nowms ))
220- oldMsg = oldMsg .replace ("%DISTANCE%" , str (self .distance ) )
221-
222- evtPayload ["message" ]= oldMsg
223- evtPayload ["body" ]= "eqNotification"
224- evtPayload ["title" ]= "oldNotif"
225-
193+
226194 # Construct JSON request payload
227195
228196 payload = {
0 commit comments