Skip to content

Commit

Permalink
iOS: Built TinyIoC with older code because the PCL library has a bug …
Browse files Browse the repository at this point in the history
…with TinyMessenger specific with iOS. Updated project after changes on other platforms.

Related to issue #405.
  • Loading branch information
ycastonguay committed Sep 4, 2013
1 parent 2ac248a commit 9798e63
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 18 deletions.
Binary file added MPfm/MPfm.Core/Lib/iOS/TinyIoC.dll
Binary file not shown.
17 changes: 14 additions & 3 deletions MPfm/MPfm.Core/MPfm.Core.iOS.csproj
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -141,8 +141,15 @@
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="TinyIoC">
<HintPath>Lib\iOS\TinyIoC.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Content Include="Lib\PCL\TinyIoC.dll" />
<Content Include="Lib\TinyIoC.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="Conversion.cs" />
<Compile Include="Attributes\DatabaseFieldAttribute.cs" />
Expand All @@ -156,8 +163,12 @@
<Compile Include="Helpers\XMLHelper.cs" />
<Compile Include="Network\IPAddressRangeFinder.cs" />
<Compile Include="Network\WebClientTimeout.cs" />
<Compile Include="TinyIoC\TinyIoC.cs" />
<Compile Include="TinyIoC\TinyMessenger.cs" />
<Compile Include="XmlSerialization.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Lib\iOS\" />
</ItemGroup>
<ItemGroup>
<None Include="Lib\iOS\TinyIoC.dll" />
</ItemGroup>
</Project>
3 changes: 3 additions & 0 deletions MPfm/MPfm.Library/MPfm.Library.iOS.csproj
Expand Up @@ -138,6 +138,9 @@
<Reference Include="Newtonsoft.Json">
<HintPath>Lib\iOS\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="TinyIoC.iOS">
<HintPath>..\MPfm.Core\Lib\iOS\TinyIoC.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Service Include="{3259AA49-8AA1-44D3-9025-A0B520596A8C}" />
Expand Down
5 changes: 5 additions & 0 deletions MPfm/MPfm.Library/Services/AudioFileCacheService.cs
Expand Up @@ -133,8 +133,13 @@ orderby GetPropertyValue(s, query.OrderBy)
/// <returns>Value</returns>
private static object GetPropertyValue(object obj, string property)
{
#if WINDOWSSTORE
var propertyInfo = obj.GetType().GetRuntimeProperty(property);
return propertyInfo.GetValue(obj, null);
#else
var propertyInfo = obj.GetType().GetProperty(property);
return propertyInfo.GetValue(obj, null);
#endif
}
}

Expand Down
4 changes: 4 additions & 0 deletions MPfm/MPfm.MVP/MPfm.MVP.iOS.csproj
Expand Up @@ -131,6 +131,9 @@
<Reference Include="taglib-sharp">
<HintPath>..\MPfm.Sound\Lib\iOS\taglib-sharp.dll</HintPath>
</Reference>
<Reference Include="TinyIoC.iOS">
<HintPath>..\MPfm.Core\Lib\iOS\TinyIoC.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
Expand Down Expand Up @@ -308,5 +311,6 @@
<Compile Include="Messages\PlayerPlaylistUpdatedMessage.cs" />
<Compile Include="Views\IDesktopPreferencesView.cs" />
<Compile Include="Views\IDesktopEffectsView.cs" />
<Compile Include="Messages\PlayerSetPositionMessage.cs" />
</ItemGroup>
</Project>
Expand Up @@ -194,6 +194,7 @@ private void HandleFaderValueChanged(object sender, MPfmEqualizerFaderValueChang

#region IEqualizerPresetDetailsView implementation

public Action<Guid> OnChangePreset { get; set; }
public Action OnResetPreset { get; set; }
public Action OnNormalizePreset { get; set; }
public Action OnRevertPreset { get; set; }
Expand Down
1 change: 1 addition & 0 deletions MPfm/MPfm.iOS/Classes/Controllers/MarkersViewController.cs
Expand Up @@ -143,6 +143,7 @@ public void RowSelected(UITableView tableView, NSIndexPath indexPath)
public Action<MarkerTemplateNameType> OnAddMarker { get; set; }
public Action<Marker> OnEditMarker { get; set; }
public Action<Marker> OnSelectMarker { get; set; }
public Action<Marker> OnDeleteMarker { get; set; }

public void MarkerError(Exception ex)
{
Expand Down
Expand Up @@ -452,7 +452,8 @@ private void ReloadImages()
}

#region IMobileLibraryBrowserView implementation


public Action<MobileLibraryBrowserType> OnChangeBrowserType { get; set; }
public Action<int> OnItemClick { get; set; }
public Action<int> OnDeleteItem { get; set; }
public Action<string, string> OnRequestAlbumArt { get; set; }
Expand Down Expand Up @@ -547,7 +548,7 @@ public void RefreshAlbumArtCell(string artistName, string albumTitle, byte[] alb
}, TaskScheduler.FromCurrentSynchronizationContext());
}

