Skip to content

Commit

Permalink
Adding feature flag for websharing
Browse files Browse the repository at this point in the history
  • Loading branch information
carpoo committed Jan 7, 2024
1 parent 2b5c0e4 commit 32c1a51
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 5 deletions.
6 changes: 3 additions & 3 deletions frontend/src/component/photo-viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
<v-icon size="16" color="white">get_app</v-icon>
</button>

<button v-if="navigatorCanShare" class="pswp__button action-webshare hide-mini" style="background: none;"
<button v-if="canWebShare" class="pswp__button action-webshare" style="background: none;"
:title="$gettext('Share')" @click.exact="onWebShare">
<v-icon size="16" color="white">share</v-icon>
</button>

<button v-if="canEdit" class="pswp__button action-edit hidden-shared-only hide-mini" style="background: none;" :title="$gettext('Edit')"
<button v-if="canEdit" class="pswp__button action-edit hidden-shared-only" style="background: none;" :title="$gettext('Edit')"
@click.exact="onEdit">
<v-icon size="16" color="white">edit</v-icon>
</button>
Expand Down Expand Up @@ -104,7 +104,7 @@ export default {
canEdit: this.$config.allow("photos", "update") && this.$config.feature("edit"),
canLike: this.$config.allow("photos", "manage") && this.$config.feature("favorites"),
canDownload: this.$config.allow("photos", "download") && this.$config.feature("download"),
navigatorCanShare: navigator.canShare,
canWebShare: navigator.canShare && this.$config.feature("webshare"),
selection: this.$clipboard.selection,
config: this.$config.values,
item: new Thumb(),
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/component/photo/clipboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@


<v-btn
v-if="context !== 'archive' && context !== 'review' && navigatorCanShare" fab dark
v-if="context !== 'archive' && context !== 'review' && canWebShare" fab dark
small
:title="$gettext('Share')"
color="webshare"
Expand Down Expand Up @@ -210,7 +210,7 @@ export default {
config: this.$config.values,
expanded: false,
isAlbum: this.album && this.album.Type === 'album',
navigatorCanShare: navigator.canShare,
canWebShare: navigator.canShare && features.webshare,
dialog: {
archive: false,
delete: false,
Expand Down
15 changes: 15 additions & 0 deletions frontend/src/page/settings/general.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,21 @@
</v-checkbox>
</v-flex>

<v-flex xs12 sm6 lg3 class="px-2 pb-2 pt-2">
<v-checkbox
v-model="settings.features.webshare"
:disabled="busy"
class="ma-0 pa-0 input-native-share"
color="secondary-dark"
:label="$gettext('WebShare')"
:hint="$gettext('Use native sharing of your device to share pictures.')"
prepend-icon="share"
persistent-hint
@change="onChange"
>
</v-checkbox>
</v-flex>

<v-flex xs12 sm6 lg3 class="px-2 pb-2 pt-2">
<v-checkbox
v-model="settings.features.edit"
Expand Down
2 changes: 2 additions & 0 deletions internal/config/client_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func TestConfig_ClientRoleConfig(t *testing.T) {
Search: true,
Settings: true,
Share: true,
WebShare: true,
Services: true,
Upload: true,
Videos: true,
Expand Down Expand Up @@ -160,6 +161,7 @@ func TestConfig_ClientRoleConfig(t *testing.T) {
Search: false,
Settings: false,
Share: false,
WebShare: true,
Services: false,
Upload: false,
Videos: false,
Expand Down
1 change: 1 addition & 0 deletions internal/config/testdata/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Features:
Archive: true
Delete: false
Share: true
WebShare: true
Library: true
Import: true
Logs: true
Expand Down
2 changes: 2 additions & 0 deletions internal/customize/acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func TestSettings_ApplyACL(t *testing.T) {
Services: true,
Upload: true,
Videos: true,
WebShare: true,
}

assert.Equal(t, original, s.Features)
Expand Down Expand Up @@ -82,6 +83,7 @@ func TestSettings_ApplyACL(t *testing.T) {
Services: false,
Upload: false,
Videos: false,
WebShare: true,
}

assert.Equal(t, original, s.Features)
Expand Down
1 change: 1 addition & 0 deletions internal/customize/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ type FeatureSettings struct {
Share bool `json:"share" yaml:"Share"`
Upload bool `json:"upload" yaml:"Upload"`
Videos bool `json:"videos" yaml:"Videos"`
WebShare bool `json:"webshare" yaml:"WebShare"`
}
1 change: 1 addition & 0 deletions internal/customize/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func NewSettings(theme, lang string) *Settings {
Archive: true,
Review: true,
Share: true,
WebShare: true,
Library: true,
Import: true,
Logs: true,
Expand Down
1 change: 1 addition & 0 deletions internal/customize/testdata/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Features:
Share: true
Upload: true
Videos: true
WebShare: true
Import:
Path: /
Move: false
Expand Down

0 comments on commit 32c1a51

Please sign in to comment.