Skip to content

Commit

Permalink
[fix] optimize welcome message send timing
Browse files Browse the repository at this point in the history
  • Loading branch information
zhgchgli0718 committed Oct 4, 2022
1 parent 5fcdece commit 64ce178
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.4
1.3.5
3 changes: 2 additions & 1 deletion lib/AndroidFetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ def execute()


# init first time, send welcome message
if latestCheckTimestamp == 0
if latestCheckTimestamp == 0 && isSentWelcomeMessage() == false
sendWelcomMessage()
setSentWelcomeMessage()
elsif reviews.length > 0
processReviews(reviews, platform)
end
Expand Down
3 changes: 2 additions & 1 deletion lib/AppleFetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ def execute()
end

# init first time, send welcome message
if latestCheckTimestamp == 0
if latestCheckTimestamp == 0 && isSentWelcomeMessage() == false
sendWelcomMessage()
setSentWelcomeMessage()
elsif reviews.length > 0
reviews = fullfillAppInfo(reviews)
processReviews(reviews, platform)
Expand Down
11 changes: 11 additions & 0 deletions lib/Models/ReviewFetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ def sendWelcomMessage()
end
end

def setSentWelcomeMessage()
basePath = "#{config.baseExecutePath}/latestCheckTimestamp/"
Helper.createDirIfNotExist(basePath)
File.open("#{basePath}/#{platform}Welcome", 'w') { |file| file.write("") }
end

def isSentWelcomeMessage()
filePath = "#{config.baseExecutePath}/latestCheckTimestamp/#{platform}Welcome"
return File.exists?(filePath)
end

def setPlatformLatestCheckTimestamp(timestamp)
basePath = "#{config.baseExecutePath}/latestCheckTimestamp/"
Helper.createDirIfNotExist(basePath)
Expand Down

0 comments on commit 64ce178

Please sign in to comment.