Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove CAS SDK #1036

Merged
merged 3 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,6 @@ dependencies {

// Google Play libraries
implementation 'com.android.billingclient:billing:6.2.0'
// implementation 'com.android.billingclient:billing-ktx:6.1.0'
implementation 'com.google.android.gms:play-services-base:18.2.0'
implementation 'com.google.android.gms:play-services-ads:22.4.0'


// lib that simplifies event bus communication between activities, fragments, threads, services, etc
implementation 'org.greenrobot:eventbus:3.3.1'
Expand Down Expand Up @@ -438,8 +434,6 @@ dependencies {
implementation 'com.github.getlantern:secrets-android:f6a7a69f3d'
implementation 'com.github.getlantern:messaging-android:e36af5da7e'
implementation 'com.github.getlantern:db-android:36239c103c'

// implementation 'com.cleveradssolutions:cas:3.3.1'
}

apply plugin: 'com.google.gms.google-services'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,19 +244,10 @@ abstract class SessionManager(application: Application) : Session {
prefs.edit().putBoolean(ADS_ENABLED, enabled).apply()
}

override fun setCASShowInterstitialAdsEnabled(enabled: Boolean) {
Logger.d(TAG, "Setting $CAS_ADS_ENABLED to $enabled")
prefs.edit().putBoolean(CAS_ADS_ENABLED, enabled).apply()
}

fun shouldShowAdsEnabled(): Boolean {
return prefs.getBoolean(ADS_ENABLED, false)
}

fun shouldCASShowAdsEnabled(): Boolean {
return prefs.getBoolean(CAS_ADS_ENABLED, false)
}

// fun chatEnabled(): Boolean = prefs.getBoolean(CHAT_ENABLED, false)
// for now, disable Chat completely
fun chatEnabled(): Boolean {
Expand Down
12 changes: 2 additions & 10 deletions android/app/src/main/kotlin/io/lantern/model/SessionModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class SessionModel(
const val PATH_USER_LEVEL = "userLevel"

const val PATH_SPLIT_TUNNELING = "/splitTunneling"
const val SHOULD_SHOW_CAS_ADS = "shouldShowCASAds"
const val SHOULD_SHOW_GOOGLE_ADS = "shouldShowGoogleAds"
const val PATH_APPS_DATA = "/appsData/"

Expand Down Expand Up @@ -108,7 +107,7 @@ class SessionModel(
if (LanternApp.getSession().isProUser) {
db.mutate { tx ->
tx.put(SHOULD_SHOW_GOOGLE_ADS, false)
tx.put(SHOULD_SHOW_CAS_ADS, false)

}
return
}
Expand All @@ -120,16 +119,9 @@ class SessionModel(
LanternApp.getSession().shouldShowAdsEnabled()
}"
)
val casAds = shouldShowAdsBasedRegion { LanternApp.getSession().shouldCASShowAdsEnabled() }
Logger.debug(
TAG,
"checkAdsAvailability with cas values $googleAds enable ${
LanternApp.getSession().shouldCASShowAdsEnabled()
}"
)
db.mutate { tx ->
tx.put(SHOULD_SHOW_GOOGLE_ADS, googleAds)
tx.put(SHOULD_SHOW_CAS_ADS, casAds)

}
}

Expand Down
7 changes: 1 addition & 6 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,7 @@ allprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android {
// Replace com.cleveradssolutions.ads.flutter package name with "com.cleveradssolutions.ads"
// This resolves an issue where an incorrect package name appears in the source AndroidManifest.xml
def match = (project.group =~ /com.cleveradssolutions.ads.flutter/)
if (match.size() == 1) {
namespace "com.cleveradssolutions.ads"
} else if (namespace == null) {
if (namespace == null) {
namespace project.group
}
}
Expand Down
12 changes: 0 additions & 12 deletions internalsdk/android.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ type Session interface {
SetChatEnabled(bool)
SplitTunnelingEnabled() (bool, error)
SetShowInterstitialAdsEnabled(bool)
SetCASShowInterstitialAdsEnabled(bool)

// workaround for lack of any sequence types in gomobile bind... ;_;
// used to implement GetInternalHeaders() map[string]string
// Should return a JSON encoded map[string]string {"key":"val","key2":"val", ...}
Expand Down Expand Up @@ -121,7 +119,6 @@ type panickingSession interface {
SetIP(string)
SplitTunnelingEnabled() bool
SetShowInterstitialAdsEnabled(bool)
SetCASShowInterstitialAdsEnabled(bool)
// workaround for lack of any sequence types in gomobile bind... ;_;
// used to implement GetInternalHeaders() map[string]string
// Should return a JSON encoded map[string]string {"key":"val","key2":"val", ...}
Expand Down Expand Up @@ -270,9 +267,6 @@ func (s *panickingSessionImpl) SetChatEnabled(enabled bool) {
func (s *panickingSessionImpl) SetShowInterstitialAdsEnabled(enabled bool) {
s.wrapped.SetShowInterstitialAdsEnabled(enabled)
}
func (s *panickingSessionImpl) SetCASShowInterstitialAdsEnabled(enabled bool) {
s.wrapped.SetCASShowInterstitialAdsEnabled(enabled)
}

func (s *panickingSessionImpl) SerializedInternalHeaders() string {
result, err := s.wrapped.SerializedInternalHeaders()
Expand Down Expand Up @@ -594,15 +588,9 @@ func run(configDir, locale string,
log.Debugf("Show ads enabled? %v", showAdsEnabled)
session.SetShowInterstitialAdsEnabled(showAdsEnabled)

//Check for CAS ads for Russia and Iran user
showCASAdsEnabled := runner.FeatureEnabled("casinterstitialads", ApplicationVersion)
session.SetCASShowInterstitialAdsEnabled(showCASAdsEnabled)
log.Debugf("Show ads enabled casinterstitialads ? %v", showCASAdsEnabled)

} else {
// Explicitly disable ads for Pro users.
session.SetShowInterstitialAdsEnabled(false)
session.SetCASShowInterstitialAdsEnabled(false)
}

}
Expand Down
27 changes: 13 additions & 14 deletions internalsdk/android_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,19 @@ func (c testSession) UpdateStats(string, string, string, int, int, bool) error {

func (c testSession) UpdateAdSettings(AdSettings) error { return nil }

func (c testSession) GetAppName() string { return "lantern" }
func (c testSession) AppVersion() (string, error) { return "6.9.0", nil }
func (c testSession) Code() (string, error) { return "1", nil }
func (c testSession) Currency() (string, error) { return "usd", nil }
func (c testSession) DeviceOS() (string, error) { return "android", nil }
func (c testSession) Email() (string, error) { return "test@getlantern.org", nil }
func (c testSession) GetCountryCode() (string, error) { return "us", nil }
func (c testSession) IsStoreVersion() (bool, error) { return false, nil }
func (c testSession) Provider() (string, error) { return "stripe", nil }
func (c testSession) SetChatEnabled(enabled bool) {}
func (c testSession) SetMatomoEnabled(bool) {}
func (c testSession) IsPlayVersion() (bool, error) { return false, nil }
func (c testSession) SetShowInterstitialAdsEnabled(enabled bool) {}
func (c testSession) SetCASShowInterstitialAdsEnabled(enabled bool) {}
func (c testSession) GetAppName() string { return "lantern" }
func (c testSession) AppVersion() (string, error) { return "6.9.0", nil }
func (c testSession) Code() (string, error) { return "1", nil }
func (c testSession) Currency() (string, error) { return "usd", nil }
func (c testSession) DeviceOS() (string, error) { return "android", nil }
func (c testSession) Email() (string, error) { return "test@getlantern.org", nil }
func (c testSession) GetCountryCode() (string, error) { return "us", nil }
func (c testSession) IsStoreVersion() (bool, error) { return false, nil }
func (c testSession) Provider() (string, error) { return "stripe", nil }
func (c testSession) SetChatEnabled(enabled bool) {}
func (c testSession) SetMatomoEnabled(bool) {}
func (c testSession) IsPlayVersion() (bool, error) { return false, nil }
func (c testSession) SetShowInterstitialAdsEnabled(enabled bool) {}

func (c testSession) SerializedInternalHeaders() (string, error) {
return c.serializedInternalHeaders, nil
Expand Down
Loading
Loading