Skip to content

Commit 70e6951

Browse files
authored
Merge pull request #295 from Manuito83/develop
Merge for v3.6.1
2 parents 7d1cc60 + 737507f commit 70e6951

17 files changed

+211
-136
lines changed

android/app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ if (localPropertiesFile.exists()) {
1616

1717
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1818
if (flutterVersionCode == null) {
19-
flutterVersionCode = '463'
19+
flutterVersionCode = '465'
2020
}
2121

2222
def flutterVersionName = localProperties.getProperty('flutter.versionName')
2323
if (flutterVersionName == null) {
24-
flutterVersionName = '3.6.0'
24+
flutterVersionName = '3.6.1'
2525
}
2626

2727
def keystoreProperties = new Properties()

ios/Runner.xcodeproj/project.pbxproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@
549549
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
550550
CODE_SIGN_IDENTITY = "Apple Development";
551551
CODE_SIGN_STYLE = Automatic;
552-
CURRENT_PROJECT_VERSION = 463;
552+
CURRENT_PROJECT_VERSION = 465;
553553
DEVELOPMENT_ASSET_PATHS = "";
554554
DEVELOPMENT_TEAM = 53KVJRJS99;
555555
ENABLE_BITCODE = NO;
@@ -567,7 +567,7 @@
567567
"$(inherited)",
568568
"$(PROJECT_DIR)/Flutter",
569569
);
570-
MARKETING_VERSION = 3.6.0;
570+
MARKETING_VERSION = 3.6.1;
571571
PRODUCT_BUNDLE_IDENTIFIER = com.manuito.tornpda;
572572
PRODUCT_NAME = "$(TARGET_NAME)";
573573
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -698,7 +698,7 @@
698698
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
699699
CODE_SIGN_IDENTITY = "Apple Development";
700700
CODE_SIGN_STYLE = Automatic;
701-
CURRENT_PROJECT_VERSION = 463;
701+
CURRENT_PROJECT_VERSION = 465;
702702
DEVELOPMENT_ASSET_PATHS = "";
703703
DEVELOPMENT_TEAM = 53KVJRJS99;
704704
ENABLE_BITCODE = NO;
@@ -716,7 +716,7 @@
716716
"$(inherited)",
717717
"$(PROJECT_DIR)/Flutter",
718718
);
719-
MARKETING_VERSION = 3.6.0;
719+
MARKETING_VERSION = 3.6.1;
720720
PRODUCT_BUNDLE_IDENTIFIER = com.manuito.tornpda;
721721
PRODUCT_NAME = "$(TARGET_NAME)";
722722
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -739,7 +739,7 @@
739739
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
740740
CODE_SIGN_IDENTITY = "Apple Development";
741741
CODE_SIGN_STYLE = Automatic;
742-
CURRENT_PROJECT_VERSION = 463;
742+
CURRENT_PROJECT_VERSION = 465;
743743
DEVELOPMENT_ASSET_PATHS = "";
744744
DEVELOPMENT_TEAM = 53KVJRJS99;
745745
ENABLE_BITCODE = NO;
@@ -757,7 +757,7 @@
757757
"$(inherited)",
758758
"$(PROJECT_DIR)/Flutter",
759759
);
760-
MARKETING_VERSION = 3.6.0;
760+
MARKETING_VERSION = 3.6.1;
761761
PRODUCT_BUNDLE_IDENTIFIER = com.manuito.tornpda;
762762
PRODUCT_NAME = "$(TARGET_NAME)";
763763
PROVISIONING_PROFILE_SPECIFIER = "";

lib/drawer.dart

+9-1
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,15 @@ class DrawerPageState extends State<DrawerPage> with WidgetsBindingObserver, Aut
445445

