Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lib_base
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sikang
lib_base
Commits
c0f39ef6
Commit
c0f39ef6
authored
Jan 30, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove firebase
parent
8232345e
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
127 additions
and
138 deletions
+127
-138
build.gradle
+8
-6
src/main/AndroidManifest.xml
+17
-17
src/main/java/com/common/base/BaseActivity.java
+7
-10
src/main/java/com/common/service/MsgHandleService.java
+69
-76
src/main/java/com/common/service/MsgInstanceIdService.java
+19
-18
src/main/java/tech/starwin/LibConfig.java
+2
-4
src/main/java/tech/starwin/network/DefaultHeaderAddInterceptor.java
+0
-2
src/main/java/tech/starwin/utils/LogUtils.java
+0
-1
src/main/java/tech/starwin/utils/TrackEventHelper.java
+5
-4
No files found.
build.gradle
View file @
c0f39ef6
...
@@ -98,20 +98,22 @@ dependencies {
...
@@ -98,20 +98,22 @@ dependencies {
api
'com.squareup.retrofit2:converter-gson:2.4.0'
api
'com.squareup.retrofit2:converter-gson:2.4.0'
api
'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
api
'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
//
firebase core
//
firebase core
api
'com.google.firebase:firebase-core:16.0.3'
//
api 'com.google.firebase:firebase-core:16.0.3'
//
firebase cloud message
//
firebase cloud message
api
'com.google.firebase:firebase-messaging:17.3.2'
//
api 'com.google.firebase:firebase-messaging:17.3.2'
//firebase remoteConfig
//firebase remoteConfig
// api 'com.google.firebase:firebase-config:16.0.0'
// api 'com.google.firebase:firebase-config:16.0.0'
api
'com.android.installreferrer:installreferrer:1.0'
api
'com.android.installreferrer:installreferrer:1.0'
api
'com.google.android.gms:play-services-auth:15.0.1'
api
'com.google.android.gms:play-services-auth-api-phone:15.0.1'
api
'com.google.android.gms:play-services-ads:15.0.1'
//facebook accountKit SDK
//facebook accountKit SDK
api
'com.facebook.android:account-kit-sdk:4.37.0'
api
'com.facebook.android:account-kit-sdk:4.37.0'
api
'com.google.android.gms:play-services-auth:15.0.1'
api
'com.google.android.gms:play-services-auth-api-phone:15.0.1'
//facebook SDK
//facebook SDK
// api 'com.facebook.android:facebook-android-sdk:[4,5)'
// api 'com.facebook.android:facebook-android-sdk:[4,5)'
...
...
src/main/AndroidManifest.xml
View file @
c0f39ef6
...
@@ -22,24 +22,24 @@
...
@@ -22,24 +22,24 @@
android:name=
"android.max_aspect"
android:name=
"android.max_aspect"
android:value=
"2.5"
/>
android:value=
"2.5"
/>
<!-- TODO - Firebase配置-->
<!--FireBase 推送-->
<!--FireBase 推送-->
<meta-data
<!--<meta-data-->
android:name=
"com.google.firebase.messaging.default_notification_channel_id"
<!--android:name="com.google.firebase.messaging.default_notification_channel_id"-->
android:value=
"${CHANNEL_NAME}"
/>
<!--android:value="${CHANNEL_NAME}" />-->
<meta-data
<!--<meta-data-->
android:name=
"firebase_messaging_auto_init_enabled"
<!--android:name="firebase_messaging_auto_init_enabled"-->
android:value=
"false"
/>
<!--android:value="false" />-->
<!--<service android:name="com.common.service.MsgHandleService">-->
<service
android:name=
"com.common.service.MsgHandleService"
>
<!--<intent-filter>-->
<intent-filter>
<!--<action android:name="com.google.firebase.MESSAGING_EVENT" />-->
<action
android:name=
"com.google.firebase.MESSAGING_EVENT"
/>
<!--</intent-filter>-->
</intent-filter>
<!--</service>-->
</service>
<!--<service android:name="com.common.service.MsgInstanceIdService">-->
<service
android:name=
"com.common.service.MsgInstanceIdService"
>
<!--<intent-filter>-->
<intent-filter>
<!--<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />-->
<action
android:name=
"com.google.firebase.INSTANCE_ID_EVENT"
/>
<!--</intent-filter>-->
</intent-filter>
<!--</service>-->
</service>
<!--AutoSize-->
<!--AutoSize-->
<meta-data
<meta-data
...
...
src/main/java/com/common/base/BaseActivity.java
View file @
c0f39ef6
...
@@ -10,14 +10,12 @@ import android.support.annotation.Nullable;
...
@@ -10,14 +10,12 @@ import android.support.annotation.Nullable;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.widget.DrawerLayout
;
import
android.support.v4.widget.DrawerLayout
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.app.AppCompatActivity
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.FrameLayout
;
import
android.widget.FrameLayout
;
import
com.google.firebase.messaging.RemoteMessage
;
import
com.qmuiteam.qmui.util.QMUIStatusBarHelper
;
import
com.qmuiteam.qmui.util.QMUIStatusBarHelper
;
import
com.trello.rxlifecycle2.LifecycleTransformer
;
import
com.trello.rxlifecycle2.LifecycleTransformer
;
import
com.trello.rxlifecycle2.RxLifecycle
;
import
com.trello.rxlifecycle2.RxLifecycle
;
...
@@ -30,10 +28,8 @@ import tech.starwin.LibConfig;
...
@@ -30,10 +28,8 @@ import tech.starwin.LibConfig;
import
tech.starwin.R
;
import
tech.starwin.R
;
import
tech.starwin.base.BasePresenter
;
import
tech.starwin.base.BasePresenter
;
import
com.common.service.MsgHandleService
;
import
tech.starwin.mvp.IView
;
import
tech.starwin.mvp.IView
;
import
tech.starwin.utils.LogUtils
;
import
tech.starwin.utils.context_utils.AppLanguageUtils
;
import
tech.starwin.utils.context_utils.AppLanguageUtils
;
import
tech.starwin.utils.PresenterHoler
;
import
tech.starwin.utils.PresenterHoler
;
import
tech.starwin.utils.context_utils.FragmentLauncher
;
import
tech.starwin.utils.context_utils.FragmentLauncher
;
...
@@ -101,13 +97,14 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
...
@@ -101,13 +97,14 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
@Override
@Override
protected
void
onStart
()
{
protected
void
onStart
()
{
super
.
onStart
();
super
.
onStart
();
//TODO - FireBase配置
//如果是通过FireBase CloudMessage 调起的界面,将消息交给Service处理
//如果是通过FireBase CloudMessage 调起的界面,将消息交给Service处理
String
action
=
getIntent
().
getAction
()
==
null
?
""
:
getIntent
().
getAction
();
//
String action = getIntent().getAction() == null ? "" : getIntent().getAction();
String
from
=
getIntent
().
getStringExtra
(
"from"
);
//
String from = getIntent().getStringExtra("from");
if
(
action
.
equals
(
"android.intent.action.MAIN"
)
&&
//
if (action.equals("android.intent.action.MAIN") &&
!
TextUtils
.
isEmpty
(
from
))
{
//
!TextUtils.isEmpty(from)) {
MsgHandleService
.
handleMsg
(
this
,
new
RemoteMessage
(
getIntent
().
getExtras
()));
//
MsgHandleService.handleMsg(this, new RemoteMessage(getIntent().getExtras()));
}
//
}
lifecycleSubject
.
onNext
(
ActivityEvent
.
START
);
lifecycleSubject
.
onNext
(
ActivityEvent
.
START
);
}
}
...
...
src/main/java/com/common/service/MsgHandleService.java
View file @
c0f39ef6
package
com
.
common
.
service
;
//package com.common.service;
//
//
import
android.content.Context
;
//import android.content.Context;
import
android.content.Intent
;
//import android.content.Intent;
import
android.support.v4.app.NotificationCompat
;
//import android.support.v4.app.NotificationCompat;
//
import
com.google.firebase.messaging.FirebaseMessagingService
;
//import com.google.firebase.messaging.FirebaseMessagingService;
import
com.google.firebase.messaging.RemoteMessage
;
//import com.google.firebase.messaging.RemoteMessage;
import
com.trello.rxlifecycle2.LifecycleTransformer
;
//
import
com.trello.rxlifecycle2.android.ActivityEvent
;
//import org.greenrobot.eventbus.EventBus;
//
import
org.greenrobot.eventbus.EventBus
;
//import tech.starwin.LibConfig;
//import tech.starwin.mvp.presenter.UserPresenter;
import
javax.annotation.Nonnull
;
//import tech.starwin.utils.PreferencesManager;
//import tech.starwin.utils.ui_utils.UIHelper;
import
io.reactivex.Observable
;
//
import
tech.starwin.LibConfig
;
//// TODO - Firebase配置
import
tech.starwin.mvp.IView
;
///**
import
tech.starwin.mvp.presenter.UserPresenter
;
// * Created by SiKang on 2018/9/27.
import
tech.starwin.utils.PreferencesManager
;
// */
import
tech.starwin.utils.PresenterHoler
;
//public class MsgHandleService extends FirebaseMessagingService {
import
tech.starwin.utils.ui_utils.UIHelper
;
// public static final String TAG = "MsgHandleService";
// public static final String RECEIVED_FIREBASE_MESSAGE = "action.receivedFireBaseMessage";
//
/**
// @Override
* Created by SiKang on 2018/9/27.
// public void onNewToken(String token) {
*/
// PreferencesManager.get().saveFireBaseMessagingToken(token);
public
class
MsgHandleService
extends
FirebaseMessagingService
{
// new UserPresenter().uploadFirebaseToken(token);
public
static
final
String
TAG
=
"MsgHandleService"
;
// }
public
static
final
String
RECEIVED_FIREBASE_MESSAGE
=
"action.receivedFireBaseMessage"
;
//
// @Override
@Override
// public void onMessageReceived(RemoteMessage remoteMessage) {
public
void
onNewToken
(
String
token
)
{
// handleMsg(this, remoteMessage);
PreferencesManager
.
get
().
saveFireBaseMessagingToken
(
token
);
//
new
UserPresenter
().
uploadFirebaseToken
(
token
);
// if (remoteMessage.getNotification() != null) {
}
// RemoteMessage.Notification notificationInfo = remoteMessage.getNotification();
// NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "default")
@Override
// .setContentTitle(notificationInfo.getTitle())
public
void
onMessageReceived
(
RemoteMessage
remoteMessage
)
{
// .setContentText(notificationInfo.getBody())
handleMsg
(
this
,
remoteMessage
);
// .setSmallIcon(LibConfig.APP_ICON)
// .setWhen(System.currentTimeMillis())
if
(
remoteMessage
.
getNotification
()
!=
null
)
{
// .setTicker(notificationInfo.getTitle())
RemoteMessage
.
Notification
notificationInfo
=
remoteMessage
.
getNotification
();
// .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
NotificationCompat
.
Builder
builder
=
new
NotificationCompat
.
Builder
(
this
,
"default"
)
// .setAutoCancel(true);
.
setContentTitle
(
notificationInfo
.
getTitle
())
// UIHelper.notifyNotification(getBaseContext(), builder);
.
setContentText
(
notificationInfo
.
getBody
())
// }
.
setSmallIcon
(
LibConfig
.
APP_ICON
)
// }
.
setWhen
(
System
.
currentTimeMillis
())
//
.
setTicker
(
notificationInfo
.
getTitle
())
// @Override
.
setVisibility
(
NotificationCompat
.
VISIBILITY_PUBLIC
)
// public void onDeletedMessages() {
.
setAutoCancel
(
true
);
// }
UIHelper
.
notifyNotification
(
getBaseContext
(),
builder
);
//
}
// /**
}
// * 处理推送内容
// */
@Override
// public static void handleMsg(Context context, RemoteMessage remoteMessage) {
public
void
onDeletedMessages
()
{
// if (remoteMessage != null) {
}
// //EventBus 通知
// EventBus.getDefault().post(remoteMessage);
/**
// //广播 通知
* 处理推送内容
// Intent intent = remoteMessage.toIntent();
*/
// intent.setAction(RECEIVED_FIREBASE_MESSAGE);
public
static
void
handleMsg
(
Context
context
,
RemoteMessage
remoteMessage
)
{
// context.sendBroadcast(intent);
if
(
remoteMessage
!=
null
)
{
// }
//EventBus 通知
//
EventBus
.
getDefault
().
post
(
remoteMessage
);
// }
//广播 通知
//
Intent
intent
=
remoteMessage
.
toIntent
();
//}
intent
.
setAction
(
RECEIVED_FIREBASE_MESSAGE
);
context
.
sendBroadcast
(
intent
);
}
}
}
src/main/java/com/common/service/MsgInstanceIdService.java
View file @
c0f39ef6
package
com
.
common
.
service
;
//package com.common.service;
//
import
com.google.firebase.iid.FirebaseInstanceId
;
//import com.google.firebase.iid.FirebaseInstanceId;
import
com.google.firebase.iid.FirebaseInstanceIdService
;
//import com.google.firebase.iid.FirebaseInstanceIdService;
//
import
tech.starwin.utils.LogUtils
;
//import tech.starwin.utils.LogUtils;
//
/**
///**
* Created by SiKang on 2018/9/27.
// * Created by SiKang on 2018/9/27.
*/
// */
public
class
MsgInstanceIdService
extends
FirebaseInstanceIdService
{
//// TODO - FireBase配置
public
static
final
String
TAG
=
"MsgInstanceIdService"
;
//public class MsgInstanceIdService extends FirebaseInstanceIdService {
@Override
// public static final String TAG = "MsgInstanceIdService";
public
void
onTokenRefresh
()
{
// @Override
String
refreshedToken
=
FirebaseInstanceId
.
getInstance
().
getToken
();
// public void onTokenRefresh() {
LogUtils
.
d
(
TAG
,
"message token:"
+
refreshedToken
);
// String refreshedToken = FirebaseInstanceId.getInstance().getToken();
}
// LogUtils.d(TAG, "message token:" + refreshedToken);
}
// }
//}
src/main/java/tech/starwin/LibConfig.java
View file @
c0f39ef6
...
@@ -6,7 +6,6 @@ import android.database.sqlite.SQLiteDatabase;
...
@@ -6,7 +6,6 @@ import android.database.sqlite.SQLiteDatabase;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.view.View
;
import
com.google.firebase.FirebaseApp
;
import
com.scwang.smartrefresh.layout.SmartRefreshLayout
;
import
com.scwang.smartrefresh.layout.SmartRefreshLayout
;
import
com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreator
;
import
com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreator
;
import
com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator
;
import
com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator
;
...
@@ -102,11 +101,10 @@ public class LibConfig {
...
@@ -102,11 +101,10 @@ public class LibConfig {
//上传工具
//上传工具
UploadManager
.
init
(
CONTEXT
);
UploadManager
.
init
(
CONTEXT
);
//TODO - FireBase配置
//init FireBase
//init FireBase
FirebaseApp
.
initializeApp
(
CONTEXT
);
//
FirebaseApp.initializeApp(CONTEXT);
//RemoteConfig
// initFirebaseRemoteConfig();
//init SharePreferences
//init SharePreferences
PreferencesManager
.
get
().
init
(
CONTEXT
);
PreferencesManager
.
get
().
init
(
CONTEXT
);
...
...
src/main/java/tech/starwin/network/DefaultHeaderAddInterceptor.java
View file @
c0f39ef6
...
@@ -16,9 +16,7 @@ import okhttp3.RequestBody;
...
@@ -16,9 +16,7 @@ import okhttp3.RequestBody;
import
okhttp3.Response
;
import
okhttp3.Response
;
import
okhttp3.internal.Util
;
import
okhttp3.internal.Util
;
import
tech.starwin.LibConfig
;
import
tech.starwin.LibConfig
;
import
tech.starwin.R
;
import
tech.starwin.utils.LoginManager
;
import
tech.starwin.utils.LoginManager
;
import
tech.starwin.utils.PreferencesManager
;
/**
/**
* Created by XLEO on 2018/1/30.
* Created by XLEO on 2018/1/30.
...
...
src/main/java/tech/starwin/utils/LogUtils.java
View file @
c0f39ef6
...
@@ -3,7 +3,6 @@ package tech.starwin.utils;
...
@@ -3,7 +3,6 @@ package tech.starwin.utils;
import
android.util.Log
;
import
android.util.Log
;
import
com.google.firebase.analytics.FirebaseAnalytics
;
import
tech.starwin.BuildConfig
;
import
tech.starwin.BuildConfig
;
...
...
src/main/java/tech/starwin/utils/TrackEventHelper.java
View file @
c0f39ef6
...
@@ -7,7 +7,6 @@ import android.view.View;
...
@@ -7,7 +7,6 @@ import android.view.View;
import
android.widget.Button
;
import
android.widget.Button
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.google.firebase.analytics.FirebaseAnalytics
;
import
tech.starwin.LibConfig
;
import
tech.starwin.LibConfig
;
...
@@ -50,9 +49,10 @@ public class TrackEventHelper {
...
@@ -50,9 +49,10 @@ public class TrackEventHelper {
public
static
void
logClickEventByName
(
Context
context
,
String
itemName
)
{
public
static
void
logClickEventByName
(
Context
context
,
String
itemName
)
{
Bundle
bundle
=
new
Bundle
();
Bundle
bundle
=
new
Bundle
();
String
eventName
=
"click_"
+
itemName
;
String
eventName
=
"click_"
+
itemName
;
bundle
.
putString
(
FirebaseAnalytics
.
Param
.
CONTENT_TYPE
,
eventName
);
//TODO - FireBase配置
// bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, eventName);
//FireBase 埋点
//FireBase 埋点
FirebaseAnalytics
.
getInstance
(
context
).
logEvent
(
FirebaseAnalytics
.
Event
.
SELECT_CONTENT
,
bundle
);
//
FirebaseAnalytics.getInstance(context).logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
if
(
onTrackEventListener
!=
null
)
{
if
(
onTrackEventListener
!=
null
)
{
onTrackEventListener
.
onActionClick
(
eventName
);
onTrackEventListener
.
onActionClick
(
eventName
);
}
}
...
@@ -62,8 +62,9 @@ public class TrackEventHelper {
...
@@ -62,8 +62,9 @@ public class TrackEventHelper {
* 行为埋点
* 行为埋点
*/
*/
public
static
void
logEvent
(
String
eventName
)
{
public
static
void
logEvent
(
String
eventName
)
{
//TODO - FireBase配置
//FireBase 埋点
//FireBase 埋点
FirebaseAnalytics
.
getInstance
(
LibConfig
.
getContext
()).
logEvent
(
eventName
,
null
);
//
FirebaseAnalytics.getInstance(LibConfig.getContext()).logEvent(eventName, null);
if
(
onTrackEventListener
!=
null
)
{
if
(
onTrackEventListener
!=
null
)
{
onTrackEventListener
.
onActionEvent
(
eventName
);
onTrackEventListener
.
onActionEvent
(
eventName
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment