Skip to content

Commit

Permalink
Added deep links compatibility for Chrome href links
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuito83 committed Feb 17, 2023
1 parent 32d8310 commit 9afe4df
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 11 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if (flutterRoot == null) {

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '281'
flutterVersionCode = '282'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
Expand Down
3 changes: 3 additions & 0 deletions lib/drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ class _DrawerPageState extends State<DrawerPage> with WidgetsBindingObserver {
showError = true;
} else {
url = url.replaceAll("http://", "https://");
// Double tornpda comes from href in website
// <a href="intent://tornpda://www.cnn.com#Intent;package=com.manuito.tornpda;scheme=tornpda;end">test</a>
url = url.replaceAll("tornpda://tornpda://", "https://");
url = url.replaceAll("tornpda://", "https://");
if (!url.contains("https://")) {
showError = true;
Expand Down
4 changes: 2 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ import 'package:torn_pda/utils/shared_prefs.dart';

// TODO: CONFIGURE FOR APP RELEASE, include exceptions in Drawer if applicable
const String appVersion = '2.9.6';
const String androidCompilation = '281';
const String iosCompilation = '281';
const String androidCompilation = '282';
const String iosCompilation = '282';

final FirebaseAnalytics analytics = FirebaseAnalytics.instance;

Expand Down
53 changes: 46 additions & 7 deletions lib/pages/tips_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -710,15 +710,54 @@ class _TipsPageState extends State<TipsPage> {
return tips;
}

List<ExpandableTip> buildDeepLinksTips() {
var tips = <ExpandableTip>[];
List<TipTextBuilder> buildDeepLinksTips() {
var tips = <TipTextBuilder>[];
tips.add(
ExpandableTip(
ComplexExpandableTip(
headerValue: "Deep/custom app links",
expandedValue: "Torn PDA supports what's called deep linking or custom URLs. You can create a link outside "
"of the application with the following scheme 'tornpda://', where the rest of the URL remains unchanged."
"\n\nExample: 'tornpda://www.torn.com/gym.php' should be recognized as a valid URL and open Torn PDA with "
"a browser pointing to the gym.",
buildExpandedText: () {
return Text.rich(
TextSpan(
text: "Torn PDA supports what's called deep linking or custom URLs. You can create a link outside "
"of the application with the following scheme 'tornpda://', where the rest of the URL remains unchanged."
"\n\nExample: 'tornpda://www.torn.com/gym.php' should be recognized as a valid URL and open Torn PDA with "
"a browser pointing to the gym."
"\n\nIn order for this to work in some browser (e.g.: Chrome), you'll need to adapt "
"your link to be similar to this example:\n\n",
style: TextStyle(
fontSize: 13,
),
children: [
TextSpan(
text:
'<a href="intent://tornpda://www.cnn.com#Intent;package=com.manuito.tornpda;scheme=tornpda;end">click</a>',
style: TextStyle(
fontStyle: FontStyle.italic,
),
),
TextSpan(
text: "\n\nYou can find more information about this scheme in Chrome's ",
),
TextSpan(
text: "official documentation",
style: TextStyle(
decoration: TextDecoration.underline,
),
recognizer: TapGestureRecognizer()
..onTap = () async {
const String scriptApiUrl = "https://developer.chrome.com/docs/multidevice/android/intents/";
if (await canLaunch(scriptApiUrl)) {
launch(scriptApiUrl);
}
},
),
TextSpan(
text: ".",
),
],
),
);
},
),
);
return tips;
Expand Down
4 changes: 3 additions & 1 deletion lib/utils/changelog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,18 @@ class _ChangeLogState extends State<ChangeLog> {
void _createItems() {
var itemList = <ChangeLogItem>[];

// Build 280 - 20/02/2023
// Build 282 - 17/02/2023

// VERSION 2.9.6
var v2_9_6 = ChangeLogItem();
v2_9_6.version = 'Torn PDA v2.9.6';
v2_9_6.date = '20 FEB 2023';
String feat2_9_6_1 = "Fixed bounties filter";
String feat2_9_6_2 = "Improved Trades widget activation";
String feat2_9_6_3 = "Added deep links compatibility for Chrome href links (see Tips)";
v2_9_6.features.add(feat2_9_6_1);
v2_9_6.features.add(feat2_9_6_2);
v2_9_6.features.add(feat2_9_6_3);

// VERSION 2.9.5
var v2_9_5 = ChangeLogItem();
Expand Down

0 comments on commit 9afe4df

Please sign in to comment.