fix: dev region to China

feature: add version display in option page
This commit is contained in:
2020-05-24 17:08:15 +08:00
parent 215528192a
commit 82527789c8
7 changed files with 59 additions and 5 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0.524" package="org.tsanie.pixiview" android:versionCode="13"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0.524" package="org.tsanie.pixiview" android:versionCode="15">
<uses-sdk android:minSdkVersion="25" android:targetSdkVersion="28" /> <uses-sdk android:minSdkVersion="25" android:targetSdkVersion="28" />
<application android:label="Pixiview" android:icon="@mipmap/icon" android:roundIcon="@mipmap/icon_round"></application> <application android:label="Pixiview" android:icon="@mipmap/icon" android:roundIcon="@mipmap/icon_round"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

View File

@ -9,7 +9,7 @@
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>org.tsanie.Pixiview.OpenExtension</string> <string>org.tsanie.Pixiview.OpenExtension</string>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>en</string> <string>China</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
@ -31,6 +31,6 @@
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0.524</string> <string>1.0.524</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>13</string> <string>15</string>
</dict> </dict>
</plist> </plist>

View File

@ -81,6 +81,8 @@
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0.524</string> <string>1.0.524</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>13</string> <string>15</string>
<key>CFBundleDevelopmentRegion</key>
<string>China</string>
</dict> </dict>
</plist> </plist>

View File

@ -12,6 +12,9 @@
<TableView Intent="Settings" VerticalOptions="Start" <TableView Intent="Settings" VerticalOptions="Start"
BackgroundColor="{DynamicResource OptionBackColor}"> BackgroundColor="{DynamicResource OptionBackColor}">
<TableRoot> <TableRoot>
<TableSection Title="{r:Text About}">
<u:OptionTextCell Title="{r:Text Version}" Detail="{Binding Version}"/>
</TableSection>
<TableSection Title="{r:Text Illusts}"> <TableSection Title="{r:Text Illusts}">
<u:OptionSwitchCell Title="{r:Text R18}" <u:OptionSwitchCell Title="{r:Text R18}"
IsToggled="{Binding IsOnR18, Mode=TwoWay}"/> IsToggled="{Binding IsOnR18, Mode=TwoWay}"/>

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Threading.Tasks;
using Pixiview.Resources; using Pixiview.Resources;
using Pixiview.UI; using Pixiview.UI;
using Pixiview.Utils; using Pixiview.Utils;
@ -9,6 +10,15 @@ namespace Pixiview
{ {
public partial class OptionPage : AdaptedPage public partial class OptionPage : AdaptedPage
{ {
public static readonly BindableProperty VersionProperty = BindableProperty.Create(
nameof(Version), typeof(string), typeof(OptionPage));
public string Version
{
get => (string)GetValue(VersionProperty);
set => SetValue(VersionProperty, value);
}
public static readonly BindableProperty IsOnR18Property = BindableProperty.Create( public static readonly BindableProperty IsOnR18Property = BindableProperty.Create(
nameof(IsOnR18), typeof(bool), typeof(OptionPage)); nameof(IsOnR18), typeof(bool), typeof(OptionPage));
public static readonly BindableProperty SyncFavTypeProperty = BindableProperty.Create( public static readonly BindableProperty SyncFavTypeProperty = BindableProperty.Create(
@ -65,12 +75,27 @@ namespace Pixiview
ResourceHelper.SyncAuto, ResourceHelper.SyncAuto,
}; };
SyncFavType = 0; SyncFavType = 0;
#if OBSOLETE
#if __IOS__
string version = Foundation.NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleShortVersionString").ToString();
int build = int.Parse(Foundation.NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleVersion").ToString());
#elif __ANDROID__
var context = Android.App.Application.Context;
var manager = context.PackageManager;
var info = manager.GetPackageInfo(context.PackageName, 0);
string version = info.VersionName;
long build = info.LongVersionCode;
#endif
Version = $"{version} ({build})";
#endif
} }
protected override void OnAppearing() protected override void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();
Version = $"{AppInfo.VersionString} ({AppInfo.BuildString})";
IsOnR18 = Configs.IsOnR18; IsOnR18 = Configs.IsOnR18;
SyncFavType = (int)Configs.SyncFavType; SyncFavType = (int)Configs.SyncFavType;
var proxy = Configs.Proxy; var proxy = Configs.Proxy;
@ -173,6 +198,7 @@ namespace Pixiview
#if LOG #if LOG
App.DebugPrint($"cookie changed, user id: {session}"); App.DebugPrint($"cookie changed, user id: {session}");
#endif #endif
Task.Run(() => AppShell.Current.DoLoginInformation(true));
} }
} }
} }

View File

@ -7,6 +7,8 @@
<Yes></Yes> <Yes></Yes>
<No></No> <No></No>
<Login>登录</Login> <Login>登录</Login>
<About>关于</About>
<Version>版本</Version>
<Illusts>插画</Illusts> <Illusts>插画</Illusts>
<Proxy>代理</Proxy> <Proxy>代理</Proxy>
<Detail>详细</Detail> <Detail>详细</Detail>

View File

@ -49,6 +49,26 @@ namespace Pixiview.UI
} }
} }
public class OptionTextCell : OptionCell
{
public static readonly BindableProperty DetailProperty = BindableProperty.Create(
nameof(Detail), typeof(string), typeof(OptionCell));
public string Detail
{
get => (string)GetValue(DetailProperty);
set => SetValue(DetailProperty, value);
}
protected override View Content => new Label
{
HorizontalOptions = LayoutOptions.End,
VerticalOptions = LayoutOptions.Center
}
.Binding(Label.TextProperty, nameof(Detail))
.DynamicResource(Label.TextColorProperty, ThemeBase.SubTextColor);
}
public class OptionSwitchCell : OptionCell public class OptionSwitchCell : OptionCell
{ {
public static readonly BindableProperty IsToggledProperty = BindableProperty.Create( public static readonly BindableProperty IsToggledProperty = BindableProperty.Create(
@ -64,7 +84,8 @@ namespace Pixiview.UI
{ {
HorizontalOptions = LayoutOptions.End, HorizontalOptions = LayoutOptions.End,
VerticalOptions = LayoutOptions.Center VerticalOptions = LayoutOptions.Center
}.Binding(Switch.IsToggledProperty, nameof(IsToggled), BindingMode.TwoWay); }
.Binding(Switch.IsToggledProperty, nameof(IsToggled), BindingMode.TwoWay);
} }
public class OptionDropCell : OptionCell public class OptionDropCell : OptionCell