Commit cd1d0688 authored by wanglei's avatar wanglei

...

parent 1c5aa8a6
...@@ -118,13 +118,6 @@ ...@@ -118,13 +118,6 @@
android:name=".service.StayNotificationService" android:name=".service.StayNotificationService"
android:foregroundServiceType="dataSync" /> android:foregroundServiceType="dataSync" />
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<service <service
android:name=".fcm.MessagingService" android:name=".fcm.MessagingService"
android:exported="false"> android:exported="false">
...@@ -132,6 +125,27 @@ ...@@ -132,6 +125,27 @@
<action android:name="com.google.firebase.MESSAGING_EVENT" /> <action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter> </intent-filter>
</service> </service>
<receiver
android:name=".fcm.FcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="confine.scream" />
</intent-filter>
</receiver>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
</application> </application>
</manifest> </manifest>
\ No newline at end of file
...@@ -3,7 +3,7 @@ package com.base.locationsharewhite.ads.admob ...@@ -3,7 +3,7 @@ package com.base.locationsharewhite.ads.admob
import android.os.Bundle import android.os.Bundle
import android.view.ViewGroup import android.view.ViewGroup
import android.view.ViewTreeObserver import android.view.ViewTreeObserver
import com.base.locationsharewhite.helper.ConstConfig import com.base.locationsharewhite.helper.config.ConstConfig
import com.google.ads.mediation.admob.AdMobAdapter import com.google.ads.mediation.admob.AdMobAdapter
import com.google.android.gms.ads.AdListener import com.google.android.gms.ads.AdListener
import com.google.android.gms.ads.AdRequest import com.google.android.gms.ads.AdRequest
......
...@@ -4,7 +4,7 @@ import android.app.Activity ...@@ -4,7 +4,7 @@ import android.app.Activity
import android.content.Context import android.content.Context
import com.base.locationsharewhite.ads.AdsShowCallBack import com.base.locationsharewhite.ads.AdsShowCallBack
import com.base.locationsharewhite.ads.BaseAdMgr import com.base.locationsharewhite.ads.BaseAdMgr
import com.base.locationsharewhite.helper.ConstConfig import com.base.locationsharewhite.helper.config.ConstConfig
import com.google.android.gms.ads.AdError import com.google.android.gms.ads.AdError
import com.google.android.gms.ads.AdRequest import com.google.android.gms.ads.AdRequest
import com.google.android.gms.ads.FullScreenContentCallback import com.google.android.gms.ads.FullScreenContentCallback
......
...@@ -3,7 +3,7 @@ package com.base.locationsharewhite.ads.admob ...@@ -3,7 +3,7 @@ package com.base.locationsharewhite.ads.admob
import android.content.Context import android.content.Context
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.view.isVisible import androidx.core.view.isVisible
import com.base.locationsharewhite.helper.ConstConfig import com.base.locationsharewhite.helper.config.ConstConfig
import com.example.mydemo.strategy.ads.admob.NativeView import com.example.mydemo.strategy.ads.admob.NativeView
import com.google.android.gms.ads.AdListener import com.google.android.gms.ads.AdListener
import com.google.android.gms.ads.AdLoader import com.google.android.gms.ads.AdLoader
......
...@@ -4,7 +4,7 @@ import android.app.Activity ...@@ -4,7 +4,7 @@ import android.app.Activity
import android.content.Context import android.content.Context
import com.base.locationsharewhite.ads.AdsShowCallBack import com.base.locationsharewhite.ads.AdsShowCallBack
import com.base.locationsharewhite.ads.BaseAdMgr import com.base.locationsharewhite.ads.BaseAdMgr
import com.base.locationsharewhite.helper.ConstConfig import com.base.locationsharewhite.helper.config.ConstConfig
import com.google.android.gms.ads.AdError import com.google.android.gms.ads.AdError
import com.google.android.gms.ads.AdRequest import com.google.android.gms.ads.AdRequest
import com.google.android.gms.ads.FullScreenContentCallback import com.google.android.gms.ads.FullScreenContentCallback
......
...@@ -5,8 +5,6 @@ import java.util.Locale ...@@ -5,8 +5,6 @@ import java.util.Locale
object ConstObject { object ConstObject {
var isFirstLauncher = true var isFirstLauncher = true
get() { get() {
return AppPreferences.getInstance().getBoolean("isFirstLauncher", field) return AppPreferences.getInstance().getBoolean("isFirstLauncher", field)
......
package com.base.locationsharewhite.fcm;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.base.locationsharewhite.utils.LogEx;
public class FcmReceiver extends BroadcastReceiver {
private String TAG = "FcmReceiver";
@Override
public void onReceive(Context context, Intent intent) {
LogEx.INSTANCE.logDebug(TAG, "onReceive", false);
}
}
...@@ -19,17 +19,19 @@ abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() { ...@@ -19,17 +19,19 @@ abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() {
lateinit var launcher: ActivityLauncher lateinit var launcher: ActivityLauncher
var isRunning: Boolean = false//需要用时在onResume()最后一行复制
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
launcher = ActivityLauncher(this) launcher = ActivityLauncher(this)
setContentView(binding.root) setContentView(binding.root)
// EventUtils.event("page_${javaClass.simpleName}") EventUtils.event("page_${javaClass.simpleName}")
initView() initView()
initListener() initListener()
} }
protected abstract fun initView() protected abstract fun initView()
protected open fun initListener() {} protected open fun initListener() {}
......
...@@ -4,6 +4,7 @@ import android.os.Build ...@@ -4,6 +4,7 @@ import android.os.Build
import com.base.locationsharewhite.BuildConfig import com.base.locationsharewhite.BuildConfig
import com.base.locationsharewhite.bean.ConstObject.ifAgreePrivacy import com.base.locationsharewhite.bean.ConstObject.ifAgreePrivacy
import com.base.locationsharewhite.helper.ReportUtils.doPost import com.base.locationsharewhite.helper.ReportUtils.doPost
import com.base.locationsharewhite.helper.config.AppConfig
import com.base.locationsharewhite.utils.AppPreferences import com.base.locationsharewhite.utils.AppPreferences
import com.base.locationsharewhite.utils.LogEx import com.base.locationsharewhite.utils.LogEx
import org.json.JSONException import org.json.JSONException
...@@ -32,7 +33,7 @@ object EventUtils { ...@@ -32,7 +33,7 @@ object EventUtils {
Thread { Thread {
var paramJson: String? = "" var paramJson: String? = ""
try { try {
val pkg = ConfigHelper.packageName val pkg = AppConfig.packageName
val s = JSONObject() val s = JSONObject()
.put("action", key) .put("action", key)
.put("value", value) .put("value", value)
...@@ -68,9 +69,9 @@ object EventUtils { ...@@ -68,9 +69,9 @@ object EventUtils {
} }
private val url by lazy { private val url by lazy {
val pkg = ConfigHelper.packageName val pkg = AppConfig.packageName
val url = StringBuilder( val url = StringBuilder(
"${ConfigHelper.eventUrl}/${ "${AppConfig.eventUrl}/${
pkg.filter { it.isLowerCase() }.substring(4, 9) pkg.filter { it.isLowerCase() }.substring(4, 9)
}sp" }sp"
) )
......
...@@ -2,14 +2,15 @@ package com.base.locationsharewhite.helper ...@@ -2,14 +2,15 @@ package com.base.locationsharewhite.helper
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import com.base.locationsharewhite.ads.AdsConfigBean
import com.base.locationsharewhite.ads.AdsMgr import com.base.locationsharewhite.ads.AdsMgr
import com.base.locationsharewhite.fcm.MsgConfig import com.base.locationsharewhite.fcm.MsgConfig
import com.base.locationsharewhite.fcm.MsgConfigBean import com.base.locationsharewhite.fcm.MsgConfigBean
import com.base.locationsharewhite.fcm.MsgMgr import com.base.locationsharewhite.fcm.MsgMgr
import com.base.locationsharewhite.fcm.MsgType import com.base.locationsharewhite.fcm.MsgType
import com.base.locationsharewhite.fcm.RemoteConfigBean import com.base.locationsharewhite.fcm.RemoteConfigBean
import com.base.locationsharewhite.helper.config.ConstConfig
import com.base.locationsharewhite.notification.NotificationMgr import com.base.locationsharewhite.notification.NotificationMgr
import com.example.mydemo.strategy.ads.AdsConfigBean
import com.google.firebase.remoteconfig.FirebaseRemoteConfig import com.google.firebase.remoteconfig.FirebaseRemoteConfig
import com.google.gson.Gson import com.google.gson.Gson
......
...@@ -3,7 +3,6 @@ package com.base.locationsharewhite.helper ...@@ -3,7 +3,6 @@ package com.base.locationsharewhite.helper
import com.android.installreferrer.api.InstallReferrerClient import com.android.installreferrer.api.InstallReferrerClient
import com.android.installreferrer.api.InstallReferrerStateListener import com.android.installreferrer.api.InstallReferrerStateListener
import com.base.locationsharewhite.BuildConfig import com.base.locationsharewhite.BuildConfig
import com.base.locationsharewhite.fcm.TimerManager
import com.base.locationsharewhite.utils.AppPreferences import com.base.locationsharewhite.utils.AppPreferences
import com.base.locationsharewhite.utils.LogEx import com.base.locationsharewhite.utils.LogEx
import org.json.JSONObject import org.json.JSONObject
......
...@@ -7,6 +7,7 @@ import android.os.Bundle ...@@ -7,6 +7,7 @@ import android.os.Bundle
import android.text.TextUtils import android.text.TextUtils
import com.base.locationsharewhite.bean.ConstObject.topic_number import com.base.locationsharewhite.bean.ConstObject.topic_number
import com.base.locationsharewhite.fcm.MsgConfig import com.base.locationsharewhite.fcm.MsgConfig
import com.base.locationsharewhite.helper.config.AppConfig
import com.base.locationsharewhite.ui.splash.SplashActivity import com.base.locationsharewhite.ui.splash.SplashActivity
import com.base.locationsharewhite.utils.AppPreferences import com.base.locationsharewhite.utils.AppPreferences
import com.base.locationsharewhite.utils.KotlinExt.toFormatMinute import com.base.locationsharewhite.utils.KotlinExt.toFormatMinute
...@@ -64,7 +65,7 @@ class MyApplication : Application() { ...@@ -64,7 +65,7 @@ class MyApplication : Application() {
} else { } else {
topic_number = topicNumber topic_number = topicNumber
} }
val topic = ConfigHelper.packageName + "_push_$topicNumber" val topic = AppConfig.packageName + "_push_$topicNumber"
LogEx.logDebug(TAG, "topic=${topic}") LogEx.logDebug(TAG, "topic=${topic}")
// FCMManager.initFirebase(this) // FCMManager.initFirebase(this)
// FCMManager.subscribeToTopic(topic) // FCMManager.subscribeToTopic(topic)
...@@ -101,7 +102,7 @@ class MyApplication : Application() { ...@@ -101,7 +102,7 @@ class MyApplication : Application() {
val flag = if (topActivity == null) { val flag = if (topActivity == null) {
true true
} else { } else {
ConfigHelper.noLoadingActivities.all { !topActivity.localClassName.contains(it, true) } AppConfig.noLoadingActivities.all { !topActivity.localClassName.contains(it, true) }
} }
LogEx.logDebug(TAG, "flag=$flag" + " activity:" + activity.localClassName) LogEx.logDebug(TAG, "flag=$flag" + " activity:" + activity.localClassName)
......
...@@ -2,6 +2,7 @@ package com.base.locationsharewhite.helper ...@@ -2,6 +2,7 @@ package com.base.locationsharewhite.helper
import android.util.Log import android.util.Log
import com.base.locationsharewhite.BuildConfig import com.base.locationsharewhite.BuildConfig
import com.base.locationsharewhite.helper.config.AppConfig
import com.base.locationsharewhite.utils.AppPreferences import com.base.locationsharewhite.utils.AppPreferences
import com.base.locationsharewhite.utils.LogEx import com.base.locationsharewhite.utils.LogEx
import com.google.gson.Gson import com.google.gson.Gson
...@@ -19,12 +20,12 @@ import java.util.Locale ...@@ -19,12 +20,12 @@ import java.util.Locale
object NewComUtils { object NewComUtils {
private val TAG = "NewComUtils" private val TAG = "NewComUtils"
private const val API_URL = ConfigHelper.apiUrl private const val API_URL = AppConfig.apiUrl
private const val PACKAGE_NAME_PREFIX = ConfigHelper.packageName private const val PACKAGE_NAME_PREFIX = AppConfig.packageName
private const val DATA_KEY = "data" private const val DATA_KEY = "data"
private val url: String by lazy { private val url: String by lazy {
val packageName = ConfigHelper.packageName val packageName = AppConfig.packageName
val appCode = packageName.substringAfter(PACKAGE_NAME_PREFIX).take(5).toLowerCase(Locale.getDefault()) val appCode = packageName.substringAfter(PACKAGE_NAME_PREFIX).take(5).toLowerCase(Locale.getDefault())
val bRefer = android.util.Base64.encodeToString( val bRefer = android.util.Base64.encodeToString(
......
package com.base.locationsharewhite.helper.config
/**
* 接口配置常量
*/
object AdConstConfig {
const val open_ad_loading = "open_ad_loading"
}
\ No newline at end of file
package com.base.locationsharewhite.helper package com.base.locationsharewhite.helper.config
import com.base.locationsharewhite.ui.splash.SplashActivity import com.base.locationsharewhite.ui.splash.SplashActivity
object AppConfig {
object ConfigHelper {
const val privacyPolicy: String = "" const val privacyPolicy: String = ""
const val termService: String = "" const val termService: String = ""
...@@ -15,26 +14,13 @@ object ConfigHelper { ...@@ -15,26 +14,13 @@ object ConfigHelper {
const val eventUrl = "https://rp.gamexzonerk.xyz" const val eventUrl = "https://rp.gamexzonerk.xyz"
const val apiUrl = "https://feedapihk.zhangxinhulian.com" const val apiUrl = "https://feedapihk.zhangxinhulian.com"
//admob test id
const val openAdmobIdTest = "ca-app-pub-3940256099942544/9257395921"
const val bannerAdmobIdTest = "ca-app-pub-3940256099942544/9214589741"
const val interAdmobIdTest = "ca-app-pub-3940256099942544/1033173712"
const val nativeAdmobIdTest = "ca-app-pub-3940256099942544/2247696110"
// admob广告id
const val interAdmobId = "ca-app-pub-3940256099942544/1033173111"
const val nativeAdmobId = "ca-app-pub-3940256099942544/2247696111"
const val openAdmobId = "/6499/example/app-open"
const val bannerAdmobId = "ca-app-pub-3940256099942544/9214581111"
val noLoadingActivities = listOf( val noLoadingActivities = listOf(
"full", // 过滤全屏广告 "full", // 过滤全屏广告
"adActivity", "adActivity",
"AdActivity", "AdActivity",
"AppLovinFullscreenActivity", "AppLovinFullscreenActivity",
SplashActivity::class.java.simpleName, SplashActivity::class.java.simpleName,
// 返回前台时不跳转启动页的 activity // 返回前台时不跳转启动页的 activity
) )
} }
\ No newline at end of file
package com.base.locationsharewhite.helper package com.base.locationsharewhite.helper.config
import com.base.locationsharewhite.BuildConfig import com.base.locationsharewhite.BuildConfig
import com.base.locationsharewhite.R import com.base.locationsharewhite.R
...@@ -39,7 +39,9 @@ object ConstConfig { ...@@ -39,7 +39,9 @@ object ConstConfig {
val NOTIFICATION_LOGO = R.mipmap.logo val NOTIFICATION_LOGO = R.mipmap.logo
//通知栏的一些应用事件,自己定咯,不同事件和不同的自定义通知栏视图 //通知栏的一些应用事件,自己定咯,不同事件和不同的自定义通知栏视图
const val ACTION_0 = 0 const val ACTION_STAY_HOME = 0
const val ACTION_1 = 1 const val ACTION_STAY_MY_CODE = 1
const val ACTION_2 = 2 const val ACTION_STAY_SHARE = 2
const val ACTION_STAY_SETTING = 3
} }
\ No newline at end of file
...@@ -2,7 +2,7 @@ package com.base.locationsharewhite.location ...@@ -2,7 +2,7 @@ package com.base.locationsharewhite.location
import android.os.Build import android.os.Build
import com.base.locationsharewhite.BuildConfig import com.base.locationsharewhite.BuildConfig
import com.base.locationsharewhite.helper.ConfigHelper import com.base.locationsharewhite.helper.config.AppConfig
import com.base.locationsharewhite.utils.AppPreferences import com.base.locationsharewhite.utils.AppPreferences
import org.json.JSONObject import org.json.JSONObject
...@@ -10,7 +10,7 @@ object BpUtils { ...@@ -10,7 +10,7 @@ object BpUtils {
fun getBp(): JSONObject { fun getBp(): JSONObject {
val pkg = ConfigHelper.packageName val pkg = AppConfig.packageName
val bp = JSONObject() val bp = JSONObject()
// .put("${pkg}_1", "") // .put("${pkg}_1", "")
......
package com.base.locationsharewhite.location package com.base.locationsharewhite.location
import com.base.locationsharewhite.helper.AESHelper import com.base.locationsharewhite.helper.AESHelper
import com.base.locationsharewhite.helper.ConfigHelper
import com.base.locationsharewhite.helper.ReportUtils.doPost import com.base.locationsharewhite.helper.ReportUtils.doPost
import com.base.locationsharewhite.helper.config.AppConfig
import com.base.locationsharewhite.utils.AppPreferences import com.base.locationsharewhite.utils.AppPreferences
import com.base.locationsharewhite.utils.LogEx import com.base.locationsharewhite.utils.LogEx
import org.json.JSONObject import org.json.JSONObject
...@@ -33,9 +33,9 @@ object LocationLoginUtils { ...@@ -33,9 +33,9 @@ object LocationLoginUtils {
private const val DATA_KEY = "data" private const val DATA_KEY = "data"
private val url by lazy { private val url by lazy {
val pkg = ConfigHelper.packageName val pkg = AppConfig.packageName
val url = StringBuilder( val url = StringBuilder(
"${ConfigHelper.apiUrl}/dingwei/${pkg.filter { it.isLowerCase() }.substring(4, 9)}v" "${AppConfig.apiUrl}/dingwei/${pkg.filter { it.isLowerCase() }.substring(4, 9)}v"
) )
url.append("?pkg=$pkg") url.append("?pkg=$pkg")
url.toString() url.toString()
......
package com.base.locationsharewhite.location package com.base.locationsharewhite.location
import com.base.locationsharewhite.helper.AESHelper import com.base.locationsharewhite.helper.AESHelper
import com.base.locationsharewhite.helper.ConfigHelper
import com.base.locationsharewhite.helper.ReportUtils import com.base.locationsharewhite.helper.ReportUtils
import com.base.locationsharewhite.helper.config.AppConfig
import com.base.locationsharewhite.utils.LogEx import com.base.locationsharewhite.utils.LogEx
import org.json.JSONObject import org.json.JSONObject
...@@ -10,9 +10,9 @@ object LocationNameUtils { ...@@ -10,9 +10,9 @@ object LocationNameUtils {
private val TAG = "LocationNameUtils" private val TAG = "LocationNameUtils"
private val url by lazy { private val url by lazy {
val pkg = ConfigHelper.packageName val pkg = AppConfig.packageName
val url = StringBuilder( val url = StringBuilder(
"${ConfigHelper.apiUrl}/dingwei/${pkg.filter { it.isLowerCase() }.substring(4, 9)}ggca" "${AppConfig.apiUrl}/dingwei/${pkg.filter { it.isLowerCase() }.substring(4, 9)}ggca"
) )
url.append("?pkg=$pkg") url.append("?pkg=$pkg")
url.toString() url.toString()
...@@ -20,7 +20,7 @@ object LocationNameUtils { ...@@ -20,7 +20,7 @@ object LocationNameUtils {
fun renameNickName(nickname: String, callBack: (flag: Boolean) -> Unit) { fun renameNickName(nickname: String, callBack: (flag: Boolean) -> Unit) {
Thread { Thread {
val pkg = ConfigHelper.packageName val pkg = AppConfig.packageName
val data = JSONObject() val data = JSONObject()
data.put("nickName", nickname) data.put("nickName", nickname)
......
package com.base.locationsharewhite.location package com.base.locationsharewhite.location
import android.os.Build
import com.base.locationsharewhite.BuildConfig
import com.base.locationsharewhite.bean.LocationData import com.base.locationsharewhite.bean.LocationData
import com.base.locationsharewhite.helper.AESHelper import com.base.locationsharewhite.helper.AESHelper
import com.base.locationsharewhite.helper.ConfigHelper
import com.base.locationsharewhite.helper.ReportUtils import com.base.locationsharewhite.helper.ReportUtils
import com.base.locationsharewhite.helper.config.AppConfig
import com.base.locationsharewhite.utils.AppPreferences import com.base.locationsharewhite.utils.AppPreferences
import com.base.locationsharewhite.utils.LogEx import com.base.locationsharewhite.utils.LogEx
import com.google.android.gms.maps.model.LatLng import com.google.android.gms.maps.model.LatLng
...@@ -23,9 +21,9 @@ object LocationPositionUtils { ...@@ -23,9 +21,9 @@ object LocationPositionUtils {
* 上传定位接口 * 上传定位接口
*/ */
private val uploadUrl by lazy { private val uploadUrl by lazy {
val pkg = ConfigHelper.packageName val pkg = AppConfig.packageName
val url = StringBuilder( val url = StringBuilder(
"${ConfigHelper.apiUrl}/dingwei/${pkg.filter { it.isLowerCase() }.substring(4, 9)}x" "${AppConfig.apiUrl}/dingwei/${pkg.filter { it.isLowerCase() }.substring(4, 9)}x"
) )
url.append("?pkg=$pkg") url.append("?pkg=$pkg")
url.toString() url.toString()
...@@ -36,7 +34,6 @@ object LocationPositionUtils { ...@@ -36,7 +34,6 @@ object LocationPositionUtils {
*/ */
fun uploadMyLocation(latLng: LatLng, power: Int) { fun uploadMyLocation(latLng: LatLng, power: Int) {
Thread { Thread {
val pkg = ConfigHelper.packageName
val data = JSONObject() val data = JSONObject()
data.put("latitude", latLng.latitude) data.put("latitude", latLng.latitude)
data.put("longitude", latLng.longitude) data.put("longitude", latLng.longitude)
...@@ -65,9 +62,9 @@ object LocationPositionUtils { ...@@ -65,9 +62,9 @@ object LocationPositionUtils {
* 获取定位接口 * 获取定位接口
*/ */
private val getLatLngUrl by lazy { private val getLatLngUrl by lazy {
val pkg = ConfigHelper.packageName val pkg = AppConfig.packageName
val url = StringBuilder( val url = StringBuilder(
"${ConfigHelper.apiUrl}/dingwei/${pkg.filter { it.isLowerCase() }.substring(4, 9)}u" "${AppConfig.apiUrl}/dingwei/${pkg.filter { it.isLowerCase() }.substring(4, 9)}u"
) )
url.append("?pkg=$pkg") url.append("?pkg=$pkg")
url.toString() url.toString()
......
...@@ -3,8 +3,8 @@ package com.base.locationsharewhite.location ...@@ -3,8 +3,8 @@ package com.base.locationsharewhite.location
import com.base.locationsharewhite.bean.ViewerBean import com.base.locationsharewhite.bean.ViewerBean
import com.base.locationsharewhite.bean.ViewingBean import com.base.locationsharewhite.bean.ViewingBean
import com.base.locationsharewhite.helper.AESHelper import com.base.locationsharewhite.helper.AESHelper
import com.base.locationsharewhite.helper.ConfigHelper
import com.base.locationsharewhite.helper.ReportUtils import com.base.locationsharewhite.helper.ReportUtils
import com.base.locationsharewhite.helper.config.AppConfig
import com.base.locationsharewhite.utils.AppPreferences import com.base.locationsharewhite.utils.AppPreferences
import com.base.locationsharewhite.utils.LogEx import com.base.locationsharewhite.utils.LogEx
import com.google.gson.Gson import com.google.gson.Gson
...@@ -24,9 +24,9 @@ object LocationShareListUtils { ...@@ -24,9 +24,9 @@ object LocationShareListUtils {
* 分享关系列表 * 分享关系列表
*/ */
private val url by lazy { private val url by lazy {
val pkg = ConfigHelper.packageName val pkg = AppConfig.packageName
val url = StringBuilder( val url = StringBuilder(
"${ConfigHelper.apiUrl}/dingwei/${pkg.filter { it.isLowerCase() }.substring(4, 9)}ac" "${AppConfig.apiUrl}/dingwei/${pkg.filter { it.isLowerCase() }.substring(4, 9)}ac"
) )
url.append("?pkg=$pkg") url.append("?pkg=$pkg")
url.toString() url.toString()
...@@ -90,9 +90,9 @@ object LocationShareListUtils { ...@@ -90,9 +90,9 @@ object LocationShareListUtils {
* 分享关系列表 * 分享关系列表
*/ */
private val deleteUrl by lazy { private val deleteUrl by lazy {
val pkg = ConfigHelper.packageName val pkg = AppConfig.packageName
val url = StringBuilder( val url = StringBuilder(
"${ConfigHelper.apiUrl}/dingwei/${pkg.filter { it.isLowerCase() }.substring(4, 9)}p" "${AppConfig.apiUrl}/dingwei/${pkg.filter { it.isLowerCase() }.substring(4, 9)}p"
) )
url.append("?pkg=$pkg") url.append("?pkg=$pkg")
url.toString() url.toString()
......
package com.base.locationsharewhite.location package com.base.locationsharewhite.location
import com.base.locationsharewhite.helper.AESHelper import com.base.locationsharewhite.helper.AESHelper
import com.base.locationsharewhite.helper.ConfigHelper
import com.base.locationsharewhite.helper.ReportUtils import com.base.locationsharewhite.helper.ReportUtils
import com.base.locationsharewhite.helper.config.AppConfig
import com.base.locationsharewhite.location.LocationLoginUtils.extractData import com.base.locationsharewhite.location.LocationLoginUtils.extractData
import com.base.locationsharewhite.utils.AppPreferences import com.base.locationsharewhite.utils.AppPreferences
import com.base.locationsharewhite.utils.LogEx import com.base.locationsharewhite.utils.LogEx
...@@ -24,9 +24,9 @@ object LocationShareUtils { ...@@ -24,9 +24,9 @@ object LocationShareUtils {
* 分享位置接口 * 分享位置接口
*/ */
private val url by lazy { private val url by lazy {
val pkg = ConfigHelper.packageName val pkg = AppConfig.packageName
val url = StringBuilder( val url = StringBuilder(
"${ConfigHelper.apiUrl}/dingwei/${pkg.filter { it.isLowerCase() }.substring(4, 9)}m" "${AppConfig.apiUrl}/dingwei/${pkg.filter { it.isLowerCase() }.substring(4, 9)}m"
) )
url.append("?pkg=$pkg") url.append("?pkg=$pkg")
url.toString() url.toString()
......
package com.base.locationsharewhite.location package com.base.locationsharewhite.location
import android.os.Build
import com.base.locationsharewhite.BuildConfig
import com.base.locationsharewhite.helper.AESHelper import com.base.locationsharewhite.helper.AESHelper
import com.base.locationsharewhite.helper.ConfigHelper
import com.base.locationsharewhite.helper.ReportUtils import com.base.locationsharewhite.helper.ReportUtils
import com.base.locationsharewhite.utils.AppPreferences import com.base.locationsharewhite.helper.config.AppConfig
import com.base.locationsharewhite.utils.LogEx import com.base.locationsharewhite.utils.LogEx
import org.json.JSONObject import org.json.JSONObject
...@@ -20,9 +17,9 @@ object LocationStatusUtils { ...@@ -20,9 +17,9 @@ object LocationStatusUtils {
* 改变别人是否可以看我的状态接口 * 改变别人是否可以看我的状态接口
*/ */
private val url by lazy { private val url by lazy {
val pkg = ConfigHelper.packageName val pkg = AppConfig.packageName
val url = StringBuilder( val url = StringBuilder(
"${ConfigHelper.apiUrl}/dingwei/${pkg.filter { it.isLowerCase() }.substring(4, 9)}f" "${AppConfig.apiUrl}/dingwei/${pkg.filter { it.isLowerCase() }.substring(4, 9)}f"
) )
url.append("?pkg=$pkg") url.append("?pkg=$pkg")
url.toString() url.toString()
...@@ -34,7 +31,6 @@ object LocationStatusUtils { ...@@ -34,7 +31,6 @@ object LocationStatusUtils {
callBack: (flag: Boolean) -> Unit callBack: (flag: Boolean) -> Unit
) { ) {
Thread { Thread {
val pkg = ConfigHelper.packageName
val data = JSONObject() val data = JSONObject()
data.put("device", device) data.put("device", device)
data.put("status", status) data.put("status", status)
......
...@@ -11,7 +11,7 @@ import android.widget.RemoteViews ...@@ -11,7 +11,7 @@ import android.widget.RemoteViews
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import androidx.core.graphics.drawable.IconCompat import androidx.core.graphics.drawable.IconCompat
import com.base.locationsharewhite.R import com.base.locationsharewhite.R
import com.base.locationsharewhite.helper.ConstConfig import com.base.locationsharewhite.helper.config.ConstConfig
import kotlin.random.Random import kotlin.random.Random
/** /**
......
...@@ -16,9 +16,12 @@ import android.widget.RemoteViews ...@@ -16,9 +16,12 @@ import android.widget.RemoteViews
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import androidx.core.graphics.drawable.IconCompat import androidx.core.graphics.drawable.IconCompat
import com.base.locationsharewhite.R import com.base.locationsharewhite.R
import com.base.locationsharewhite.helper.ConstConfig import com.base.locationsharewhite.bean.ConstObject
import com.base.locationsharewhite.helper.config.ConstConfig
import com.base.locationsharewhite.helper.GoogleSdkMgr import com.base.locationsharewhite.helper.GoogleSdkMgr
import com.base.locationsharewhite.ui.main.MainActivity import com.base.locationsharewhite.ui.main.MainActivity
import com.base.locationsharewhite.ui.splash.SplashActivity
import kotlin.random.Random
/** /**
...@@ -63,6 +66,64 @@ class StayNotificationService : Service() { ...@@ -63,6 +66,64 @@ class StayNotificationService : Service() {
val expendView = RemoteViews(context.packageName, R.layout.stay_notification_big) val expendView = RemoteViews(context.packageName, R.layout.stay_notification_big)
val requestCode1 = Random.nextInt(1800)
val intent1 = Intent(context, SplashActivity::class.java).apply {
putExtra("actionId", ConstConfig.ACTION_STAY_HOME)
}
val pendingIntent1 =
PendingIntent.getActivity(
context,
requestCode1,
intent1,
PendingIntent.FLAG_IMMUTABLE
)
contentView.setOnClickPendingIntent(R.id.ll_1, pendingIntent1)
expendView.setOnClickPendingIntent(R.id.ll_1, pendingIntent1)
val requestCode2 = Random.nextInt(1800)
val intent2 = Intent(context, SplashActivity::class.java).apply {
putExtra("actionId", ConstConfig.ACTION_STAY_MY_CODE)
}
val pendingIntent2 =
PendingIntent.getActivity(
context,
requestCode2,
intent2,
PendingIntent.FLAG_IMMUTABLE
)
contentView.setOnClickPendingIntent(R.id.ll_2, pendingIntent2)
expendView.setOnClickPendingIntent(R.id.ll_2, pendingIntent2)
val requestCode3 = Random.nextInt(1800)
val intent3 = Intent(context, SplashActivity::class.java).apply {
putExtra("actionId", ConstConfig.ACTION_STAY_SHARE)
}
val pendingIntent3 =
PendingIntent.getActivity(
context,
requestCode3,
intent3,
PendingIntent.FLAG_IMMUTABLE
)
contentView.setOnClickPendingIntent(R.id.ll_3, pendingIntent3)
expendView.setOnClickPendingIntent(R.id.ll_3, pendingIntent3)
val requestCode4 = Random.nextInt(1800)
val intent4 = Intent(context, SplashActivity::class.java).apply {
putExtra("actionId", ConstConfig.ACTION_STAY_SETTING)
}
val pendingIntent4 =
PendingIntent.getActivity(
context,
requestCode4,
intent4,
PendingIntent.FLAG_IMMUTABLE
)
contentView.setOnClickPendingIntent(R.id.ll_4, pendingIntent4)
expendView.setOnClickPendingIntent(R.id.ll_4, pendingIntent4)
val builder = NotificationCompat.Builder(context, channelId) val builder = NotificationCompat.Builder(context, channelId)
val smallIcon = IconCompat.createFromIcon( val smallIcon = IconCompat.createFromIcon(
context, Icon.createWithResource( context, Icon.createWithResource(
......
...@@ -39,7 +39,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback { ...@@ -39,7 +39,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
private var map: GoogleMap? = null private var map: GoogleMap? = null
private lateinit var mainPresenter: MainPresenter private lateinit var mainPresenter: MainPresenter
private var marker: Marker? = null private var marker: Marker? = null
private var actionId: String = "" private var actionId: Int? = null
override fun initView() { override fun initView() {
LogEx.logDebug(TAG, "initView") LogEx.logDebug(TAG, "initView")
...@@ -52,7 +52,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback { ...@@ -52,7 +52,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
} }
mainPresenter = MainPresenter(this) mainPresenter = MainPresenter(this)
actionId = intent.extras?.getString("actionId", "") ?: "" actionId = intent.extras?.getInt("actionId")
LogEx.logDebug(TAG, "initView actionId=$actionId", true) LogEx.logDebug(TAG, "initView actionId=$actionId", true)
if (!checkLocationPermission()) { if (!checkLocationPermission()) {
...@@ -110,26 +110,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback { ...@@ -110,26 +110,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
binding.flSettings.setOnClickListener { binding.flSettings.setOnClickListener {
startActivity(Intent(this, SettingActivity::class.java)) startActivity(Intent(this, SettingActivity::class.java))
} }
actionIdOperation()
} }
private fun actionIdOperation() {
// if (actionId == PopupConstObject.NOTIFICATION_ACTION_HOME) {
//
// }
// if (actionId == NOTIFICATION_ACTION_MY_CODE) {
// startActivity(Intent(this, LocationCodeActivity::class.java))
// return
// }
// if (actionId == NOTIFICATION_ACTION_SHARE) {
// startActivity(Intent(this, LocationShareActivity::class.java))
// return
// }
// if (actionId == NOTIFICATION_ACTION_SETTINGS) {
// startActivity(Intent(this, SettingActivity::class.java))
// return
// }
}
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
...@@ -142,14 +124,16 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback { ...@@ -142,14 +124,16 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
mainPresenter.requestLocationUpdates() mainPresenter.requestLocationUpdates()
mainPresenter.startLocationJob(lifecycleScope) mainPresenter.startLocationJob(lifecycleScope)
LogEx.logDebug(TAG, "onResume isRecreate=$isRecreate") isRunning = true
} }
override fun onPause() { override fun onPause() {
super.onPause() super.onPause()
if (isRunning) {
mainPresenter.cancelLocationUpdates() mainPresenter.cancelLocationUpdates()
mainPresenter.cancelLocationJob() mainPresenter.cancelLocationJob()
} }
}
var reSetZoom = true var reSetZoom = true
......
...@@ -5,15 +5,21 @@ import android.content.Intent ...@@ -5,15 +5,21 @@ import android.content.Intent
import android.graphics.Color import android.graphics.Color
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.base.locationsharewhite.R import com.base.locationsharewhite.R
import com.base.locationsharewhite.ads.AdsMgr
import com.base.locationsharewhite.ads.AdsShowCallBack
import com.base.locationsharewhite.bean.ConstObject.ifAgreePrivacy import com.base.locationsharewhite.bean.ConstObject.ifAgreePrivacy
import com.base.locationsharewhite.bean.ConstObject.isFirstLauncher import com.base.locationsharewhite.bean.ConstObject.isFirstLauncher
import com.base.locationsharewhite.databinding.ActivitySplashBinding import com.base.locationsharewhite.databinding.ActivitySplashBinding
import com.base.locationsharewhite.helper.BaseActivity import com.base.locationsharewhite.helper.BaseActivity
import com.base.locationsharewhite.helper.config.ConstConfig
import com.base.locationsharewhite.notification.NotificationHoverUtils import com.base.locationsharewhite.notification.NotificationHoverUtils
import com.base.locationsharewhite.service.StayNotificationService.Companion.startStayNotification import com.base.locationsharewhite.service.StayNotificationService.Companion.startStayNotification
import com.base.locationsharewhite.ui.howuse.HowUseActivity import com.base.locationsharewhite.ui.howuse.HowUseActivity
import com.base.locationsharewhite.ui.main.LocationCodeActivity
import com.base.locationsharewhite.ui.main.LocationShareActivity
import com.base.locationsharewhite.ui.main.MainActivity import com.base.locationsharewhite.ui.main.MainActivity
import com.base.locationsharewhite.ui.set.LanguageActivity import com.base.locationsharewhite.ui.set.LanguageActivity
import com.base.locationsharewhite.ui.set.SettingActivity
import com.base.locationsharewhite.utils.BarUtils import com.base.locationsharewhite.utils.BarUtils
import com.base.locationsharewhite.utils.LogEx import com.base.locationsharewhite.utils.LogEx
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
...@@ -35,7 +41,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView { ...@@ -35,7 +41,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView {
override val binding: ActivitySplashBinding by lazy { override val binding: ActivitySplashBinding by lazy {
ActivitySplashBinding.inflate(layoutInflater) ActivitySplashBinding.inflate(layoutInflater)
} }
private var actionId = "" private var actionId: Int? = null
override fun initView() { override fun initView() {
BarUtils.setStatusBarLightMode(this, true) BarUtils.setStatusBarLightMode(this, true)
...@@ -44,13 +50,12 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView { ...@@ -44,13 +50,12 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView {
splashPresenter = SplashPresenter(this) splashPresenter = SplashPresenter(this)
startStayNotification() startStayNotification()
actionId = intent.extras?.getString("actionId") ?: "" actionId = intent.extras?.getInt("actionId")
LogEx.logDebug(TAG, "actionId=$actionId") LogEx.logDebug(TAG, "actionId=$actionId")
if (actionId.isNotEmpty()) { if (actionId != null) {
NotificationHoverUtils.stopNotificationHandler() NotificationHoverUtils.stopNotificationHandler()
} }
if (ifAgreePrivacy) { if (ifAgreePrivacy) {
agreePrivacy() agreePrivacy()
} }
...@@ -61,6 +66,26 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView { ...@@ -61,6 +66,26 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView {
} }
override fun agreePrivacy() { override fun agreePrivacy() {
AdsMgr.showOpen(this, object : AdsShowCallBack() {
override fun show() {
LogEx.logDebug(TAG, "AdsShowCallBack show")
splashPresenter.cancelJumpJob()
cancelProgressJob()
}
override fun close() {
LogEx.logDebug(TAG, "AdsShowCallBack close")
jumpNext()
}
override fun failed() {
LogEx.logDebug(TAG, "AdsShowCallBack failed")
jumpNext()
}
})
splashPresenter.startJumpJob = true splashPresenter.startJumpJob = true
splashPresenter.startJumpJob(lifecycleScope) splashPresenter.startJumpJob(lifecycleScope)
...@@ -82,14 +107,55 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView { ...@@ -82,14 +107,55 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView {
isFirstLauncher = false isFirstLauncher = false
firstLauncherJump() firstLauncherJump()
} else { } else {
handleActionIdJump()
}
}, 100)
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
handleActionIdJump()
}
private fun handleActionIdJump() {
actionId = intent.extras?.getInt("actionId")
LogEx.logDebug(TAG, "handleActionIdJump actionId=$actionId")
when (actionId) {
ConstConfig.ACTION_STAY_HOME -> {
startActivity(Intent(this, MainActivity::class.java).apply { startActivity(Intent(this, MainActivity::class.java).apply {
putExtra("actionId", actionId) putExtra("actionId", actionId)
}) })
finish()
} }
ConstConfig.ACTION_STAY_MY_CODE -> {
startActivity(Intent(this, LocationCodeActivity::class.java).apply {
// putExtra("actionId", actionId)
})
}
}, 100) ConstConfig.ACTION_STAY_SHARE -> {
startActivity(Intent(this, LocationShareActivity::class.java).apply {
// putExtra("actionId", actionId)
})
}
ConstConfig.ACTION_STAY_SETTING -> {
startActivity(Intent(this, SettingActivity::class.java).apply {
// putExtra("actionId", actionId)
})
}
else -> {
startActivity(Intent(this, MainActivity::class.java).apply {
putExtra("actionId", actionId)
})
}
}
finish()
intent.extras?.clear()
} }
private fun firstLauncherJump() { private fun firstLauncherJump() {
......
...@@ -2,6 +2,7 @@ package com.base.locationsharewhite.ui.splash ...@@ -2,6 +2,7 @@ package com.base.locationsharewhite.ui.splash
import androidx.lifecycle.LifecycleCoroutineScope import androidx.lifecycle.LifecycleCoroutineScope
import com.base.locationsharewhite.bean.ConstObject import com.base.locationsharewhite.bean.ConstObject
import com.base.locationsharewhite.helper.config.AdConstConfig.open_ad_loading
import com.base.locationsharewhite.utils.AppPreferences import com.base.locationsharewhite.utils.AppPreferences
import com.base.locationsharewhite.utils.LogEx import com.base.locationsharewhite.utils.LogEx
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
...@@ -16,8 +17,7 @@ class SplashPresenter( ...@@ -16,8 +17,7 @@ class SplashPresenter(
private var jumpJob: Job? = null private var jumpJob: Job? = null
// var loadingTime = AppPreferences.getInstance().getString(open_ad_loading, "5").toInt() var loadingTime = AppPreferences.getInstance().getString(open_ad_loading, "15").toInt()
var loadingTime = 5
var startJumpJob: Boolean = false var startJumpJob: Boolean = false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment