Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discord authentication #119

Merged
merged 25 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
95aab0d
Add a method to open a popup
bricefriha Mar 31, 2024
7157f30
Add a ClosePopUp() method
bricefriha Apr 1, 2024
4eb5b5e
Use The open popup
bricefriha Apr 1, 2024
85d79a4
Use ClosePopUp(0 everywhere
bricefriha Apr 1, 2024
0e9d4ba
Discord signin - Popup to signin on discord
bricefriha Apr 7, 2024
bfaab6b
set app config
bricefriha Apr 13, 2024
bc5faf2
Add app settings
bricefriha Apr 13, 2024
0ff624b
Discord auth navigation
bricefriha Apr 14, 2024
0a1bf67
Discord auth - Navigate back after login
bricefriha Apr 21, 2024
71a3100
Discord auth - get user data
bricefriha Apr 21, 2024
0ba2c89
Discord auth - parse discord data
bricefriha Apr 22, 2024
7652e64
Save user info
bricefriha Apr 23, 2024
591943d
Discord login - wait for a response
bricefriha Apr 26, 2024
ee59844
Auth - Save user session
bricefriha Apr 27, 2024
8232f18
Discord auth - token maintenance
bricefriha Apr 28, 2024
2c5dab5
Discord - Implement session maintenance
bricefriha Apr 28, 2024
ee0ce3b
Discord authentication - show profile on the header of the flyout
bricefriha Apr 30, 2024
2f2d096
Logout - Add logout button
bricefriha May 3, 2024
a2e41ab
Logout - finish building logout method
bricefriha May 3, 2024
4d9a32a
Add logout confirmation message
bricefriha May 3, 2024
47ed3cb
Change style of Logout popup
bricefriha May 6, 2024
dd5c6e9
DIscord auth - Add loading indication
bricefriha May 6, 2024
597578d
Change loading indicator
bricefriha May 6, 2024
4a64807
Add a prebuild script
bricefriha May 7, 2024
86ea1f5
Add Android pre-build script
bricefriha May 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,5 @@ ASALocalRun/
.localhistory/

# BeatPulse healthcheck temp database
healthchecksdb
healthchecksdb
/AresNews/AresNews/Config/AppSettings.json
1 change: 1 addition & 0 deletions AresNews/AresNews.Android/AresNews.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
</ItemGroup>
<ItemGroup>
<AndroidAsset Include="Assets\Ubuntu-Regular.ttf" />
<None Include="appcenter-pre-build.sh" />
<None Include="Resources\AboutResources.txt" />
<None Include="Assets\AboutAssets.txt" />
<None Include="Properties\AndroidManifest.xml" />
Expand Down
29 changes: 29 additions & 0 deletions AresNews/AresNews.Android/appcenter-pre-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
echo "Launching Android pre-build script"
if [ -z "$discord_client_id" ]
then
echo "You need define the discord_client_id variable in App Center"
exit
fi
if [ -z "$api_host" ]
then
echo "You need define the api_host variable in App Center"
exit
fi

APP_CONSTANT_FILE=$APPCENTER_SOURCE_DIRECTORY/AresNews/AresNews/Core/AppConstant.cs

if [ -e "$APP_CONSTANT_FILE" ]
then
echo "Updating AppConstant.cs"
echo "---"
echo "DiscordClientId = "$discord_client_id
sed -i '' 's#DiscordClientId = Environment.GetEnvironmentVariable("discord_client_id")#DiscordClientId = "'$discord_client_id'"#g' $APP_CONSTANT_FILE
echo "ApiHost = "$api_host
sed -i '' 's#ApiHost = Environment.GetEnvironmentVariable("api_host")#ApiHost = "'$api_host'"#g' $APP_CONSTANT_FILE
echo "File content:"
cat $APP_CONSTANT_FILE
else
echo "Incorrect file: "$APP_CONSTANT_FILE
exit
fi
1 change: 1 addition & 0 deletions AresNews/AresNews.iOS/AresNews.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
<Compile Include="Renderers\CustomShellTabLayoutAppearanceTracker.cs" />
<Compile Include="Renderers\HtmlLabelRenderer.cs" />
<Compile Include="Renderers\IShellTabLayoutAppearanceTracker.cs" />
<None Include="appcenter-pre-build.sh" />
<None Include="Entitlements.plist" />
<None Include="Info.plist" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
50 changes: 50 additions & 0 deletions AresNews/AresNews.iOS/appcenter-pre-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
#
# For Xamarin, change some constants located in some class of the app.
# In this sample, suppose we have an AppConstant.cs class in shared folder with follow content:
#
# namespace Core
# {
# public class AppConstant
# {
# public const string ApiUrl = "https://CMS_MyApp-Eur01.com/api";
# }
# }
#
# Suppose in our project exists two branches: master and develop.
# We can release app for production API in master branch and app for test API in develop branch.
# We just need configure this behaviour with environment variable in each branch :)
#
# The same thing can be perform with any class of the app.
#
# AN IMPORTANT THING: FOR THIS SAMPLE YOU NEED DECLARE API_URL ENVIRONMENT VARIABLE IN APP CENTER BUILD CONFIGURATION.
echo "Launching ios pre-build script"
if [ -z "$discord_client_id" ]
then
echo "You need define the discord_client_id variable in App Center"
exit
fi

if [ -z "$api_host" ]
then
echo "You need define the api_host variable in App Center"
exit
fi

APP_CONSTANT_FILE=$APPCENTER_SOURCE_DIRECTORY/AresNews/AresNews/Core/AppConstant.cs

if [ -e "$APP_CONSTANT_FILE" ]
then
echo "Updating AppConstant.cs"
echo "---"
echo "DiscordClientId = "$discord_client_id
sed -i '' 's#DiscordClientId = Environment.GetEnvironmentVariable("discord_client_id")#DiscordClientId = "'$discord_client_id'"#g' $APP_CONSTANT_FILE
echo "ApiHost = "$api_host
sed -i '' 's#ApiHost = Environment.GetEnvironmentVariable("api_host")#ApiHost = "'$api_host'"#g' $APP_CONSTANT_FILE

echo "File content:"
cat $APP_CONSTANT_FILE
else
echo "Incorrect file: "$APP_CONSTANT_FILE
exit
fi
10 changes: 3 additions & 7 deletions AresNews/AresNews/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,18 @@
x:Class="AresNews.App">
<Application.Resources>
<ResourceDictionary>
<Color x:Key="Primary" >#84D1AC</Color>
<Color x:Key="Primary" >#4AC776</Color>
<Color x:Key="SelectionColor" >#528e70</Color>
<Color x:Key="PrimaryAccent" >#1DB954</Color>
<Color x:Key="Secondary" >#666666</Color>
<Color x:Key="Alternate">#8B8E92</Color>
<Color x:Key="Dark" >#191414</Color>
<Color x:Key="DarkSecondary" >#4A4A4A</Color>
<Color x:Key="LightDark" >#404348</Color>
<Color x:Key="Light" >#9FDBBE</Color>
<Color x:Key="Light" >#8EDCA9</Color>
<Color x:Key="FontColor" >#ecebeb</Color>
<Color x:Key="BgBannerColor" >#262626</Color>
<!--
Potential future colour scheme:
<Color x:Key="Light">#87afc5</Color>
<Color x:Key="Primary">#5f94b1</Color>
-->
<Color x:Key="DiscordPurple" >#5d6af2</Color>
</ResourceDictionary>

<!-- Converters-->
Expand Down
Loading