Commit 404947f8 authored by HankG's avatar HankG

Merge branch 'initial-timeline-view' into 'develop'

Release 1 PR

See merge request !4
parents 94f60075 7c017a53
Pipeline #98537958 failed with stage
in 60 minutes and 1 second
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
## Visual Studio Code specific files and folder
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.jsons
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
OpenGraph cache data (images essentially) will go here
Credentials for various social networks will be stored here.
This is the layout of the standard user's app directory.

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MySocialPortalDesktop", "MySocialPortalDesktop\MySocialPortalDesktop.csproj", "{90CC3DCB-374A-433E-BFCE-2DDA3D0406D7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MySocialPortalDesktopTest", "MySocialPortalDesktopTest\MySocialPortalDesktopTest.csproj", "{E81E7878-4037-4027-B155-E88119429AB7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{90CC3DCB-374A-433E-BFCE-2DDA3D0406D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90CC3DCB-374A-433E-BFCE-2DDA3D0406D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90CC3DCB-374A-433E-BFCE-2DDA3D0406D7}.Debug|x64.ActiveCfg = Debug|Any CPU
{90CC3DCB-374A-433E-BFCE-2DDA3D0406D7}.Debug|x64.Build.0 = Debug|Any CPU
{90CC3DCB-374A-433E-BFCE-2DDA3D0406D7}.Debug|x86.ActiveCfg = Debug|Any CPU
{90CC3DCB-374A-433E-BFCE-2DDA3D0406D7}.Debug|x86.Build.0 = Debug|Any CPU
{90CC3DCB-374A-433E-BFCE-2DDA3D0406D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90CC3DCB-374A-433E-BFCE-2DDA3D0406D7}.Release|Any CPU.Build.0 = Release|Any CPU
{90CC3DCB-374A-433E-BFCE-2DDA3D0406D7}.Release|x64.ActiveCfg = Release|Any CPU
{90CC3DCB-374A-433E-BFCE-2DDA3D0406D7}.Release|x64.Build.0 = Release|Any CPU
{90CC3DCB-374A-433E-BFCE-2DDA3D0406D7}.Release|x86.ActiveCfg = Release|Any CPU
{90CC3DCB-374A-433E-BFCE-2DDA3D0406D7}.Release|x86.Build.0 = Release|Any CPU
{E81E7878-4037-4027-B155-E88119429AB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E81E7878-4037-4027-B155-E88119429AB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E81E7878-4037-4027-B155-E88119429AB7}.Debug|x64.ActiveCfg = Debug|Any CPU
{E81E7878-4037-4027-B155-E88119429AB7}.Debug|x64.Build.0 = Debug|Any CPU
{E81E7878-4037-4027-B155-E88119429AB7}.Debug|x86.ActiveCfg = Debug|Any CPU
{E81E7878-4037-4027-B155-E88119429AB7}.Debug|x86.Build.0 = Debug|Any CPU
{E81E7878-4037-4027-B155-E88119429AB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E81E7878-4037-4027-B155-E88119429AB7}.Release|Any CPU.Build.0 = Release|Any CPU
{E81E7878-4037-4027-B155-E88119429AB7}.Release|x64.ActiveCfg = Release|Any CPU
{E81E7878-4037-4027-B155-E88119429AB7}.Release|x64.Build.0 = Release|Any CPU
{E81E7878-4037-4027-B155-E88119429AB7}.Release|x86.ActiveCfg = Release|Any CPU
{E81E7878-4037-4027-B155-E88119429AB7}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MySocialPortalDesktop"
x:Class="MySocialPortalDesktop.App">
<Application.DataTemplates>
<local:ViewLocator/>
</Application.DataTemplates>
<Application.Styles>
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/>
</Application.Styles>
</Application>
using System;
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using MySocialPortalDesktop.ViewModels;
using MySocialPortalDesktop.Views;
namespace MySocialPortalDesktop
{
public class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted()
{
var window = new MainWindow
{
DataContext = new MainWindowViewModel(),
};
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
desktop.MainWindow = window;
else if (ApplicationLifetime is ISingleViewApplicationLifetime singleView)
throw new ArgumentException("View apps aren't supported at this time");
base.OnFrameworkInitializationCompleted();
}
}
}
\ No newline at end of file
using MySocialPortalDesktop.Factory;
using MySocialPortalDesktop.ViewModels;
namespace MySocialPortalDesktop.DesignData
{
public class ExternalLinkItemVmExample : ExternalLinkViewModel
{
public ExternalLinkItemVmExample() : base()
{
var lps = ServiceFactory.Instance.LinkPreviewService;
var refItem = lps.GetPreview("https://everydayastronaut.com/aerospikes/").Result;
var tmp = ExternalLinkViewModel.FromLinkPreview(refItem, lps.ImageCacheFolderPath);
Title = tmp.Title;
Description = tmp.Description;
HasPreview = true;
HasImage = tmp.HasImage;
Image = tmp.Image;
Url = tmp.Url;
}
}
}
\ No newline at end of file
using Avalonia.Media.Imaging;
using MySocialPortalDesktop.ViewModels;
using MySocialPortalLib.Model;
using MySocialPortalLib.Service;
using System.IO;
namespace MySocialPortalDesktop.DesignData
{
public class PostViewModelDesignData : PostViewModel
{
public PostViewModelDesignData():base()
{
var p = this.Post;
Title = p.Title = "Rugby Wiki";
Body = p.Body = "I have lots of friends that play rugby. Seeing this photo in my stream decided to find a Wiki on it and share...";
OriginalSocialMediaSystem = p.OriginalSocialMediaSystem = "HandJam";
p.Links.Add(new ExternalLink
{
Name = "Rugby Football",
Url = "https://en.wikipedia.org/wiki/Rugby_football"
});
//p.Media.Add(new MySocialPortalLib.Model.MediaData
//{
// Description = "Guys playing rugby",
// LocalPath = "ManRugby.jpg",
// OriginalUrl = "https://www.flickr.com/photos/naparazzi/18700282260/in/photolist-uutQpE-2hmHERb-iRhnz-2cfFTC-bebnbT-2hEvfBp-6vejuD-bzrDNY-23rEk6j-93DvNp-6e4wcn-5sxjDa-5sBDH9-5sxhTR-5sxjwc-5sxjB4-5sxhNK-5sxjtr-5sBDLU-5sxhSc-5sBDR3-W4bHQq-cd6prf-215tBJ7-6ve93v-2gSrjSs-6vecs4-6vikyj-6vembx-2hFRkU1-6ve7Er-28F746f-WXgnU2-6vegbH-6ve73g-6veeQp-6vij4J-MRR7T8-6vebiM-6vius5-6veati-AXwY3S-BRPiXJ-2cijvy-85BZqJ-6vitsY-2ehzkL8-2cinNd-XNwqEE-2cb8ZX",
// MediaType = "Photo",
// Title = "Brett Manning"
//});
Links?.Add(new ExternalLinkItemVmExample() as ExternalLinkViewModel);
//FillLinkVMs();
}
}
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<NoWarn>1701;1702;1303</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<NoWarn>1701;1702;1303</NoWarn>
</PropertyGroup>
<ItemGroup>
<Folder Include="Models\" />
<Compile Update="**\*.xaml.cs">
<DependentUpon>%(Filename)</DependentUpon>
</Compile>
<AvaloniaResource Include="**\*.xaml">
<SubType>Designer</SubType>
</AvaloniaResource>
<AvaloniaResource Include="Assets\**" />
<Folder Include="Services" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.9.0-preview7" />
<PackageReference Include="Avalonia.Desktop" Version="0.9.0-preview7" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.9.0-preview7" />
<PackageReference Include="MySocialPortalLib" Version="1.0.0-alpha1" />
</ItemGroup>
</Project>
using Avalonia;
using Avalonia.ReactiveUI;
namespace MySocialPortalDesktop
{
class Program
{
public static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UseReactiveUI()
.UsePlatformDetect();
}
}
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
using Avalonia.Controls;
using Avalonia.Controls.Templates;
using MySocialPortalDesktop.ViewModels;
namespace MySocialPortalDesktop
{
public class ViewLocator : IDataTemplate
{
public bool SupportsRecycling => false;
public IControl Build(object data)
{
var name = data?.GetType()?.FullName?.Replace("ViewModel", "View", StringComparison.InvariantCulture) ?? "";
var type = Type.GetType(name);
if (type != null)
{
return (Control)Activator.CreateInstance(type);
}
else
{
return new TextBlock { Text = "Not Found: " + name };
}
}
public bool Match(object data)
{
return data is ViewModelBase;
}
}
}
\ No newline at end of file
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using Avalonia.Media.Imaging;
using MySocialPortalLib.Model;
using ReactiveUI;
namespace MySocialPortalDesktop.ViewModels
{
[SuppressMessage("ReSharper", "CA1056")]
public class ExternalLinkViewModel : ViewModelBase, IDisposable
{
private const int DefaultMaxHeight = 150;
private const int DefaultMaxWidth = 250;
private const int MaxDescriptionLenth = 240;
private bool _disposed = false;
private int _imageMaxHeight;
private int _imageMaxWidth;
public string Title { get; protected set; }
public string Description { get; protected set; }
public bool HasImage { get; protected set; }
public bool HasPreview { get; protected set; }
public Bitmap Image { get; protected set; }
public int ImageMaxHeight
{
get => _imageMaxHeight;
set => this.RaiseAndSetIfChanged(ref _imageMaxHeight, value);
}
public int ImageMaxWidth
{
get => _imageMaxWidth;
set => this.RaiseAndSetIfChanged(ref _imageMaxWidth, value);
}
public string Url { get; protected set; }
public ExternalLinkViewModel()
{
HasPreview = false;
ImageMaxHeight = DefaultMaxHeight;
ImageMaxWidth = DefaultMaxWidth;
}
public static ExternalLinkViewModel FromLinkPreview(LinkPreview item, string baseFolder)
{
var vm = new ExternalLinkViewModel();
if (item != null && item.UrlFound)
{
vm.Title = item.Title;
if (item.Description != null)
{
vm.Description = item.Description.Length > MaxDescriptionLenth ? item.Description.Substring(0, MaxDescriptionLenth) + "..." : item.Description;
}
vm.HasPreview = true;
vm.Url = item.RequestUrl;
if (!item.HasPreviewImage)
{
return vm;
}
try
{
var bitmapPath = Path.Combine(baseFolder, item.PreviewImageName);
var bitmap = new Bitmap(bitmapPath);
vm.Image = bitmap;
vm.HasImage = true;
}
catch (IOException e)
{
Console.WriteLine(e);
}
}
return vm;
}