Skip to content

Commit 7d1cc60

Browse files
authored
Merge pull request #294 from Manuito83/develop
Merge for v3.6.0
2 parents 7ee9b04 + 30b5d26 commit 7d1cc60

File tree

1,514 files changed

+36541
-4385
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,514 files changed

+36541
-4385
lines changed

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/lib/config/
33
/lib/torn-pda-native/
44

5-
# Miscellaneous
5+
# Miscellaneoussure
66
*.class
77
*.lock
88
*.log
@@ -16,6 +16,10 @@
1616
.VSCodeCounter/
1717
.fvm
1818

19+
# ENV
20+
.env
21+
*env.g.dart
22+
1923
# IntelliJ related
2024
*.iml
2125
*.ipr

.metadata

+22-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,27 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: 18cd7a3601bcffb36fdf2f679f763b5e827c2e8e
8-
channel: beta
7+
revision: "2663184aa79047d0a33a14a3b607954f8fdd8730"
8+
channel: "stable"
99

1010
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
17+
base_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
18+
- platform: windows
19+
create_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
20+
base_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
21+
22+
# User provided section
23+
24+
# List of Local paths (relative to this file) that should be
25+
# ignored by the migrate tool.
26+
#
27+
# Files that are not part of the templates will be ignored by default.
28+
unmanaged_files:
29+
- 'lib/main.dart'
30+
- 'ios/Runner.xcodeproj/project.pbxproj'

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 = '450'
19+
flutterVersionCode = '463'
2020
}
2121

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

2727
def keystoreProperties = new Properties()

android/app/src/main/AndroidManifest.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<uses-permission android:name="android.permission.VIBRATE" />
1111
<uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>
1212
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
13+
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
1314

1415
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
1516
calls FlutterMain.startInitialization(this); in its onCreate method.
@@ -32,6 +33,7 @@
3233
android:hardwareAccelerated="true"
3334
android:windowSoftInputMode="adjustResize"
3435
android:exported="true">
36+
<meta-data android:name="flutter_deeplinking_enabled" android:value="false" />
3537
<meta-data
3638
android:name="io.flutter.embedding.android.NormalTheme"
3739
android:resource="@style/NormalTheme" />
@@ -56,14 +58,14 @@
5658
<data android:scheme="https" android:host="wiki.torn.com" />
5759
<data android:scheme="http" android:host="api.torn.com" />
5860
<data android:scheme="https" android:host="api.torn.com" />
59-
<data android:pathPattern="/.*" />
61+
<data android:pathPattern=".*" />
6062
</intent-filter>
6163
<intent-filter>
6264
<action android:name="android.intent.action.VIEW" />
6365
<category android:name="android.intent.category.DEFAULT" />
6466
<category android:name="android.intent.category.BROWSABLE" />
6567
<data android:scheme="tornpda" android:host="*" />
66-
<data android:pathPattern="/.*" />
68+
<data android:pathPattern=".*" />
6769
</intent-filter>
6870
</activity>
6971
<provider

android/app/src/main/java/com/manuito/tornpda/MainActivity.java

+32-11
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
import android.app.NotificationManager;
1010
import android.content.ComponentName;
1111
import android.content.Context;
12+
import android.content.Intent;
1213
import android.os.Build;
1314
import java.util.List;
1415
import io.flutter.plugin.common.MethodChannel;
1516
import android.os.Bundle;
1617
import android.window.SplashScreenView;
1718
import androidx.core.view.WindowCompat;
1819
import android.appwidget.AppWidgetManager;
20+
import android.os.PowerManager;
1921

2022
public class MainActivity extends FlutterActivity {
2123
private static final String CHANNEL = "tornpda.channel";
@@ -49,24 +51,28 @@ public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
4951
.setMethodCallHandler((call, result) -> {
5052
if (call.method.equals("cancelNotifications")) {
5153
cancelNotifications();
52-
}
53-
54-
if (call.method.equals("deleteNotificationChannels")) {
54+
} else if (call.method.equals("deleteNotificationChannels")) {
5555
deleteNotificationChannels();
56-
}
57-
58-
if (call.method.equals("widgetCount")) {
56+
} else if (call.method.equals("widgetCount")) {
5957
AppWidgetManager lala = AppWidgetManager.getInstance(this);
6058
ComponentName name = new ComponentName(this, HomeWidgetTornPda.class);
6159
result.success(lala.getAppWidgetIds(name));
60+
} else if (call.method.equals("checkBatteryOptimization")) {
61+
boolean isRestricted = isBatteryOptimizationRestricted();
62+
result.success(isRestricted);
63+
} else if (call.method.equals("openBatterySettings")) {
64+
openBatterySettings();
65+
result.success(null);
66+
} else {
67+
result.notImplemented();
6268
}
6369
});
6470
}
6571

