fun attach()

in mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt [241:260]


        fun attach() {
            if (adHost != null || !item.isSponsored) return
            if (nativeAdView == null) {
                nativeAdView = layoutInflater.inflate(R.layout.ad_unified, adContainer, false) as UnifiedNativeAdView
                AdsManager.load(context) {
                    forUnifiedNativeAd { unifiedNativeAd ->
                        // You must call destroy on old ads when you are done with them,
                        // otherwise you will have a memory leak.
                        nativeAd?.destroy()
                        nativeAd = unifiedNativeAd
                        tryBindAd()
                    }
                    withNativeAdOptions(NativeAdOptions.Builder().apply {
                        setVideoOptions(VideoOptions.Builder().apply {
                            setStartMuted(true)
                        }.build())
                    }.build())
                }
            } else if (nativeAd != null) populateUnifiedNativeAdView(nativeAd!!, nativeAdView!!)
        }