Skip to content

Commit

Permalink
Get the redirect and universal links working (#294)
Browse files Browse the repository at this point in the history
This updates the project so that universal links work. The default expo project does not build the dev mode in a way
that universal links work. The associate domains on iOS are not registered. This was resolved by adding the
expo-dev-client to the project.
  • Loading branch information
NigelBreslaw authored Feb 6, 2024
1 parent 747063a commit 9381fc1
Show file tree
Hide file tree
Showing 23 changed files with 419 additions and 26 deletions.
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"indentWidth": 2,
"indentStyle": "space",
"lineWidth": 120,
"ignore": ["ios/**", "android/**", "node_modules/**"]
"ignore": ["ios/**", "android/**", "node_modules/**", "app.json", "eas.json"]
},
"linter": {
"enabled": true,
Expand Down
28 changes: 26 additions & 2 deletions native_gg/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
import { StatusBar } from "expo-status-bar";
import { StyleSheet, Text, View } from "react-native";
import { Button, Linking, Platform, StyleSheet, Text, View } from "react-native";
import { Image } from "expo-image";
import { LinearGradient } from "expo-linear-gradient";
import * as WebBrowser from "expo-web-browser";

export default function App() {
const openURL = async (url: string) => {
if (Platform.OS === "ios") {
// Open URL in Expo's WebBrowser on iOS
console.log("Opening URL in WebBrowser");
try {
const result = await WebBrowser.openAuthSessionAsync(url, "https://guardianghost.com/auth", {
preferEphemeralSession: false,
});
console.log(result);
} catch (error) {
console.error(error);
}
} else if (Platform.OS === "android") {
// Open URL in the default system browser on Android
Linking.openURL(url);
}
};

return (
<View style={styles.container}>
<LinearGradient
Expand All @@ -16,7 +35,12 @@ export default function App() {
contentFit="contain"
source="https://d33wubrfki0l68.cloudfront.net/554c3b0e09cf167f0281fda839a5433f2040b349/ecfc9/img/header_logo.svg"
/>

<Button
title="Auth"
onPress={() =>
openURL("https://www.bungie.net/en/oauth/authorize?client_id=46250&response_type=code&reauth=true")
}
/>
<Text style={{ fontSize: 22, marginTop: 15, color: "#150f63" }}>
New Architecture: <Text style={{ fontWeight: "bold" }}>Enabled</Text>
</Text>
Expand Down
8 changes: 4 additions & 4 deletions native_gg/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter android:autoVerify="true" >
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="https" />
<data android:host="guardianghost.com" />
<data android:pathPrefix="/auth" />
<data android:scheme="https"/>
<data android:host="guardianghost.com"/>
<data android:pathPrefix="/auth"/>
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false"/>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splashscreen_background"/>
</layer-list>
1 change: 1 addition & 0 deletions native_gg/android/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<resources>
<color name="colorPrimary">#023c69</color>
<color name="colorPrimaryDark">#ffffff</color>
<color name="splashscreen_background">#ffffff</color>
</resources>
2 changes: 2 additions & 0 deletions native_gg/android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<resources>
<string name="app_name">Guardian Ghost</string>
<string name="expo_splash_screen_resize_mode" translatable="false">contain</string>
<string name="expo_splash_screen_status_bar_translucent" translatable="false">false</string>
</resources>
4 changes: 2 additions & 2 deletions native_gg/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m

# Gradle will try to reuse outputs from previous builds for all builds,
# Gradle will try to reuse outputs from previous builds for all builds,
# unless explicitly disabled with --no-build-cache.
org.gradle.caching=true

Expand All @@ -21,7 +21,7 @@ org.gradle.caching=true
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true

# Disables the Gradle daemon which saves some time in CI where creating it is
# Disables the Gradle daemon which saves some time in CI where creating it is
# pointless as the free runners are thrown away after the build.
org.gradle.daemon=false

Expand Down
2 changes: 1 addition & 1 deletion native_gg/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rootProject.name = 'native_gg2'
rootProject.name = 'native_gg'

dependencyResolutionManagement {
versionCatalogs {
Expand Down
16 changes: 13 additions & 3 deletions native_gg/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"assetBundlePatterns": ["**/*"],
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.guardianghost.mobile"
"bundleIdentifier": "com.guardianghost.mobile",
"associatedDomains": [
"applinks:guardianghost.com"
]
},
"android": {
"package": "com.example.withnewarch"
Expand All @@ -30,6 +35,11 @@
}
}
]
]
],
"extra": {
"eas": {
"projectId": "aa838362-0c4a-434d-b70b-d67f764a5d32"
}
}
}
}
20 changes: 20 additions & 0 deletions native_gg/eas.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"development-simulator": {
"developmentClient": true,
"distribution": "internal",
"ios": {
"simulator": true
}
},
"production": {}
}
}

Loading

0 comments on commit 9381fc1

Please sign in to comment.