Skip to content

Commit

Permalink
fix breaking code
Browse files Browse the repository at this point in the history
  • Loading branch information
jumaallan committed May 13, 2023
1 parent 0729df5 commit b8f3274
Show file tree
Hide file tree
Showing 33 changed files with 117 additions and 88 deletions.
1 change: 0 additions & 1 deletion app/src/main/java/com/hover/stax/RoutingActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import com.hover.sdk.api.Hover
import com.hover.stax.addChannels.ChannelsViewModel
import com.hover.stax.channels.ImportChannelsWorker
import com.hover.stax.channels.UpdateChannelsWorker
import com.hover.stax.BuildConfig
import com.hover.stax.home.MainActivity
import com.hover.stax.hover.PERM_ACTIVITY
import com.hover.stax.inapp_banner.BannerUtils
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/hover/stax/Stax.kt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Stax : Application() {
init(getString(R.string.appsflyer_key), conversionListener, this@Stax)

if (AppsFlyerProperties.getInstance()
.getString(AppsFlyerProperties.APP_USER_ID) == null
.getString(AppsFlyerProperties.APP_USER_ID) == null
)
setCustomerUserId(Hover.getDeviceId(this@Stax))

Expand Down
15 changes: 15 additions & 0 deletions app/src/main/java/com/hover/stax/bounty/BountyModule.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2023 Stax
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hover.stax.bounty

import dagger.Binds
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/hover/stax/home/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ class MainActivity : AbstractGoogleAuthActivity(), BiometricChecker.AuthListener
}

private fun observeForAppReview() = historyViewModel.showAppReviewLiveData().observe(this@MainActivity) {
if (it) StaxAppReview.launchStaxReview(this@MainActivity)
}
if (it) StaxAppReview.launchStaxReview(this@MainActivity)
}

