-
-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Change the way of getting followers & followings: no more internet …
…requests - Fix crash when trying to follow already followed user #50 - Fix attempt to interact with yourself when seeing you in blogger's followers list
- Loading branch information
Alexander Mishchenko
committed
Jul 11, 2020
1 parent
23e6c92
commit 565603d
Showing
6 changed files
with
213 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
from src.navigation import Tabs, navigate | ||
from src.utils import * | ||
|
||
|
||
def parse(device, text): | ||
multiplier = 1 | ||
text = text.replace(",", "") | ||
if "K" in text: | ||
text = text.replace("K", "") | ||
multiplier = 1_000 | ||
if "M" in text: | ||
text = text.replace("M", "") | ||
multiplier = 1_000_000 | ||
try: | ||
count = int(float(text) * multiplier) | ||
except ValueError: | ||
print_timeless(COLOR_FAIL + "Cannot parse \"" + text + "\". Probably wrong language, will set English now." + | ||
COLOR_ENDC) | ||
take_screenshot(device) | ||
_switch_to_english(device) | ||
raise LanguageChangedException() | ||
return count | ||
|
||
|
||
def _switch_to_english(device): | ||
print(COLOR_OKGREEN + "Switching to English locale" + COLOR_ENDC) | ||
navigate(device, Tabs.PROFILE) | ||
print("Changing language in settings") | ||
|
||
action_bar = device(resourceId='com.instagram.android:id/action_bar', | ||
className='android.widget.LinearLayout') | ||
options_view = action_bar.child(index=1) | ||
options_view.click.wait() | ||
|
||
settings_button = device(resourceId='com.instagram.android:id/menu_settings_row', | ||
className='android.widget.TextView') | ||
settings_button.click.wait() | ||
|
||
list_view = device(resourceId='android:id/list', | ||
className='android.widget.ListView') | ||
account_item = list_view.child(index=6) | ||
account_item.click.wait() | ||
|
||
list_view = device(resourceId='android:id/list', | ||
className='android.widget.ListView') | ||
language_item = list_view.child(index=3) | ||
language_item.click.wait() | ||
|
||
search_edit_text = device(resourceId='com.instagram.android:id/search', | ||
className='android.widget.EditText') | ||
search_edit_text.set_text("english") | ||
device.wait.idle() | ||
|
||
list_view = device(resourceId='com.instagram.android:id/language_locale_list', | ||
className='android.widget.ListView') | ||
english_item = list_view.child(index=0) | ||
english_item.click.wait() | ||
|
||
|
||
class LanguageChangedException(Exception): | ||
pass |
Oops, something went wrong.