public void RefreshLibraryBrowser(IEnumerable<LibraryBrowserEntity> entities, MobileLibraryBrowserType browserType, string navigationBarTitle, string navigationBarSubtitle, string breadcrumb, bool isPopBackstack)
public void RefreshLibraryBrowser(IEnumerable<LibraryBrowserEntity> entities, MobileLibraryBrowserType browserType, string navigationBarTitle, string navigationBarSubtitle, string breadcrumb, bool isPopBackstack, bool isBackstackEmpty)
{
InvokeOnMainThread(() => {
_items = entities.ToList();
Expand Down
Expand Up @@ -58,7 +58,7 @@ public override void ViewDidLoad()

partial void actionPlaylist(NSObject sender)
{
OnClickPlaylist();
OnOpenPlaylist();
}

partial void actionRepeat(NSObject sender)
Expand Down Expand Up @@ -98,7 +98,7 @@ public void ShowPanel(bool show, bool swipeUp)

#region IPlayerMetadataView implementation

public Action OnClickPlaylist { get; set; }
public Action OnOpenPlaylist { get; set; }
public Action OnToggleShuffle { get; set; }
public Action OnToggleRepeat { get; set; }

Expand Down
4 changes: 4 additions & 0 deletions MPfm/MPfm.iOS/Classes/Controllers/PlayerViewController.cs
Expand Up @@ -406,6 +406,10 @@ private void CreateHidePlayerMetadataTimer()
public Action<float> OnPlayerSetPitchShifting { get; set; }
public Action<float> OnPlayerSetTimeShifting { get; set; }
public Action<float> OnPlayerSetPosition { get; set; }
public Action OnPlayerShuffle { get; set; }
public Action OnPlayerRepeat { get; set; }
public Action OnEditSongMetadata { get; set; }
public Action OnOpenPlaylist { get; set; }
public Func<float, PlayerPositionEntity> OnPlayerRequestPosition { get; set; }

public void RefreshPlayerPosition(PlayerPositionEntity entity)
Expand Down
3 changes: 2 additions & 1 deletion MPfm/MPfm.iOS/Classes/Controllers/PlaylistViewController.cs
Expand Up @@ -25,6 +25,7 @@
using MPfm.iOS.Classes.Controls;
using MPfm.Sound.Playlists;
using MPfm.Sound.AudioFiles;
using System.Collections.Generic;

namespace MPfm.iOS
{
Expand Down Expand Up @@ -196,7 +197,7 @@ private void HandleShuffleTouchUpInside(object sender, EventArgs e)

public Action<Guid, int> OnChangePlaylistItemOrder { get; set; }
public Action<Guid> OnSelectPlaylistItem { get; set; }
public Action<Guid> OnRemovePlaylistItem { get; set; }
public Action<List<Guid>> OnRemovePlaylistItems { get; set; }
public Action OnNewPlaylist { get; set; }
public Action<string> OnLoadPlaylist { get; set; }
public Action OnSavePlaylist { get; set; }
Expand Down
29 changes: 19 additions & 10 deletions MPfm/MPfm.iOS/Classes/Controllers/SyncMenuViewController.cs
Expand Up @@ -112,9 +112,9 @@ private void HandleLongPress(UILongPressGestureRecognizer gestureRecognizer)
NSIndexPath indexPath = tableView.IndexPathForRowAtPoint(pt);
if (indexPath != null)
{
if(OnSelectItem != null)
if(OnSelectItems != null)
{
OnSelectItem(_items[indexPath.Row]);
OnSelectItems(new List<SyncMenuItemEntity>() { _items[indexPath.Row] });
RefreshCell(indexPath);
}
}
Expand Down Expand Up @@ -193,7 +193,7 @@ private void HandleOnRightButtonTap(MPfmTableViewCell cell)
{
Console.WriteLine("SyncMenuViewController - HandleOnRightButtonTap");
int row = cell.Tag;
OnSelectItem(_items[row]);
OnSelectItems(new List<SyncMenuItemEntity>() { _items[row] });

tableView.BeginUpdates();
tableView.ReloadRows(new NSIndexPath[1] { NSIndexPath.FromRowSection(row, 0) }, UITableViewRowAnimation.None);
Expand All @@ -206,13 +206,13 @@ public void RowSelected(UITableView tableView, NSIndexPath indexPath)
switch(_items[indexPath.Row].ItemType)
{
case SyncMenuItemEntityType.Artist:
OnExpandItem(_items[indexPath.Row]);
OnExpandItem(_items[indexPath.Row], null);
break;
case SyncMenuItemEntityType.Album:
OnExpandItem(_items[indexPath.Row]);
OnExpandItem(_items[indexPath.Row], null);
break;
case SyncMenuItemEntityType.Song:
OnSelectItem(_items[indexPath.Row]);
OnSelectItems(new List<SyncMenuItemEntity>() { _items[indexPath.Row] });
RefreshCell(indexPath);
break;
}
Expand All @@ -227,10 +227,13 @@ private void RefreshCell(NSIndexPath indexPath)

#region ISyncMenuView implementation

public Action<SyncMenuItemEntity> OnExpandItem { get; set; }
public Action<SyncMenuItemEntity> OnSelectItem { get; set; }
public Action<SyncMenuItemEntity, object> OnExpandItem { get; set; }
public Action<List<SyncMenuItemEntity>> OnSelectItems { get; set; }
public Action OnSync { get; set; }
public Action OnSelectButtonClick { get; set; }
public Action<List<AudioFile>> OnRemoveItems { get; set; }
public Action OnSelectAll { get; set; }
public Action OnRemoveAll { get; set; }

public void SyncMenuError(Exception ex)
{
Expand Down Expand Up @@ -300,7 +303,7 @@ public void RefreshSyncTotal(string title, string subtitle, bool enoughFreeSpace
});
}

public void InsertItems(int index, List<SyncMenuItemEntity> items)
public void InsertItems(int index, SyncMenuItemEntity parentItem, List<SyncMenuItemEntity> items, object userData)
{
InvokeOnMainThread(() => {
_items.InsertRange(index, items);
Expand All @@ -313,7 +316,7 @@ public void InsertItems(int index, List<SyncMenuItemEntity> items)
});
}

public void RemoveItems(int index, int count)
public void RemoveItems(int index, int count, object userData)
{
InvokeOnMainThread(() => {
_items.RemoveRange(index, count);
Expand All @@ -326,6 +329,12 @@ public void RemoveItems(int index, int count)
});
}

public void RefreshSelection(List<AudioFile> audioFiles)
{
// Not used on mobile devices.
}

#endregion

}
}
Expand Up @@ -75,6 +75,7 @@ public override void ViewDidAppear(bool animated)
#region IUpdateLibraryView implementation

public Action<UpdateLibraryMode, List<string>, string> OnStartUpdateLibrary { get; set; }
public Action<string> OnSaveLog { get; set; }
public Action OnCancelUpdateLibrary { get; set; }

public void RefreshStatus(UpdateLibraryEntity entity)
Expand Down
2 changes: 2 additions & 0 deletions MPfm/MPfm.iOS/Classes/Delegates/AppDelegate.cs
Expand Up @@ -30,6 +30,7 @@
using MPfm.iOS.Classes.Navigation;
using MPfm.iOS.Classes.Objects;
using MPfm.iOS.Helpers;
using TinyMessenger;

namespace MPfm.iOS.Classes.Delegates
{
Expand Down Expand Up @@ -58,6 +59,7 @@ public partial class AppDelegate : UIApplicationDelegate
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
TinyIoC.TinyIoCContainer container = Bootstrapper.GetContainer();
var messenger = container.Resolve<ITinyMessengerHub>();
RegisterViews();

UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
Expand Down
3 changes: 3 additions & 0 deletions MPfm/MPfm.iOS/MPfm.iOS.csproj
Expand Up @@ -107,6 +107,9 @@
<Reference Include="taglib-sharp">
<HintPath>Lib\taglib-sharp.dll</HintPath>
</Reference>
<Reference Include="TinyIoC.iOS">
<HintPath>..\MPfm.Core\Lib\iOS\TinyIoC.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
Expand Down

0 comments on commit 9798e63

Please sign in to comment.