private fun checkForRequest(intent: Intent) {
if (intent.hasExtra(REQUEST_LINK)) {
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/hover/stax/model/Bounty.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package com.hover.stax.model
import android.content.Context
import com.hover.sdk.actions.HoverAction
import com.hover.sdk.transactions.Transaction
import com.hover.stax.database.models.Channel
import com.hover.stax.database.models.StaxTransaction
import com.yariksoffice.lingver.Lingver
import java.util.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ class OnBoardingActivity : AbstractGoogleAuthActivity() {
PermissionUtils.showInformativeBasicPermissionDialog(
0,
{ PermissionUtils.requestPerms(NAV_HOME, this) }, {
com.hover.stax.utils.AnalyticsUtil.logAnalyticsEvent(getString(R.string.perms_basic_cancelled), this)
}, this
com.hover.stax.utils.AnalyticsUtil.logAnalyticsEvent(getString(R.string.perms_basic_cancelled), this)
}, this
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ internal class InteractiveTutorialFragment : Fragment() {
getString(
R.string.visit_screen,
getString(R.string.visit_interactive_tutorial)
), requireActivity()
),
requireActivity()
)

setTopBarClicks()
Expand Down Expand Up @@ -101,8 +102,8 @@ internal class InteractiveTutorialFragment : Fragment() {

private fun isNoneApply(): Boolean {
return !binding.variant2Checkbox1.isChecked &&
!binding.variant2Checkbox2.isChecked &&
!binding.variant2Checkbox3.isChecked
!binding.variant2Checkbox2.isChecked &&
!binding.variant2Checkbox3.isChecked
}

override fun onDestroyView() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ class ManagePermissionsFragment : Fragment() {
private val grantResults = arrayOf(PackageManager.PERMISSION_DENIED, PackageManager.PERMISSION_GRANTED)

private val requestSMSPermLauncher = registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) { grantResults ->
if (grantResults.containsValue(false))
Timber.i("SMS permissions denied")
else
Timber.i("SMS permissions granted")
}
if (grantResults.containsValue(false))
Timber.i("SMS permissions denied")
else
Timber.i("SMS permissions granted")
}

private val requestPhonePermLauncher = registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) { grantResults ->
if (grantResults.containsValue(false))
Expand Down Expand Up @@ -133,7 +133,7 @@ class ManagePermissionsFragment : Fragment() {

private fun shouldOpenSettings(permissions: List<String>): Boolean {
return grantResults.contains(ContextCompat.checkSelfPermission(requireActivity(), permissions[0])) ||
grantResults.contains(ContextCompat.checkSelfPermission(requireActivity(), permissions[1]))
grantResults.contains(ContextCompat.checkSelfPermission(requireActivity(), permissions[1]))
}

private fun openAppDetailSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private fun emailStax(simWithAccount: SimWithAccount, context: Context) {
simWithAccount.sim.networkOperator ?: "Null",
simWithAccount.sim.countryIso ?: "Null"
)
com.hover.stax.utils.Utils.openEmail(R.string.sim_card_support_request_emailSubject, context, emailBody)
com.hover.stax.utils.Utils.openEmail(R.string.sim_card_support_request_emailSubject, context, emailBody)
}

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ class NewRequestViewModel @Inject constructor(

fun validAmount(): Boolean =
(
!amount.value.isNullOrEmpty() && amount.value!!.matches("\\d+".toRegex()) && !amount.value!!.matches(
"[0]+".toRegex()
)
)
!amount.value.isNullOrEmpty() && amount.value!!.matches("\\d+".toRegex()) && !amount.value!!.matches(
"[0]+".toRegex()
)
)

fun requesteeErrors(): String? {
return if (!requestee.value?.accountNumber.isNullOrEmpty())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.hover.stax.requests;

import static com.hover.stax.utils.AnalyticsUtil.logAnalyticsEvent;

import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
Expand All @@ -9,7 +11,6 @@
import android.telephony.PhoneNumberUtils;

import com.hover.stax.R;
import com.hover.stax.core.AnalyticsUtil;
import com.hover.stax.database.models.StaxContact;

import java.util.List;
Expand Down Expand Up @@ -69,7 +70,7 @@ public void onChange(boolean selfChange) {
wasSent = true;
callBack();

AnalyticsUtil.logAnalyticsEvent(successMsg, context);
logAnalyticsEvent(successMsg, context);

break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import androidx.lifecycle.MediatorLiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.switchMap
import androidx.lifecycle.viewModelScope
import com.hover.sdk.actions.HoverAction
import com.hover.sdk.api.Hover.getSMSMessageByUUID
Expand Down Expand Up @@ -67,17 +67,17 @@ class TransactionDetailsViewModel @Inject constructor(
var bonusAmt: MediatorLiveData<Int> = MediatorLiveData()

init {
account = Transformations.switchMap(transaction) { getLiveAccount(it) }
action = Transformations.switchMap(transaction) { getLiveAction(it) }
contact = Transformations.switchMap(transaction) { getLiveContact(it) }
merchant = Transformations.switchMap(transaction) { getLiveMerchant(it) }
account = transaction.switchMap(this::getLiveAccount)
action = transaction.switchMap(this::getLiveAction)
contact = transaction.switchMap(this::getLiveContact)
// merchant = transaction.switchMap { it?.let { getLiveMerchant(it) } } TODO - FIX ME

messages.apply {
addSource(transaction) { loadMessages(it) }
addSource(action) { loadMessages(it) }
}

sms = Transformations.map(transaction) { it?.let { loadSms(it) } }
// sms = transaction.map { it?.let { loadSms(it) } } TODO - FIX ME
isExpectingSMS.addSource(transaction, this::setExpectingSMS)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class TransactionHistoryFragment : Fragment(), TransactionHistoryAdapter.SelectL
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
com.hover.stax.core.AnalyticsUtil.logAnalyticsEvent(
com.hover.stax.utils.AnalyticsUtil.logAnalyticsEvent(
getString(
R.string.visit_screen,
getString(R.string.visit_transaction_history)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ package com.hover.stax.transactions
import androidx.lifecycle.LiveData
import androidx.lifecycle.MediatorLiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import androidx.lifecycle.map
import androidx.lifecycle.viewModelScope
import com.hover.sdk.actions.HoverAction
import com.hover.stax.data.actions.ActionRepo
Expand All @@ -45,8 +45,9 @@ class TransactionHistoryViewModel @Inject constructor(
init {
transactionHistoryItem.addSource(allNonBountyTransaction, this::getTransactionHistory)
staxTransactions = repo.completeAndPendingTransferTransactions!!
appReviewLiveData =
Transformations.map(repo.transactionsForAppReview!!) { showAppReview(it) }
appReviewLiveData = repo.transactionsForAppReview?.map { showAppReview(it) }!!
// appReviewLiveData =
// Transformations.map(repo.transactionsForAppReview!!) { showAppReview(it) } // TODO - FIX ME
}

private fun getTransactionHistory(transactions: List<StaxTransaction>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ abstract class AbstractFormFragment : Fragment() {
getString(R.string.error_running_action)
)
}
com.hover.stax.core.AnalyticsUtil.logErrorAndReportToFirebase(
com.hover.stax.utils.AnalyticsUtil.logErrorAndReportToFirebase(
b.action.public_id,
getString(R.string.error_running_action_log),
e
Expand Down Expand Up @@ -210,7 +210,7 @@ abstract class AbstractFormFragment : Fragment() {
}

open fun startContactPicker(c: Context) {
com.hover.stax.core.AnalyticsUtil.logAnalyticsEvent(
com.hover.stax.utils.AnalyticsUtil.logAnalyticsEvent(
getString(R.string.try_contact_select),
c
)
Expand Down Expand Up @@ -293,5 +293,5 @@ abstract class AbstractFormFragment : Fragment() {
}

private fun log(event: String) =
com.hover.stax.core.AnalyticsUtil.logAnalyticsEvent(event, requireContext())
com.hover.stax.utils.AnalyticsUtil.logAnalyticsEvent(event, requireContext())
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ abstract class AbstractFormViewModel(
(getApplication() as Context).getString(
R.string.scheduled_complete,
s.type
), getApplication()
),
getApplication()
)
scheduleRepo.insert(s)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ class TransferFragment : AbstractFormFragment(), ActionSelect.HighlightListener
text = getString(R.string.top_up_with, bonus.from_institution_name)

setOnClickListener {
com.hover.stax.core.AnalyticsUtil.logAnalyticsEvent(
com.hover.stax.utils.AnalyticsUtil.logAnalyticsEvent(
getString(R.string.clicked_bonus_airtime_banner),
requireActivity()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class TransferViewModel @Inject constructor(
)
isLoading.postValue(false)
} catch (e: NumberFormatException) {
com.hover.stax.core.AnalyticsUtil.logErrorAndReportToFirebase(
com.hover.stax.utils.AnalyticsUtil.logErrorAndReportToFirebase(
TransferViewModel::class.java.simpleName, e.message!!, e
)
}
Expand Down Expand Up @@ -143,7 +143,7 @@ class TransferViewModel @Inject constructor(
setRecipientSmartly(r, r.requester_country_alpha2)
setAmount(r.amount)
setNote(r.note)
com.hover.stax.core.AnalyticsUtil.logAnalyticsEvent(
com.hover.stax.utils.AnalyticsUtil.logAnalyticsEvent(
getString(R.string.loaded_request_link),
getApplication()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class LibraryChannelsAdapter(private val favoriteClickInterface: FavoriteClickIn
liTitle.text = channel.name
liButton.apply {
text = liButton.context.getString(R.string.dial_btn, channel.rootCode)
setOnClickListener { Utils.dial(channel.rootCode, binding.root.context) }
setOnClickListener { com.hover.stax.utils.Utils.dial(channel.rootCode, binding.root.context) }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class LibraryFragment :

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
com.hover.stax.core.AnalyticsUtil.logAnalyticsEvent(
com.hover.stax.utils.AnalyticsUtil.logAnalyticsEvent(
getString(
R.string.visit_screen,
LibraryFragment::class.java.simpleName
Expand Down
21 changes: 18 additions & 3 deletions app/src/main/java/com/hover/stax/utils/AnalyticsUtil.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2023 Stax
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hover.stax.utils

import android.content.Context
Expand Down Expand Up @@ -70,9 +85,9 @@ object AnalyticsUtil {
val firebaseAnalytics = FirebaseAnalytics.getInstance(context)
firebaseAnalytics.apply {
setUserId(deviceId); logEvent(
AnalyticsUtil.strippedForFireAnalytics(event),
bundle
)
AnalyticsUtil.strippedForFireAnalytics(event),
bundle
)
}
}
}
8 changes: 4 additions & 4 deletions app/src/main/java/com/hover/stax/utils/UIHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ object UIHelper {
val s = Snackbar.make(view, message!!, Snackbar.LENGTH_LONG)
s.anchorView = view
s.show()
com.hover.stax.core.AnalyticsUtil.logAnalyticsEvent(message, view.context)
com.hover.stax.utils.AnalyticsUtil.logAnalyticsEvent(message, view.context)
}

fun flashAndReportMessage(context: Context, messageRes: Int) {
Expand All @@ -58,7 +58,7 @@ object UIHelper {

fun flashAndReportMessage(context: Context, message: String) {
Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
com.hover.stax.core.AnalyticsUtil.logAnalyticsEvent(message, context)
com.hover.stax.utils.AnalyticsUtil.logAnalyticsEvent(message, context)
}

fun flashAndReportError(context: Context, messageRes: Int) {
Expand All @@ -68,8 +68,8 @@ object UIHelper {

fun flashAndReportError(context: Context, message: String) {
Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
com.hover.stax.core.AnalyticsUtil.logAnalyticsEvent(message, context)
com.hover.stax.core.AnalyticsUtil.logErrorAndReportToFirebase(
com.hover.stax.utils.AnalyticsUtil.logAnalyticsEvent(message, context)
com.hover.stax.utils.AnalyticsUtil.logErrorAndReportToFirebase(
context.getString(R.string.toast_err_tag),
message,
null
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/hover/stax/utils/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import android.view.inputmethod.InputMethodManager
import androidx.annotation.StringRes
import com.google.firebase.messaging.FirebaseMessaging
import com.hover.stax.R
import com.hover.stax.core.AnalyticsUtil
import com.hover.stax.core.Utils
import com.hover.stax.permissions.PermissionUtils
import com.hover.stax.utils.AnalyticsUtil.logAnalyticsEvent
import org.json.JSONException
import org.json.JSONObject
import timber.log.Timber
Expand Down Expand Up @@ -116,7 +116,7 @@ object Utils {
}

fun shareStax(activity: Activity, shareMessage: String? = null) {
AnalyticsUtil.logAnalyticsEvent(activity.getString(R.string.clicked_share), activity)
logAnalyticsEvent(activity.getString(R.string.clicked_share), activity)

val sharingIntent = Intent(Intent.ACTION_SEND)
sharingIntent.type = "text/plain"
Expand Down Expand Up @@ -161,7 +161,7 @@ object Utils {
} catch (ignored: JSONException) {
}

AnalyticsUtil.logAnalyticsEvent(c.getString(R.string.clicked_dial_shortcode), data, c)
logAnalyticsEvent(c.getString(R.string.clicked_dial_shortcode), data, c)

val dialIntent = Intent(
Intent.ACTION_CALL,
Expand Down
Loading

0 comments on commit b8f3274

Please sign in to comment.