Commit df605b07 by Mobile : Art

lastupdate_210222

parent f083cf0d
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>android</name>
<comment>Project android created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>1600501234686</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=C\:/Program Files/java/jdk-14.0.2
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.pea.crmmobileworkforce"
minSdkVersion 21
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "androidx.appcompat:appcompat:1.2.0"
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.google.firebase:firebase-messaging:21.0.0'
implementation 'com.google.firebase:firebase-analytics:18.0.0'
}
apply plugin: 'com.google.gms.google-services'
\ No newline at end of file
{
"project_info": {
"project_number": "695582057986",
"project_id": "crm-mobile-work-force",
"storage_bucket": "crm-mobile-work-force.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:695582057986:android:a590fe37eba63422c7e91b",
"android_client_info": {
"package_name": "com.pea.crmmobileworkforce"
}
},
"oauth_client": [
{
"client_id": "695582057986-drbrk8edkqc29fmmja36kfkj40i98jme.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDFKueS4UlMiuEAWhWS0oJ7lK0Xmrtq6Vw"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "695582057986-drbrk8edkqc29fmmja36kfkj40i98jme.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
\ No newline at end of file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pea.crmmobileworkforce">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.pea.crmmobileworkforce">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!-- Permissions options for the `camera` group -->
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera.any" android:required="true" />
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
<application
android:name=".App"
android:allowBackup="false"
android:label="CRM Mobile Workforce"
android:usesCleartextTraffic="true"
android:icon="@mipmap/ic_launcher"
tools:ignore="GoogleAppIndexingWarning"
android:requestLegacyExternalStorage="true">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:showWhenLocked="true"
android:turnScreenOn="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service
android:name=".BackgroundService"
android:enabled="true"
android:exported="false" />
<provider
android:name="vn.hunghd.flutterdownloader.DownloadedFileProvider"
android:authorities="${applicationId}.flutter_downloader.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
tools:node="remove" />
<provider
android:name="vn.hunghd.flutterdownloader.FlutterDownloaderInitializer"
android:authorities="${applicationId}.flutter-downloader-init"
android:exported="false">
<!-- changes this number to configure the maximum number of concurrent tasks -->
<meta-data
android:name="vn.hunghd.flutterdownloader.MAX_CONCURRENT_TASKS"
android:value="5" />
</provider>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
</intent-filter>
</receiver>
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/default_notification_channel_id" />
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCTM1-AGM73n9yyCu67nHgA0LJCzaYBAjc"/>
<meta-data
android:name="firebase_messaging_auto_init_enabled"
android:value="false" />
<meta-data
android:name="firebase_analytics_collection_enabled"
android:value="false" />
<!-- Set custom default icon. This is used when no icon is set for incoming notification messages.
See README(https://goo.gl/l4GJaQ) for more. -->
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_launcher" />
<!-- Set color used with incoming notification messages. This is used when no color is set for the incoming
notification message. See README(https://goo.gl/6BKBk7) for more. -->
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/color_purple" />
</application>
</manifest>
\ No newline at end of file
package com.pea.crmmobileworkforce
// import android.app.Application
// class App : Application() {
// override fun onCreate() {
// super.onCreate()
// registerActivityLifecycleCallbacks(LifecycleDetector.activityLifecycleCallbacks)
// }
// }
import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;
import android.content.Context
class App : FlutterApplication() , PluginRegistrantCallback {
override fun onCreate() {
super.onCreate()
println("---------- Application")
registerActivityLifecycleCallbacks(LifecycleDetector.activityLifecycleCallbacks)
FlutterFirebaseMessagingService.setPluginRegistrant(this)
}
override fun registerWith(registry: PluginRegistry) {
io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.registerWith(registry. registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
}
}
\ No newline at end of file
package com.pea.crmmobileworkforce
import android.app.Service
import android.content.Context
import android.content.Intent
import android.os.IBinder
import android.util.Log
import androidx.core.content.ContextCompat
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.embedding.engine.dart.DartExecutor
import io.flutter.view.FlutterCallbackInformation
import io.flutter.view.FlutterMain
class BackgroundService : Service(), LifecycleDetector.Listener {
private var flutterEngine: FlutterEngine? = null
override fun onCreate() {
super.onCreate()
val notification = Notifications.buildForegroundNotification(this)
startForeground(Notifications.NOTIFICATION_ID_BACKGROUND_SERVICE, notification)
LifecycleDetector.listener = this
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
intent?.getLongExtra(KEY_CALLBACK_RAW_HANDLE, -1)?.let { callbackRawHandle ->
if (callbackRawHandle != -1L) setCallbackRawHandle(callbackRawHandle)
}
if (!LifecycleDetector.isActivityRunning) {
startFlutterNativeView()
}
return START_STICKY
}
override fun onDestroy() {
super.onDestroy()
LifecycleDetector.listener = null
}
override fun onBind(intent: Intent): IBinder? = null
override fun onFlutterActivityCreated() {
stopFlutterNativeView()
}
override fun onFlutterActivityDestroyed() {
startFlutterNativeView()
}
private fun startFlutterNativeView() {
if (flutterEngine != null) return
Log.i("BackgroundService", "Starting FlutterEngine")
getCallbackRawHandle()?.let { callbackRawHandle ->
flutterEngine = FlutterEngine(this).also { engine ->
val callbackInformation =
FlutterCallbackInformation.lookupCallbackInformation(callbackRawHandle)
engine.dartExecutor.executeDartCallback(
DartExecutor.DartCallback(
assets,
FlutterMain.findAppBundlePath(),
callbackInformation
)
)
}
}
}
private fun stopFlutterNativeView() {
Log.i("BackgroundService", "Stopping FlutterEngine")
flutterEngine?.destroy()
flutterEngine = null
}
private fun getCallbackRawHandle(): Long? {
val prefs = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)
val callbackRawHandle = prefs.getLong(KEY_CALLBACK_RAW_HANDLE, -1)
return if (callbackRawHandle != -1L) callbackRawHandle else null
}
private fun setCallbackRawHandle(handle: Long) {
val prefs = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)
prefs.edit().putLong(KEY_CALLBACK_RAW_HANDLE, handle).apply()
}
companion object {
private const val SHARED_PREFERENCES_NAME = "com.pea.BackgroundService"
private const val KEY_CALLBACK_RAW_HANDLE = "callbackRawHandle"
fun startService(context: Context, callbackRawHandle: Long) {
val intent = Intent(context, BackgroundService::class.java).apply {
putExtra(KEY_CALLBACK_RAW_HANDLE, callbackRawHandle)
}
ContextCompat.startForegroundService(context, intent)
}
}
}
package com.pea.crmmobileworkforce
import android.app.Activity
import android.app.Application
import android.os.Bundle
object LifecycleDetector {
val activityLifecycleCallbacks: Application.ActivityLifecycleCallbacks =
ActivityLifecycleCallbacks()
var listener: Listener? = null
var isActivityRunning = false
private set
interface Listener {
fun onFlutterActivityCreated()
fun onFlutterActivityDestroyed()
}
private class ActivityLifecycleCallbacks : Application.ActivityLifecycleCallbacks {
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
if (activity is MainActivity) {
isActivityRunning = true
listener?.onFlutterActivityCreated()
}
}
override fun onActivityDestroyed(activity: Activity) {
if (activity is MainActivity) {
isActivityRunning = false
listener?.onFlutterActivityDestroyed()
}
}
override fun onActivityStarted(activity: Activity) {}
override fun onActivityStopped(activity: Activity) {}
override fun onActivityResumed(activity: Activity) {}
override fun onActivityPaused(activity: Activity) {}
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle?) {}
}
}
\ No newline at end of file
package com.pea.crmmobileworkforce
import android.os.Bundle
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
class MainActivity : FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Notifications.createNotificationChannels(this)
}
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
val binaryMessenger = flutterEngine.dartExecutor.binaryMessenger
MethodChannel(binaryMessenger, "com.pea/background_service").apply {
setMethodCallHandler { method, result ->
if (method.method == "startService") {
val callbackRawHandle = method.arguments as Long
BackgroundService.startService(this@MainActivity, callbackRawHandle)
result.success(null)
} else {
result.notImplemented()
}
}
}
MethodChannel(binaryMessenger, "com.pea/app_retain").apply {
setMethodCallHandler { method, result ->
if (method.method == "sendToBackground") {
moveTaskToBack(true)
result.success(null)
} else {
result.notImplemented()
}
}
}
}
}
package com.pea.crmmobileworkforce
import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import android.os.Build
import androidx.core.app.NotificationCompat
object Notifications {
const val NOTIFICATION_ID_BACKGROUND_SERVICE = 1
private const val CHANNEL_ID_BACKGROUND_SERVICE = "background_service"
fun createNotificationChannels(context: Context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = NotificationChannel(
CHANNEL_ID_BACKGROUND_SERVICE,
"Background Service",
NotificationManager.IMPORTANCE_DEFAULT
)
val manager =
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
manager.createNotificationChannel(channel)
}
}
fun buildForegroundNotification(context: Context): Notification {
return NotificationCompat
.Builder(context, CHANNEL_ID_BACKGROUND_SERVICE)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Background Service")
.setContentText("Keeps app process on foreground.")
.build()
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#039BE5</color>
<color name="colorPrimaryDark">#0288D1</color>
<color name="colorAccent">#FFA000</color>
<color name="color_purple">#ffaa66cc</color>
<color name="blue_grey_500">#607D8B</color>
<color name="blue_grey_600">#546E7A</color>
<color name="blue_grey_700">#455A64</color>
<color name="blue_grey_800">#37474F</color>
<color name="blue_grey_900">#263238</color>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="default_notification_channel_id" translatable="false">1000</string>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
</resources>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pea.crmmobileworkforce">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
\ No newline at end of file
#Sun Oct 18 11:40:19 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
include ':app'
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}
plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
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