Commit 5065a010 by Takatoshi Miura

Merge branch 'features/1.4.410' into features/1.4.410_miura

# Conflicts:
#	ABVJE_Launcher_Android/assets/check
#	gradle.properties
parent e0af23f0
......@@ -56,12 +56,6 @@
</intent-filter>
</service>
<service android:name="jp.agentec.abook.abv.cl.push.ABVInstanceIDListenerService" android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"></action>
</intent-filter>
</service>
<service
android:name="jp.agentec.abook.abv.launcher.android.BackgroundDownloadService"
android:enabled="true"
......@@ -97,7 +91,7 @@
</provider>
<provider
android:name="android.support.v4.content.FileProvider"
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
......
......@@ -4,7 +4,7 @@ buildscript {
}
dependencies {
classpath 'org.ajoberstar:gradle-git:0.12+'
classpath 'com.google.gms:google-services:3.1.0'
classpath 'com.google.gms:google-services:4.0.1'
}
}
......@@ -13,12 +13,11 @@ apply plugin: 'com.google.gms.google-services'
dependencies {
implementation project(':ABVJE_UI_Android')
implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.multidex:multidex:2.0.0'
}
android {
compileSdkVersion 31
buildToolsVersion '31.0.0'
defaultConfig {
minSdkVersion 23
......@@ -80,7 +79,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions "default" // OK
......@@ -133,25 +133,30 @@ android {
}
import org.ajoberstar.grgit.*
task gitInfo << {
description 'update githash.txt with current hash'
def grgit = Grgit.open(project.file('..'))
def gitfile=file('assets/githash.txt')
gitfile.write grgit.head().id
task gitInfo {
doLast {
description 'update githash.txt with current hash'
def grgit = Grgit.open(project.file('..'))
def gitfile = file('assets/githash.txt')
gitfile.write grgit.head().id
}
}
preBuild.dependsOn gitInfo
task convertToPackage << {
description 'convert to package for google-services.json'
def appModuleRootFolder = '.'
def googleServicesJson = 'google-services.json'
copy {
from "fcm"
include "$googleServicesJson"
into "$appModuleRootFolder"
expand PACKAGE_NAME : app_custompackagename
task convertToPackage {
doLast {
description 'convert to package for google-services.json'
def appModuleRootFolder = '.'
def googleServicesJson = 'google-services.json'
copy {
from "fcm"
include "$googleServicesJson"
into "$appModuleRootFolder"
expand PACKAGE_NAME: app_custompackagename
}
}
}
preBuild.dependsOn convertToPackage
gradle.projectsEvaluated {
......
......@@ -7,7 +7,6 @@ apply plugin: 'com.android.library'
android {
compileSdkVersion 31
buildToolsVersion '31.0.0'
defaultConfig {
minSdkVersion 23
......
......@@ -8,13 +8,13 @@ apply plugin: 'com.android.library'
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.multidex:multidex:2.0.0'
implementation project(':ABVJE_BL')
implementation project(':ABVJE_Res_Default_Android')
implementation files('libs/ozrv_android.jar')
api 'com.google.firebase:firebase-core:11.4.0'
api 'com.google.firebase:firebase-messaging:11.4.0'
api 'com.android.support:appcompat-v7:25.0.0'
api 'com.google.firebase:firebase-core:21.1.1'
api 'com.google.firebase:firebase-messaging:23.0.8'
api 'androidx.appcompat:appcompat:1.0.0'
implementation 'commons-codec:commons-codec:1.10'
implementation 'net.lingala.zip4j:zip4j:1.3.2'
......@@ -27,7 +27,6 @@ dependencies {
android {
compileSdkVersion 31
buildToolsVersion '31.0.0'
defaultConfig {
minSdkVersion 23
......
......@@ -27,9 +27,9 @@ import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.os.Environment;
import android.os.StatFs;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.util.LruCache;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.collection.LruCache;
import android.util.Log;
import java.io.File;
......@@ -49,9 +49,9 @@ import java.util.Set;
/**
* This class handles disk and memory caching of bitmaps in conjunction with the
* {@link ImageWorker} class and its subclasses. Use
* {@link ImageCache#getInstance(android.support.v4.app.FragmentManager, ImageCacheParams)} to get an instance of this
* {@link ImageCache#getInstance(FragmentManager, ImageCacheParams)} to get an instance of this
* class, although usually a cache should be added directly to an {@link ImageWorker} by calling
* {@link ImageWorker#addImageCache(android.support.v4.app.FragmentManager, ImageCacheParams)}.
* {@link ImageWorker#addImageCache(FragmentManager, ImageCacheParams)}.
*/
public class ImageCache {
private static final String TAG = "ImageCache";
......@@ -83,7 +83,7 @@ public class ImageCache {
/**
* Create a new ImageCache object using the specified parameters. This should not be
* called directly by other classes, instead use
* {@link ImageCache#getInstance(android.support.v4.app.FragmentManager, ImageCacheParams)} to fetch an ImageCache
* {@link ImageCache#getInstance(FragmentManager, ImageCacheParams)} to fetch an ImageCache
* instance.
*
* @param cacheParams The cache parameters to use to initialize the cache
......@@ -453,8 +453,8 @@ public class ImageCache {
/**
* Create a set of image cache parameters that can be provided to
* {@link ImageCache#getInstance(android.support.v4.app.FragmentManager, ImageCacheParams)} or
* {@link ImageWorker#addImageCache(android.support.v4.app.FragmentManager, ImageCacheParams)}.
* {@link ImageCache#getInstance(FragmentManager, ImageCacheParams)} or
* {@link ImageWorker#addImageCache(FragmentManager, ImageCacheParams)}.
* @param context A context to use.
* @param diskCacheDirectoryName A unique subdirectory name that will be appended to the
* application cache directory. Usually "cache" or "images"
......
......@@ -16,7 +16,6 @@
package com.imagepicker;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
......@@ -26,15 +25,12 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.TransitionDrawable;
import android.os.Looper;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.util.Log;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import android.widget.ImageView;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.WeakReference;
import jp.agentec.abook.abv.bl.common.log.Logger;
......@@ -71,7 +67,7 @@ public abstract class ImageWorker {
* Load an image specified by the data parameter into an ImageView (override
* {@link ImageWorker#processBitmap(Object)} to define the processing logic). A memory and
* disk cache will be used if an {@link ImageCache} has been added using
* {@link ImageWorker#addImageCache(android.support.v4.app.FragmentManager, ImageCache.ImageCacheParams)}. If the
* {@link ImageWorker#addImageCache(FragmentManager, ImageCache.ImageCacheParams)}. If the
* image is found in the memory cache, it is set immediately, otherwise an {@link AsyncTask}
* will be created to asynchronously load the bitmap.
*
......
......@@ -13,7 +13,7 @@ import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import java.io.File;
import java.io.FileOutputStream;
......
......@@ -8,6 +8,7 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import androidx.annotation.NonNull;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
......@@ -18,7 +19,6 @@ import org.json.adf.JSONObject;
import java.util.Map;
import java.util.Objects;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
......@@ -26,11 +26,11 @@ import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.CommunicationLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
import jp.agentec.abook.abv.cl.util.AppUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVAuthenticatedActivity;
import jp.agentec.abook.abv.ui.common.activity.ShowPushMessageDailogActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.home.activity.ChatWebViewActivity;
import jp.agentec.abook.abv.ui.home.activity.OperationListActivity;
import jp.agentec.abook.abv.ui.home.activity.OperationRelatedContentActivity;
import jp.agentec.abook.abv.ui.home.activity.SplashScreenActivity;
......@@ -61,6 +61,11 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
}
}
}
@Override
public void onNewToken(@NonNull String token) {
Logger.i(TAG, "onNewToken token = " + token);
PreferenceUtil.putUserPref(this, AppDefType.UserPrefKey.NEED_SEND_TOKEN, true);
}
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
......@@ -176,9 +181,7 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
int uniqueId = (int) System.currentTimeMillis();
PendingIntent pendingIntent = PendingIntent.getActivity(this, uniqueId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent pendingIntent = PendingIntent.getActivity(this, uniqueId, intent, PendingIntent.FLAG_UPDATE_CURRENT|PendingIntent.FLAG_IMMUTABLE);
notification = getNotificationBuilder(pendingIntent, message).setChannelId(getApplicationContext().getPackageName()).build();
if (mNotificationManager != null) {
......
package jp.agentec.abook.abv.cl.push;
import com.google.firebase.iid.FirebaseInstanceIdService;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
public class ABVInstanceIDListenerService extends FirebaseInstanceIdService {
private static final String TAG = "ABVInstanceID";
@Override
public void onTokenRefresh() {
Logger.i(TAG, "onTokenRefresh()");
PreferenceUtil.putUserPref(this, AppDefType.UserPrefKey.NEED_SEND_TOKEN, true);
}
}
......@@ -2,44 +2,45 @@ package jp.agentec.abook.abv.cl.push;
import android.content.Context;
import com.google.firebase.iid.FirebaseInstanceId;
import androidx.annotation.NonNull;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.messaging.FirebaseMessaging;
import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.cl.util.ThreadUtil;
import jp.agentec.abook.abv.launcher.android.R;
public class FcmManager {
private static final String TAG = "FcmManager";
/**
* FcmTokenを返す。ただし、PushMessageの利用なしの場合は、noneIdを返す。
* @param context Context
* @return String
*/
public static String getFcmToken(Context context) {
String fcmToken;
public static void getFcmToken(Context context, final Callback resultCallback) {
if (context.getResources().getInteger(R.integer.push_message) == 1) {
fcmToken = getFcmTokenWithRetryCount(10);
FirebaseMessaging.getInstance().getToken()
.addOnCompleteListener(new OnCompleteListener<String>() {
@Override
public void onComplete(@NonNull Task<String> task) {
if (!task.isSuccessful()) {
Logger.w(TAG, "Fetching FCM registration token failed", task.getException());
resultCallback.callback(null);
return;
}
// Get new FCM registration token
String token = task.getResult();
resultCallback.callback(token);
}
});
} else {
fcmToken = "noneId";
}
return fcmToken;
}
private static String getFcmTokenWithRetryCount(int retryCount) {
String token = FirebaseInstanceId.getInstance().getToken();
if (token != null) {
return token;
}
// Tokenの取得に失敗したため、{retryCount}回までリトライする
int count = 0;
while (count < retryCount && token == null) {
ThreadUtil.sleep(1000);// 1sec
count++;
Logger.d("FcmManager", "[getFcmTokenWithRetry]:retry_count=" + count);
token = FirebaseInstanceId.getInstance().getToken();
resultCallback.callback("noneId");
}
return token;
}
}
\ No newline at end of file
......@@ -3,8 +3,8 @@ package jp.agentec.abook.abv.launcher.android;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;
import androidx.multidex.MultiDex;
import androidx.multidex.MultiDexApplication;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.log.Logger;
......
......@@ -14,7 +14,7 @@ import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.os.IBinder;
import android.support.v4.content.FileProvider;
import androidx.core.content.FileProvider;
import java.io.File;
......
......@@ -8,7 +8,7 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.support.v4.content.FileProvider;
import androidx.core.content.FileProvider;
import android.util.Log;
import android.widget.Toast;
......
......@@ -27,7 +27,6 @@ import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.iid.FirebaseInstanceId;
import net.lingala.zip4j.exception.ZipException;
......@@ -92,6 +91,7 @@ import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.bl.logic.PushMessageLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
import jp.agentec.abook.abv.cl.helper.ABVUncaughtExceptionHandler;
import jp.agentec.abook.abv.cl.push.FcmManager;
import jp.agentec.abook.abv.cl.push.PushMessageJSON;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.cl.util.StorageUtil;
......@@ -215,7 +215,22 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
// 更新されてない
return;
}
String fcmToken = FirebaseInstanceId.getInstance().getToken();
final Callback resultCallback = new Callback() {
@Override
public Object callback(Object ret) {
String fcmToken = (String)ret;
needSendDeviceToken(fcmToken);
return null;
}
};
FcmManager.getFcmToken(this, resultCallback);
}
/**
* デバイストークン取得後の処理
* @param fcmToken デバイストークン
*/
private void needSendDeviceToken(String fcmToken) {
boolean isSendSuccess = false;
// CMSに送信
if (getRInteger(R.integer.push_message) == 1 && fcmToken != null) {
......@@ -239,7 +254,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
PreferenceUtil.putUserPref(this, UserPrefKey.NEED_SEND_TOKEN, !isSendSuccess);
}
@Override
protected void onStart() {
super.onStart();
......
......@@ -3,6 +3,7 @@ package jp.agentec.abook.abv.ui.common.activity;
import android.widget.Toast;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.log.LogLevel;
import jp.agentec.abook.abv.bl.common.log.Logger;
......@@ -24,23 +25,32 @@ public abstract class ABVLoginActivity extends ABVNoAuthenticatedActivity {
* 必要なければユーザ情報を保存する。
*/
protected void fcmRegister() {
String fcmToken = FcmManager.getFcmToken(this);
try {
if (fcmToken == null) {
Logger.w(TAG, "[fcmRegister]: FCM Token is null.");
runOnUiThread(new Runnable() {
@Override
public void run() {
ABVToastUtil.showMakeText(ABVLoginActivity.this, R.string.fcm_not_supported, Toast.LENGTH_SHORT);
final Callback resultCallback = new Callback() {
@Override
public Object callback(Object ret) {
String fcmToken = (String)ret;
try {
if (fcmToken == null) {
Logger.w(TAG, "[fcmRegister]: FCM Token is null.");
runOnUiThread(new Runnable() {
@Override
public void run() {
ABVToastUtil.showMakeText(ABVLoginActivity.this, R.string.fcm_not_supported, Toast.LENGTH_SHORT);
}
});
// FCMトークンを取得できない場合、noneIdでセットしてログインする
fcmToken = "noneId";
}
});
// FCMトークンを取得できない場合、noneIdでセットしてログインする
fcmToken = "noneId";
serverLoginAndCheckChangeUser(fcmToken);
} finally {
closeProgressPopup();
}
return null;
}
serverLoginAndCheckChangeUser(fcmToken);
} finally {
closeProgressPopup();
}
};
FcmManager.getFcmToken(this, resultCallback);
}
/**
......
......@@ -107,14 +107,21 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
String fcmToken = FcmManager.getFcmToken(mContext);
if (fcmToken == null) {
ABVToastUtil.showMakeText(mContext, R.string.fcm_not_supported, Toast.LENGTH_SHORT);
// FCMトークンを取得できない場合、noneIdでセットしてログインする
fcmToken = "noneId";
}
noAuthenticatedShowMain(isGuestLogin, fcmToken, urlPath);
}
final Callback resultCallback = new Callback() {
@Override
public Object callback(Object ret) {
String fcmToken = (String)ret;
if (fcmToken == null) {
ABVToastUtil.showMakeText(mContext, R.string.fcm_not_supported, Toast.LENGTH_SHORT);
// FCMトークンを取得できない場合、noneIdでセットしてログインする
fcmToken = "noneId";
}
noAuthenticatedShowMain(isGuestLogin, fcmToken, urlPath);
return null;
}
};
FcmManager.getFcmToken(mContext, resultCallback);
}
});
}
......
......@@ -4,7 +4,7 @@ import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import androidx.core.app.ActivityCompat;
import android.view.View;
import java.io.IOException;
......@@ -12,7 +12,6 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import jp.agentec.abook.abv.bl.acms.type.LoginMode;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
......
......@@ -25,7 +25,7 @@ import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.support.annotation.RequiresApi;
import androidx.annotation.RequiresApi;
import android.util.Log;
import android.view.KeyEvent;
import android.view.ViewGroup;
......
package jp.agentec.abook.abv.ui.home.helper;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
......@@ -9,7 +8,7 @@ import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.provider.Settings;
import android.support.v4.content.ContextCompat;
import androidx.core.content.ContextCompat;
import java.util.ArrayList;
......
......@@ -10,7 +10,7 @@ import android.content.res.Configuration;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.support.v4.content.FileProvider;
import androidx.core.content.FileProvider;
import android.webkit.MimeTypeMap;
import android.widget.Toast;
......
......@@ -3,7 +3,7 @@ package jp.agentec.abook.abv.ui.home.view;
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.support.v4.content.ContextCompat;
import androidx.core.content.ContextCompat;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
......
......@@ -4,7 +4,7 @@ import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.content.res.ResourcesCompat;
import androidx.core.content.res.ResourcesCompat;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.View;
......
......@@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.android.tools.build:gradle:3.6.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
......
......@@ -139,3 +139,5 @@ privacy_policy_url=https://www.agentec.jp/privacy/
#利用規約に同意するのテキストがあるURL
agree_to_terms_of_use_url=https://chatdev2.agentec.jp/acms/common/getAgreement/
android.useAndroidX=true
android.enableJetifier=true
#Tue Feb 19 17:59:22 JST 2019
#Mon Oct 17 17:00:19 KST 2022
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
......@@ -2,7 +2,6 @@ apply plugin: 'com.android.library'
android {
compileSdkVersion 31
buildToolsVersion '31.0.0'
defaultConfig {
minSdkVersion 23
......
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