Skip to content

Commit

Permalink
- Version Control implementation bug fix
Browse files Browse the repository at this point in the history
- Ayan Notif implementation bug fix
  • Loading branch information
samanshah committed Jul 8, 2024
1 parent c4a9edb commit acb78e3
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 11 deletions.
6 changes: 3 additions & 3 deletions PishkhanHelper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ dependencies {
implementation 'com.github.shadowalker77:whygoogle:0.8.2'

//Ayan Networking
implementation 'com.github.shadowalker77:networking:1.6.1'
implementation 'com.github.shadowalker77:networking:1.6.7'

//Version Control
implementation 'com.github.ayantech:versioncontrol:0.6.2'

//Push Notification
implementation 'com.github.shadowalker77:pushnotification:1.1.10'
implementation 'com.github.shadowalker77:pushnotification:1.1.11'

//Scanner
api 'com.google.zxing:core:3.5.0'
Expand Down Expand Up @@ -94,7 +94,7 @@ afterEvaluate {
artifactId = 'pishkhanhelper'

// Version Library Name (Example : "1.0.0")
version = '0.3.2'
version = '0.3.4'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ir.ayantech.ayannetworking.api.AyanApi
import ir.ayantech.ayannetworking.api.AyanCommonCallStatus
import ir.ayantech.ayannetworking.api.CallingState
import ir.ayantech.ayannetworking.ayanModel.FailureType
import ir.ayantech.pishkhanhelper.model.versionControl.AppExtraInfo
import ir.ayantech.pishkhanhelper.PishkhanHelper
import ir.ayantech.pishkhanhelper.R
import ir.ayantech.pishkhanhelper.app.HelperApplication
Expand All @@ -25,6 +26,7 @@ import ir.ayantech.pishkhanhelper.model.AppInfo
import ir.ayantech.pishkhanhelper.rate.showRatingIntent
import ir.ayantech.pishkhanhelper.storage.SavedData
import ir.ayantech.pishkhanhelper.fragment.login.EnterPhoneNumberFragment
import ir.ayantech.pushsdk.core.AyanNotification
import ir.ayantech.versioncontrol.VersionControlCore
import ir.ayantech.whygoogle.fragment.WhyGoogleFragment
import ir.ayantech.whygoogle.helper.SimpleCallBack
Expand Down Expand Up @@ -119,6 +121,7 @@ abstract class HelperDrawerActivity : LocaleHelperActivity<HelperDrawerActivityB
abstract val handleToolbarRlVisibilityOnTopFragmentChanged: (whyGoogleFragment: WhyGoogleFragment<*>) -> Boolean
abstract val handleDrawerLayoutLockOnTopFragmentChanged: (whyGoogleFragment: WhyGoogleFragment<*>) -> Boolean
abstract val getUserPhoneNumber: () -> String
abstract val getUserToken: () -> String

open val onPrivacyPolicyMenuItemClicked: SimpleCallBack? = null
open val onTermsAndConditionsMenuItemClicked: SimpleCallBack? = null
Expand All @@ -138,6 +141,18 @@ abstract class HelperDrawerActivity : LocaleHelperActivity<HelperDrawerActivityB
handleIntent(intent)
}

private fun reportTokenForNotif() {
AyanNotification.reportExtraInfo(AppExtraInfo(getUserToken()))
}

private fun checkForNewVersion() {
VersionControlCore.getInstance()
.setApplicationName(appInfo.applicationName)
.setCategoryName(appInfo.flavor)
.setExtraInfo(AppExtraInfo(getUserToken()))
.checkForNewVersion(this)
}

private fun initViews() {
initNavigationDrawer()
initToolbar()
Expand Down Expand Up @@ -169,6 +184,8 @@ abstract class HelperDrawerActivity : LocaleHelperActivity<HelperDrawerActivityB
} else {
initialize {
initViews()
checkForNewVersion()
reportTokenForNotif()
}
}

Expand Down Expand Up @@ -311,8 +328,8 @@ abstract class HelperDrawerActivity : LocaleHelperActivity<HelperDrawerActivityB

private fun onMenuItemClicked(callback: SimpleCallBack) {
hideKeyboard()
callback()
closeDrawer()
callback()
}

private fun closeDrawer() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ abstract class HelperApplication : LocaleHelperApplication() {
corePishkhan24AyanApi = AyanApi(
context = this,
getUserToken = this.getUserToken,
defaultBaseUrl = "https://core.pishkhan24.ayantech.ir/webservices/Core.svc/",
defaultBaseUrl = appInfo.coreApiBaseUrl ?: "https://core.pishkhan24.ayantech.ir/webservices/Core.svc/",
timeout = 120,
headers = hashMapOf("Accept-Language" to "fa"),
logLevel = if (appInfo.isDebugMode) LogLevel.LOG_ALL else LogLevel.DO_NOT_LOG
Expand All @@ -37,7 +37,7 @@ abstract class HelperApplication : LocaleHelperApplication() {
servicesPishkhan24AyanApi = AyanApi(
context = this,
getUserToken = this.getUserToken,
defaultBaseUrl = "https://services.pishkhan24.ayantech.ir/webservices/services.svc/",
defaultBaseUrl = appInfo.servicesApiBaseUrl ?: "https://services.pishkhan24.ayantech.ir/webservices/services.svc/",
timeout = 120,
headers = hashMapOf("Accept-Language" to "fa"),
logLevel = if (appInfo.isDebugMode) LogLevel.LOG_ALL else LogLevel.DO_NOT_LOG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import ir.ayantech.pishkhanhelper.helper.changeEnable
import ir.ayantech.pishkhanhelper.helper.getColorCompat
import ir.ayantech.pishkhanhelper.helper.setSpanText
import ir.ayantech.pishkhanhelper.helper.startTimer
import ir.ayantech.pushsdk.core.AyanNotification
import ir.ayantech.whygoogle.fragment.WhyGoogleFragment
import ir.ayantech.whygoogle.helper.SimpleCallBack

abstract class EnterOtpCodeFragment : WhyGoogleFragment<FragmentEnterOtpCodeBinding>() {

Expand All @@ -30,7 +32,9 @@ abstract class EnterOtpCodeFragment : WhyGoogleFragment<FragmentEnterOtpCodeBind
abstract val appIcon: Int

abstract fun resendOtpCode()
@Deprecated(message = "Use function with two parameters: login(otpCode, reportPhoneNumber)")
abstract fun login(otpCode: String)
abstract fun login(otpCode: String, reportPhoneNumber: SimpleCallBack)

override fun onCreate() {
super.onCreate()
Expand Down Expand Up @@ -75,10 +79,14 @@ abstract class EnterOtpCodeFragment : WhyGoogleFragment<FragmentEnterOtpCodeBind
if (otpCode.isEmpty() || otpCode.length < 4) {
binding.otpCodeInput.setInputComponentError(getString(R.string.enter_otp_code))
} else {
login(otpCode = otpCode)
login(otpCode = otpCode, reportPhoneNumber = reportPhoneNumberForNotif)
}
}

open val reportPhoneNumberForNotif: SimpleCallBack = {
phoneNumber?.let { AyanNotification.reportDeviceMobileNumber(it) }
}

private var timer: CountDownTimer? = null

private fun startRemainingSecondsTimer() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ data class AppInfo(
val flavor: String,
val applicationId: String,
val isDebugMode: Boolean,
@DrawableRes val appIcon: Int
@DrawableRes val appIcon: Int,
val coreApiBaseUrl: String? = null,
val servicesApiBaseUrl: String? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package ir.ayantech.pishkhanhelper.model.versionControl

import ir.ayantech.versioncontrol.model.ExtraInfoModel

data class AppExtraInfo(val Token: String) : ExtraInfoModel()

data class AppPushExtraInfo(val Token: String)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions PishkhanHelper/src/main/res/layout/helper_drawer_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
android:layout_centerVertical="true"
android:background="@drawable/helper_background_radius_8"
android:padding="@dimen/margin_8"
app:srcCompat="@drawable/ic_privacy_policy" />
app:srcCompat="@drawable/helper_ic_privacy_policy" />
</RelativeLayout>

<RelativeLayout
Expand Down Expand Up @@ -276,14 +276,14 @@
android:layout_centerVertical="true"
android:background="@drawable/helper_background_radius_8"
android:padding="@dimen/margin_8"
app:srcCompat="@drawable/ic_terms_and_conditions" />
app:srcCompat="@drawable/helper_ic_terms_and_conditions" />
</RelativeLayout>

<RelativeLayout
android:id="@+id/appLanguageRl"
android:layout_width="match_parent"
android:layout_height="@dimen/margin_48"
android:layout_below="@id/shareAppRl"
android:layout_below="@id/termsAndConditionsRl"
android:layout_centerHorizontal="true"
android:layout_marginStart="@dimen/margin_16"
android:layout_marginTop="@dimen/margin_8"
Expand Down
6 changes: 6 additions & 0 deletions PishkhanHelper/src/main/res/values/properties.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="applicationName">Hook</string>
<string name="applicationType">android</string>
<drawable name="pushIcon">@drawable/notif_logo</drawable>
</resources>

0 comments on commit acb78e3

Please sign in to comment.