mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-05-18 05:36:39 -04:00
More zip types
This commit is contained in:
@@ -49,17 +49,18 @@
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<!-- Accepts URIs that begin with "https://github.com/brarcher/loyalty-card-locker/” -->
|
||||
<!-- Accepts URIs that begin with "https://brarcher.github.io/loyalty-card-locker/share” -->
|
||||
<data android:scheme="https"
|
||||
android:host="@string/intent_import_card_from_url_host"
|
||||
android:pathPrefix="@string/intent_import_card_from_url_path_prefix" />
|
||||
</intent-filter>
|
||||
<intent-filter android:label="@string/intent_import_card_from_url">
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<!-- Accept pkpass files -->
|
||||
<data android:scheme="content" android:mimeType="application/octet-stream"/>
|
||||
<data android:scheme="content" android:mimeType="application/x-compressed"/>
|
||||
<data android:scheme="content" android:mimeType="application/x-zip-compressed"/>
|
||||
<data android:scheme="content" android:mimeType="application/zip"/>
|
||||
<data android:scheme="content" android:mimeType="application/vnd.apple.pkpass"/>
|
||||
<data android:scheme="content" android:mimeType="application/pkpass"/>
|
||||
|
||||
@@ -85,19 +85,6 @@ public class LoyaltyCardEditActivity extends AppCompatActivity
|
||||
|
||||
private LoyaltyCard importCard(String type, Uri uri)
|
||||
{
|
||||
// Pkpass
|
||||
if(type != null && pkpassImporter.isPkpass(type))
|
||||
{
|
||||
try
|
||||
{
|
||||
return pkpassImporter.fromURI(uri);
|
||||
}
|
||||
catch (IOException | JSONException ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Import URI
|
||||
if(importUriHelper.isImportUri(uri))
|
||||
{
|
||||
@@ -111,6 +98,13 @@ public class LoyaltyCardEditActivity extends AppCompatActivity
|
||||
}
|
||||
}
|
||||
|
||||
// Pkpass
|
||||
try
|
||||
{
|
||||
return pkpassImporter.fromURI(uri);
|
||||
}
|
||||
catch (IOException | JSONException ex) {}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,10 +138,6 @@ public class PkpassImporter {
|
||||
return extrasHelper;
|
||||
}
|
||||
|
||||
public boolean isPkpass(String type) {
|
||||
return Arrays.asList("application/octet-stream", "application/zip", "application/vnd.apple.pkpass", "application/pkpass", "application/vndapplepkpass", "application/vnd-com.apple.pkpass").contains(type);
|
||||
}
|
||||
|
||||
public LoyaltyCard fromURI(Uri uri) throws IOException, JSONException {
|
||||
return fromInputStream(context.getContentResolver().openInputStream(uri));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user