446446
@override
447447
Future<void> didChangeAppLifecycleState(AppLifecycleState state) async {
448-
if (Platform.isWindows) return;
448+
// For Windows, just execute what's needed and return (other tasks are not compatible or make no sense)
449+
if (Platform.isWindows) {
450+
if (state == AppLifecycleState.resumed) {
451+
checkForScriptUpdates();
452+
_syncThemeWithDeviceSettings();
453+
Get.find<PeriodicExecutionController>().checkAndExecuteTasks();
454+
}
455+
return;
456+
}
449457

450458
if (state == AppLifecycleState.paused) {
451459
// Stop stakeouts

lib/main.dart

+4-9
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,12 @@ import 'package:torn_pda/utils/notification.dart';
6565
import 'package:torn_pda/utils/shared_prefs.dart';
6666
import 'package:upgrader/upgrader.dart';
6767
import 'package:wakelock_plus/wakelock_plus.dart';
68-
import 'package:windows_notification/windows_notification.dart';
6968
import 'package:workmanager/workmanager.dart';
7069

7170
// TODO (App release)
72-
const String appVersion = '3.6.0';
73-
const String androidCompilation = '463';
74-
const String iosCompilation = '463';
71+
const String appVersion = '3.6.1';
72+
const String androidCompilation = '465';
73+
const String iosCompilation = '465';
7574

7675
// TODO (App release)
7776
// Note: if using Windows and calling HTTP functions, we need to change the URL in [firebase_functions.dart]
@@ -87,11 +86,6 @@ final FirebaseRemoteConfig remoteConfig = FirebaseRemoteConfig.instance;
8786

8887
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
8988

90-
// TODO Run [flutter run --machine] to set up
91-
final winNotifyPlugin = WindowsNotification(
92-
applicationId: kDebugMode ? r"{fdf9adab-cc5d-4660-aec3-f9b7e4b3e355}\WindowsPowerShell\v1.0\powershell.exe" : null,
93-
);
94-
9589
final StreamController<ReceivedNotification> didReceiveLocalNotificationStream =
9690
StreamController<ReceivedNotification>.broadcast();
9791

@@ -198,6 +192,7 @@ Future<void> main() async {
198192
const initizationSettingsWindows = WindowsInitializationSettings(
199193
appName: 'Torn PDA',
200194
appUserModelId: 'com.manuito.tornpda',
195+
// Run [flutter run --machine] to set up ??
201196
guid: 'fdf9adab-cc5d-4660-aec3-f9b7e4b3e355',
202197
);
203198

lib/pages/alerts/stockmarket_alerts_page.dart

+19-15
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,9 @@ class StockMarketAlertsPageState extends State<StockMarketAlertsPage> {
199199
iconTheme: IconThemeData(color: Colors.white),
200200
elevation: _settingsP!.appBarTop ? 2 : 0,
201201
systemOverlayStyle: SystemUiOverlayStyle.light,
202-
title: const Text("Stock market alerts", style: TextStyle(color: Colors.white)),
202+
title: Platform.isWindows
203+
? const Text("Stock market", style: TextStyle(color: Colors.white))
204+
: const Text("Stock market alerts", style: TextStyle(color: Colors.white)),
203205
leadingWidth: _webViewProvider.webViewSplitActive ? 50 : 88,
204206
leading: Row(
205207
children: [
@@ -317,7 +319,7 @@ class StockMarketAlertsPageState extends State<StockMarketAlertsPage> {
317319
try {
318320
// If we call from the main menu, we have to get the fbUser before loading anything, as it won't come from
319321
// the alerts pages, like in other cases
320-
if (widget.calledFromMenu) {
322+
if (widget.calledFromMenu && !Platform.isWindows) {
321323
_fbUser = await FirestoreHelper().getUserProfile(); // We are NOT getting updated stocks every time
322324
}
323325

@@ -372,19 +374,21 @@ class StockMarketAlertsPageState extends State<StockMarketAlertsPage> {
372374
}
373375

374376
// Complete details based on what's saved in Firebase
375-
for (final fbAlert in _fbUser!.stockMarketShares) {
376-
final acronym = fbAlert.toString().substring(0, 3);
377-
final regex = RegExp(r"[A-Z]+-G-((?:\d+(?:\.)?(?:\d{1,2}))|n)-L-((?:\d+(?:\.)?(?:\d{1,2}))|n)");
378-
final match = regex.firstMatch(fbAlert.toString())!;
379-
final fbGain = match.group(1);
380-
final fbLoss = match.group(2);
381-
for (final listedStock in _stockList) {
382-
if (listedStock.acronym == acronym) {
383-
if (fbGain != "n") {
384-
listedStock.alertGain = double.tryParse(fbGain!);
385-
}
386-
if (fbLoss != "n") {
387-
listedStock.alertLoss = double.tryParse(fbLoss!);
377+
if (!Platform.isWindows) {
378+
for (final fbAlert in _fbUser!.stockMarketShares) {
379+
final acronym = fbAlert.toString().substring(0, 3);
380+
final regex = RegExp(r"[A-Z]+-G-((?:\d+(?:\.)?(?:\d{1,2}))|n)-L-((?:\d+(?:\.)?(?:\d{1,2}))|n)");
381+
final match = regex.firstMatch(fbAlert.toString())!;
382+
final fbGain = match.group(1);
383+
final fbLoss = match.group(2);
384+
for (final listedStock in _stockList) {
385+
if (listedStock.acronym == acronym) {
386+
if (fbGain != "n") {
387+
listedStock.alertGain = double.tryParse(fbGain!);
388+
}
389+
if (fbLoss != "n") {
390+
listedStock.alertLoss = double.tryParse(fbLoss!);
391+
}
388392
}
389393
}
390394
}

lib/pages/loot.dart

+8-13
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ class LootPageState extends State<LootPage> {
275275
)
276276
else
277277
const SizedBox.shrink(),
278-
if (_apiSuccess && Platform.isIOS)
278+
if (_apiSuccess && (Platform.isIOS || Platform.isWindows))
279279
IconButton(
280280
icon: Icon(
281281
Icons.alarm_on,
@@ -427,7 +427,7 @@ class LootPageState extends State<LootPage> {
427427
}
428428

429429
Widget notificationIcon;
430-
if (!Platform.isWindows && (!isPast && !isCurrent)) {
430+
if (!isPast && !isCurrent) {
431431
bool isPending = false;
432432
for (final id in _activeNotificationsIds) {
433433
if (id == int.parse('400$npcId$levelNumber')) {
@@ -935,13 +935,12 @@ class LootPageState extends State<LootPage> {
935935
},
936936
),
937937
),
938-
if (!Platform.isWindows)
939-
Row(
940-
children: [
941-
const SizedBox(width: 15),
942-
notificationIcon,
943-
],
944-
),
938+
Row(
939+
children: [
940+
const SizedBox(width: 15),
941+
notificationIcon,
942+
],
943+
),
945944
],
946945
),
947946
],
@@ -1292,8 +1291,6 @@ class LootPageState extends State<LootPage> {
12921291
}
12931292

12941293
Future _retrievePendingNotifications() async {
1295-
if (Platform.isWindows) return;
1296-
12971294
try {
12981295
final pendingNotificationRequests = await flutterLocalNotificationsPlugin.pendingNotificationRequests();
12991296

@@ -1309,8 +1306,6 @@ class LootPageState extends State<LootPage> {
13091306
}
13101307

13111308
Future _cancelPassedNotifications() async {
1312-
if (Platform.isWindows) return;
1313-
13141309
try {
13151310
final pendingNotificationRequests = await flutterLocalNotificationsPlugin.pendingNotificationRequests();
13161311

lib/pages/profile_page.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ class ProfilePageState extends State<ProfilePage> with WidgetsBindingObserver {
12611261
),
12621262
if (!_dedicatedTravelCard) _travelWidget(),
12631263
descriptionWidget(),
1264-
if (_user!.status!.state != 'Hospital' && _w.nukeReviveActive)
1264+
if (_user!.status!.state == 'Hospital' && _w.nukeReviveActive)
12651265
Padding(
12661266
padding: const EdgeInsets.only(left: 13, top: 10),
12671267
child: NukeReviveButton(

lib/pages/settings_page.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -2567,8 +2567,8 @@ class SettingsPageState extends State<SettingsPage> {
25672567
_apiError = false;
25682568
});
25692569
if (!Platform.isWindows) await FirebaseMessaging.instance.deleteToken();
2570-
await FirestoreHelper().deleteUserProfile();
2571-
await firebaseAuth.signOut();
2570+
if (!Platform.isWindows) await FirestoreHelper().deleteUserProfile();
2571+
if (!Platform.isWindows) await firebaseAuth.signOut();
25722572
widget.changeUID("");
25732573
},
25742574
),
@@ -3701,6 +3701,7 @@ class SettingsPageState extends State<SettingsPage> {
37013701
if (uc.playerId == 0 && myProfile.playerId != null) {
37023702
uc.playerId = myProfile.playerId!;
37033703
uc.apiKey = myProfile.userApiKey;
3704+
uc.playerName = myProfile.name!;
37043705
}
37053706

37063707
// Firestore uploading, but only if "Load" pressed by user

lib/providers/sendbird_controller.dart

+6-2
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ class SendbirdController extends GetxController {
261261
}
262262
}
263263

264-
Future<void> getDoNotDisturbSettings() async {
264+
Future<bool> getDoNotDisturbSettings() async {
265265
try {
266266
final result = await SendbirdChat.getDoNotDisturb();
267267
doNotDisturbEnabled = result.isDoNotDisturbOn;
@@ -271,10 +271,12 @@ class SendbirdController extends GetxController {
271271
update();
272272
} catch (e) {
273273
logToUser("Sendbird: error getting Do Not Disturb: $e");
274+
return false;
274275
}
276+
return true;
275277
}
276278

277-
Future<void> setDoNotDisturbSettings(bool enabled, TimeOfDay start, TimeOfDay end) async {
279+
Future<bool> setDoNotDisturbSettings(bool enabled, TimeOfDay start, TimeOfDay end) async {
278280
try {
279281
String timezone = await getLocalTimeZone();
280282
await SendbirdChat.setDoNotDisturb(
@@ -293,7 +295,9 @@ class SendbirdController extends GetxController {
293295
log("Sendbird: do not disturb updated");
294296
} catch (e) {
295297
logToUser("Sendbird: error updating Do Not Disturb: $e");
298+
return false;
296299
}
300+
return true;
297301
}
298302

299303
Future<String> getLocalTimeZone() async {

lib/providers/user_controller.dart

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:get/get.dart';
33
class UserController extends GetxController {
44
String? apiKey = "";
55
int playerId = 0;
6+
String playerName = "";
67

78
// Alternative keys YATA
89
bool _alternativeYataKeyEnabled = false;

lib/providers/user_details_provider.dart

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class UserDetailsProvider extends ChangeNotifier {
5252

5353
// Set Player ID in the controller, so that certain providers can use it while avoiding multi-providers
5454
_u.playerId = basic!.playerId ?? 0;
55+
_u.playerName = basic!.name ?? "";
5556

5657
final bool alternativeYataKey = await Prefs().getAlternativeYataKeyEnabled();
5758
if (alternativeYataKey) {

lib/utils/changelog.dart

+5-2
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,18 @@ class ChangeLogState extends State<ChangeLog> {
5151
void _createItems() {
5252
final itemList = <ChangeLogItem>[];
5353

54-
// v3.6.1 - Build 464 - 04/11/2024
54+
// v3.6.1 - Build 465 - 06/11/2024
5555
itemList.add(
5656
ChangeLogItem()
5757
..version = 'Torn PDA v3.6.1'
58-
..date = '15 DEC 2024'
58+
..date = '8 DEC 2024'
5959
..features = [
6060
"Added channel info to chat notifications",
61+
"Fixed notifications for own chat messages",
6162
"Fixed cooldown calculations for traveling",
6263
"Fixed deep links issues",
64+
"Fixed revive icon in Profile",
65+
"Fixed browser search",
6366
],
6467
);
6568

lib/utils/notification.dart

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import 'package:get/get.dart';
1515
import 'package:torn_pda/main.dart';
1616
import 'package:torn_pda/providers/sendbird_controller.dart';
1717
import 'package:torn_pda/providers/settings_provider.dart';
18+
import 'package:torn_pda/providers/user_controller.dart';
1819
import 'package:torn_pda/utils/shared_prefs.dart';
1920
import 'package:torn_pda/widgets/settings/alarm_permissions_dialog.dart';
2021

@@ -906,6 +907,8 @@ Future assessExactAlarmsPermissionsAndroid(BuildContext context, SettingsProvide
906907
}
907908

908909
showSendbirdNotification(String sender, String message, String channelUrl) async {
910+
if (sender.toLowerCase() == Get.find<UserController>().playerName.toLowerCase()) return;
911+
909912
final modifier = await getNotificationChannelsModifiers();
910913
String channelTitle = "Torn chat ${modifier.channelIdModifier} s";
911914
String channelSubtitle = "Torn chat ${modifier.channelIdModifier} s";

0 commit comments

Comments
 (0)