Skip to content

Commit 7dfef19

Browse files
authored
Merge pull request #2 from VideoOS/develop
fix track
2 parents 18a1fff + 236969f commit 7dfef19

File tree

8 files changed

+139
-87
lines changed

8 files changed

+139
-87
lines changed

VideoOS-lua-app/template/bubble/os_bubble_hotspot.lua

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,13 @@ function itemClick(data)
13151315
end
13161316

13171317
local function onCreate(data)
1318+
local showLinkUrl = getHotspotExposureTrackLink(data, 1)
1319+
if (showLinkUrl ~= nil) then
1320+
Native:get(showLinkUrl)
1321+
end
1322+
if (bubble.launchPlanId ~= nil) then
1323+
osTrack(bubble.launchPlanId, 1, 2)
1324+
end
13181325
getScrollViewLocation(data)
13191326
bubble.luaview = createParent()
13201327
performWithDelay(function()
@@ -1374,13 +1381,7 @@ function show(args)
13741381
end
13751382
bubble.launchPlanId = dataTable.launchPlanId
13761383
bubble.id = dataTable.id
1377-
local showLinkUrl = getHotspotExposureTrackLink(dataTable, 1)
1378-
if (showLinkUrl ~= nil) then
1379-
Native:get(showLinkUrl)
1380-
end
1381-
if (bubble.launchPlanId ~= nil) then
1382-
osTrack(bubble.launchPlanId, 1, 2)
1383-
end
1384+
13841385
setBubbleTime(dataTable)
13851386
Native:widgetEvent(eventTypeShow, bubble.id, bubble.id, adTypeBubble, "") --todo 修改参数为table
13861387
Native:saveCacheData(bubble.id, tostring(eventTypeShow))

VideoOS-lua-app/template/card/os_card_hotspot.lua

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,15 @@ local function registerWindow()
439439
end
440440

441441
local function onCreate(data)
442+
local showLinkUrl = getHotspotExposureTrackLink(card.data, card.hotspotOrder)
443+
if (showLinkUrl ~= nil) then
444+
Native:get(showLinkUrl)
445+
end
446+
if (card.launchPlanId ~= nil) then
447+
osTrack(card.launchPlanId, 1, 2)
448+
osTrack(card.launchPlanId, 2, 2)
449+
end
450+
442451
configSize(data)
443452
local isPortrait = Native:isPortraitScreen()
444453
card.luaview = createLuaView(isPortrait)
@@ -621,14 +630,7 @@ function show(args)
621630
hotspotOrder = hotspotOrder + 1
622631
card.hotspotOrder = hotspotOrder
623632
end
624-
local showLinkUrl = getHotspotExposureTrackLink(card.data, card.hotspotOrder)
625-
if (showLinkUrl ~= nil) then
626-
Native:get(showLinkUrl)
627-
end
628-
if (card.launchPlanId ~= nil) then
629-
osTrack(card.launchPlanId, 1, 2)
630-
osTrack(card.launchPlanId, 2, 2)
631-
end
633+
632634
getUserCardInfo(function(dataTable)
633635
if dataTable ~= nil then
634636
if dataTable.collectStatus ~= collectStatusGet then

VideoOS-lua-app/template/card/os_card_window.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,10 @@ local function successState(data)
917917
end
918918

919919
local function onCreate(data)
920+
if (cardWindow.launchPlanId ~= nil) then
921+
osTrack(cardWindow.launchPlanId, 1, 1)
922+
end
923+
920924
local isPortrait = Native:isPortraitScreen()
921925
cardWindow.media = registerMedia()
922926
cardWindow.window = registerWindow()
@@ -1132,9 +1136,7 @@ function show(args)
11321136
return
11331137
end
11341138
setConfig(args.data)
1135-
if (cardWindow.launchPlanId ~= nil) then
1136-
osTrack(cardWindow.launchPlanId, 1, 1)
1137-
end
1139+
11381140
onCreate(args.data)
11391141
-- postUserCardInfo()
11401142
end

VideoOS-lua-app/template/cloud/os_cloud_hotspot.lua

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,16 @@ local function createCloseButton(data, isPortrait)
502502
end
503503

504504
local function onCreate(data)
505+
local showLinkUrl = getHotspotExposureTrackLink(data, 1)
506+
if (showLinkUrl ~= nil) then
507+
Native:get(showLinkUrl)
508+
end
509+
if (cloud.launchPlanId ~= nil) then
510+
osTrack(cloud.launchPlanId, 1, 2)
511+
if (getLinkUrl(data) ~= nil) then
512+
osTrack(cloud.launchPlanId, 2, 2)
513+
end
514+
end
505515
cloud.needShowOnPortrait = isNeedShowOnPortrait(data)
506516
local isPortrait = Native:isPortraitScreen()
507517
cloud.luaView = createParent(isPortrait)
@@ -556,16 +566,7 @@ function show(args)
556566
end
557567
cloud.id = dataTable.id
558568
cloud.launchPlanId = dataTable.launchPlanId
559-
local showLinkUrl = getHotspotExposureTrackLink(dataTable, 1)
560-
if (showLinkUrl ~= nil) then
561-
Native:get(showLinkUrl)
562-
end
563-
if (cloud.launchPlanId ~= nil) then
564-
osTrack(cloud.launchPlanId, 1, 2)
565-
if (getLinkUrl(dataTable) ~= nil) then
566-
osTrack(cloud.launchPlanId, 2, 2)
567-
end
568-
end
569+
569570
setDefaultValue(dataTable)
570571
Native:widgetEvent(eventTypeShow, cloud.id, adTypeName, actionTypeNone, "") --todo 修改参数为table
571572
Native:saveCacheData(cloud.id, tostring(eventTypeShow))

VideoOS-lua-app/template/red_envelope/os_red_envelope_hotspot.lua

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,15 @@ local function fillData(data)
469469
end
470470

471471
local function onCreate(data)
472+
local showLinkUrl = getHotspotExposureTrackLink(redEnvelope.data, 1)
473+
if (showLinkUrl ~= nil) then
474+
Native:get(showLinkUrl)
475+
end
476+
if (redEnvelope.launchPlanId ~= nil) then
477+
osTrack(redEnvelope.launchPlanId, 1, 2)
478+
osTrack(redEnvelope.launchPlanId, 2, 2)
479+
end
480+
472481
configSize(data)
473482
local isPortrait = Native:isPortraitScreen()
474483
redEnvelope.luaview = createLuaView(isPortrait)
@@ -590,14 +599,6 @@ function show(args)
590599

591600
redEnvelope.id = redEnvelope.data.id
592601
redEnvelope.launchPlanId = redEnvelope.data.launchPlanId
593-
local showLinkUrl = getHotspotExposureTrackLink(redEnvelope.data, 1)
594-
if (showLinkUrl ~= nil) then
595-
Native:get(showLinkUrl)
596-
end
597-
if (redEnvelope.launchPlanId ~= nil) then
598-
osTrack(redEnvelope.launchPlanId, 1, 2)
599-
osTrack(redEnvelope.launchPlanId, 2, 2)
600-
end
601602
getRedEnvelopeInfo(function()
602603
onCreate(redEnvelope.data)
603604
end)

VideoOS-lua-app/template/red_envelope/os_red_envelope_window.lua

Lines changed: 76 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,15 @@ local function setRedEnvelopeTitleViewSize(data, redEnvelopeTitleView, isPortrai
192192
end
193193
if (isPortrait) then
194194
redEnvelopeTitleView:textSize(24)
195+
if (System.ios()) then
196+
redEnvelopeTitleView:font("HelveticaNeue-Bold", 24)
197+
end
195198
redEnvelopeTitleView:frame(0, 28 * scale, redEnvelopeWindow.portraitWidth, 35 * scale)
196199
else
197200
redEnvelopeTitleView:textSize(14)
201+
if (System.ios()) then
202+
redEnvelopeTitleView:font("HelveticaNeue-Bold", 14)
203+
end
198204
redEnvelopeTitleView:frame(0, 12 * scale, 200 * scale, 30 * scale)
199205
end
200206
end
@@ -204,17 +210,17 @@ local function setRedEnvelopeCommandViewSize(data, redEnvelopeCommandLayout, red
204210
return
205211
end
206212
if (isPortrait) then
207-
local viewWidth, viewHight = redEnvelopeWindow.portraitWidth * 0.613, redEnvelopeWindow.portraitHeight * 0.127
213+
local viewWidth, viewHight = redEnvelopeWindow.portraitWidth * 0.619, redEnvelopeWindow.portraitHeight * 0.178
208214

209-
redEnvelopeCommandLayout:frame(redEnvelopeWindow.portraitWidth * 0.1935, redEnvelopeWindow.portraitHeight * 0.380, viewWidth, viewHight)
215+
redEnvelopeCommandLayout:frame(redEnvelopeWindow.portraitWidth * 0.190, redEnvelopeWindow.portraitHeight * 0.363, viewWidth, viewHight)
210216
redEnvelopeCommandBackgroundView:frame(0, 0, viewWidth, viewHight)
211-
redEnvelopeCommandView:frame(20 * scale, 0, viewWidth - 40 * scale, viewHight)
217+
redEnvelopeCommandView:frame(0, 0, viewWidth, viewHight)
212218
redEnvelopeCommandView:textSize(18)
213219
else
214-
redEnvelopeCommandLayout:frame(21 * scale, 140 * scale, 163 * scale, 55 * scale)
215-
redEnvelopeCommandBackgroundView:frame(0, 0, 163 * scale, 55 * scale)
216-
redEnvelopeCommandView:frame(20 * scale, 0, 112 * scale, 55 * scale)
217-
redEnvelopeCommandView:textSize(16)
220+
redEnvelopeCommandLayout:frame(11 * scale, 130 * scale, 182 * scale, 61 * scale)
221+
redEnvelopeCommandBackgroundView:frame(0, 0, 182 * scale, 61 * scale)
222+
redEnvelopeCommandView:frame(0, 0, 182 * scale, 61 * scale)
223+
redEnvelopeCommandView:textSize(15)
218224
end
219225
end
220226

@@ -253,31 +259,27 @@ local function setRedEnvelopeCommendTitleViewSize(data, createredEnvelopeCommend
253259
end
254260
if (isPortrait) then
255261
if (System.android()) then
256-
createredEnvelopeCommendTitleView:textSize(8)
262+
createredEnvelopeCommendTitleView:textSize(12)
257263
createredEnvelopeCommendTitleView:frame(redEnvelopeWindow.portraitWidth * 0.277, redEnvelopeWindow.portraitHeight * 0.655, redEnvelopeWindow.portraitWidth * 0.446, redEnvelopeWindow.portraitHeight * 0.093)
258264
else
259265
createredEnvelopeCommendTitleView:textSize(12)
260-
local width = 1
261-
local height = redEnvelopeWindow.portraitHeight * 0.093
262-
if createredEnvelopeCommendTitleView:text() ~= nil then
263-
width, height = Native:stringSizeWithWidth(createredEnvelopeCommendTitleView:text(), redEnvelopeWindow.portraitWidth * 0.646, 12)
264-
height = height + 12
266+
local y = redEnvelopeWindow.portraitHeight * 0.655
267+
if redEnvelopeWindow.redEnvelopeCopyView ~= nil then
268+
y = redEnvelopeWindow.redEnvelopeCopyView:y() + redEnvelopeWindow.redEnvelopeCopyView:height() + 8 * scale
265269
end
266-
createredEnvelopeCommendTitleView:frame(redEnvelopeWindow.portraitWidth * 0.177, redEnvelopeWindow.portraitHeight * 0.655, redEnvelopeWindow.portraitWidth * 0.646, height)
270+
createredEnvelopeCommendTitleView:frame(redEnvelopeWindow.redEnvelopeCopyView:x(), y, redEnvelopeWindow.redEnvelopeCopyView:width(), 40)
267271
end
268272
else
269273
if (System.android()) then
270-
createredEnvelopeCommendTitleView:textSize(8)
274+
createredEnvelopeCommendTitleView:textSize(10)
271275
createredEnvelopeCommendTitleView:frame(27 * scale, 251 * scale, 150 * scale, 50 * scale)
272276
else
273277
createredEnvelopeCommendTitleView:textSize(10)
274-
local width = 1
275-
local height = 40 * scale
276-
if createredEnvelopeCommendTitleView:text() ~= nil then
277-
width, height = Native:stringSizeWithWidth(createredEnvelopeCommendTitleView:text(), 120 * scale, 10)
278-
height = height + 10
278+
local y = 251 * scale
279+
if redEnvelopeWindow.redEnvelopeCopyView ~= nil then
280+
y = redEnvelopeWindow.redEnvelopeCopyView:y() + redEnvelopeWindow.redEnvelopeCopyView:height() + 8 * scale
279281
end
280-
createredEnvelopeCommendTitleView:frame(28 * scale, 251 * scale, 140 * scale, height)
282+
createredEnvelopeCommendTitleView:frame(redEnvelopeWindow.redEnvelopeCopyView:x(), y, redEnvelopeWindow.redEnvelopeCopyView:width(), 30)
281283
end
282284
end
283285
end
@@ -324,6 +326,9 @@ local function createredEnvelopeTitleView(data, isPortrait)
324326
local redEnvelopeTitleView = Label()
325327
redEnvelopeTitleView:textColor(0xFFFFFF)
326328
redEnvelopeTitleView:textAlign(TextAlign.CENTER)
329+
if (redEnvelopeTitleView.textBold) and (System.android()) then
330+
redEnvelopeTitleView:textBold()
331+
end
327332
setRedEnvelopeTitleViewSize(data, redEnvelopeTitleView, isPortrait)
328333
return redEnvelopeTitleView
329334
end
@@ -377,16 +382,44 @@ end
377382
local function createredEnvelopeCommendTitleView(data, isPortrait)
378383
local redEnvelopeCommendTitleView = Label()
379384
redEnvelopeCommendTitleView:textColor(0xB8B8B8)
380-
redEnvelopeCommendTitleView:lines(100)
385+
redEnvelopeCommendTitleView:lines(2)
386+
redEnvelopeCommendTitleView:ellipsize(Ellipsize.END)
381387
if (System.android()) then
382-
redEnvelopeCommendTitleView:gravity(Gravity.START)
388+
redEnvelopeCommendTitleView:gravity(Gravity.H_CENTER)
389+
else
390+
redEnvelopeCommendTitleView:textAlign(TextAlign.CENTER)
383391
end
384392

385393
setRedEnvelopeCommendTitleViewSize(data, redEnvelopeCommendTitleView, isPortrait)
386394

387395
return redEnvelopeCommendTitleView
388396
end
389397

398+
local function showToastView(message, view)
399+
if message == nil or view == nil then
400+
return
401+
end
402+
local label = Label()
403+
label:textColor(0xFFFFFF)
404+
label:textAlign(TextAlign.CENTER)
405+
label:text(message)
406+
label:lines(0)
407+
label:textSize(14)
408+
local width, height = Native:stringSizeWithWidth(message, view:width() - 20 * 2 - 12, 14)
409+
view:addView(label)
410+
if width < 100 then
411+
width = 100
412+
end
413+
label:frame((view:width() - width - 12) * 0.5, (view:height() - height - 12) * 0.5, width + 12, height + 12)
414+
label:cornerRadius(5)
415+
label:borderWidth(1)
416+
label:borderColor(0x808080, 0.5)
417+
label:backgroundColor(0x343434, 0.75)
418+
performWithDelay(function()
419+
label:removeFromSuper()
420+
end, 1000)
421+
end
422+
390423
--屏幕旋转--
391424
local function rotationScreen(isPortrait)
392425
setLuaViewSize(redEnvelopeWindow.luaView, isPortrait)
@@ -464,6 +497,15 @@ local function fillData(data)
464497
end
465498

466499
local function onCreate(data)
500+
local showLinkUrl = getHotspotExposureTrackLink(data, 1)
501+
if (showLinkUrl ~= nil) then
502+
Native:get(showLinkUrl)
503+
end
504+
if (redEnvelopeWindow.launchPlanId ~= nil) then
505+
osTrack(redEnvelopeWindow.launchPlanId, 1, 1)
506+
osTrack(redEnvelopeWindow.launchPlanId, 2, 1)
507+
end
508+
467509
redEnvelopeWindow.media = registerMedia()
468510
local isPortrait = Native:isPortraitScreen()
469511
redEnvelopeWindow.luaView = createLuaView(isPortrait)
@@ -537,12 +579,20 @@ local function onCreate(data)
537579
redEnvelopeWindow.redEnvelopeCopyView:onClick(function()
538580
local infoWord = redEnvelopeWindow.redEnvelopeCommandView:text()
539581
if (infoWord == nil) then
540-
Toast("未获取到口令,请稍后重试")
582+
if (System.android()) then
583+
Toast("未获取到口令,请稍后重试")
584+
else
585+
showToastView("未获取到口令,请稍后重试", redEnvelopeWindow.redEnvelopeWindowView)
586+
end
541587
return
542588
end
543589
Native:copyStringToPasteBoard(infoWord)
544590
postUserRedEnvelopeInfo()
545-
Toast("复制成功")
591+
if (System.android()) then
592+
Toast("复制成功")
593+
else
594+
showToastView("复制成功", redEnvelopeWindow.redEnvelopeWindowView)
595+
end
546596
local clickLinkUrl = getHotspotClickTrackLink(data, 1)
547597
if (clickLinkUrl ~= nil) then
548598
Native:get(clickLinkUrl)
@@ -559,14 +609,7 @@ function show(args)
559609
return
560610
end
561611
redEnvelopeWindow.launchPlanId = args.data.launchPlanId
562-
local showLinkUrl = getHotspotExposureTrackLink(args.data, 1)
563-
if (showLinkUrl ~= nil) then
564-
Native:get(showLinkUrl)
565-
end
566-
if (redEnvelopeWindow.launchPlanId ~= nil) then
567-
osTrack(redEnvelopeWindow.launchPlanId, 1, 1)
568-
osTrack(redEnvelopeWindow.launchPlanId, 2, 1)
569-
end
612+
570613
setConfig(args.data)
571614
onCreate(args.data)
572615
end

VideoOS-lua-app/template/vote/os_vote_hotspot.lua

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,14 @@ local function configSize(data)
432432
end
433433

434434
local function onCreate(args)
435+
local showLinkUrl = getHotspotExposureTrackLink(args, 1)
436+
if (showLinkUrl ~= nil) then
437+
Native:get(showLinkUrl)
438+
end
439+
if (vote.launchPlanId ~= nil) then
440+
osTrack(vote.launchPlanId, 1, 2)
441+
osTrack(vote.launchPlanId, 2, 2)
442+
end
435443
vote.data = args
436444
configSize(args)
437445
local isPortrait = Native:isPortraitScreen()
@@ -493,14 +501,7 @@ function show(args)
493501
end
494502
vote.id = args.data.id
495503
vote.launchPlanId = args.data.launchPlanId
496-
local showLinkUrl = getHotspotExposureTrackLink(args.data, 1)
497-
if (showLinkUrl ~= nil) then
498-
Native:get(showLinkUrl)
499-
end
500-
if (vote.launchPlanId ~= nil) then
501-
osTrack(vote.launchPlanId, 1, 2)
502-
osTrack(vote.launchPlanId, 2, 2)
503-
end
504+
504505
onCreate(args.data)
505506
getVoteCountInfo()
506507
getUserVoteInfo()

0 commit comments

Comments
 (0)