Skip to content

Commit

Permalink
Added internal header to track platform.
Browse files Browse the repository at this point in the history
  • Loading branch information
jigar-f committed Jun 17, 2024
1 parent 6ff237d commit fa48e77
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 59 deletions.
33 changes: 22 additions & 11 deletions internalsdk/pro/pro.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,17 @@ func (c *proClient) defaultHeader() map[string]string {
return params
}

func (c *proClient) internalHeader() map[string]string {
uc := c.userConfig()
params := map[string]string{}

// Import all the internal headers
for k, v := range uc.GetInternalHeaders() {
params[k] = v
}
return params
}

// EmailExists is used to check if an email address belongs to an existing Pro account
// XXX Deprecated: See https://github.com/getlantern/lantern-internal/issues/4377
func (c *proClient) EmailExists(ctx context.Context, email string) (*protos.BaseResponse, error) {
Expand Down Expand Up @@ -406,7 +417,7 @@ func (c *proClient) SignUp(ctx context.Context, signupData *protos.SignupRequest
// Params: ctx context.Context, data *protos.SignupEmailResendRequest
func (c *proClient) SignupEmailResendCode(ctx context.Context, data *protos.SignupEmailResendRequest) (bool, error) {
var resp protos.EmptyResponse
err := c.webclient.PostPROTOC(ctx, "/users/signup/resend/email", nil, data, &resp, nil)
err := c.webclient.PostPROTOC(ctx, "/users/signup/resend/email", nil, data, &resp, c.internalHeader())
if err != nil {
return false, err
}
Expand All @@ -417,7 +428,7 @@ func (c *proClient) SignupEmailResendCode(ctx context.Context, data *protos.Sign
// Params: ctx context.Context, data *protos.ConfirmSignupRequest
func (c *proClient) SignupEmailConfirmation(ctx context.Context, data *protos.ConfirmSignupRequest) (bool, error) {
var resp protos.EmptyResponse
err := c.webclient.PostPROTOC(ctx, "/users/signup/complete/email", nil, data, &resp, nil)
err := c.webclient.PostPROTOC(ctx, "/users/signup/complete/email", nil, data, &resp, c.internalHeader())
if err != nil {
return false, err
}
Expand All @@ -427,7 +438,7 @@ func (c *proClient) SignupEmailConfirmation(ctx context.Context, data *protos.Co
// LoginPrepare does the initial login preparation with come make sure the user exists and match user salt
func (c *proClient) LoginPrepare(ctx context.Context, loginData *protos.PrepareRequest) (*protos.PrepareResponse, error) {
var model protos.PrepareResponse
err := c.webclient.PostPROTOC(ctx, "/users/prepare", nil, loginData, &model, nil)
err := c.webclient.PostPROTOC(ctx, "/users/prepare", nil, loginData, &model, c.internalHeader())
if err != nil {
// Send custom error to show error on client side
return nil, log.Errorf("user_not_found %v", err)
Expand All @@ -438,7 +449,7 @@ func (c *proClient) LoginPrepare(ctx context.Context, loginData *protos.PrepareR
// Login is used to login a user with the LoginRequest
func (c *proClient) Login(ctx context.Context, loginData *protos.LoginRequest) (*protos.LoginResponse, error) {
var resp protos.LoginResponse
err := c.webclient.PostPROTOC(ctx, "/users/login", nil, loginData, &resp, nil)
err := c.webclient.PostPROTOC(ctx, "/users/login", nil, loginData, &resp, c.internalHeader())
if err != nil {
return nil, err
}
Expand All @@ -449,7 +460,7 @@ func (c *proClient) Login(ctx context.Context, loginData *protos.LoginRequest) (
// StartRecoveryByEmail is used to start the recovery process by sending a recovery code to the user's email
func (c *proClient) StartRecoveryByEmail(ctx context.Context, loginData *protos.StartRecoveryByEmailRequest) (bool, error) {
var resp protos.EmptyResponse
err := c.webclient.PostPROTOC(ctx, "/users/recovery/start/email", nil, loginData, &resp, nil)
err := c.webclient.PostPROTOC(ctx, "/users/recovery/start/email", nil, loginData, &resp, c.internalHeader())
if err != nil {
return false, err
}
Expand All @@ -459,7 +470,7 @@ func (c *proClient) StartRecoveryByEmail(ctx context.Context, loginData *protos.
// CompleteRecoveryByEmail is used to complete the recovery process by validating the recovery code
func (c *proClient) CompleteRecoveryByEmail(ctx context.Context, loginData *protos.CompleteRecoveryByEmailRequest) (bool, error) {
var resp protos.EmptyResponse
err := c.webclient.PostPROTOC(ctx, "/users/recovery/complete/email", nil, loginData, &resp, nil)
err := c.webclient.PostPROTOC(ctx, "/users/recovery/complete/email", nil, loginData, &resp, c.internalHeader())
if err != nil {
return false, err
}
Expand All @@ -470,7 +481,7 @@ func (c *proClient) CompleteRecoveryByEmail(ctx context.Context, loginData *prot
func (c *proClient) ValidateEmailRecoveryCode(ctx context.Context, recoveryData *protos.ValidateRecoveryCodeRequest) (*protos.ValidateRecoveryCodeResponse, error) {
var resp protos.ValidateRecoveryCodeResponse
log.Debugf("ValidateEmailRecoveryCode request is %v", recoveryData)
err := c.webclient.PostPROTOC(ctx, "/users/recovery/validate/email", nil, recoveryData, &resp, nil)
err := c.webclient.PostPROTOC(ctx, "/users/recovery/validate/email", nil, recoveryData, &resp, c.internalHeader())
if err != nil {
return nil, err
}
Expand All @@ -483,7 +494,7 @@ func (c *proClient) ValidateEmailRecoveryCode(ctx context.Context, recoveryData
// ChangeEmail is used to change the email address of a user
func (c *proClient) ChangeEmail(ctx context.Context, loginData *protos.ChangeEmailRequest) (bool, error) {
var resp protos.EmptyResponse
err := c.webclient.PostPROTOC(ctx, "/users/change_email", nil, loginData, &resp, nil)
err := c.webclient.PostPROTOC(ctx, "/users/change_email", nil, loginData, &resp, c.internalHeader())
if err != nil {
return false, err
}
Expand All @@ -493,7 +504,7 @@ func (c *proClient) ChangeEmail(ctx context.Context, loginData *protos.ChangeEma
// CompleteChangeEmail is used to complete the email change process
func (c *proClient) CompleteChangeEmail(ctx context.Context, loginData *protos.CompleteChangeEmailRequest) (bool, error) {
var resp protos.EmptyResponse
err := c.webclient.PostPROTOC(ctx, "/users/change_email/complete/email", nil, loginData, &resp, nil)
err := c.webclient.PostPROTOC(ctx, "/users/change_email/complete/email", nil, loginData, &resp, c.internalHeader())
if err != nil {
return false, err
}
Expand All @@ -504,7 +515,7 @@ func (c *proClient) CompleteChangeEmail(ctx context.Context, loginData *protos.C
// Once account is delete make sure to create new account
func (c *proClient) DeleteAccount(ctx context.Context, accountData *protos.DeleteUserRequest) (bool, error) {
var resp protos.EmptyResponse
err := c.webclient.PostPROTOC(ctx, "/users/delete", nil, accountData, &resp, nil)
err := c.webclient.PostPROTOC(ctx, "/users/delete", nil, accountData, &resp, c.internalHeader())
if err != nil {
return false, err
}
Expand All @@ -515,7 +526,7 @@ func (c *proClient) DeleteAccount(ctx context.Context, accountData *protos.Delet
// Once account is delete make sure to create new account
func (c *proClient) SignOut(ctx context.Context, logoutData *protos.LogoutRequest) (bool, error) {
var resp protos.EmptyResponse
err := c.webclient.PostPROTOC(ctx, "/users/logout", nil, logoutData, &resp, nil)
err := c.webclient.PostPROTOC(ctx, "/users/logout", nil, logoutData, &resp, c.internalHeader())
if err != nil {
return false, err
}
Expand Down
11 changes: 4 additions & 7 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/cleveradssolutions/CAS-Specs.git'
# Uncomment this line to define a global platform for your project
platform :ios, '13.0'
use_frameworks! :linkage => :static
$casVersion = '~> 3.5.1'
inhibit_all_warnings!
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'false'
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
Expand Down Expand Up @@ -37,7 +36,6 @@ target 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
# pod 'SQLite.swift', '~> 0.12.2'
pod 'Toast-Swift', '~> 5.0.1'
pod 'CleverAdsSolutions-Base', $casVersion
end

# target 'LanternTests' do
Expand All @@ -58,16 +56,15 @@ post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',

## dart: PermissionGroup.calendar
'PERMISSION_EVENTS=0',
#'PERMISSION_EVENTS=0',

## dart: PermissionGroup.reminders
'PERMISSION_REMINDERS=0',
#'PERMISSION_REMINDERS=0',

## dart: PermissionGroup.contacts
# 'PERMISSION_CONTACTS=0',
Expand All @@ -88,7 +85,7 @@ post_install do |installer|
# 'PERMISSION_LOCATION=0',

## dart: PermissionGroup.notification
# 'PERMISSION_NOTIFICATIONS=0',
'PERMISSION_NOTIFICATIONS=0',

## dart: PermissionGroup.mediaLibrary
'PERMISSION_MEDIA_LIBRARY=0',
Expand Down
70 changes: 32 additions & 38 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ PODS:
- Flutter
- audioplayers_darwin (0.0.1):
- Flutter
- CleverAdsSolutions-Base (3.5.6)
- connectivity_plus (0.0.1):
- Flutter
- FlutterMacOS
- device_info_plus (0.0.1):
- Flutter
- DKImagePickerController/Core (4.3.9):
Expand Down Expand Up @@ -70,9 +72,6 @@ PODS:
- fluttertoast (0.0.2):
- Flutter
- Toast
- FMDB (2.7.10):
- FMDB/standard (= 2.7.10)
- FMDB/standard (2.7.10)
- Google-Mobile-Ads-SDK (11.2.0):
- GoogleUserMessagingPlatform (>= 1.1)
- google_mobile_ads (5.1.0):
Expand Down Expand Up @@ -118,40 +117,39 @@ PODS:
- SDWebImageWebPCoder (0.14.6):
- libwebp (~> 1.0)
- SDWebImage/Core (~> 5.17)
- Sentry/HybridSDK (8.21.0):
- SentryPrivate (= 8.21.0)
- sentry_flutter (0.0.1):
- Sentry/HybridSDK (8.25.0)
- sentry_flutter (7.20.2):
- Flutter
- FlutterMacOS
- Sentry/HybridSDK (= 8.21.0)
- SentryPrivate (8.21.0)
- Sentry/HybridSDK (= 8.25.0)
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite (0.0.3):
- Flutter
- FMDB (>= 2.7.5)
- FlutterMacOS
- SwiftyGif (5.4.5)
- Toast (4.1.1)
- Toast-Swift (5.0.1)
- url_launcher_ios (0.0.1):
- Flutter
- video_player_avfoundation (0.0.1):
- Flutter
- FlutterMacOS
- video_thumbnail (0.0.1):
- Flutter
- libwebp
- wakelock (0.0.1):
- wakelock_plus (0.0.1):
- Flutter
- webview_flutter_wkwebview (0.0.1):
- Flutter

DEPENDENCIES:
- app_links (from `.symlinks/plugins/app_links/ios`)
- audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/ios`)
- CleverAdsSolutions-Base (~> 3.5.1)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- emoji_picker_flutter (from `.symlinks/plugins/emoji_picker_flutter/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
Expand All @@ -174,22 +172,19 @@ DEPENDENCIES:
- sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
- Toast-Swift (~> 5.0.1)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`)
- video_thumbnail (from `.symlinks/plugins/video_thumbnail/ios`)
- wakelock (from `.symlinks/plugins/wakelock/ios`)
- wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)

SPEC REPOS:
https://github.com/cleveradssolutions/CAS-Specs.git:
- CleverAdsSolutions-Base
https://github.com/CocoaPods/Specs.git:
- Alamofire
- DKImagePickerController
- DKPhotoGallery
- FMDB
- Google-Mobile-Ads-SDK
- GoogleUserMessagingPlatform
- libwebp
Expand All @@ -199,7 +194,6 @@ SPEC REPOS:
- SDWebImage
- SDWebImageWebPCoder
- Sentry
- SentryPrivate
- SwiftyGif
- Toast
- Toast-Swift
Expand All @@ -209,6 +203,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/app_links/ios"
audioplayers_darwin:
:path: ".symlinks/plugins/audioplayers_darwin/ios"
connectivity_plus:
:path: ".symlinks/plugins/connectivity_plus/darwin"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
emoji_picker_flutter:
Expand Down Expand Up @@ -254,24 +250,24 @@ EXTERNAL SOURCES:
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
:path: ".symlinks/plugins/sqflite/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
video_player_avfoundation:
:path: ".symlinks/plugins/video_player_avfoundation/ios"
:path: ".symlinks/plugins/video_player_avfoundation/darwin"
video_thumbnail:
:path: ".symlinks/plugins/video_thumbnail/ios"
wakelock:
:path: ".symlinks/plugins/wakelock/ios"
wakelock_plus:
:path: ".symlinks/plugins/wakelock_plus/ios"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"

SPEC CHECKSUMS:
Alamofire: 814429acc853c6c54ff123fc3d2ef66803823ce0
app_links: e70ca16b4b0f88253b3b3660200d4a10b4ea9795
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
CleverAdsSolutions-Base: b2b98815a732a72d75dadfde430c5f24eafafdd5
device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea
connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
emoji_picker_flutter: fe2e6151c5b548e975d546e6eeb567daf0962a58
Expand All @@ -284,8 +280,7 @@ SPEC CHECKSUMS:
flutter_mailer: 2ef5a67087bc8c6c4cefd04a178bf1ae2c94cd83
flutter_pdfview: 25f53dd6097661e6395b17de506e6060585946bd
flutter_uploader: 2b07c4d41cf1218f25e6d5b8bcfa2d913838e27c
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
FMDB: eae540775bf7d0c87a5af926ae37af69effe5a19
fluttertoast: e9a18c7be5413da53898f660530c56f35edfba9c
Google-Mobile-Ads-SDK: 5a6d005a6cb5b5e8f4c7b69ca05cdea79c181139
google_mobile_ads: 9379c80fdfa9988fb0e105a407890ff8deb3cf86
GoogleUserMessagingPlatform: f131fa7978d2ba88d7426702b057c2cc318e6595
Expand All @@ -295,27 +290,26 @@ SPEC CHECKSUMS:
Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e
SDWebImage: dfe95b2466a9823cf9f0c6d01217c06550d7b29a
SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380
Sentry: ebc12276bd17613a114ab359074096b6b3725203
sentry_flutter: dff1df05dc39c83d04f9330b36360fc374574c5e
SentryPrivate: d651efb234cf385ec9a1cdd3eff94b5e78a0e0fe
share_plus: 599aa54e4ea31d4b4c0e9c911bcc26c55e791028
shared_preferences_foundation: e2dae3258e06f44cc55f49d42024fd8dd03c590c
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
Sentry: cd86fc55628f5b7c572cabe66cc8f95a9d2f165a
sentry_flutter: 0cf2507eb90ff7a6aa3304e900dd7f08edbbefdf
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e
Toast-Swift: 9b6a70f28b3bf0b96c40d46c0c4b9d6639846711
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126
video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3
video_thumbnail: c4e2a3c539e247d4de13cd545344fd2d26ffafd1
wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f
wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1
webview_flutter_wkwebview: be0f0d33777f1bfd0c9fdcb594786704dbf65f36

PODFILE CHECKSUM: f41df053e13795ca3bec060038c249ef06910792
PODFILE CHECKSUM: edbeaea3b499feb7b2b276309b09c237de1a6cff

COCOAPODS: 1.14.3
2 changes: 1 addition & 1 deletion lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class _LanternAppState extends State<LanternApp>
create: (context) => BottomBarChangeNotifier(),
child: sessionModel.language(
(context, lang, child) {
Localization.locale = lang;
Localization.locale = lang.startsWith('en') ? "en_us" : lang;
return GlobalLoaderOverlay(
useDefaultLoading: false,
overlayColor: Colors.black.withOpacity(0.5),
Expand Down
2 changes: 1 addition & 1 deletion lib/i18n/i18n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:i18n_extension_importer/src/io/import.dart';
import 'package:lantern/common/common.dart';

extension Localization on String {
static String defaultLocale = 'en';
static String defaultLocale = 'en_us';
static String locale = defaultLocale;

static Translations translations =
Expand Down
2 changes: 1 addition & 1 deletion lib/plans/reseller_checkout_legacy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class _ResellerCodeCheckoutState extends State<ResellerCodeCheckout> {
Column(
children: [
const TOS(),
SizedBox(height: 16),
const SizedBox(height: 16),
// * resellerCodeCheckout
Button(
disabled: emailController.value.text.isEmpty ||
Expand Down
Loading

0 comments on commit fa48e77

Please sign in to comment.