66-
// This cancel Firebase notifications upon request from the Flutter app, as the
67-
// local plugins also cancels its scheduled ones when cancelAll() is called.
72+
// This cancels Firebase notifications upon request from the Flutter app, as the
73+
// local plugins also cancel their scheduled ones when cancelAll() is called.
6874
// Note: It is also possible to use "cancel("TAG", 0)" but giving a TAG in FCM
69-
// Android options overwrites the notifications with same tag.
75+
// Android options overwrites the notifications with the same tag.
7076
// There is an alternative which is preparing multiple tags.
7177
private void cancelNotifications() {
7278
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
@@ -76,7 +82,6 @@ private void cancelNotifications() {
7682
// Deletes all notification channels
7783
private void deleteNotificationChannels() {
7884
// Oreo or above, otherwise it will fail (can't be cached in Flutter)
79-
// https://developer.android.com/reference/android/os/Build.VERSION_CODES#O
8085
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
8186
NotificationManager notificationManager = (NotificationManager) getSystemService(
8287
Context.NOTIFICATION_SERVICE);
@@ -86,4 +91,20 @@ private void deleteNotificationChannels() {
8691
}
8792
}
8893
}
89-
}
94+
95+
// Checks if the battery optimization is restricted
96+
private boolean isBatteryOptimizationRestricted() {
97+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
98+
PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
99+
String packageName = getPackageName();
100+
return !powerManager.isIgnoringBatteryOptimizations(packageName);
101+
}
102+
return false; // Not restricted for versions below Marshmallow
103+
}
104+
105+
// Opens the battery optimization settings screen
106+
private void openBatterySettings() {
107+
Intent intent = new Intent(android.provider.Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS);
108+
startActivity(intent);
109+
}
110+
}
Loading

android/app/src/main/res/raw/keep.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources xmlns:tools="http://schemas.android.com/tools"
3-
tools:keep="@drawable/*,@raw/slow_spring_board,@raw/aircraft_seatbelt,@raw/sword_clash,@raw/car_start"
3+
tools:keep="@drawable/*,@raw/slow_spring_board,@raw/aircraft_seatbelt,@raw/sword_clash,@raw/car_start,@raw/keyboard"
44
/>
1.28 KB
Binary file not shown.

android/build.gradle

+13
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ subprojects {
2020
}
2121
}
2222

23+
// Needed for sendbird_chat 4.2.26 to build with no namespace issues
24+
subprojects {
25+
afterEvaluate { project ->
26+
if (project.plugins.hasPlugin("com.android.library")) {
27+
project.android {
28+
if (namespace == null) {
29+
namespace project.group
30+
}
31+
}
32+
}
33+
}
34+
}
35+
2336
subprojects {
2437
project.buildDir = "${rootProject.buildDir}/${project.name}"
2538
}

android/settings.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ plugins {
2121
id "com.android.application" version '8.7.0' apply false
2222
id "org.jetbrains.kotlin.android" version "1.9.20" apply false
2323
id "com.google.gms.google-services" version "4.4.1" apply false
24-
id "com.google.firebase.crashlytics" version "2.9.9" apply false
24+
id "com.google.firebase.crashlytics" version "3.0.0" apply false
2525
}
2626

2727
include ":app"

build.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
targets:
2+
$default:
3+
sources:
4+
- $package$
5+
- lib/$lib$
6+
- pubspec.yaml
7+
- lib/models/api_v2/**
8+
- lib/models/api_v2/swagger/**
9+
builders:
10+
chopper_generator:
11+
options:
12+
header: "//Generated code"
13+
swagger_dart_code_generator:
14+
options:
15+
input_folder: "lib/models/api_v2/swagger/"
16+
output_folder: "lib/models/api_v2/"
17+
type_mappings:
18+
"ForumId": "int"
19+
20+

0 commit comments

Comments
 (0)