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

Enable data cap on iOS #1168

Merged
merged 7 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion desktop/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func init() {
proClient = proclient.NewClient(fmt.Sprintf("https://%s", common.ProAPIHost), &webclient.Opts{
UserConfig: userConfig,
})
authClient = auth.NewClient(fmt.Sprintf("https://%s", common.V1BaseUrl), userConfig)
authClient = auth.NewClient(fmt.Sprintf("https://%s", common.DFBaseUrl), userConfig)

a = app.NewApp(flags, cdir, proClient, ss)
}
Expand Down
17 changes: 15 additions & 2 deletions internalsdk/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,27 @@ type AuthClient interface {
func NewClient(baseURL string, userConfig func() common.UserConfig) AuthClient {
// The default http.RoundTripper is ChainedNonPersistent which proxies requests through chained servers
// and does not use keep alive connections. Since no root CA is specified, we do not need to check for an error.
rt, _ := proxied.ChainedNonPersistent("")

var httpClient *http.Client

if strings.HasSuffix(baseURL, common.APIBaseUrl) {
log.Debug("using proxied.Fronted")
//this is ios version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atavism For iOS only proxied.Fronted works nothing else.

httpClient = &http.Client{
Transport: proxied.Fronted(30 * time.Second),
}
} else {
rt, _ := proxied.ChainedNonPersistent("")
httpClient = pro.NewHTTPClient(rt, 30*time.Second)
}

rc := webclient.NewRESTClient(&webclient.Opts{
BaseURL: baseURL,
OnBeforeRequest: func(client *resty.Client, req *http.Request) error {
prepareUserRequest(req, userConfig())
return nil
},
HttpClient: pro.NewHTTPClient(rt, 30*time.Second),
HttpClient: httpClient,
UserConfig: userConfig,
})

Expand Down
3 changes: 2 additions & 1 deletion internalsdk/common/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ var (

ProAPIHost = "api.getiantem.org"

V1BaseUrl = "df.iantem.io/api/v1"
DFBaseUrl = "df.iantem.io/api/v1"
APIBaseUrl = "iantem.io/api/v1"

log = golog.LoggerFor("flashlight.common")

Expand Down
9 changes: 7 additions & 2 deletions internalsdk/session_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,12 @@ func NewSessionModel(mdb minisql.DB, opts *SessionModelOpts) (*SessionModel, err
},
}
m.proClient = pro.NewClient(fmt.Sprintf("https://%s", common.ProAPIHost), webclientOpts)
m.authClient = auth.NewClient(fmt.Sprintf("https://%s", common.V1BaseUrl), webclientOpts.UserConfig)

authUrl := common.DFBaseUrl
if opts.Platform == "ios" {
authUrl = common.APIBaseUrl
}
m.authClient = auth.NewClient(fmt.Sprintf("https://%s", authUrl), webclientOpts.UserConfig)

m.baseModel.doInvokeMethod = m.doInvokeMethod
go m.initSessionModel(context.Background(), opts)
Expand Down Expand Up @@ -698,7 +703,7 @@ func (m *SessionModel) initSessionModel(ctx context.Context, opts *SessionModelO
m.surveyModel, _ = NewSurveyModel(*m)
// By defautl on ios auth flow enabled
if opts.Platform == "ios" {
m.SetAuthEnabled(false)
m.SetAuthEnabled(true)
}
return checkAdsEnabled(m)
}
Expand Down
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ SPEC CHECKSUMS:
google_mobile_ads: 9379c80fdfa9988fb0e105a407890ff8deb3cf86
GoogleUserMessagingPlatform: 6b4f48a370e77ce121d034c908cc6ee4fdafaf13
in_app_purchase_storekit: 8c3b0b3eb1b0f04efbff401c3de6266d4258d433
integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
integration_test: ce0a3ffa1de96d1a89ca0ac26fca7ea18a749ef4
libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009
Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
Expand All @@ -306,4 +306,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: edbeaea3b499feb7b2b276309b09c237de1a6cff

COCOAPODS: 1.15.2
COCOAPODS: 1.14.3
4 changes: 2 additions & 2 deletions ios/Runner/Lantern/Models/SessionModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class SessionModel: BaseModel<InternalsdkSessionModel> {
let systemName = device.systemName
opts.deviceID = deviceId
opts.lang = Locale.current.identifier
opts.developmentMode = !isRunningFromAppStore() && !isRunningInTestFlightEnvironment()
opts.playVersion = (isRunningFromAppStore() || isRunningInTestFlightEnvironment())
opts.developmentMode = false
opts.playVersion = true
opts.timeZone = TimeZone.current.identifier
opts.device = modelName
opts.model = modelName
Expand Down
36 changes: 18 additions & 18 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1146,18 +1146,18 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev"
source: hosted
version: "10.0.5"
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "3.0.5"
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
Expand Down Expand Up @@ -1226,10 +1226,10 @@ packages:
dependency: transitive
description:
name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.11.1"
version: "0.8.0"
menu_base:
dependency: transitive
description:
Expand All @@ -1242,10 +1242,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted
version: "1.15.0"
version: "1.12.0"
mime:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1458,10 +1458,10 @@ packages:
dependency: transitive
description:
name: platform
sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65"
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
url: "https://pub.dev"
source: hosted
version: "3.1.5"
version: "3.1.4"
plugin_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -1863,26 +1863,26 @@ packages:
dependency: "direct dev"
description:
name: test
sha256: "7ee44229615f8f642b68120165ae4c2a75fe77ae2065b1e55ae4711f6cf0899e"
sha256: "7ee446762c2c50b3bd4ea96fe13ffac69919352bd3b4b17bac3f3465edc58073"
url: "https://pub.dev"
source: hosted
version: "1.25.7"
version: "1.25.2"
test_api:
dependency: transitive
description:
name: test_api
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev"
source: hosted
version: "0.7.2"
version: "0.7.0"
test_core:
dependency: transitive
description:
name: test_core
sha256: "55ea5a652e38a1dfb32943a7973f3681a60f872f8c3a05a14664ad54ef9c6696"
sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4"
url: "https://pub.dev"
source: hosted
version: "0.6.4"
version: "0.6.0"
timezone:
dependency: transitive
description:
Expand Down Expand Up @@ -2079,10 +2079,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "14.2.4"
version: "14.2.1"
watcher:
dependency: transitive
description:
Expand Down
Loading