From 232903b6a5cc9330b45e0e6be8299ba905b4020d Mon Sep 17 00:00:00 2001 From: "A.Badakhshan" Date: Thu, 16 Apr 2020 11:08:42 +0430 Subject: [PATCH] Initial commit --- .gitignore | 14 + .idea/codeStyles/Project.xml | 122 ++++++++ .idea/codeStyles/codeStyleConfig.xml | 5 + .idea/gradle.xml | 21 ++ .idea/misc.xml | 9 + .idea/runConfigurations.xml | 12 + app/.gitignore | 1 + app/build.gradle | 41 +++ app/google-services.json | 42 +++ app/proguard-rules.pro | 21 ++ app/src/main/AndroidManifest.xml | 22 ++ .../ayantech/pushnotification/MainActivity.kt | 22 ++ .../pushnotification/PushApplication.kt | 11 + .../drawable-v24/ic_launcher_foreground.xml | 30 ++ .../res/drawable/ic_launcher_background.xml | 170 +++++++++++ app/src/main/res/layout/activity_main.xml | 14 + .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 5 + app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3593 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 5339 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2636 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 3388 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4926 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 7472 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 7909 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 11873 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 10652 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 16570 bytes app/src/main/res/values/colors.xml | 6 + app/src/main/res/values/properties.xml | 6 + app/src/main/res/values/strings.xml | 3 + app/src/main/res/values/styles.xml | 11 + build.gradle | 30 ++ gradle.properties | 21 ++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54329 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 172 +++++++++++ gradlew.bat | 84 ++++++ pushsdk/.gitignore | 1 + pushsdk/build.gradle | 36 +++ pushsdk/consumer-rules.pro | 0 pushsdk/proguard-rules.pro | 21 ++ pushsdk/src/main/AndroidManifest.xml | 28 ++ .../activity/CustomizableDialogActivity.java | 205 +++++++++++++ .../pushsdk/activity/DownloadFileDialog.java | 121 ++++++++ .../activity/IncomeMessageActivity.java | 47 +++ .../ayantech/pushsdk/core/AyanNotification.kt | 125 ++++++++ .../ayantech/pushsdk/helper/ImageHelper.java | 64 +++++ .../pushsdk/helper/MyFileProvider.java | 6 + .../pushsdk/helper/NotificationUtils.java | 269 ++++++++++++++++++ .../ayantech/pushsdk/helper/ShareHelper.java | 28 ++ .../ayantech/pushsdk/helper/StringHelper.kt | 20 ++ .../ir/ayantech/pushsdk/helper/UrlHelper.java | 17 ++ .../ir/ayantech/pushsdk/model/Config.java | 11 + .../ir/ayantech/pushsdk/model/Message.java | 51 ++++ .../pushsdk/model/MessageDeserializer.java | 68 +++++ .../pushsdk/model/NotificationToShow.java | 49 ++++ .../pushsdk/model/action/ActionModel.java | 6 + .../pushsdk/model/action/CustomAction.java | 48 ++++ .../model/action/CustomActionReceived.java | 5 + .../action/CustomizableDialogAction.java | 66 +++++ .../model/action/DownloadFileAction.java | 232 +++++++++++++++ .../pushsdk/model/action/NoAction.java | 10 + .../pushsdk/model/action/OpenUrlAction.java | 35 +++ .../model/action/PushNotificationAction.java | 19 ++ .../pushsdk/model/action/ShareAction.java | 35 +++ .../model/action/TargetedClassAction.java | 81 ++++++ .../model/api/GetNotificationDetail.kt | 32 +++ .../pushsdk/model/api/GetNotificationsList.kt | 15 + .../pushsdk/model/api/NotificationObject.kt | 65 +++++ .../model/api/RemoveAllNotifications.kt | 5 + .../pushsdk/model/api/RemoveNotification.kt | 6 + .../model/api/ReportDeviceMobileNumber.kt | 7 + .../ReportDeviceReceivedNotificationStatus.kt | 7 + .../pushsdk/model/api/ReportNewDevice.kt | 11 + .../networking/PushNotificationNetworking.kt | 164 +++++++++++ .../service/MyFirebaseMessagingService.kt | 53 ++++ .../ir/ayantech/pushsdk/storage/Constants.kt | 6 + .../ir/ayantech/pushsdk/storage/EndPoint.kt | 11 + .../pushsdk/storage/PreferencesManager.java | 40 +++ .../pushsdk/storage/PushNotificationUser.java | 46 +++ .../src/main/res/drawable-xhdpi/ic_notif.png | Bin 0 -> 490 bytes pushsdk/src/main/res/drawable/progress.xml | 24 ++ .../main/res/layout/dialog_customizable.xml | 54 ++++ .../main/res/layout/dialog_download_file.xml | 55 ++++ .../remote_view_custom_notification.xml | 86 ++++++ pushsdk/src/main/res/values/colors.xml | 13 + pushsdk/src/main/res/values/dimens.xml | 11 + pushsdk/src/main/res/values/properties.xml | 7 + pushsdk/src/main/res/values/styles.xml | 8 + pushsdk/src/main/res/xml/provider_paths.xml | 8 + settings.gradle | 3 + 92 files changed, 3347 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/gradle.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/runConfigurations.xml create mode 100644 app/.gitignore create mode 100644 app/build.gradle create mode 100644 app/google-services.json create mode 100644 app/proguard-rules.pro create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/java/ir/ayantech/pushnotification/MainActivity.kt create mode 100644 app/src/main/java/ir/ayantech/pushnotification/PushApplication.kt create mode 100644 app/src/main/res/drawable-v24/ic_launcher_foreground.xml create mode 100644 app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/properties.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/styles.xml create mode 100644 build.gradle create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100755 gradlew create mode 100644 gradlew.bat create mode 100644 pushsdk/.gitignore create mode 100644 pushsdk/build.gradle create mode 100644 pushsdk/consumer-rules.pro create mode 100644 pushsdk/proguard-rules.pro create mode 100644 pushsdk/src/main/AndroidManifest.xml create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/activity/CustomizableDialogActivity.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/activity/DownloadFileDialog.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/activity/IncomeMessageActivity.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/core/AyanNotification.kt create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/helper/ImageHelper.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/helper/MyFileProvider.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/helper/NotificationUtils.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/helper/ShareHelper.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/helper/StringHelper.kt create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/helper/UrlHelper.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/Config.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/Message.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/MessageDeserializer.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/NotificationToShow.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/action/ActionModel.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/action/CustomAction.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/action/CustomActionReceived.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/action/CustomizableDialogAction.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/action/DownloadFileAction.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/action/NoAction.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/action/OpenUrlAction.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/action/PushNotificationAction.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/action/ShareAction.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/action/TargetedClassAction.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/api/GetNotificationDetail.kt create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/api/GetNotificationsList.kt create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/api/NotificationObject.kt create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/api/RemoveAllNotifications.kt create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/api/RemoveNotification.kt create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/api/ReportDeviceMobileNumber.kt create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/api/ReportDeviceReceivedNotificationStatus.kt create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/model/api/ReportNewDevice.kt create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/networking/PushNotificationNetworking.kt create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/service/MyFirebaseMessagingService.kt create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/storage/Constants.kt create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/storage/EndPoint.kt create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/storage/PreferencesManager.java create mode 100644 pushsdk/src/main/java/ir/ayantech/pushsdk/storage/PushNotificationUser.java create mode 100644 pushsdk/src/main/res/drawable-xhdpi/ic_notif.png create mode 100644 pushsdk/src/main/res/drawable/progress.xml create mode 100644 pushsdk/src/main/res/layout/dialog_customizable.xml create mode 100644 pushsdk/src/main/res/layout/dialog_download_file.xml create mode 100644 pushsdk/src/main/res/layout/remote_view_custom_notification.xml create mode 100644 pushsdk/src/main/res/values/colors.xml create mode 100644 pushsdk/src/main/res/values/dimens.xml create mode 100644 pushsdk/src/main/res/values/properties.xml create mode 100644 pushsdk/src/main/res/values/styles.xml create mode 100644 pushsdk/src/main/res/xml/provider_paths.xml create mode 100644 settings.gradle diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..603b140 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..88ea3aa --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,122 @@ + + + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+ + +
+
\ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..1a91c1b --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..37a7509 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..2e66c8a --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,41 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' + +android { + compileSdkVersion 29 + + defaultConfig { + applicationId "ir.ayantech.ghabzino" + minSdkVersion 16 + targetSdkVersion 29 + versionCode 1 + versionName "1.0.0" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.core:core-ktx:1.2.0' + implementation 'com.coolerfall:android-http-download-manager:1.6.1' + implementation 'com.google.code.gson:gson:2.8.6' + implementation 'com.squareup.retrofit2:converter-gson:2.6.0' + implementation 'com.squareup.okhttp3:okhttp:3.12.1' + implementation 'com.github.shadowalker77:networking:0.6.0' + implementation 'com.google.firebase:firebase-messaging:20.1.5' + implementation 'com.google.firebase:firebase-core:17.3.0' + + implementation project (':pushsdk') +} + +apply plugin: 'com.google.gms.google-services' diff --git a/app/google-services.json b/app/google-services.json new file mode 100644 index 0000000..967d571 --- /dev/null +++ b/app/google-services.json @@ -0,0 +1,42 @@ +{ + "project_info": { + "project_number": "418500099884", + "firebase_url": "https://ghabzino.firebaseio.com", + "project_id": "ghabzino", + "storage_bucket": "ghabzino.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:418500099884:android:9cac67c26af0813b", + "android_client_info": { + "package_name": "ir.ayantech.ghabzino" + } + }, + "oauth_client": [ + { + "client_id": "418500099884-thsbm1222m1537lhmk3a8t7fp9t90egu.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyBcGvssd94IXyXZZmIQWmzqs1fEwD3xIYA" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 1, + "other_platform_oauth_client": [] + }, + "ads_service": { + "status": 2 + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..c8392e2 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/ir/ayantech/pushnotification/MainActivity.kt b/app/src/main/java/ir/ayantech/pushnotification/MainActivity.kt new file mode 100644 index 0000000..2a84da1 --- /dev/null +++ b/app/src/main/java/ir/ayantech/pushnotification/MainActivity.kt @@ -0,0 +1,22 @@ +package ir.ayantech.pushnotification + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.util.Log +import ir.ayantech.pushsdk.core.AyanNotification +import kotlinx.android.synthetic.main.activity_main.* + +class MainActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + getListBtn.setOnClickListener { + AyanNotification.getNotificationList(10) { totalCount, unSeenCount, notifications, getNextPageClosure -> + Log.d("notifs", notifications.toString()) + getNextPageClosure?.invoke() + } + } + } +} diff --git a/app/src/main/java/ir/ayantech/pushnotification/PushApplication.kt b/app/src/main/java/ir/ayantech/pushnotification/PushApplication.kt new file mode 100644 index 0000000..7b1b424 --- /dev/null +++ b/app/src/main/java/ir/ayantech/pushnotification/PushApplication.kt @@ -0,0 +1,11 @@ +package ir.ayantech.pushnotification + +import android.app.Application +import ir.ayantech.pushsdk.core.AyanNotification + +class PushApplication : Application() { + override fun onCreate() { + super.onCreate() + AyanNotification.initialize(this) + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..3fc5ad2 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,14 @@ + + + +