Skip to content

Commit

Permalink
Merge pull request #269 from Manuito83/develop
Browse files Browse the repository at this point in the history
Develop merge for 3.4.4 release
  • Loading branch information
Manuito83 authored Jul 25, 2024
2 parents b467ebf + a495b3d commit 15d688e
Show file tree
Hide file tree
Showing 16 changed files with 1,099 additions and 148 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ if (localPropertiesFile.exists()) {

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '432'
flutterVersionCode = '435'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '3.4.3'
flutterVersionName = '3.4.4'
}

def keystoreProperties = new Properties()
Expand Down
12 changes: 6 additions & 6 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 432;
CURRENT_PROJECT_VERSION = 435;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 53KVJRJS99;
ENABLE_BITCODE = NO;
Expand All @@ -549,7 +549,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 3.4.3;
MARKETING_VERSION = 3.4.4;
PRODUCT_BUNDLE_IDENTIFIER = com.manuito.tornpda;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -675,7 +675,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 432;
CURRENT_PROJECT_VERSION = 435;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 53KVJRJS99;
ENABLE_BITCODE = NO;
Expand All @@ -693,7 +693,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 3.4.3;
MARKETING_VERSION = 3.4.4;
PRODUCT_BUNDLE_IDENTIFIER = com.manuito.tornpda;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -713,7 +713,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 432;
CURRENT_PROJECT_VERSION = 435;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 53KVJRJS99;
ENABLE_BITCODE = NO;
Expand All @@ -731,7 +731,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 3.4.3;
MARKETING_VERSION = 3.4.4;
PRODUCT_BUNDLE_IDENTIFIER = com.manuito.tornpda;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
11 changes: 7 additions & 4 deletions lib/drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ class DrawerPageState extends State<DrawerPage> with WidgetsBindingObserver, Aut
"yata_stats_enabled": true,
"prefs_backup_enabled": true,
"tornexchange_enabled": true,
"use_browser_cache": "user", // user, on, off
});

// Remote Config first fetch and live update
Expand All @@ -334,13 +335,15 @@ class DrawerPageState extends State<DrawerPage> with WidgetsBindingObserver, Aut
_settingsProvider.yataStatsEnabledStatusRemoteConfig = remoteConfig.getBool("yata_stats_enabled");
_settingsProvider.backupPrefsEnabledStatusRemoteConfig = remoteConfig.getBool("prefs_backup_enabled");
_settingsProvider.tornExchangeEnabledStatusRemoteConfig = remoteConfig.getBool("tornexchange_enabled");
_settingsProvider.webviewCacheEnabledRemoteConfig = remoteConfig.getString("use_browser_cache");

remoteConfig.onConfigUpdated.listen((event) async {
await remoteConfig.activate();
_settingsProvider.tscEnabledStatusRemoteConfig = remoteConfig.getBool("tsc_enabled");
_settingsProvider.yataStatsEnabledStatusRemoteConfig = remoteConfig.getBool("yata_stats_enabled");
_settingsProvider.backupPrefsEnabledStatusRemoteConfig = remoteConfig.getBool("prefs_backup_enabled");
_settingsProvider.tornExchangeEnabledStatusRemoteConfig = remoteConfig.getBool("tornexchange_enabled");
_settingsProvider.webviewCacheEnabledRemoteConfig = remoteConfig.getString("use_browser_cache");
});
});

