Skip to content

Commit

Permalink
fix: get rid of Activity class when starting app
Browse files Browse the repository at this point in the history
  • Loading branch information
mastrolube committed Sep 28, 2023
1 parent 5a3bd94 commit e99fe69
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Changelog
## 3.2.6 (2023-09-28)
### Fix
- get rid of Activity class when starting app
## 3.2.5 (2023-07-23)
### Fix
- account selection with the little arrow instead of clicking on the account name
Expand Down
24 changes: 9 additions & 15 deletions GramAddict/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import emoji
import requests
import uiautomator2.exceptions
import urllib3
from colorama import Fore, Style
from packaging.version import parse as parse_version
Expand Down Expand Up @@ -232,24 +233,17 @@ def open_instagram(device):
logger.info("Open Instagram app.")

def call_ig():
cmd_ig: str = f"adb{'' if configs.device_id is None else ' -s ' + configs.device_id} shell am start -n {app_id}/com.instagram.mainactivity.MainActivity"
return subprocess.run(
cmd_ig, stdout=PIPE, stderr=PIPE, shell=True, encoding="utf8"
)
try:
return device.deviceV2.app_start(app_id)
except uiautomator2.exceptions.BaseError as exc:
return exc

err = call_ig().stderr.strip()
if "Error" in err:
logger.error(err.replace(nl, ". "))
return False
elif "more than one device/emulator" in err:
logger.error(
f"{err[9:].capitalize()}, specify only one by using `device: devicename` in your config.yml"
)
err = call_ig()
if err:
logger.error(err)
return False
elif err == "":
logger.debug("Instagram called successfully.")
else:
logger.debug(f"{err.replace('Warning: ', '')}.")
logger.debug("Instagram called successfully.")

max_tries = 3
n = 0
Expand Down
2 changes: 1 addition & 1 deletion GramAddict/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.2.5"
__version__ = "3.2.6"

0 comments on commit e99fe69

Please sign in to comment.