Expand Down Expand Up @@ -767,10 +770,10 @@ class DrawerPageState extends State<DrawerPage> with WidgetsBindingObserver, Aut
browserUrl = 'https://www.torn.com/item.php#medical-items';
} else if (_settingsProvider.lifeNotificationTapAction == "itemsFaction") {
launchBrowser = true;
browserUrl = 'https://www.torn.com/factions.php?step=your&type=1#armoury-medical';
browserUrl = 'https://www.torn.com/factions.php?step=your&type=1#/tab=armoury&start=0&sub=medical';
} else if (_settingsProvider.lifeNotificationTapAction == "factionMain") {
launchBrowser = true;
browserUrl = 'https://www.torn.com/factions.php?step=your&type=1#/';
browserUrl = 'https://www.torn.com/factions.php';
}
} else if (energy) {
launchBrowser = true;
Expand Down Expand Up @@ -984,10 +987,10 @@ class DrawerPageState extends State<DrawerPage> with WidgetsBindingObserver, Aut
browserUrl = 'https://www.torn.com/item.php#medical-items';
} else if (_settingsProvider.lifeNotificationTapAction == "itemsFaction") {
launchBrowser = true;
browserUrl = 'https://www.torn.com/factions.php?step=your&type=1#armoury-medical';
browserUrl = 'https://www.torn.com/factions.php?step=your&type=1#/tab=armoury&start=0&sub=medical';
} else if (_settingsProvider.lifeNotificationTapAction == "factionMain") {
launchBrowser = true;
browserUrl = 'https://www.torn.com/factions.php?step=your&type=1#/';
browserUrl = 'https://www.torn.com/factions.php';
}
} else if (payload.contains('drugs')) {
launchBrowser = true;
Expand Down
128 changes: 43 additions & 85 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ import 'package:wakelock_plus/wakelock_plus.dart';
import 'package:workmanager/workmanager.dart';

// TODO (App release)
const String appVersion = '3.4.3';
const String androidCompilation = '432';
const String iosCompilation = '432';
const String appVersion = '3.4.4';
const String androidCompilation = '435';
const String iosCompilation = '435';

// TODO (App release)
const bool pointFunctionsEmulatorToLocal = false;
Expand All @@ -73,14 +73,12 @@ bool logAndShowToUser = false;
final FirebaseAnalytics analytics = FirebaseAnalytics.instance;
final FirebaseRemoteConfig remoteConfig = FirebaseRemoteConfig.instance;

final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();

final StreamController<ReceivedNotification> didReceiveLocalNotificationStream =
StreamController<ReceivedNotification>.broadcast();

final StreamController<String?> selectNotificationStream =
StreamController<String?>.broadcast();
final StreamController<String?> selectNotificationStream = StreamController<String?>.broadcast();

bool exactAlarmsPermissionAndroid = false;

Expand Down Expand Up @@ -115,8 +113,7 @@ Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
Prefs().setDataStockMarket(newData);
}
} catch (e) {
FirebaseCrashlytics.instance
.log("PDA Crash at Messaging Background Handler");
FirebaseCrashlytics.instance.log("PDA Crash at Messaging Background Handler");
FirebaseCrashlytics.instance.recordError("PDA Error: $e", null);
}
}
Expand Down Expand Up @@ -146,17 +143,14 @@ Future<void> main() async {

// Flutter Local Notifications
if (Platform.isAndroid) {
final AndroidFlutterLocalNotificationsPlugin androidImplementation =
flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>()!;
final AndroidFlutterLocalNotificationsPlugin androidImplementation = flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>()!;
await androidImplementation.requestNotificationsPermission();
exactAlarmsPermissionAndroid =
await androidImplementation.canScheduleExactNotifications() ?? false;
exactAlarmsPermissionAndroid = await androidImplementation.canScheduleExactNotifications() ?? false;
}

tz.initializeTimeZones();
const initializationSettingsAndroid =
AndroidInitializationSettings('app_icon');
const initializationSettingsAndroid = AndroidInitializationSettings('app_icon');
const initializationSettingsIOS = DarwinInitializationSettings();

const initializationSettings = InitializationSettings(
Expand All @@ -166,8 +160,7 @@ Future<void> main() async {

await flutterLocalNotificationsPlugin.initialize(
initializationSettings,
onDidReceiveNotificationResponse:
(NotificationResponse notificationResponse) async {
onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) async {
final String? payload = notificationResponse.payload;
if (notificationResponse.payload != null) {
log('Notification payload: $payload');
Expand All @@ -184,8 +177,7 @@ Future<void> main() async {

if (kDebugMode) {
if (pointFunctionsEmulatorToLocal) {
FirebaseFunctions.instanceFor(region: 'us-east4')
.useFunctionsEmulator('localhost', 5001);
FirebaseFunctions.instanceFor(region: 'us-east4').useFunctionsEmulator('localhost', 5001);
}
// Only 'true' intended for debugging, otherwise leave in false
await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(false);
Expand Down Expand Up @@ -218,53 +210,34 @@ Future<void> main() async {
// iOS settings for AudioPlayer are managed through the controller
AudioPlayer.global.setAudioContext(
AudioContext(
android: AudioContextAndroid(
audioFocus: AndroidAudioFocus.gainTransientMayDuck),
android: AudioContextAndroid(audioFocus: AndroidAudioFocus.gainTransientMayDuck),
),
);

runApp(
MultiProvider(
providers: [
// UserDetailsProvider has to go first to initialize the others!
ChangeNotifierProvider<UserDetailsProvider>(
create: (context) => UserDetailsProvider()),
ChangeNotifierProvider<TargetsProvider>(
create: (context) => TargetsProvider()),
ChangeNotifierProvider<AttacksProvider>(
create: (context) => AttacksProvider()),
ChangeNotifierProvider<ThemeProvider>(
create: (context) => ThemeProvider()),
ChangeNotifierProvider<SettingsProvider>(
create: (context) => SettingsProvider()),
ChangeNotifierProvider<FriendsProvider>(
create: (context) => FriendsProvider()),
ChangeNotifierProvider<UserScriptsProvider>(
create: (context) => UserScriptsProvider()),
ChangeNotifierProvider<ChainStatusProvider>(
create: (context) => ChainStatusProvider()),
ChangeNotifierProvider<CrimesProvider>(
create: (context) => CrimesProvider()),
ChangeNotifierProvider<QuickItemsProvider>(
create: (context) => QuickItemsProvider()),
ChangeNotifierProvider<QuickItemsProviderFaction>(
create: (context) => QuickItemsProviderFaction()),
ChangeNotifierProvider<TradesProvider>(
create: (context) => TradesProvider()),
ChangeNotifierProvider<ShortcutsProvider>(
create: (context) => ShortcutsProvider()),
ChangeNotifierProvider<AwardsProvider>(
create: (context) => AwardsProvider()),
ChangeNotifierProvider<UserDetailsProvider>(create: (context) => UserDetailsProvider()),
ChangeNotifierProvider<TargetsProvider>(create: (context) => TargetsProvider()),
ChangeNotifierProvider<AttacksProvider>(create: (context) => AttacksProvider()),
ChangeNotifierProvider<ThemeProvider>(create: (context) => ThemeProvider()),
ChangeNotifierProvider<SettingsProvider>(create: (context) => SettingsProvider()),
ChangeNotifierProvider<FriendsProvider>(create: (context) => FriendsProvider()),
ChangeNotifierProvider<UserScriptsProvider>(create: (context) => UserScriptsProvider()),
ChangeNotifierProvider<ChainStatusProvider>(create: (context) => ChainStatusProvider()),
ChangeNotifierProvider<CrimesProvider>(create: (context) => CrimesProvider()),
ChangeNotifierProvider<QuickItemsProvider>(create: (context) => QuickItemsProvider()),
ChangeNotifierProvider<QuickItemsProviderFaction>(create: (context) => QuickItemsProviderFaction()),
ChangeNotifierProvider<TradesProvider>(create: (context) => TradesProvider()),
ChangeNotifierProvider<ShortcutsProvider>(create: (context) => ShortcutsProvider()),
ChangeNotifierProvider<AwardsProvider>(create: (context) => AwardsProvider()),
ChangeNotifierProvider<TacProvider>(create: (context) => TacProvider()),
ChangeNotifierProvider<TerminalProvider>(
create: (context) => TerminalProvider("")),
ChangeNotifierProvider<WebViewProvider>(
create: (context) => WebViewProvider()),
ChangeNotifierProvider<TerminalProvider>(create: (context) => TerminalProvider("")),
ChangeNotifierProvider<WebViewProvider>(create: (context) => WebViewProvider()),
// Native login
ChangeNotifierProvider<NativeAuthProvider>(
create: (context) => NativeAuthProvider()),
ChangeNotifierProvider<NativeUserProvider>(
create: (context) => NativeUserProvider()),
ChangeNotifierProvider<NativeAuthProvider>(create: (context) => NativeAuthProvider()),
ChangeNotifierProvider<NativeUserProvider>(create: (context) => NativeUserProvider()),
// ------------
],
child: MyApp(),
Expand Down Expand Up @@ -299,8 +272,7 @@ class MyAppState extends State<MyApp> with WidgetsBindingObserver {
// Callback to force the browser back to full screen if there is a system request to revert
// Might happen when app is on the background or when only the top is being extended
SystemChrome.setSystemUIChangeCallback((systemOverlaysAreVisible) async {
if (_webViewProvider.currentUiMode == UiMode.fullScreen &&
systemOverlaysAreVisible) {
if (_webViewProvider.currentUiMode == UiMode.fullScreen && systemOverlaysAreVisible) {
_webViewProvider.setCurrentUiMode(UiMode.fullScreen, context);
}
});
Expand All @@ -320,8 +292,7 @@ class MyAppState extends State<MyApp> with WidgetsBindingObserver {
void didChangeMetrics() async {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
final bool splitNowActive = _webViewProvider.webViewSplitActive;
final bool splitUserEnabled =
_webViewProvider.splitScreenPosition != WebViewSplitPosition.off;
final bool splitUserEnabled = _webViewProvider.splitScreenPosition != WebViewSplitPosition.off;
final bool screenIsWide = MediaQuery.sizeOf(context).width >= 800;

if (!splitNowActive && splitUserEnabled && screenIsWide) {
Expand Down Expand Up @@ -361,16 +332,12 @@ class MyAppState extends State<MyApp> with WidgetsBindingObserver {
),
appBarTheme: AppBarTheme(
systemOverlayStyle: SystemUiOverlayStyle.light,
surfaceTintColor: _themeProvider.currentTheme == AppTheme.extraDark
? Colors.black
: null,
surfaceTintColor: _themeProvider.currentTheme == AppTheme.extraDark ? Colors.black : null,
color: _themeProvider.statusBar,
),
primarySwatch: Colors.blueGrey,
useMaterial3: _themeProvider.useMaterial3,
brightness: _themeProvider.currentTheme == AppTheme.light
? Brightness.light
: Brightness.dark,
brightness: _themeProvider.currentTheme == AppTheme.light ? Brightness.light : Brightness.dark,
);

SystemChrome.setSystemUIOverlayStyle(
Expand Down Expand Up @@ -400,8 +367,7 @@ class MyAppState extends State<MyApp> with WidgetsBindingObserver {
debugShowCheckedModeBanner: false,
builder: BotToastInit(),
navigatorObservers: [BotToastNavigatorObserver()],
home: Consumer2<SettingsProvider, WebViewProvider>(
builder: (context, sProvider, wProvider, child) {
home: Consumer2<SettingsProvider, WebViewProvider>(builder: (context, sProvider, wProvider, child) {
// Build standard or split-screen home
Widget home = Stack(
children: [
Expand All @@ -425,8 +391,7 @@ class MyAppState extends State<MyApp> with WidgetsBindingObserver {
const AppBorder(),
],
);
} else if (wProvider.splitScreenPosition ==
WebViewSplitPosition.left &&
} else if (wProvider.splitScreenPosition == WebViewSplitPosition.left &&
wProvider.webViewSplitActive &&
screenIsWide) {
home = Stack(
Expand All @@ -444,13 +409,11 @@ class MyAppState extends State<MyApp> with WidgetsBindingObserver {

return PopScope(
// Only exit app if user allows and we are not in the browser
canPop: sProvider.onBackButtonAppExit == "exit" &&
!wProvider.browserShowInForeground,
canPop: sProvider.onBackButtonAppExit == "exit" && !wProvider.browserShowInForeground,
onPopInvoked: (didPop) async {
if (didPop) return;
// If we can't pop, decide if we open the drawer or go backwards in the browser
final WebViewProvider w =
Provider.of<WebViewProvider>(context, listen: false);
final WebViewProvider w = Provider.of<WebViewProvider>(context, listen: false);
if (w.browserShowInForeground) {
// Browser is in front, delegate the call
w.tryGoBack();
Expand All @@ -466,8 +429,7 @@ class MyAppState extends State<MyApp> with WidgetsBindingObserver {
}

_openDrawerIfPossible() async {
final SettingsProvider s =
Provider.of<SettingsProvider>(context, listen: false);
final SettingsProvider s = Provider.of<SettingsProvider>(context, listen: false);
if (routeWithDrawer) {
// Open drawer instead
s.willPopShouldOpenDrawerStream.add(true);
Expand Down Expand Up @@ -531,8 +493,7 @@ Future<void> _shouldSyncDeviceTheme(WidgetsBinding widgetsBinding) async {
}
}

logToUser(String? message,
{int duration = 3, Color? color, Color? borderColor}) {
logToUser(String? message, {int duration = 3, Color? color, Color? borderColor}) {
log(message.toString());
if (message == null) return;
color ??= Colors.red.shade600;
Expand All @@ -555,11 +516,8 @@ logToUser(String? message,
margin: const EdgeInsets.all(8),
child: Column(
children: [
Text("Debug Message\n",
style: TextStyle(
color: Colors.white, fontWeight: FontWeight.bold)),
Text(message.toString(),
style: TextStyle(color: Colors.white)),
Text("Debug Message\n", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
Text(message.toString(), style: TextStyle(color: Colors.white)),
],
),
)),
Expand Down
Loading

0 comments on commit 15d688e

Please sign in to comment.